Re: [eigen] Recursion and block matrices |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
On 21.09.2012 19:05, Norman Goldstein wrote:
-- What was it about the Eigen class designs that made it convenient to
restrict Ref to innerStride==1?
Would it be a major development to remove this restriction? (convenient
for transposing and even/odd
subscripting).
It's only much more efficient at runtime. If you don't mind that, you
can allow dynamic inner stride this way:
Ref<MatrixXf,0,Stride<> >
Read this for details:
http://eigen.tuxfamily.org/dox-devel/classEigen_1_1Ref.html
I'm not sure if the current implementation would allow passing a
transposed matrix to that yet (I guess not).
-- Is there a signature for incr() that would allow me to pass in the
MatrixXd directly, without first
converting it to a Ref in main():
Ref< MatrixXd > sub( mat );
incr( sub );
void incr( Ref< MatrixXd > matV );
and in C++11 it should also be possible to use an l-value reference:
void incr( Ref< MatrixXd >&& matV )
-- Are the two expressions
Ref< MatrixXd > sub = mat;
Ref< MatrixXd > sub( mat );
supposed to be equavalent? I think that a compiler is allowed to
interpret the
first one as a default constructor followed by an assignment operator.
No, for a class A
A a = b; // not allowed if constructor is explicit ...
and
A a(b);
call the constructor, and
A a; a = b;
calls the default constructor and then the assignment operator.
Ref does not have a default constructor so the second interpretation
would not even be possible.
Of course, there is (almost?) always a rule that the compiler can
interpret things differently, if the outcome is the same.
Christoph
--
----------------------------------------------
Dipl.-Inf. Christoph Hertzberg
Cartesium 0.049
Universität Bremen
Enrique-Schmidt-Straße 5
28359 Bremen
Tel: +49 (421) 218-64252
----------------------------------------------