mat: rowset() and columnset()

This commit is contained in:
2026-01-27 17:29:50 +01:00
parent 18d8fd8d9b
commit 1580891639
3 changed files with 37 additions and 4 deletions

10
mat.h
View File

@@ -266,6 +266,9 @@ public:
//! get the i<sup>th</sup> row
const NRVec<T> row(const int i, int l = -1) const;
//! set the i<sup>th</sup> row
void rowset(const NRVec<T> &r, const int i, int l = -1);
//! get the j<sup>th</sup> column
const NRVec<T> column(const int j, int l = -1) const {
NOT_GPU(*this);
@@ -275,6 +278,13 @@ public:
return r;
};
//! set the j<sup>th</sup> column
void columnset(const NRVec<T> &r, const int j, int l = -1) {
NOT_GPU(*this);
if(l < 0) l = nn;
for(register int i=0; i<l; ++i) (*this)(i,j) = r[i];
};
//! extract the digonal elements of this matrix and store them into a vector
const T* diagonalof(NRVec<T> &, const bool divide = 0, bool cache = false) const;
//! set diagonal elements