Re: [eigen] sub-matrix extensions

[ Thread Index | Date Index | More Archives ]

On Fri, Feb 6, 2009 at 1:27 PM, Jitse Niesen <jitse@xxxxxxxxxxxxxxxxx> wrote:
> On Fri, 6 Feb 2009, Gael Guennebaud wrote:
>> c) here I have a use case where runtime strides are needed, but do
>> you think we also need compile-time strides ? (probably yes)
>> d) do you think bidirectional strides might be useful ? eg:
>> mat.stride(2,3) (picks the intersections of all even rows and k*3
>> columns)
> I have some Matlab code that uses A(1:2:end, 1:2:end) = ... which would be
> A.stride(2,2) = ... in your notation. In the end, we got rid of it by
> redefining A to be a permutation of the original A, so it was not essential,
> but it was useful in developing the code / maths.
> As for c), I'm not sure what the question is. I guess with compile-time
> strides you mean all the template tricks so that you write A.stride<2,2> .
> In my case, 2 is a compile-time constant (obviously), so this could be done.
> As I understand it, the use of the templates is that you can do
> optimizations at compile time. Is there a possible optimization here? In my
> case, it wouldn't be very useful since we could get rid of the double
> strides (indeed, the fact that double strides are slow in Matlab was one of
> the reasons we re-defined A).

exactly, for instance the compiler might optimize a *2 using a shift,
this allows us to compute the size of the matrix at compile time (if
the matrix size if known at compile time of course) that further allow
to perform some unrolling, etc...

Mail converted by MHonArc 2.6.19+