X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2Fcml%2Fmatrix%2Fexternal.h;h=6bfb8c4199d195f7062293454f98ee825b89e9b0;hp=36c225a067b84cdf4dc4b1533f501c398f59f820;hb=6b0a0d0efafe34d48ab344fca3b479553bd4e62c;hpb=0fffd0097d7b496454413e57b398c903ecc252e4 diff --git a/src/cml/matrix/external.h b/src/cml/matrix/external.h index 36c225a..6bfb8c4 100644 --- a/src/cml/matrix/external.h +++ b/src/cml/matrix/external.h @@ -78,7 +78,7 @@ class matrix,BasisOrient,Layout> /* To simplify the matrix transpose operator: */ typedef matrix< - Element, + typename cml::remove_const::type, typename array_type::transposed_type::generator_type, BasisOrient, Layout @@ -221,6 +221,16 @@ class matrix,BasisOrient,Layout> set_basis_element(i,j,s,basis_orient()); } + /** Set the matrix row from the given vector. */ + void set_row(size_t i, const row_vector_type& row) { + for(size_t j = 0; j < this->cols(); ++ j) (*this)(i,j) = row[j]; + } + + /** Set the matrix column from the given vector. */ + void set_col(size_t j, const col_vector_type& col) { + for(size_t i = 0; i < this->rows(); ++ i) (*this)(i,j) = col[i]; + } + public: @@ -440,6 +450,8 @@ class matrix,BasisOrient,Layout> * responsible for doing any necessary memory management. * * @param ptr specify the external pointer. + * @param rows the number of rows in the C array. + * @param cols the number of columns in the C array. * * @throws same as the ArrayType constructor. */