[eigen] resizing in ReturnByValue assignment |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
First, the praise: I really like the ReturnByValue paradigm. It is
syntactically cleaner than using the destination-as-an-argument. It
bends the rules of c++ somewhat and allows one to overload/specialize
based on return type. Very cool.
Next, my confusion:
Eigen::FFT fwd,inv now uses ReturnByValue but it elicits an unnecessary
resize in some conditions (eliminating the advantage of the
ReturnByValue proxy object). This is my bug -- I thought the rows() and
cols() referred to the source matrix. They refer to the destination. I
can fix this by duplicating the logic required to decide the output size
from the FFT fwd and inv functions, but I'm lazy and I don't like doing
work I don't need to do.
Why does DenseStorageBase::operator=( ReturnByValue ) call resize() first?
(defined in Eigen/src/Core/DenseStorageBase.h around line 300)
Why not just require the ReturnByValue subclass evalTo method resize the
destination as needed?
Removing the resize also simplifies the implementation slightly by
eliminating the need for rows() and cols() to be defined in the
ReturnByValue subclass.
Am I missing something?
-- Mark Borgerding