Registered Member
|
In the previous code, I can pass the row "by value" -- does this actually make a copy of the block reference? In the second chunk, I'm trying to pass "by reference" but it fails to compile, unless I first set a variable to the row(). Two questions:
|
Moderator
|
Have a look at the Ref<> class: http://eigen.tuxfamily.org/dox/classEigen_1_1Ref.html
|
Registered Member
|
Near as I can tell, this will only allow you to send a const row to a function. I need to be able to modify the elements within the function. The "cast away constness" trick seen elsewhere seems like it gets away from this, but surely there must be a less hack-ish way? |
Moderator
|
nope, a Ref can be in/out as in the example of the doc. For instance, to accept a matrix, or any kind of submatrices including rows/columns:
|
Registered Member
|
The problem with that is that I can't access individual elements:
Gives the static assertion "YOU_ARE_TRYING_TO_USE_AN_INDEX_BASED_ACCESSOR_ON_AN_EXPRESSION_THAT_DOES_NOT_SUPPORT_THAT" |
Moderator
|
x(0,0) will do, but If you are expecting a vector, then do as in the doc:
Stride<> is needed to accept a row of a column major matrix. |
Registered users: Baidu [Spider], Bing [Bot], Google [Bot], rblackwell