98 return matrix.coeffRef((
int)r, (
int)c);
112 return matrix.coeff((
int)r, (
int)c);
137 return matrix.coeff((
int)r, (
int)c);
176 for (
int i = 0;
i < m;
i++) {
196 for (
int i = 0;
i < m;
i++) {
197 Eigen::SparseMatrix<double, Eigen::RowMajor>::InnerIterator it(
matrix,
i);
199 A(it.row(), it.col()) = it.value();
280 row_indices.resize(
nnz());
281 column_indices.resize(
nnz());
284 for (
int i = 0;
i < m;
i++) {
285 Eigen::SparseMatrix<double, Eigen::RowMajor>::InnerIterator it(
matrix,
i);
287 values[j] = it.value();
288 row_indices[j] = it.row();
289 column_indices[j] = it.col();
297 Eigen::SparseMatrix<Numeric, Eigen::RowMajor> block_copy(
298 matrix.block((
int)offset, 0, (
int)nrows_block, (
int)
ncols()));
321 if (v[
i] != 0)
matrix.coeffRef((
int)r,
i) = v[
i];
341 typedef Eigen::Triplet<Numeric> T;
342 std::vector<T> tripletList(nelems);
344 for (
Index i = 0;
i < nelems;
i++) {
345 tripletList[
i] = T((
int)rowind[
i], (
int)colind[i], data[i]);
348 matrix.setFromTriplets(tripletList.begin(), tripletList.end());
365 matrix.resize((
int)r, (
int)c);
423 typedef Eigen::Matrix<Numeric, Eigen::Dynamic, 1, Eigen::ColMajor>
425 typedef Eigen::Stride<1, Eigen::Dynamic> Stride;
426 typedef Eigen::Map<EigenColumnVector, 0, Stride> ColumnMap;
458 typedef Eigen::Matrix<Numeric, 1, Eigen::Dynamic, Eigen::RowMajor>
460 typedef Eigen::Stride<1, Eigen::Dynamic> Stride;
461 typedef Eigen::Map<EigenColumnVector, 0, Stride> ColumnMap;
498 Matrix<Numeric, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>
500 typedef Eigen::Stride<Eigen::Dynamic, Eigen::Dynamic> Stride;
501 typedef Eigen::Map<EigenMatrix, 0, Stride> MatrixMap;
503 Index row_stride, column_stride;
509 Stride c_stride(row_stride, column_stride);
510 MatrixMap C_map(data, C.
nrows(), C.
ncols(), c_stride);
515 Stride a_stride(row_stride, column_stride);
516 MatrixMap A_map(data, A.
nrows(), A.
ncols(), a_stride);
547 Matrix<Numeric, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>
549 typedef Eigen::Stride<Eigen::Dynamic, Eigen::Dynamic> Stride;
550 typedef Eigen::Map<EigenMatrix, 0, Stride> MatrixMap;
552 Index row_stride, column_stride;
558 Stride b_stride(row_stride, column_stride);
559 MatrixMap B_map(data, B.
nrows(), B.
ncols(), b_stride);
564 Stride a_stride(row_stride, column_stride);
565 MatrixMap A_map(data, A.
nrows(), A.
ncols(), a_stride);
INDEX Index
The type to use for all integer numbers and indices.
friend void id_mat(Sparse &A)
Sparse identity matrix.
Index nnz() const
Returns the number of nonzero elements.
Numeric operator()(Index r, Index c) const
Plain index operator.
Vector diagonal() const
Diagonal elements as vector.
Numeric * mdata
Pointer to the plain C array that holds the data.
Index ncols() const
Returns the number of columns.
Numeric & rw(Index r, Index c)
Read and write index operator.
bool empty() const
Returns true if variable size is zero.
Eigen::SparseMatrix< Numeric, Eigen::RowMajor > matrix
The actual matrix.
constexpr Index get_start() const
Returns the start index of the range.
G0 G2 FVC Y DV Numeric Numeric Numeric Zeeman LowerQuantumNumbers void * data
friend void transpose_mult(VectorView y, const Sparse &M, ConstVectorView x)
Sparse matrix - Vector multiplication.
Index nelem() const
Returns the number of elements.
Index ncols() const
Returns the number of columns.
Sparse()
Default constructor.
Range mrr
The row range of mdata that is actually used.
Header file for sparse matrices.
friend void transpose(Sparse &A, const Sparse &B)
Transpose of sparse matrix.
void split(Index offset, Index nrows)
Reduce matrix to the row range [offset, offset + nrows].
friend void abs(Sparse &A, const Sparse &B)
Absolute value of sparse matrix elements.
Index nrows() const
Returns the number of rows.
Sparse & operator/=(Numeric x)
Scale matrix by reciprocal.
friend void mult(VectorView y, const Sparse &M, ConstVectorView x)
Sparse matrix - Vector multiplication.
NUMERIC Numeric
The type to use for all floating point numbers.
Sparse & operator-=(const Sparse &x)
Subtract sparse matrix.
friend void sub(Sparse &A, const Sparse &B, const Sparse &C)
Sparse - Sparse subtraction.
constexpr Index get_stride() const
Returns the stride of the range.
Range mcr
The column range of mdata that is actually used.
Sparse & operator+=(const Sparse &x)
Add sparse matrix.
friend std::ostream & operator<<(std::ostream &os, const Sparse &v)
Output operator for Sparse.
void resize(Index n)
Resize function.
Numeric ro(Index r, Index c) const
Read only index operator.
A constant view of a Vector.
void list_elements(Vector &values, ArrayOfIndex &row_indices, ArrayOfIndex &column_indices) const
List elements in matrix.
Numeric * mdata
Pointer to the plain C array that holds the data.
A constant view of a Matrix.
void resize(Index r, Index c)
Resize function.
Range mrange
The range of mdata that is actually used.
friend void add(Sparse &A, const Sparse &B, const Sparse &C)
Sparse - Sparse addition.
void insert_row(Index r, Vector v)
Insert row function.
invlib::Matrix< ArtsMatrix > Matrix
invlib wrapper type for ARTS matrices.
Index nrows() const
Returns the number of rows.
void insert_elements(Index nnz, const ArrayOfIndex &rowind, const ArrayOfIndex &colind, ConstVectorView data)
Insert vector of elements with given row and column indices.
Sparse & operator*=(Numeric x)
Scale matrix.