Eigen-based dense matrix wrapper.
More...
#include <eigen_dense.hpp>
template<
typename T,
int StorageOrder = Eigen::ColMajor>
class bem::EigenDenseMatrix< T, StorageOrder >
Eigen-based dense matrix wrapper.
- Template Parameters
-
| T | - Data type to be stored in the matrix (e.g., float, double, std::complex). |
| StorageOrder | - Storage order of the matrix, either Eigen::ColMajor or Eigen::RowMajor. |
- Examples
- /examples/ex01_start_here.cpp, and /examples/ex02_assemblers.cpp.
Definition at line 44 of file eigen_dense.hpp.
◆ value()
Returns the matrix value at the specified row and column.
- Parameters
-
| [in] | row | - Row index. |
| [in] | col | - Column index. |
- Returns
- Value at the specified position in the matrix.
Implements bem::MatrixBase< T >.
Definition at line 61 of file eigen_dense.hpp.
◆ set_value()
Sets the matrix value at the specified row and column.
- Parameters
-
| [in] | row | - Row index. |
| [in] | col | - Column index. |
| [in] | a | - Value to set. |
Implements bem::MatrixBase< T >.
Definition at line 73 of file eigen_dense.hpp.
◆ add_value()
Adds to the matrix value at the specified row and column.
- Parameters
-
| [in] | row | - Row index. |
| [in] | col | - Column index. |
| [in] | a | - Value to add. |
Reimplemented from bem::MatrixBase< T >.
Definition at line 86 of file eigen_dense.hpp.
◆ scale()
◆ set_constant()
Sets all matrix entries to a given constant value.
- Parameters
-
| [in] | a | - Constant value to set. |
Definition at line 108 of file eigen_dense.hpp.
◆ mat_solve()
Solves \( \mathbf{M}\mathbf{X} = \mathbf{B} \) for matrix \( \mathbf{X} \) with a direct solver, where \( \mathbf{M} \) is this matrix, and \( \mathbf{B} \) is a given right-hand side matrix.
- Parameters
-
| [out] | x | - Solution. |
| [in] | b | - Right-hand side matrix, must have the same number of rows as this matrix. |
Implements bem::MatrixBase< T >.
Definition at line 122 of file eigen_dense.hpp.
◆ set_block()
Sets a block of values in this matrix to the values of a given matrix, starting at a given position.
- Parameters
-
| [in] | x | - Matrix to insert. |
| [in] | row_start | - Starting row index for the block. |
| [in] | col_start | - Starting column index for the block. |
| [in] | a | - Scalar to multiply the values of x before inserting (optional). |
Implements bem::EigenMatrixBase< T, MatrixType >.
Definition at line 142 of file eigen_dense.hpp.
◆ add_block()
Adds a block of values to this matrix from the values of a given matrix, starting at a given position.
- Parameters
-
| [in] | x | - Matrix whose values should be added to a block of this matrix. |
| [in] | row_start | - Starting row index for the block. |
| [in] | col_start | - Starting column index for the block. |
| [in] | a | - Scalar to multiply the values of x before adding (optional). |
Implements bem::EigenMatrixBase< T, MatrixType >.
Definition at line 163 of file eigen_dense.hpp.
◆ get_block()
Retrieves a block of values from this matrix.
- Parameters
-
| [out] | x | - Matrix to store the retrieved block of values. |
| [in] | row_start | - Starting row index for the block. |
| [in] | col_start | - Starting column index for the block. |
| [in] | b_rows | - Number of rows in the block to retrieve. |
| [in] | b_cols | - Number of columns in the block to retrieve. |
Implements bem::EigenMatrixBase< T, MatrixType >.
Definition at line 184 of file eigen_dense.hpp.
◆ data() [1/2]
◆ data() [2/2]
Returns a writable pointer to the underlying raw data - use with care.
- Returns
- Writable pointer to the raw data.
Implements bem::MatrixBase< T >.
Definition at line 211 of file eigen_dense.hpp.
◆ frobenius_norm()
Returns the Frobenius norm of the matrix, defined as the square root of the sum of the squares of all matrix values.
- Returns
- Frobenius norm of the matrix.
Definition at line 220 of file eigen_dense.hpp.
◆ one_norm()
Returns the one-norm of the matrix, computed by taking the sum of absolute values of all rows for each column, and then taking the largest of these sums across all columns.
- Returns
- One-norm of the matrix.
Definition at line 231 of file eigen_dense.hpp.
◆ infinity_norm()
Returns the infinity-norm of the matrix, computed by taking the sum of absolute values of all columns for each row, and then taking the largest of these sums across all rows.
- Returns
- Infinity-norm of the matrix.
Definition at line 242 of file eigen_dense.hpp.
◆ rank()
Computes the rank of the matrix.
- Returns
- Rank.
Definition at line 252 of file eigen_dense.hpp.
◆ raw_matrix() [1/2]
Returns a writable reference to the underlying raw matrix - use with caution.
Definition at line 120 of file eigen_base.hpp.
◆ raw_matrix() [2/2]
Returns a read-only reference to the underlying raw matrix.
Definition at line 129 of file eigen_base.hpp.
◆ set_raw_matrix()
Sets the underlying raw matrix by copying over data from a given matrix.
- Parameters
-
| [in] | matrix | - The raw matrix to set. |
Definition at line 139 of file eigen_base.hpp.
◆ bind_raw_matrix()
Binds the underlying raw matrix to the data pointed at by a given matrix pointer.
- Parameters
-
| [in] | matrix | - Pointer to the raw matrix to be bound. |
The purpose of this method is to allow creating an external Eigen matrix of type MatrixType, and then transferring ownership of that matrix to this object, but without copying over the underlying data, unlike set_raw_matrix().
Definition at line 154 of file eigen_base.hpp.
◆ num_rows()
|
|
inlineoverridevirtualinherited |
◆ num_cols()
|
|
inlineoverridevirtualinherited |
◆ size()
|
|
inlineoverridevirtualinherited |
◆ resize()
|
|
inlineoverridevirtualinherited |
Resizes the matrix to a new number of rows and columns.
- Parameters
-
| [in] | rows | - New number of rows. |
| [in] | cols | - New number of columns. |
Implements bem::MatrixBase< T >.
Definition at line 196 of file eigen_base.hpp.
◆ clear()
|
|
inlineoverridevirtualinherited |
◆ set_zero()
|
|
inlineoverridevirtualinherited |
◆ set_identity()
|
|
inlineoverridevirtualinherited |
◆ set_transpose()
Computes \( \mathbf{M} = \mathbf{X}^T \) where \( \mathbf{M} \) is this matrix, \( \mathbf{X} \) is a given matrix, and \( \mathbf{X}^T \) is its transpose.
- Parameters
-
| [in] | x | - Matrix to transpose. |
Definition at line 240 of file eigen_base.hpp.
◆ get_diagonal()
Retrieves matrix values on the diagonal, zeroing out all other entries.
- Parameters
-
Definition at line 252 of file eigen_base.hpp.
◆ add_ax()
|
|
inlineoverridevirtualinherited |
Computes \( \mathbf{M} = \mathbf{M} + a\mathbf{X} \) where \( \mathbf{M} \) is this matrix, \( a \) is a scalar, and \( \mathbf{X} \) is a matrix.
- Parameters
-
| [in] | x | - Matrix to scale and add, must have the same dimensions as this matrix. |
| [in] | a | - Scalar which which to scale x. |
Implements bem::MatrixBase< T >.
Definition at line 266 of file eigen_base.hpp.
◆ set_axpby()
Computes \( \mathbf{M} = a\mathbf{X} + b\mathbf{Y} \) where \( \mathbf{M} \) is this matrix, \( a \) and \( b \) are scalars, and \( \mathbf{X} \) and \( \mathbf{Y} \) are matrices.
- Parameters
-
| [in] | x | - First matrix to scale and add, must have the same dimensions as y. |
| [in] | y | - Second matrix to scale and add, must have the same dimensions as x. |
| [in] | a | - Scalar which which to scale x. |
| [in] | b | - Scalar which which to scale y. |
Definition at line 282 of file eigen_base.hpp.
◆ set_mat_mul()
Computes \( \mathbf{M} = a\mathbf{X}\mathbf{Y} \) where \( \mathbf{M} \) is this matrix, \( a \) is a scalar, and \( \mathbf{X} \) and \( \mathbf{Y} \) are matrices.
- Parameters
-
| [in] | x | - First matrix to multiply, must have the same number of columns as y has rows. |
| [in] | y | - Second matrix to multiply , must have the same number of rows as x has columns. |
| [in] | a | - Scalar which which to scale the product of x and y. |
Definition at line 298 of file eigen_base.hpp.
◆ add_mat_mul()
Computes \( \mathbf{M} = \mathbf{M} + a\mathbf{X}\mathbf{Y} \) where \( \mathbf{M} \) is this matrix, \( a \) is a scalar, and \( \mathbf{X} \) and \( \mathbf{Y} \) are matrices.
- Parameters
-
| [in] | x | - First matrix to multiply, must have the same number of columns as y has rows. |
| [in] | y | - Second matrix to multiply , must have the same number of rows as x has columns. |
| [in] | a | - Scalar which which to scale the product of x and y. |
Definition at line 314 of file eigen_base.hpp.
◆ mat_solve_iterative()
Solves \( \mathbf{M}\mathbf{X} = \mathbf{B} \) for matrix \( \mathbf{X} \) with an iterative solver, where \( \mathbf{M} \) is this matrix, and \( \mathbf{B} \) is a given right-hand side matrix.
- Parameters
-
| [out] | x | - Solution. |
| [in] | b | - Right-hand side matrix, must have the same number of rows as this matrix. |
| [in] | tol | - Tolerance for convergence (optional). |
Definition at line 332 of file eigen_base.hpp.
◆ mat_solve_gmres()
Solves \( \mathbf{M}\mathbf{X} = \mathbf{B} \) for matrix \( \mathbf{X} \) with the GMRES iterative solver, where \( \mathbf{M} \) is this matrix, and \( \mathbf{B} \) is a given right-hand side matrix.
- Parameters
-
| [out] | x | - Solution. |
| [in] | b | - Right-hand side matrix, must have the same number of rows as this matrix. |
| [in] | tol | - Tolerance for convergence (optional). |
| [in] | restart | - Restart iteration at which the Krylov subspace is discarded (optional). |
Definition at line 349 of file eigen_base.hpp.
◆ mat_solve_bicgstab()
Solves \( \mathbf{M}\mathbf{X} = \mathbf{B} \) for matrix \( \mathbf{X} \) with the BiCGSTAB iterative solver, where \( \mathbf{M} \) is this matrix, and \( \mathbf{B} \) is a given right-hand side matrix.
- Parameters
-
| [out] | x | - Solution. |
| [in] | b | - Right-hand side matrix, must have the same number of rows as this matrix. |
| [in] | tol | - Tolerance for convergence (optional). |
Definition at line 390 of file eigen_base.hpp.
◆ cond()
Computes the condition number (ratio of largest to smallest singular value) of the matrix.
- Returns
- Condition number.
Definition at line 424 of file eigen_base.hpp.
◆ print()
|
|
inlineoverridevirtualinherited |
◆ preallocate() [1/2]
◆ preallocate() [2/2]
◆ assemble()
◆ write_binary()
Writes the matrix to a binary file.
Definition at line 196 of file base.hpp.
◆ read_binary()
Reads the matrix from a binary file.
Definition at line 211 of file base.hpp.
The documentation for this class was generated from the following file: