[eigen] DenseBase::NullaryExpr - Functor requirements |

[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]

Hi guys,
I am slightly confused by the required functions for the Functors to create a
CwiseNullaryOp using DenseBase::NullaryExpr.
I thought it would be enough to write a struct which provides a operator()
(int,int) which returns the element i,j of the expression. However when doing
that, I get frequent compilation errors which end with the following:
/usr/include/eigen3/Eigen/src/Core/CwiseNullaryOp.h:82:29: error: no match for
call to '(...)'
return m_functor(index)
(... <- is an ugly template expression which is my functor)
So after some experimentation, I guessed that this operator()(int) should
return also the matrix elements but compressed into a 1D array. But I am not
sure at all about that. Although I seem to get the correct result when doing
that.
Could you maybe point me to the documentation where this is specified (sorry
couldn't find it)? Also is the single index operator dependent on the storage
order of DenseBase?
And out of curiosity, when searching the file Eigen/src/Core/CwiseNullaryOp.h
(the compile error from above occurred there), I found a function call
PacketScalar. What's that about? Is this for vectorization?
Thanks in advance!
Dan