Skip to content

Commit

Permalink
take into account non-square matrices
Browse files Browse the repository at this point in the history
  • Loading branch information
conrad committed Aug 2, 2017
1 parent 82bf6a8 commit 763ed1a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions include/armadillo_bits/SpMat_meat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3392,6 +3392,12 @@ SpMat<eT>::eye(const uword in_rows, const uword in_cols)

for(uword i = 0; i <= N; ++i) { access::rw(col_ptrs[i]) = i; }

// take into account non-square matrices
for(uword i = (N+1); i <= in_cols; ++i)
{
access::rw(col_ptrs[i]) += col_ptrs[i - 1];
}

access::rw(n_nonzero) = N;

return *this;
Expand Down

0 comments on commit 763ed1a

Please sign in to comment.