libMesh::DenseSubMatrix< T > Class Template Reference
#include <dense_submatrix.h>

Public Member Functions | |
| virtual void | zero ()=0 |
| virtual T | el (const unsigned int i, const unsigned int j) const =0 |
| virtual T & | el (const unsigned int i, const unsigned int j)=0 |
| virtual void | left_multiply (const DenseMatrixBase< T > &M2)=0 |
| virtual void | right_multiply (const DenseMatrixBase< T > &M3)=0 |
| unsigned int | m () const |
| unsigned int | n () const |
| void | print (std::ostream &os=libMesh::out) const |
| void | print_scientific (std::ostream &os) const |
| template<typename T2 , typename T3 > | |
| boostcopy::enable_if_c < ScalarTraits< T2 >::value, void >::type | add (const T2 factor, const DenseMatrixBase< T3 > &mat) |
Protected Member Functions | |
| void | multiply (DenseMatrixBase< T > &M1, const DenseMatrixBase< T > &M2, const DenseMatrixBase< T > &M3) |
| void | condense (const unsigned int i, const unsigned int j, const T val, DenseVectorBase< T > &rhs) |
Protected Attributes | |
| unsigned int | _m |
| unsigned int | _n |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const DenseMatrixBase< T > &m) |
Detailed Description
template<typename T>
class libMesh::DenseSubMatrix< T >
Defines a dense submatrix for use in Finite Element-type computations. Useful for storing element stiffness matrices before summation into a global matrix, particularly when you have systems of equations.
Definition at line 46 of file dense_submatrix.h.
Member Function Documentation
| boostcopy::enable_if_c< ScalarTraits< T2 >::value, void >::type libMesh::DenseMatrixBase< T >::add | ( | const T2 | factor, | |
| const DenseMatrixBase< T3 > & | mat | |||
| ) | [inline, inherited] |
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 184 of file dense_matrix_base.h.
References libMesh::DenseMatrixBase< T >::el(), libMesh::DenseMatrixBase< T >::m(), and libMesh::DenseMatrixBase< T >::n().
| void libMesh::DenseMatrixBase< T >::condense | ( | const unsigned int | i, | |
| const unsigned int | j, | |||
| const T | val, | |||
| DenseVectorBase< T > & | rhs | |||
| ) | [inline, protected, inherited] |
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::DenseMatrixBase< T >::_m, libMesh::DenseMatrixBase< T >::el(), libMesh::DenseVectorBase< T >::el(), libMesh::DenseMatrixBase< T >::m(), libMesh::DenseMatrixBase< T >::n(), and libMesh::DenseVectorBase< T >::size().
00062 { 00063 libmesh_assert_equal_to (this->_m, rhs.size()); 00064 libmesh_assert_equal_to (iv, jv); 00065 00066 00067 // move the known value into the RHS 00068 // and zero the column 00069 for (unsigned int i=0; i<this->m(); i++) 00070 { 00071 rhs.el(i) -= this->el(i,jv)*val; 00072 this->el(i,jv) = 0.; 00073 } 00074 00075 // zero the row 00076 for (unsigned int j=0; j<this->n(); j++) 00077 this->el(iv,j) = 0.; 00078 00079 this->el(iv,jv) = 1.; 00080 rhs.el(iv) = val; 00081 00082 }
| virtual T& libMesh::DenseMatrixBase< T >::el | ( | const unsigned int | i, | |
| const unsigned int | j | |||
| ) | [pure virtual, inherited] |
- Returns:
- the
(i,j) element of the matrix as a writeable reference. Since internal data representations may differ, you must redefine this function.
Implemented in libMesh::DenseMatrix< T >, and libMesh::DenseMatrix< Number >.
| virtual T libMesh::DenseMatrixBase< T >::el | ( | const unsigned int | i, | |
| const unsigned int | j | |||
| ) | const [pure virtual, inherited] |
- Returns:
- the
(i,j) element of the matrix. Since internal data representations may differ, you must redefine this function.
Implemented in libMesh::DenseMatrix< T >, and libMesh::DenseMatrix< Number >.
Referenced by libMesh::DenseMatrixBase< T >::add(), libMesh::DenseMatrixBase< T >::condense(), libMesh::DenseMatrixBase< T >::multiply(), libMesh::DenseMatrixBase< T >::print(), and libMesh::DenseMatrixBase< T >::print_scientific().
| virtual void libMesh::DenseMatrixBase< T >::left_multiply | ( | const DenseMatrixBase< T > & | M2 | ) | [pure virtual, inherited] |
Performs the operation: (*this) <- M2 * (*this)
Implemented in libMesh::DenseMatrix< Number >.
| unsigned int libMesh::DenseMatrixBase< T >::m | ( | ) | const [inline, inherited] |
- Returns:
- the row-dimension of the matrix.
Definition at line 99 of file dense_matrix_base.h.
Referenced by libMesh::DenseMatrix< T >::_cholesky_back_substitute(), libMesh::DenseMatrix< T >::_cholesky_decompose(), libMesh::DenseMatrix< T >::_lu_back_substitute(), libMesh::DenseMatrix< T >::_lu_back_substitute_lapack(), libMesh::DenseMatrix< T >::_lu_decompose(), libMesh::DenseMatrix< T >::_lu_decompose_lapack(), libMesh::DenseMatrix< T >::_matvec_blas(), libMesh::DenseMatrix< T >::_multiply_blas(), libMesh::DenseMatrix< T >::_svd_helper(), libMesh::DenseMatrix< T >::_svd_lapack(), libMesh::DenseMatrixBase< T >::add(), libMesh::EpetraMatrix< T >::add_matrix(), libMesh::PetscMatrix< T >::add_matrix(), libMesh::LaspackMatrix< T >::add_matrix(), libMesh::DofMap::build_constraint_matrix(), libMesh::DofMap::build_constraint_matrix_and_vector(), libMesh::DenseMatrixBase< T >::condense(), libMesh::DofMap::constrain_element_dyad_matrix(), libMesh::DofMap::constrain_element_matrix(), libMesh::DofMap::constrain_element_matrix_and_vector(), libMesh::DofMap::constrain_element_vector(), libMesh::DenseMatrix< T >::det(), libMesh::DofMap::extract_local_vector(), libMesh::DenseMatrix< T >::get_principal_submatrix(), libMesh::DenseMatrix< T >::get_transpose(), libMesh::DofMap::heterogenously_constrain_element_matrix_and_vector(), libMesh::DenseMatrix< T >::left_multiply(), libMesh::DenseMatrix< T >::left_multiply_transpose(), libMesh::DenseMatrix< T >::lu_solve(), libMesh::DofMap::max_constraint_error(), libMesh::DenseMatrixBase< T >::multiply(), libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::PatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::DenseMatrixBase< T >::print(), libMesh::DenseMatrixBase< T >::print_scientific(), libMesh::DenseMatrix< T >::right_multiply(), libMesh::DenseMatrix< T >::right_multiply_transpose(), libMesh::DenseMatrix< T >::vector_mult(), libMesh::DenseMatrix< T >::vector_mult_add(), and libMesh::DenseMatrix< T >::vector_mult_transpose().
00099 { return _m; }
| void libMesh::DenseMatrixBase< T >::multiply | ( | DenseMatrixBase< T > & | M1, | |
| const DenseMatrixBase< T > & | M2, | |||
| const DenseMatrixBase< T > & | M3 | |||
| ) | [inline, protected, inherited] |
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().
Referenced by libMesh::DenseMatrix< T >::left_multiply(), and libMesh::DenseMatrix< T >::right_multiply().
00034 { 00035 // Assertions to make sure we have been 00036 // passed matrices of the correct dimension. 00037 libmesh_assert_equal_to (M1.m(), M2.m()); 00038 libmesh_assert_equal_to (M1.n(), M3.n()); 00039 libmesh_assert_equal_to (M2.n(), M3.m()); 00040 00041 const unsigned int m_s = M2.m(); 00042 const unsigned int p_s = M2.n(); 00043 const unsigned int n_s = M1.n(); 00044 00045 // Do it this way because there is a 00046 // decent chance (at least for constraint matrices) 00047 // that M3(k,j) = 0. when right-multiplying. 00048 for (unsigned int k=0; k<p_s; k++) 00049 for (unsigned int j=0; j<n_s; j++) 00050 if (M3.el(k,j) != 0.) 00051 for (unsigned int i=0; i<m_s; i++) 00052 M1.el(i,j) += M2.el(i,k) * M3.el(k,j); 00053 }
| unsigned int libMesh::DenseMatrixBase< T >::n | ( | ) | const [inline, inherited] |
- Returns:
- the column-dimension of the matrix.
Definition at line 104 of file dense_matrix_base.h.
Referenced by libMesh::DenseMatrix< T >::_cholesky_back_substitute(), libMesh::DenseMatrix< T >::_cholesky_decompose(), libMesh::DenseMatrix< T >::_lu_back_substitute(), libMesh::DenseMatrix< T >::_lu_decompose_lapack(), libMesh::DenseMatrix< T >::_matvec_blas(), libMesh::DenseMatrix< T >::_multiply_blas(), libMesh::DenseMatrix< T >::_svd_helper(), libMesh::DenseMatrix< T >::_svd_lapack(), libMesh::DenseMatrixBase< T >::add(), libMesh::EpetraMatrix< T >::add_matrix(), libMesh::PetscMatrix< T >::add_matrix(), libMesh::LaspackMatrix< T >::add_matrix(), libMesh::DofMap::build_constraint_matrix(), libMesh::DofMap::build_constraint_matrix_and_vector(), libMesh::DenseMatrixBase< T >::condense(), 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< T >::get_principal_submatrix(), libMesh::DenseMatrix< T >::get_transpose(), libMesh::DofMap::heterogenously_constrain_element_matrix_and_vector(), libMesh::DenseMatrix< T >::left_multiply(), libMesh::DenseMatrix< T >::left_multiply_transpose(), libMesh::DenseMatrix< T >::lu_solve(), libMesh::DofMap::max_constraint_error(), libMesh::DenseMatrixBase< T >::multiply(), libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::PatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::DenseMatrixBase< T >::print(), libMesh::DenseMatrixBase< T >::print_scientific(), libMesh::DenseMatrix< T >::right_multiply(), libMesh::DenseMatrix< T >::right_multiply_transpose(), libMesh::DenseMatrix< T >::vector_mult(), and libMesh::DenseMatrix< T >::vector_mult_transpose().
00104 { return _n; }
| void libMesh::DenseMatrixBase< T >::print | ( | std::ostream & | os = libMesh::out |
) | const [inline, inherited] |
Pretty-print the matrix, by default to libMesh::out.
Definition at line 128 of file dense_matrix_base.C.
References libMesh::DenseMatrixBase< T >::el(), libMesh::DenseMatrixBase< T >::m(), and libMesh::DenseMatrixBase< T >::n().
| void libMesh::DenseMatrixBase< T >::print_scientific | ( | std::ostream & | os | ) | const [inline, inherited] |
Prints the matrix entries with more decimal places in scientific notation.
Definition at line 86 of file dense_matrix_base.C.
References libMesh::DenseMatrixBase< T >::el(), libMesh::DenseMatrixBase< T >::m(), and libMesh::DenseMatrixBase< T >::n().
00087 { 00088 #ifndef LIBMESH_BROKEN_IOSTREAM 00089 00090 // save the initial format flags 00091 std::ios_base::fmtflags os_flags = os.flags(); 00092 00093 // Print the matrix entries. 00094 for (unsigned int i=0; i<this->m(); i++) 00095 { 00096 for (unsigned int j=0; j<this->n(); j++) 00097 os << std::setw(15) 00098 << std::scientific 00099 << std::setprecision(8) 00100 << this->el(i,j) << " "; 00101 00102 os << std::endl; 00103 } 00104 00105 // reset the original format flags 00106 os.flags(os_flags); 00107 00108 #else 00109 00110 // Print the matrix entries. 00111 for (unsigned int i=0; i<this->m(); i++) 00112 { 00113 for (unsigned int j=0; j<this->n(); j++) 00114 os << std::setprecision(8) 00115 << this->el(i,j) 00116 << " "; 00117 00118 os << std::endl; 00119 } 00120 00121 00122 #endif 00123 }
| virtual void libMesh::DenseMatrixBase< T >::right_multiply | ( | const DenseMatrixBase< T > & | M3 | ) | [pure virtual, inherited] |
Performs the operation: (*this) <- (*this) * M3
Implemented in libMesh::DenseMatrix< Number >.
| virtual void libMesh::DenseMatrixBase< T >::zero | ( | ) | [pure virtual, inherited] |
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.
Implemented in libMesh::DenseMatrix< T >, and libMesh::DenseMatrix< Number >.
Friends And Related Function Documentation
| std::ostream& operator<< | ( | std::ostream & | os, | |
| const DenseMatrixBase< T > & | m | |||
| ) | [friend, inherited] |
Formatted print as above but allows you to do DenseMatrix K; libMesh::out << K << std::endl;
Definition at line 116 of file dense_matrix_base.h.
00117 { 00118 m.print(os); 00119 return os; 00120 }
Member Data Documentation
unsigned int libMesh::DenseMatrixBase< T >::_m [protected, inherited] |
The row dimension.
Definition at line 165 of file dense_matrix_base.h.
Referenced by libMesh::DenseMatrix< T >::_multiply_blas(), libMesh::DenseMatrixBase< T >::condense(), libMesh::DenseMatrix< T >::l1_norm(), libMesh::DenseMatrix< T >::linfty_norm(), libMesh::DenseMatrixBase< Number >::m(), libMesh::DenseMatrix< T >::max(), libMesh::DenseMatrix< T >::min(), libMesh::DenseMatrix< T >::operator()(), libMesh::DenseMatrix< T >::operator=(), libMesh::DenseMatrix< T >::resize(), and libMesh::DenseMatrix< T >::swap().
unsigned int libMesh::DenseMatrixBase< T >::_n [protected, inherited] |
The column dimension.
Definition at line 170 of file dense_matrix_base.h.
Referenced by libMesh::DenseMatrix< T >::_multiply_blas(), libMesh::DenseMatrix< T >::l1_norm(), libMesh::DenseMatrix< T >::linfty_norm(), libMesh::DenseMatrix< T >::max(), libMesh::DenseMatrix< T >::min(), libMesh::DenseMatrixBase< Number >::n(), libMesh::DenseMatrix< T >::operator()(), libMesh::DenseMatrix< T >::operator=(), libMesh::DenseMatrix< T >::resize(), and libMesh::DenseMatrix< T >::swap().
The documentation for this class was generated from the following file:
Site Created By: libMesh Developers
Last modified: February 05 2013 19:55:13 UTC
Hosted By: