A matrix object used for finite element assembly and numerics. More...
#include <dense_matrix.h>
Public Member Functions | |
DenseMatrix (const unsigned int new_m=0, const unsigned int new_n=0) | |
DenseMatrix (DenseMatrix &&)=default | |
DenseMatrix (const DenseMatrix &)=default | |
DenseMatrix & | operator= (const DenseMatrix &)=default |
DenseMatrix & | operator= (DenseMatrix &&)=default |
virtual | ~DenseMatrix ()=default |
virtual void | zero () override |
T | operator() (const unsigned int i, const unsigned int j) const |
T & | operator() (const unsigned int i, const unsigned int j) |
virtual T | el (const unsigned int i, const unsigned int j) const override |
virtual T & | el (const unsigned int i, const unsigned int j) override |
virtual void | left_multiply (const DenseMatrixBase< T > &M2) override |
template<typename T2 > | |
void | left_multiply (const DenseMatrixBase< T2 > &M2) |
virtual void | right_multiply (const DenseMatrixBase< T > &M2) override |
template<typename T2 > | |
void | right_multiply (const DenseMatrixBase< T2 > &M2) |
void | vector_mult (DenseVector< T > &dest, const DenseVector< T > &arg) const |
template<typename T2 > | |
void | vector_mult (DenseVector< typename CompareTypes< T, T2 >::supertype > &dest, const DenseVector< T2 > &arg) const |
void | vector_mult_transpose (DenseVector< T > &dest, const DenseVector< T > &arg) const |
template<typename T2 > | |
void | vector_mult_transpose (DenseVector< typename CompareTypes< T, T2 >::supertype > &dest, const DenseVector< T2 > &arg) const |
void | vector_mult_add (DenseVector< T > &dest, const T factor, const DenseVector< T > &arg) const |
template<typename T2 , typename T3 > | |
void | vector_mult_add (DenseVector< typename CompareTypes< T, typename CompareTypes< T2, T3 >::supertype >::supertype > &dest, const T2 factor, const DenseVector< T3 > &arg) const |
void | get_principal_submatrix (unsigned int sub_m, unsigned int sub_n, DenseMatrix< T > &dest) const |
void | get_principal_submatrix (unsigned int sub_m, DenseMatrix< T > &dest) const |
void | outer_product (const DenseVector< T > &a, const DenseVector< T > &b) |
template<typename T2 > | |
DenseMatrix< T > & | operator= (const DenseMatrix< T2 > &other_matrix) |
void | swap (DenseMatrix< T > &other_matrix) |
void | resize (const unsigned int new_m, const unsigned int new_n) |
void | scale (const T factor) |
void | scale_column (const unsigned int col, const T factor) |
DenseMatrix< T > & | operator*= (const T factor) |
template<typename T2 , typename T3 > | |
boostcopy::enable_if_c< ScalarTraits< T2 >::value, void >::type | add (const T2 factor, const DenseMatrix< T3 > &mat) |
bool | operator== (const DenseMatrix< T > &mat) const |
bool | operator!= (const DenseMatrix< T > &mat) const |
DenseMatrix< T > & | operator+= (const DenseMatrix< T > &mat) |
DenseMatrix< T > & | operator-= (const DenseMatrix< T > &mat) |
Real | min () const |
Real | max () const |
Real | l1_norm () const |
Real | linfty_norm () const |
void | left_multiply_transpose (const DenseMatrix< T > &A) |
template<typename T2 > | |
void | left_multiply_transpose (const DenseMatrix< T2 > &A) |
void | right_multiply_transpose (const DenseMatrix< T > &A) |
template<typename T2 > | |
void | right_multiply_transpose (const DenseMatrix< T2 > &A) |
T | transpose (const unsigned int i, const unsigned int j) const |
void | get_transpose (DenseMatrix< T > &dest) const |
std::vector< T > & | get_values () |
const std::vector< T > & | get_values () const |
void | condense (const unsigned int i, const unsigned int j, const T val, DenseVector< T > &rhs) |
void | lu_solve (const DenseVector< T > &b, DenseVector< T > &x) |
template<typename T2 > | |
void | cholesky_solve (const DenseVector< T2 > &b, DenseVector< T2 > &x) |
void | svd (DenseVector< Real > &sigma) |
void | svd (DenseVector< Real > &sigma, DenseMatrix< Number > &U, DenseMatrix< Number > &VT) |
void | svd_solve (const DenseVector< T > &rhs, DenseVector< T > &x, Real rcond=std::numeric_limits< Real >::epsilon()) const |
void | evd (DenseVector< T > &lambda_real, DenseVector< T > &lambda_imag) |
void | evd_left (DenseVector< T > &lambda_real, DenseVector< T > &lambda_imag, DenseMatrix< T > &VL) |
void | evd_right (DenseVector< T > &lambda_real, DenseVector< T > &lambda_imag, DenseMatrix< T > &VR) |
void | evd_left_and_right (DenseVector< T > &lambda_real, DenseVector< T > &lambda_imag, DenseMatrix< T > &VL, DenseMatrix< T > &VR) |
T | det () |
unsigned int | m () const |
unsigned int | n () const |
void | print (std::ostream &os=libMesh::out) const |
void | print_scientific (std::ostream &os, unsigned precision=8) const |
template<typename T2 , typename T3 > | |
boostcopy::enable_if_c< ScalarTraits< T2 >::value, void >::type | add (const T2 factor, const DenseMatrixBase< T3 > &mat) |
Public Attributes | |
bool | use_blas_lapack |
Protected Member Functions | |
void | condense (const unsigned int i, const unsigned int j, const T val, DenseVectorBase< T > &rhs) |
Static Protected Member Functions | |
static void | multiply (DenseMatrixBase< T > &M1, const DenseMatrixBase< T > &M2, const DenseMatrixBase< T > &M3) |
Protected Attributes | |
unsigned int | _m |
unsigned int | _n |
Private Types | |
enum | DecompositionType { LU =0, CHOLESKY =1, LU_BLAS_LAPACK, NONE } |
enum | _BLAS_Multiply_Flag { LEFT_MULTIPLY = 0, RIGHT_MULTIPLY, LEFT_MULTIPLY_TRANSPOSE, RIGHT_MULTIPLY_TRANSPOSE } |
typedef PetscBLASInt | pivot_index_t |
typedef int | pivot_index_t |
Private Member Functions | |
void | _lu_decompose () |
void | _lu_back_substitute (const DenseVector< T > &b, DenseVector< T > &x) const |
void | _cholesky_decompose () |
template<typename T2 > | |
void | _cholesky_back_substitute (const DenseVector< T2 > &b, DenseVector< T2 > &x) const |
void | _multiply_blas (const DenseMatrixBase< T > &other, _BLAS_Multiply_Flag flag) |
void | _lu_decompose_lapack () |
void | _svd_lapack (DenseVector< Real > &sigma) |
void | _svd_lapack (DenseVector< Real > &sigma, DenseMatrix< Number > &U, DenseMatrix< Number > &VT) |
void | _svd_solve_lapack (const DenseVector< T > &rhs, DenseVector< T > &x, Real rcond) const |
void | _svd_helper (char JOBU, char JOBVT, std::vector< Real > &sigma_val, std::vector< Number > &U_val, std::vector< Number > &VT_val) |
void | _evd_lapack (DenseVector< T > &lambda_real, DenseVector< T > &lambda_imag, DenseMatrix< T > *VL=nullptr, DenseMatrix< T > *VR=nullptr) |
void | _lu_back_substitute_lapack (const DenseVector< T > &b, DenseVector< T > &x) |
void | _matvec_blas (T alpha, T beta, DenseVector< T > &dest, const DenseVector< T > &arg, bool trans=false) const |
Private Attributes | |
std::vector< T > | _val |
DecompositionType | _decomposition_type |
std::vector< pivot_index_t > | _pivots |
A matrix object used for finite element assembly and numerics.
Defines a dense matrix for use in Finite Element-type computations. Useful for storing element stiffness matrices before summation into a global matrix. All overridden virtual functions are documented in dense_matrix_base.h.
Definition at line 54 of file dense_matrix.h.
|
private |
Array used to store pivot indices. May be used by whatever factorization is currently active, clients of the class should not rely on it for any reason.
Definition at line 668 of file dense_matrix.h.
|
private |
Definition at line 670 of file dense_matrix.h.
|
private |
Enumeration used to determine the behavior of the _multiply_blas function.
Enumerator | |
---|---|
LEFT_MULTIPLY | |
RIGHT_MULTIPLY | |
LEFT_MULTIPLY_TRANSPOSE | |
RIGHT_MULTIPLY_TRANSPOSE |
Definition at line 588 of file dense_matrix.h.
|
private |
The decomposition schemes above change the entries of the matrix A. It is therefore an error to call A.lu_solve() and subsequently call A.cholesky_solve() since the result will probably not match any desired outcome. This typedef keeps track of which decomposition has been called for this matrix.
Enumerator | |
---|---|
LU | |
CHOLESKY | |
LU_BLAS_LAPACK | |
NONE |
Definition at line 576 of file dense_matrix.h.
|
inline |
Constructor. Creates a dense matrix of dimension m
by n
.
Definition at line 744 of file dense_matrix.h.
|
default |
The 5 special functions can be defaulted for this class, as it does not manage any memory itself.
|
default |
|
virtualdefault |
|
private |
Solves the equation Ax=b for the unknown value x and rhs b based on the Cholesky factorization of A.
Definition at line 1007 of file dense_matrix_impl.h.
|
private |
Decomposes a symmetric positive definite matrix into a product of two lower triangular matrices according to A = LL^T.
Definition at line 961 of file dense_matrix_impl.h.
|
private |
Computes the eigenvalues of the matrix using the Lapack routine "DGEEV". If VR and/or VL are not nullptr, then the matrix of right and/or left eigenvectors is also computed and returned by this function.
[ Implementation in dense_matrix_blas_lapack.C ]
Definition at line 703 of file dense_matrix_blas_lapack.C.
|
private |
Solves the system Ax=b through back substitution. This function is private since it is only called as part of the implementation of the lu_solve(...) function.
Definition at line 666 of file dense_matrix_impl.h.
|
private |
Companion function to _lu_decompose_lapack(). Do not use directly, called through the public lu_solve() interface. This function is logically const in that it does not modify the matrix, but since we are just calling LAPACK routines, it's less const_cast hassle to just declare the function non-const. [ Implementation in dense_matrix_blas_lapack.C ]
Definition at line 911 of file dense_matrix_blas_lapack.C.
|
private |
Form the LU decomposition of the matrix. This function is private since it is only called as part of the implementation of the lu_solve(...) function.
Definition at line 717 of file dense_matrix_impl.h.
|
private |
Computes an LU factorization of the matrix using the Lapack routine "getrf". This routine should only be used by the "use_blas_lapack" branch of the lu_solve() function. After the call to this function, the matrix is replaced by its factorized version, and the DecompositionType is set to LU_BLAS_LAPACK. [ Implementation in dense_matrix_blas_lapack.C ]
Definition at line 207 of file dense_matrix_blas_lapack.C.
|
private |
Uses the BLAS GEMV function (through PETSc) to compute
dest := alpha*A*arg + beta*dest
where alpha and beta are scalars, A is this matrix, and arg and dest are input vectors of appropriate size. If trans is true, the transpose matvec is computed instead. By default, trans==false.
[ Implementation in dense_matrix_blas_lapack.C ]
Definition at line 1000 of file dense_matrix_blas_lapack.C.
|
private |
The _multiply_blas function computes A <- op(A) * op(B) using BLAS gemm function. Used in the right_multiply(), left_multiply(), right_multiply_transpose(), and left_multiply_transpose() routines. [ Implementation in dense_matrix_blas_lapack.C ]
Definition at line 37 of file dense_matrix_blas_lapack.C.
|
private |
Helper function that actually performs the SVD. [ Implementation in dense_matrix_blas_lapack.C ]
Definition at line 381 of file dense_matrix_blas_lapack.C.
|
private |
Computes an SVD of the matrix using the Lapack routine "getsvd". [ Implementation in dense_matrix_blas_lapack.C ]
Definition at line 274 of file dense_matrix_blas_lapack.C.
|
private |
Computes a "reduced" SVD of the matrix using the Lapack routine "getsvd". [ Implementation in dense_matrix_blas_lapack.C ]
Definition at line 315 of file dense_matrix_blas_lapack.C.
|
private |
Called by svd_solve(rhs).
Definition at line 526 of file dense_matrix_blas_lapack.C.
|
inlineinherited |
Adds factor
to every element in the matrix. This should only work if T += T2 * T3 is valid C++ and if T2 is scalar. Return type is void
Definition at line 188 of file dense_matrix_base.h.
References libMesh::DenseMatrixBase< T >::el(), libMesh::DenseMatrixBase< T >::m(), and libMesh::DenseMatrixBase< T >::n().
|
inline |
Adds factor
times mat
to this matrix.
Definition at line 884 of file dense_matrix.h.
Referenced by libMesh::FEMSystem::assembly().
void libMesh::DenseMatrix< T >::cholesky_solve | ( | const DenseVector< T2 > & | b, |
DenseVector< T2 > & | x | ||
) |
For symmetric positive definite (SPD) matrices. A Cholesky factorization of A such that A = L L^T is about twice as fast as a standard LU factorization. Therefore you can use this method if you know a-priori that the matrix is SPD. If the matrix is not SPD, an error is generated. One nice property of Cholesky decompositions is that they do not require pivoting for stability.
Definition at line 929 of file dense_matrix_impl.h.
Referenced by libMesh::FEGenericBase< FEOutputType< T >::type >::coarsened_dof_values(), libMesh::FEGenericBase< FEOutputType< T >::type >::compute_periodic_constraints(), libMesh::FEGenericBase< FEOutputType< T >::type >::compute_proj_constraints(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::operator()(), libMesh::BoundaryProjectSolution::operator()(), and libMesh::HPCoarsenTest::select_refinement().
|
protectedinherited |
Condense-out the (i,j) entry of the matrix, forcing it to take on the value
val
. This is useful in numerical simulations for applying boundary conditions. Preserves the symmetry of the matrix.
Definition at line 58 of file dense_matrix_base.C.
References libMesh::DenseVectorBase< T >::el(), and libMesh::DenseVectorBase< T >::size().
Referenced by libMesh::DenseMatrix< Number >::condense().
|
inline |
Condense-out the (i,j) entry of the matrix, forcing it to take on the value
val
. This is useful in numerical simulations for applying boundary conditions. Preserves the symmetry of the matrix.
Definition at line 354 of file dense_matrix.h.
T libMesh::DenseMatrix< T >::det | ( | ) |
Definition at line 868 of file dense_matrix_impl.h.
|
inlineoverridevirtual |
(i,j) element of the matrix. Since internal data representations may differ, you must redefine this function. Implements libMesh::DenseMatrixBase< T >.
Definition at line 88 of file dense_matrix.h.
|
inlineoverridevirtual |
(i,j) element of the matrix as a writable reference. Since internal data representations may differ, you must redefine this function. Implements libMesh::DenseMatrixBase< T >.
Definition at line 92 of file dense_matrix.h.
void libMesh::DenseMatrix< T >::evd | ( | DenseVector< T > & | lambda_real, |
DenseVector< T > & | lambda_imag | ||
) |
Compute the eigenvalues (both real and imaginary parts) of a general matrix.
Warning: the contents of *this
are overwritten by this function!
The implementation requires the LAPACKgeev_ function which is wrapped by PETSc.
Definition at line 824 of file dense_matrix_impl.h.
void libMesh::DenseMatrix< T >::evd_left | ( | DenseVector< T > & | lambda_real, |
DenseVector< T > & | lambda_imag, | ||
DenseMatrix< T > & | VL | ||
) |
Compute the eigenvalues (both real and imaginary parts) and left eigenvectors of a general matrix, .
Warning: the contents of *this
are overwritten by this function!
The left eigenvector of satisfies: where denotes the conjugate-transpose of .
If the j-th and (j+1)-st eigenvalues form a complex conjugate pair, then the j-th and (j+1)-st columns of VL "share" their real-valued storage in the following way: u_j = VL(:,j) + i*VL(:,j+1) and u_{j+1} = VL(:,j) - i*VL(:,j+1).
The implementation requires the LAPACKgeev_ routine which is provided by PETSc.
Definition at line 834 of file dense_matrix_impl.h.
void libMesh::DenseMatrix< T >::evd_left_and_right | ( | DenseVector< T > & | lambda_real, |
DenseVector< T > & | lambda_imag, | ||
DenseMatrix< T > & | VL, | ||
DenseMatrix< T > & | VR | ||
) |
Compute the eigenvalues (both real and imaginary parts) as well as the left and right eigenvectors of a general matrix.
Warning: the contents of *this
are overwritten by this function!
See the documentation of the evd_left()
and evd_right()
functions for more information. The implementation requires the LAPACKgeev_ routine which is provided by PETSc.
Definition at line 856 of file dense_matrix_impl.h.
void libMesh::DenseMatrix< T >::evd_right | ( | DenseVector< T > & | lambda_real, |
DenseVector< T > & | lambda_imag, | ||
DenseMatrix< T > & | VR | ||
) |
Compute the eigenvalues (both real and imaginary parts) and right eigenvectors of a general matrix, .
Warning: the contents of *this
are overwritten by this function!
The right eigenvector of satisfies: where is its corresponding eigenvalue.
The implementation requires the LAPACKgeev_ routine which is provided by PETSc.
Definition at line 845 of file dense_matrix_impl.h.
void libMesh::DenseMatrix< T >::get_principal_submatrix | ( | unsigned int | sub_m, |
unsigned int | sub_n, | ||
DenseMatrix< T > & | dest | ||
) | const |
Put the sub_m
x sub_n
principal submatrix into dest
.
Definition at line 556 of file dense_matrix_impl.h.
void libMesh::DenseMatrix< T >::get_principal_submatrix | ( | unsigned int | sub_m, |
DenseMatrix< T > & | dest | ||
) | const |
Put the sub_m
x sub_m
principal submatrix into dest
.
Definition at line 586 of file dense_matrix_impl.h.
void libMesh::DenseMatrix< T >::get_transpose | ( | DenseMatrix< T > & | dest | ) | const |
|
inline |
This should be used with caution (i.e. one should not change the size of the vector, etc.) but is useful for interoperating with low level BLAS routines which expect a simple array.
Definition at line 341 of file dense_matrix.h.
Referenced by libMesh::DenseMatrix< Number >::_evd_lapack(), libMesh::DenseMatrix< Number >::_matvec_blas(), libMesh::DenseMatrix< Number >::_multiply_blas(), libMesh::DenseMatrix< Number >::_svd_lapack(), libMesh::DenseMatrix< Number >::_svd_solve_lapack(), libMesh::PetscMatrix< T >::add_block_matrix(), libMesh::EpetraMatrix< T >::add_matrix(), and libMesh::PetscMatrix< T >::add_matrix().
|
inline |
Definition at line 346 of file dense_matrix.h.
|
inline |
,
This is the natural matrix norm that is compatible to the l1-norm for vectors, i.e. .
Definition at line 991 of file dense_matrix.h.
Referenced by libMesh::FEMSystem::assembly().
|
overridevirtual |
Performs the operation: (*this) <- M2 * (*this)
Implements libMesh::DenseMatrixBase< T >.
Definition at line 40 of file dense_matrix_impl.h.
void libMesh::DenseMatrix< T >::left_multiply | ( | const DenseMatrixBase< T2 > & | M2 | ) |
Left multiplies by the matrix M2
of different type
Definition at line 67 of file dense_matrix_impl.h.
void libMesh::DenseMatrix< T >::left_multiply_transpose | ( | const DenseMatrix< T > & | A | ) |
Left multiplies by the transpose of the matrix A
.
Definition at line 88 of file dense_matrix_impl.h.
Referenced by libMesh::DofMap::constrain_element_matrix(), libMesh::DofMap::constrain_element_matrix_and_vector(), and libMesh::DofMap::heterogenously_constrain_element_matrix_and_vector().
void libMesh::DenseMatrix< T >::left_multiply_transpose | ( | const DenseMatrix< T2 > & | A | ) |
Left multiplies by the transpose of the matrix A
which contains a different numerical type.
Definition at line 154 of file dense_matrix_impl.h.
|
inline |
,
This is the natural matrix norm that is compatible to the linfty-norm of vectors, i.e. .
Definition at line 1018 of file dense_matrix.h.
void libMesh::DenseMatrix< T >::lu_solve | ( | const DenseVector< T > & | b, |
DenseVector< T > & | x | ||
) |
Solve the system Ax=b given the input vector b. Partial pivoting is performed by default in order to keep the algorithm stable to the effects of round-off error.
Definition at line 607 of file dense_matrix_impl.h.
Referenced by libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), and libMesh::PatchRecoveryErrorEstimator::EstimateError::operator()().
|
inlineinherited |
Definition at line 102 of file dense_matrix_base.h.
References libMesh::DenseMatrixBase< T >::_m.
Referenced by libMesh::DenseMatrix< Number >::_multiply_blas(), libMesh::DenseMatrix< Number >::_svd_solve_lapack(), libMesh::DenseMatrixBase< T >::add(), libMesh::DenseMatrix< Number >::add(), libMesh::PetscMatrix< T >::add_block_matrix(), libMesh::SparseMatrix< ValOut >::add_block_matrix(), libMesh::EigenSparseMatrix< T >::add_matrix(), libMesh::LaspackMatrix< T >::add_matrix(), libMesh::EpetraMatrix< T >::add_matrix(), libMesh::PetscMatrix< T >::add_matrix(), libMesh::DofMap::build_constraint_matrix(), libMesh::DofMap::build_constraint_matrix_and_vector(), libMesh::DofMap::constrain_element_dyad_matrix(), libMesh::DofMap::constrain_element_matrix(), libMesh::DofMap::constrain_element_matrix_and_vector(), libMesh::DofMap::constrain_element_vector(), libMesh::DofMap::extract_local_vector(), libMesh::DenseMatrix< Number >::get_transpose(), libMesh::DofMap::heterogenously_constrain_element_matrix_and_vector(), libMesh::DofMap::heterogenously_constrain_element_vector(), libMesh::DenseMatrix< Number >::left_multiply(), libMesh::DenseMatrix< Number >::left_multiply_transpose(), libMesh::DofMap::max_constraint_error(), libMesh::DenseMatrixBase< T >::multiply(), libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::PatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::DenseMatrix< Number >::operator=(), libMesh::DenseMatrix< Number >::right_multiply(), and libMesh::DenseMatrix< Number >::right_multiply_transpose().
|
inline |
Definition at line 970 of file dense_matrix.h.
|
inline |
Definition at line 949 of file dense_matrix.h.
|
staticprotectedinherited |
Helper function - Performs the computation M1 = M2 * M3 where: M1 = (m x n) M2 = (m x p) M3 = (p x n)
Definition at line 31 of file dense_matrix_base.C.
References libMesh::DenseMatrixBase< T >::el(), libMesh::DenseMatrixBase< T >::m(), and libMesh::DenseMatrixBase< T >::n().
|
inlineinherited |
Definition at line 107 of file dense_matrix_base.h.
References libMesh::DenseMatrixBase< T >::_n.
Referenced by libMesh::DenseMatrix< Number >::_multiply_blas(), libMesh::DenseMatrix< Number >::_svd_solve_lapack(), libMesh::DenseMatrixBase< T >::add(), libMesh::DenseMatrix< Number >::add(), libMesh::PetscMatrix< T >::add_block_matrix(), libMesh::SparseMatrix< ValOut >::add_block_matrix(), libMesh::EigenSparseMatrix< T >::add_matrix(), libMesh::LaspackMatrix< T >::add_matrix(), libMesh::EpetraMatrix< T >::add_matrix(), libMesh::PetscMatrix< T >::add_matrix(), libMesh::DofMap::build_constraint_matrix(), libMesh::DofMap::build_constraint_matrix_and_vector(), libMesh::DofMap::constrain_element_dyad_matrix(), libMesh::DofMap::constrain_element_matrix(), libMesh::DofMap::constrain_element_matrix_and_vector(), libMesh::DofMap::constrain_element_vector(), libMesh::DofMap::extract_local_vector(), libMesh::DenseMatrix< Number >::get_transpose(), libMesh::DofMap::heterogenously_constrain_element_matrix_and_vector(), libMesh::DofMap::heterogenously_constrain_element_vector(), libMesh::DenseMatrix< Number >::left_multiply(), libMesh::DenseMatrix< Number >::left_multiply_transpose(), libMesh::DofMap::max_constraint_error(), libMesh::DenseMatrixBase< T >::multiply(), libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::PatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::DenseMatrix< Number >::operator=(), libMesh::DenseMatrix< Number >::right_multiply(), and libMesh::DenseMatrix< Number >::right_multiply_transpose().
|
inline |
true
if mat
is not exactly equal to this matrix, false otherwise. Definition at line 912 of file dense_matrix.h.
|
inline |
|
inline |
(i,j) element of the matrix as a writable reference. Definition at line 835 of file dense_matrix.h.
|
inline |
Multiplies every element in the matrix by factor
.
Definition at line 871 of file dense_matrix.h.
|
inline |
Adds mat
to this matrix.
Definition at line 925 of file dense_matrix.h.
|
inline |
Subtracts mat
from this matrix.
Definition at line 937 of file dense_matrix.h.
|
default |
|
default |
|
inline |
Assignment-from-other-matrix-type operator.
Copies the dense matrix of type T2 into the present matrix. This is useful for copying real matrices into complex ones for further operations.
Definition at line 777 of file dense_matrix.h.
|
inline |
true
if mat
is exactly equal to this matrix, false
otherwise. Definition at line 899 of file dense_matrix.h.
void libMesh::DenseMatrix< T >::outer_product | ( | const DenseVector< T > & | a, |
const DenseVector< T > & | b | ||
) |
Computes the outer (dyadic) product of two vectors and stores in (*this).
The outer product of two real-valued vectors and is
The outer product of two complex-valued vectors and is
where denotes the conjugate transpose of the vector and denotes the complex conjugate.
[in] | a | Vector whose entries correspond to rows in the product matrix. |
[in] | b | Vector whose entries correspond to columns in the product matrix. |
Definition at line 571 of file dense_matrix_impl.h.
|
inherited |
Pretty-print the matrix, by default to libMesh::out
.
Definition at line 110 of file dense_matrix_base.C.
|
inherited |
Prints the matrix entries with more decimal places in scientific notation.
Definition at line 86 of file dense_matrix_base.C.
|
inline |
Resize the matrix. Will never free memory, but may allocate more. Sets all elements to 0.
Definition at line 792 of file dense_matrix.h.
Referenced by libMesh::DenseMatrix< Number >::_evd_lapack(), libMesh::DenseMatrix< Number >::_svd_lapack(), libMesh::HPCoarsenTest::add_projection(), libMesh::DofMap::build_constraint_matrix(), libMesh::DofMap::build_constraint_matrix_and_vector(), libMesh::FEGenericBase< FEOutputType< T >::type >::coarsened_dof_values(), libMesh::FEGenericBase< FEOutputType< T >::type >::compute_periodic_constraints(), libMesh::FEGenericBase< FEOutputType< T >::type >::compute_proj_constraints(), libMesh::DenseMatrix< Number >::get_principal_submatrix(), libMesh::DenseMatrix< Number >::get_transpose(), libMesh::DGFEMContext::neighbor_side_fe_reinit(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::operator()(), libMesh::BoundaryProjectSolution::operator()(), libMesh::FEMContext::pre_fe_reinit(), libMesh::DenseMatrix< Number >::resize(), and libMesh::HPCoarsenTest::select_refinement().
|
overridevirtual |
Performs the operation: (*this) <- (*this) * M3
Implements libMesh::DenseMatrixBase< T >.
Definition at line 213 of file dense_matrix_impl.h.
Referenced by libMesh::DofMap::build_constraint_matrix(), libMesh::DofMap::build_constraint_matrix_and_vector(), libMesh::DofMap::constrain_element_matrix(), libMesh::DofMap::constrain_element_matrix_and_vector(), libMesh::DofMap::heterogenously_constrain_element_matrix_and_vector(), and libMesh::FESubdivision::init_shape_functions().
void libMesh::DenseMatrix< T >::right_multiply | ( | const DenseMatrixBase< T2 > & | M2 | ) |
Right multiplies by the matrix M2
of different type
Definition at line 239 of file dense_matrix_impl.h.
void libMesh::DenseMatrix< T >::right_multiply_transpose | ( | const DenseMatrix< T > & | A | ) |
Right multiplies by the transpose of the matrix A
Definition at line 260 of file dense_matrix_impl.h.
void libMesh::DenseMatrix< T >::right_multiply_transpose | ( | const DenseMatrix< T2 > & | A | ) |
Right multiplies by the transpose of the matrix A
which contains a different numerical type.
Definition at line 325 of file dense_matrix_impl.h.
|
inline |
|
inline |
Multiplies every element in the column col
matrix by factor
.
Definition at line 861 of file dense_matrix.h.
void libMesh::DenseMatrix< T >::svd | ( | DenseVector< Real > & | sigma | ) |
Compute the singular value decomposition of the matrix. On exit, sigma holds all of the singular values (in descending order).
The implementation uses PETSc's interface to BLAS/LAPACK. If this is not available, this function throws an error.
Definition at line 795 of file dense_matrix_impl.h.
void libMesh::DenseMatrix< T >::svd | ( | DenseVector< Real > & | sigma, |
DenseMatrix< Number > & | U, | ||
DenseMatrix< Number > & | VT | ||
) |
Compute the "reduced" singular value decomposition of the matrix. On exit, sigma holds all of the singular values (in descending order), U holds the left singular vectors, and VT holds the transpose of the right singular vectors. In the reduced SVD, U has min(m,n) columns and VT has min(m,n) rows. (In the "full" SVD, U and VT would be square.)
The implementation uses PETSc's interface to BLAS/LAPACK. If this is not available, this function throws an error.
Definition at line 803 of file dense_matrix_impl.h.
void libMesh::DenseMatrix< T >::svd_solve | ( | const DenseVector< T > & | rhs, |
DenseVector< T > & | x, | ||
Real | rcond = std::numeric_limits<Real>::epsilon() |
||
) | const |
Solve the system of equations for in the least-squares sense. may be non-square and/or rank-deficient. You can control which singular values are treated as zero by changing the "rcond" parameter. Singular values S(i) for which S(i) <= rcond*S(1) are treated as zero for purposes of the solve. Passing a negative number for rcond forces a "machine precision" value to be used instead.
This function is marked const, since due to various implementation details, we do not need to modify the contents of A in order to compute the SVD (a copy is made internally instead).
Requires PETSc >= 3.1 since this was the first version to provide the LAPACKgelss_ wrapper.
Definition at line 814 of file dense_matrix_impl.h.
|
inline |
STL-like swap method
Definition at line 762 of file dense_matrix.h.
Referenced by libMesh::EulerSolver::_general_residual(), libMesh::Euler2Solver::_general_residual(), and libMesh::NewmarkSolver::_general_residual().
|
inline |
(i,j) element of the transposed matrix. Definition at line 1045 of file dense_matrix.h.
Referenced by libMesh::DenseMatrix< Number >::right_multiply_transpose().
void libMesh::DenseMatrix< T >::vector_mult | ( | DenseVector< T > & | dest, |
const DenseVector< T > & | arg | ||
) | const |
Performs the matrix-vector multiplication, dest
:= (*this) * arg
.
Definition at line 385 of file dense_matrix_impl.h.
Referenced by libMesh::FEMap::compute_single_point_map(), libMesh::DofMap::heterogenously_constrain_element_matrix_and_vector(), and libMesh::DofMap::heterogenously_constrain_element_vector().
void libMesh::DenseMatrix< T >::vector_mult | ( | DenseVector< typename CompareTypes< T, T2 >::supertype > & | dest, |
const DenseVector< T2 > & | arg | ||
) | const |
Performs the matrix-vector multiplication, dest
:= (*this) * arg
on mixed types
Definition at line 416 of file dense_matrix_impl.h.
void libMesh::DenseMatrix< T >::vector_mult_add | ( | DenseVector< T > & | dest, |
const T | factor, | ||
const DenseVector< T > & | arg | ||
) | const |
Performs the scaled matrix-vector multiplication, dest
+= factor
* (*this) * arg
.
Definition at line 511 of file dense_matrix_impl.h.
Referenced by libMesh::DofMap::build_constraint_matrix_and_vector().
void libMesh::DenseMatrix< T >::vector_mult_add | ( | DenseVector< typename CompareTypes< T, typename CompareTypes< T2, T3 >::supertype >::supertype > & | dest, |
const T2 | factor, | ||
const DenseVector< T3 > & | arg | ||
) | const |
Performs the scaled matrix-vector multiplication, dest
+= factor
* (*this) * arg
. on mixed types
Definition at line 536 of file dense_matrix_impl.h.
void libMesh::DenseMatrix< T >::vector_mult_transpose | ( | DenseVector< T > & | dest, |
const DenseVector< T > & | arg | ||
) | const |
Performs the matrix-vector multiplication, dest
:= (*this)^T * arg
.
Definition at line 441 of file dense_matrix_impl.h.
Referenced by libMesh::DofMap::constrain_element_dyad_matrix(), libMesh::DofMap::constrain_element_matrix_and_vector(), libMesh::DofMap::constrain_element_vector(), libMesh::DofMap::heterogenously_constrain_element_matrix_and_vector(), and libMesh::DofMap::heterogenously_constrain_element_vector().
void libMesh::DenseMatrix< T >::vector_mult_transpose | ( | DenseVector< typename CompareTypes< T, T2 >::supertype > & | dest, |
const DenseVector< T2 > & | arg | ||
) | const |
Performs the matrix-vector multiplication, dest
:= (*this)^T * arg
. on mixed types
Definition at line 480 of file dense_matrix_impl.h.
|
inlineoverridevirtual |
Set every element in the matrix to 0. You must redefine what you mean by zeroing the matrix since it depends on how your values are stored.
Implements libMesh::DenseMatrixBase< T >.
Definition at line 808 of file dense_matrix.h.
Referenced by libMesh::HPCoarsenTest::add_projection(), libMesh::FEMSystem::assembly(), libMesh::FEGenericBase< FEOutputType< T >::type >::coarsened_dof_values(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::operator()(), libMesh::BoundaryProjectSolution::operator()(), and libMesh::HPCoarsenTest::select_refinement().
|
private |
This flag keeps track of which type of decomposition has been performed on the matrix.
Definition at line 582 of file dense_matrix.h.
Referenced by libMesh::DenseMatrix< Number >::swap().
|
protectedinherited |
The row dimension.
Definition at line 169 of file dense_matrix_base.h.
Referenced by libMesh::DenseMatrixBase< T >::m(), and libMesh::DenseMatrix< Number >::swap().
|
protectedinherited |
The column dimension.
Definition at line 174 of file dense_matrix_base.h.
Referenced by libMesh::DenseMatrixBase< T >::n(), and libMesh::DenseMatrix< Number >::swap().
|
private |
Definition at line 672 of file dense_matrix.h.
|
private |
The actual data values, stored as a 1D array.
Definition at line 532 of file dense_matrix.h.
Referenced by libMesh::DenseMatrix< Number >::get_values(), libMesh::DenseMatrix< Number >::operator!=(), libMesh::DenseMatrix< Number >::operator+=(), libMesh::DenseMatrix< Number >::operator-=(), libMesh::DenseMatrix< Number >::operator==(), and libMesh::DenseMatrix< Number >::swap().
bool libMesh::DenseMatrix< T >::use_blas_lapack |
Computes the inverse of the dense matrix (assuming it is invertible) by first computing the LU decomposition and then performing multiple back substitution steps. Follows the algorithm from Numerical Recipes in C that is available on the web.
This routine is commented out since it is not really a memory- or computationally- efficient implementation. Also, you typically don't need the actual inverse for anything, and can use something like lu_solve() instead. Run-time selectable option to turn on/off BLAS support. This was primarily used for testing purposes, and could be removed...
Definition at line 525 of file dense_matrix.h.