Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-14740: Stop using ndarray::EigenView indirectly in C++ code #119

Merged
merged 3 commits into from Jun 18, 2018

Conversation

r-owen
Copy link
Contributor

@r-owen r-owen commented Jun 11, 2018

No description provided.

Replace it with ndarray::asEigenArray, which returns an Eigen::Map
instead of an ndarray::EigenView
In all but one case the Eigen::Map was being used as a matrix,
not an array, so make the maps matrices.
Copy link
Member

@kfindeisen kfindeisen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just one small question.

auto model = ndarray::asEigenMatrix(modelNdArray);
auto data = ndarray::asEigenMatrix(dataNdArray);
auto variance = ndarray::asEigenMatrix(varianceNdArray);
PsfPixel alpha = model.squaredNorm();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these asEigenMatrix rather than asEigenArray? The original code used asEigen<Eigen::ArrayXpr>.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because in almost all cases in the old code the array EigenView is used as a matrix by appending .matrix(). This eliminates all those calls to .matrix() at the expense of adding one call to .array(). See the changes below.

@r-owen r-owen merged commit 3a12586 into master Jun 18, 2018
@ktlim ktlim deleted the tickets/DM-14740 branch August 25, 2018 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants