Skip to content

Commit

Permalink
Merge pull request #69 from SeisSol/is-in-range-csc
Browse files Browse the repository at this point in the history
Add isInRange to CSC matrix format
  • Loading branch information
davschneller authored Nov 30, 2023
2 parents 723a4ca + 631bab5 commit 88a5803
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions include/yateto/TensorView.h
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,20 @@ namespace yateto {
return m_values[addr];
}

bool isInRange(uint_t row, uint_t col) const {
assert(col >= 0 && col < this->shape(1));
uint_t addr = m_colPtr[ col ];
uint_t stop = m_colPtr[ col+1 ];
while (addr < stop) {
if (m_rowInd[addr] == row) {
return true;
}
++addr;
}

return false;
}

real_t& operator[](uint_t entry[2]) {
return operator()(entry[0], entry[1]);
}
Expand Down

0 comments on commit 88a5803

Please sign in to comment.