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

antiDiag() method seems incorrect #19

Open
fcarlosjr opened this issue Aug 15, 2016 · 1 comment
Open

antiDiag() method seems incorrect #19

fcarlosjr opened this issue Aug 15, 2016 · 1 comment

Comments

@fcarlosjr
Copy link

fcarlosjr commented Aug 15, 2016

Hi Michael,

I would like to report a issue with the method antiDiag() defined in the FullStorage class. If I
didn't misuse it, its not correctly implemented. For it to work, I had to make
adjustments in its code. Currently its function body is composed of the
following:

IndexType row_ = (d>0) ? 0 : -d;
IndexType col_ = (d>0) ? d : 0;

IndexType row = firstRow() + row_;
IndexType col = firstCol() + col_;

return ArrayView(std::min(numRows()-row_, numCols()-col_),
                 &(operator()(row,lastCol()-col+1)),
                 -leadingDimension()+1,
                 firstViewIndex,
                 allocator());

I replaced this content with the following, making it work as expected (//***
points out changed lines):

IndexType row_ = (d<0) ? 0 : d; //***
IndexType col_ = (d<0) ? -d : 0; //***

IndexType row = row_;   //***
IndexType col = firstCol() + col_;

return ArrayView(std::min(numRows()-row_, numCols()-col_),
                 &(operator()(lastRow()-row,col)),    //***
                 leadingDimension()-1,  //***
                 firstViewIndex,
                 allocator());

I hope you guys keep up this great work.

@fcarlosjr
Copy link
Author

Just reporting, these changes I've made don't work for RowMajor-ordered matrices.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant