Not signed in (Sign In)

Categories

Welcome, Guest

Want to take part in these discussions? Sign in if you have an account, or apply for one below

Vanilla 1.1.4 is a product of Lussumo. More Information: Documentation, Community Support.

Welcome Guest!
Want to take part in these discussions? If you have an account, sign in now.
If you don't have an account, apply for one now.
    • CommentAuthorhaymo
    • CommentTimeJun 7th 2010
     
    I have the following question. We are writing a high performance application.
    This will require preallocating memory for a matrix. The matrix will be used
    as Circular Buffer - when the new row arrives, it will replace one of the
    existing rows, with the old values in that row being "lost". Therefore, the
    "beginning row" of the matrix will be shifted as new rows are populated. What
    we want is to be able to reindex the existing background matrix so that the
    other "matrix as a view" would recalculate indexes accordingly. Let me give
    you an example.



    Let's say we have a matrix



    m =

    [ 1 2;

    3 4]



    I want to create a matrix m2 that would use the same background storage, but
    return the following values when queried by indices as follows:



    m2(0,0) -> 3

    m2(0,1) -> 2

    m2(1,0) -> 1

    m2(1,1) -> 2



    Ideally, we would want to be able to create something like "reindexer" and
    pass it into constructor of the new ILArray along with the instance if the
    old ILArray.



    Do you think it is (or will be) possible to do?

    A.
    • CommentAuthorakuzmenko
    • CommentTimeJun 8th 2010
     
    There is a mistake in the desired output, it should be:
    m2(0,0) -> 3
    m2(0,1) -> 4
    m2(1,0) -> 1
    m2(1,1) -> 2
    • CommentAuthorhaymo
    • CommentTimeJun 11th 2010
     

    this might be archievable with the referencing feature of ILArray<T>. (?) You might combine ILArray.ReferencingBehaviour.DetachNever with a rotating row definition for the subarray creation.

    For every step:

    A[String.Format("{0}:end,0:{0};:",step.ToString()]; step++;

    will realize the rotating rows. In order to overwrite them without detaching (and recreating) the original storage, you must prevent the array from automatic detaching. use the before mentioned property for that.

    • CommentAuthorakuzmenko
    • CommentTimeJun 11th 2010
     
    I think that's what I need. Great, thank you!

    Can I ask another (also related to performance) question? Sorry I've tried to look at help, but maybe I missed...

    Is it possible to precreate all matrices needed for my computations, and then provide them to relevant operations?

    Like for example, I want to have two matrices R[m,n] and C[n,n], and then whenever I want to calculate R'*R, I provide matrix C as the one to be populated... Seems like a fairly desirable feature to have for very high performance applications :)

    Thanks again for the answer above, very helpful.
    • CommentAuthorhaymo
    • CommentTimeJun 11th 2010
     
    • CommentAuthorakuzmenko
    • CommentTimeJun 11th 2010
     
    That's impressive!