Registered Member
|
I have read http://eigen.tuxfamily.org/dox-devel/To ... Types.html and know that the question of ways to return Eigen types from functions is asked frequently, but I still have a few questions.
1) Using the cov example, is it OK/efficient to use:
If C in the calling code is already of the correct size, not part of a block, and not an expression? ie a simple method. If so then this can still be a useful approach without using the DenseBase versions. 2) If I have a function defined using:
where x & y are say Array<complex<double>,Dynamic,2> and within that function I want to call another similarly defined function that returns Real eg: Something like
What is the correct syntax to do this? Is casting still available? I realize that I do not know how to do this even in a simple case of the same type. Sorry if this is not completely clear. Thanks for your help. |
Registered Member
|
The method is not as efficient as the pure template version when you want to pass expressions as opposed to MatrixXf. The biggest misconception is to assume that any operation in Eigen is returning a plain matrix object. So even
would already be inefficient because x were creating an unnecessary temporary.
IIRC, the correct thing to do is
PlainObject is here used to get access to the underlying Array type since Derived could itself be an expression. Now, you are back to normal. In your example this would be equivalent to
HTH, Hauke |
Registered users: Bing [Bot], Evergrowing, Google [Bot], rockscient