Closed kaigu1997 closed 3 years ago
And I am curious about why the constructor of DenseFeatures
uses a copy of SGMatrix
instead of a const reference.
hi @kaigu1997, I think you can just construct a SGMatrix
from a Eigen::MatrixXd
, it will not waste extra time and memory, because there is only a shallow copy in here.
https://github.com/shogun-toolbox/shogun/blob/e2e8ae60d506e80251b771d309bae60920cff9af/src/shogun/lib/SGMatrix.cpp#L131-L139
And I am curious about why the constructor of
DenseFeatures
uses a copy ofSGMatrix
instead of a const reference.
same reason, there is only shallow copy.
hi @kaigu1997, I think you can just construct a
SGMatrix
from aEigen::MatrixXd
, it will not waste extra time and memory, because there is only a shallow copy in here.And I am curious about why the constructor of
DenseFeatures
uses a copy ofSGMatrix
instead of a const reference.same reason, there is only shallow copy.
This constructor of SGMatrix
requires the matrix to be non-const, while in my case the function get a const Eigen::MatrixXd&
parameter.
So in my case, I guess I could only make a copy, right?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue is now being closed due to a lack of activity. Feel free to reopen it.
I tried to construct a feature using matrix from Eigen, but the compiling fails. The src is
I am using Ubuntu 9.3.0-10ubuntu2 with the latest release of Shogun (6.1.4). Compiled with
g++ test.cpp -lshogun
, the error isI noticed that the
DenseFeatures
class maintains its own matrix, so is there an elegant way to construct a feature from aEigen::MatrixXd
? (I tried with construct aSGMatrix
from aEigen::MatrixXd
by hand without using theMap
wrapper and it works, but this needs extra time and memory)