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-14725: Eliminate explicit use of ndarray::EigenView in C++ code #88

Merged
merged 2 commits into from
Jun 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ config.log
*.pyc
*.py~
.cache
.pytest_cache
.coverage
pytest_session.txt
doc/html
doc/xml
Expand Down
10 changes: 5 additions & 5 deletions src/KernelSolution.cc
Original file line number Diff line number Diff line change
Expand Up @@ -559,22 +559,22 @@ namespace diffim {
ndarray::Array<int, 1, 1> maskArray =
ndarray::allocate(ndarray::makeVector(fullFp->getArea()));
fullFp->getSpans()->flatten(maskArray, finalMask.getArray(), templateImage.getXY0());
ndarray::EigenView<int, 1, 1> maskEigen(maskArray);
auto maskEigen = maskArray.asEigen();
Copy link
Member

Choose a reason for hiding this comment

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

Can't say I approve of this use of auto, but I gather it's for forward-compatibility with DM-14728.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes


ndarray::Array<InputT, 1, 1> arrayTemplate =
ndarray::allocate(ndarray::makeVector(fullFp->getArea()));
fullFp->getSpans()->flatten(arrayTemplate, templateImage.getArray(), templateImage.getXY0());
ndarray::EigenView<InputT, 1, 1> eigenTemplate0(arrayTemplate);
auto eigenTemplate0 = arrayTemplate.asEigen();

ndarray::Array<InputT, 1, 1> arrayScience =
ndarray::allocate(ndarray::makeVector(fullFp->getArea()));
fullFp->getSpans()->flatten(arrayScience, scienceImage.getArray(), scienceImage.getXY0());
ndarray::EigenView<InputT, 1, 1> eigenScience0(arrayScience);
auto eigenScience0 = arrayScience.asEigen();

ndarray::Array<afwImage::VariancePixel, 1, 1> arrayVariance =
ndarray::allocate(ndarray::makeVector(fullFp->getArea()));
fullFp->getSpans()->flatten(arrayVariance, varianceEstimate.getArray(), varianceEstimate.getXY0());
ndarray::EigenView<afwImage::VariancePixel, 1, 1> eigenVariance0(arrayVariance);
auto eigenVariance0 = arrayVariance.asEigen();

int nGood = 0;
for (int i = 0; i < maskEigen.size(); i++) {
Expand Down Expand Up @@ -619,7 +619,7 @@ namespace diffim {
ndarray::Array<InputT, 1, 1> arrayC =
ndarray::allocate(ndarray::makeVector(fullFp->getArea()));
fullFp->getSpans()->flatten(arrayC, cimage.getArray(), cimage.getXY0());
ndarray::EigenView<InputT, 1, 1> eigenC0(arrayC);
auto eigenC0 = arrayC.asEigen();

Eigen::VectorXd eigenC(nGood);
int nUsed = 0;
Expand Down