32template <
typename SPARSITY_PATTERN>
33struct SetMatrixSparsity<LisMatrix, SPARSITY_PATTERN>;
111 void write(
const std::string& filename)
const;
118 template <
class T_DENSE_MATRIX>
119 void add(std::vector<IndexType>
const& row_pos,
120 const T_DENSE_MATRIX& sub_matrix,
123 this->
add(row_pos, row_pos, sub_matrix, fkt);
127 template <
class T_DENSE_MATRIX>
129 const T_DENSE_MATRIX& sub_matrix,
135 template <
class T_DENSE_MATRIX>
136 void add(std::vector<IndexType>
const& row_pos,
137 std::vector<IndexType>
const& col_pos,
138 const T_DENSE_MATRIX& sub_matrix,
double fkt = 1.0);
161 template <
typename MATRIX,
typename SPARSITY_PATTERN>
165template <
class T_DENSE_MATRIX>
167 std::vector<IndexType>
const& col_pos,
168 const T_DENSE_MATRIX& sub_matrix,
double fkt)
170 auto const n_rows = row_pos.size();
171 auto const n_cols = col_pos.size();
172 for (
auto i =
decltype(n_rows){0}; i < n_rows; i++)
174 auto const row = row_pos[i];
175 for (
auto j =
decltype(n_cols){0}; j < n_cols; j++)
177 auto const col = col_pos[j];
178 add(row, col, fkt * sub_matrix(i, j));
187template <
typename SPARSITY_PATTERN>
191 SPARSITY_PATTERN
const& sparsity_pattern)
const
194 std::vector<LisMatrix::IndexType> row_sizes;
195 row_sizes.reserve(n_rows);
198 transform(cbegin(sparsity_pattern), cend(sparsity_pattern),
199 back_inserter(row_sizes), [](
auto const i) {
return i + 1; });
201 int ierr = lis_matrix_malloc(matrix.
AA_, 0, row_sizes.data());
LisMatrix is a wrapper class for matrix types of the linear iterative solvers library.
IndexType ie_
location where the partial matrix AA_ ends in global matrix.
LisMatrix(std::size_t n_rows, MatrixType mat_type=MatrixType::CRS)
std::size_t getRangeBegin() const
return a start index of the active data range
std::size_t const n_rows_
std::size_t getNumberOfColumns() const
return the number of columns
MatrixType const mat_type_
std::size_t getNumberOfRows() const
return the number of rows
int setValue(IndexType rowId, IndexType colId, double v)
set entry
std::size_t getRangeEnd() const
return an end index of the active data range
int add(IndexType rowId, IndexType colId, double v)
add value
void add(std::vector< IndexType > const &row_pos, const T_DENSE_MATRIX &sub_matrix, double fkt=1.0)
void setZero()
reset this matrix with keeping its original dimension
MatrixType getMatrixType() const
get this matrix type
bool use_external_arrays_
friend bool finalizeMatrixAssembly(LisMatrix &mat)
finish assembly to make this matrix be ready for use
void write(const std::string &filename) const
printout this equation for debugging
LIS_MATRIX & getRawMatrix()
return a raw Lis matrix object
void add(RowColumnIndices< IndexType > const &indices, const T_DENSE_MATRIX &sub_matrix, double fkt=1.0)
Add sub-matrix at positions given by indices.
bool isAssembled() const
return if this matrix is already assembled or not
bool checkLisError(int err)
bool finalizeMatrixAssembly(MAT_T &)
LineIndex const & columns
void operator()(LisMatrix &matrix, SPARSITY_PATTERN const &sparsity_pattern) const