Matrix
-
class Matrix : public godzilla::PetscObjectWrapper<Mat>
Subclassed by godzilla::ShellMatrix
Public Functions
-
void set_type(const char *type)
Builds matrix object for a particular matrix type.
- Parameters:
type – The matrix type
-
void set_values_local(Int n, const Int *row_idxs, Int m, const Int *col_idxs, const Scalar *vals, InsertMode mode = INSERT_VALUES)
Inserts or adds values into certain locations of a matrix, using a local numbering of the rows and columns.
- Parameters:
n – Number of rows
row_idxs – The row local indices
m – Number of columns
col_idxs – The column local indices
vals – The values to insert (row-major format)
mode – The insertion mode
-
void set_values_local(const std::vector<Int> &row_idxs, const std::vector<Int> &col_idxs, const std::vector<Scalar> &vals, InsertMode mode = INSERT_VALUES)
Inserts or adds values into certain locations of a matrix, using a local numbering of the rows and columns.
- Parameters:
row_idxs – The row local indices
col_idxs – The column local indices
vals – The values to insert
mode – The insertion mode
-
template<Int N>
inline void set_values_local(const DenseVector<Int, N> &row_idxs, const DenseVector<Int, N> &col_idxs, const DenseMatrix<Scalar, N, N> &vals, InsertMode mode = INSERT_VALUES) Inserts or adds values into certain locations of a matrix, using a local numbering of the rows and columns.
- Parameters:
row_idxs – The row local indices
col_idxs – The column local indices
vals – The values to insert
mode – The insertion mode
-
void set_values_local(const DynDenseVector<Int> &row_idxs, const DynDenseVector<Int> &col_idxs, const DynDenseMatrix<Scalar> &vals, InsertMode mode = INSERT_VALUES)
Inserts or adds values into certain locations of a matrix, using a local numbering of the rows and columns.
- Parameters:
row_idxs – The row local indices
col_idxs – The column local indices
vals – The values to insert
mode – The insertion mode
-
void scale(Scalar a)
Scales all elements of a matrix by a given number.
- Parameters:
a – The scaling value
-
void transpose()
Computes an in-place transpose of a matrix.
-
void set_option(Option option, bool flag)
Sets a parameter option for a matrix.
- Parameters:
option – The option to set
flag – The value of the option
-
void set_block_size(Int bs)
Sets the matrix block size.
- Parameters:
bs – The block size
-
bool is_symmetric(Real tol) const
Test whether a matrix is symmetric.
- Parameters:
tol – difference between value and its transpose less than this amount counts as equal (use 0.0 for exact transpose)
- Returns:
trueif the matrix is symmetric,falseotherwise
-
void set_type(const char *type)