Registered Member
|
Hello,
I have multiple use-cases where I extract a portion of a matrix using block operations e.g. block, middleRows, bottomRows etc. For performance reasons I would like to get a reference to those data portions within the matrix rather than a copy. I know this is not always possible due to e.g. striding but in some cases it does make sense and the performance gains of avoiding unnecessary expensive copies is substantial. Is there a way to do block operations that do not incur in copying? TIA, Best regards, Giovanni |
Registered Member
|
The object returned by block (and similar functions) does precisely what you want. The return type is an expression type. It is not a reference in the C++ sense (a type of the form X&), but it stores a reference to the matrix. This means that bad things happen if the matrix is destroyed.
|
Registered users: Baidu [Spider], Bing [Bot], Google [Bot]