Chaste Release::3.1
|
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/matrix_proxy.hpp>
#include <boost/numeric/ublas/io.hpp>
#include <boost/numeric/ublas/matrix_expression.hpp>
#include "petsc.h"
#include "petscblaslapack.h"
#include "Exception.hpp"
#include "MathsCustomFunctions.hpp"
Go to the source code of this file.
Functions | |
template<class T > | |
T | Determinant (const boost::numeric::ublas::c_matrix< T, 1, 1 > &rM) |
template<class T > | |
T | Determinant (const boost::numeric::ublas::c_matrix< T, 2, 2 > &rM) |
template<class T > | |
T | Determinant (const boost::numeric::ublas::c_matrix< T, 3, 3 > &rM) |
template<class T > | |
T | Determinant (const boost::numeric::ublas::c_matrix< T, 3, 2 > &rM) |
template<class T > | |
T | Determinant (const boost::numeric::ublas::c_matrix< T, 3, 1 > &rM) |
template<class T > | |
T | Determinant (const boost::numeric::ublas::c_matrix< T, 2, 1 > &rM) |
template<class T > | |
T | Determinant (const boost::numeric::ublas::c_matrix< T, 3, 0 > &rM) |
template<class T > | |
T | Determinant (const boost::numeric::ublas::c_matrix< T, 2, 0 > &rM) |
template<class T > | |
T | Determinant (const boost::numeric::ublas::c_matrix< T, 1, 0 > &rM) |
template<class T > | |
T | SubDeterminant (const boost::numeric::ublas::c_matrix< T, 1, 1 > &rM, const unsigned missrow, const unsigned misscol) |
template<class T > | |
T | SubDeterminant (const boost::numeric::ublas::c_matrix< T, 2, 2 > &rM, const unsigned missrow, const unsigned misscol) |
template<class T > | |
T | SubDeterminant (const boost::numeric::ublas::c_matrix< T, 3, 3 > &rM, const unsigned missrow, const unsigned misscol) |
template<class T > | |
T | SubDeterminant (const boost::numeric::ublas::c_matrix< T, 3, 2 > &rM, const unsigned missrow, const unsigned misscol) |
template<class T > | |
T | SubDeterminant (const boost::numeric::ublas::c_matrix< T, 3, 1 > &rM, const unsigned missrow, const unsigned misscol) |
template<class T > | |
T | SubDeterminant (const boost::numeric::ublas::c_matrix< T, 2, 1 > &rM, const unsigned missrow, const unsigned misscol) |
template<class T > | |
T | SubDeterminant (const boost::numeric::ublas::c_matrix< T, 3, 0 > &rM, const unsigned missrow, const unsigned misscol) |
template<class T > | |
T | SubDeterminant (const boost::numeric::ublas::c_matrix< T, 2, 0 > &rM, const unsigned missrow, const unsigned misscol) |
template<class T > | |
T | SubDeterminant (const boost::numeric::ublas::c_matrix< T, 1, 0 > &rM, const unsigned missrow, const unsigned misscol) |
template<class T > | |
boost::numeric::ublas::c_matrix < T, 1, 1 > | Inverse (const boost::numeric::ublas::c_matrix< T, 1, 1 > &rM) |
template<class T > | |
boost::numeric::ublas::c_matrix < T, 2, 2 > | Inverse (const boost::numeric::ublas::c_matrix< T, 2, 2 > &rM) |
template<class T > | |
boost::numeric::ublas::c_matrix < T, 3, 3 > | Inverse (const boost::numeric::ublas::c_matrix< T, 3, 3 > &rM) |
template<class T > | |
boost::numeric::ublas::c_matrix < T, 2, 3 > | Inverse (const boost::numeric::ublas::c_matrix< T, 3, 2 > &rM) |
template<class T > | |
boost::numeric::ublas::c_matrix < T, 1, 2 > | Inverse (const boost::numeric::ublas::c_matrix< T, 2, 1 > &rM) |
template<class T > | |
boost::numeric::ublas::c_matrix < T, 1, 3 > | Inverse (const boost::numeric::ublas::c_matrix< T, 3, 1 > &rM) |
template<class T > | |
T | Trace (const c_matrix< T, 1, 1 > &rM) |
template<class T > | |
T | Trace (const c_matrix< T, 2, 2 > &rM) |
template<class T > | |
T | Trace (const c_matrix< T, 3, 3 > &rM) |
template<class T > | |
T | Trace (const c_matrix< T, 4, 4 > &rM) |
template<class T > | |
T | SecondInvariant (const c_matrix< T, 3, 3 > &rM) |
template<class T > | |
T | SecondInvariant (const c_matrix< T, 2, 2 > &rM) |
c_vector< double, 3 > | CalculateEigenvectorForSmallestNonzeroEigenvalue (c_matrix< double, 3, 3 > &rA) |
template<class T > | |
c_vector< T, 3 > | VectorProduct (const c_vector< T, 3 > &rA, const c_vector< T, 3 > &rB) |
c_vector< double, 1 > | Create_c_vector (double x) |
c_vector< double, 2 > | Create_c_vector (double x, double y) |
c_vector< double, 3 > | Create_c_vector (double x, double y, double z) |
A collection of useful functions extending the functionality of the Boost Ublas library.
Definition in file UblasCustomFunctions.hpp.
c_vector<double,3> CalculateEigenvectorForSmallestNonzeroEigenvalue | ( | c_matrix< double, 3, 3 > & | rA | ) |
Use LAPACK functionality to find the eigenvector corresponding real eigenvalue which is smallest in magnitude. Caveat: if there are zero eigenvalues they are ignored. It's the smallest magnitude non-zero real eigenvalue which is used.
rA | 3x3 matrix is question |
Definition at line 62 of file UblasCustomFunctions.cpp.
Convenience function for quickly creating test vectors (1D).
x | entry in vector |
Definition at line 38 of file UblasCustomFunctions.cpp.
Convenience function for quickly creating test vectors (2D).
x | entry in vector |
y | entry in vector |
Definition at line 45 of file UblasCustomFunctions.cpp.
Convenience function for quickly creating test vectors (3D).
x | entry in vector |
y | entry in vector |
z | entry in vector |
Definition at line 53 of file UblasCustomFunctions.cpp.
T Determinant | ( | const boost::numeric::ublas::c_matrix< T, 3, 2 > & | rM | ) |
3x2 (Generalized determinant). Calculate the generalized determinant of a 3x2 matrix. The generalized determinant is given by det(T) = sqrt(det(T'T));
rM | The matrix of which to find the generalized determinant. |
Definition at line 120 of file UblasCustomFunctions.hpp.
References Determinant().
T Determinant | ( | const boost::numeric::ublas::c_matrix< T, 2, 0 > & | rM | ) |
2x0 (Generalized determinant) - not implement, but needed by some compilers.
rM | The matrix of which to find the generalized determinant. |
Definition at line 172 of file UblasCustomFunctions.hpp.
References NEVER_REACHED.
T Determinant | ( | const boost::numeric::ublas::c_matrix< T, 2, 2 > & | rM | ) |
2x2 Determinant. Get the determinant of a ublas matrix.
rM | The matrix of which to find the determinant. |
Definition at line 87 of file UblasCustomFunctions.hpp.
T Determinant | ( | const boost::numeric::ublas::c_matrix< T, 1, 0 > & | rM | ) |
1x0 (Generalized determinant) - not implement, but needed by some compilers.
rM | The matrix of which to find the generalized determinant. |
Definition at line 183 of file UblasCustomFunctions.hpp.
References NEVER_REACHED.
T Determinant | ( | const boost::numeric::ublas::c_matrix< T, 3, 1 > & | rM | ) |
3x1 (Generalized determinant). Calculate the generalized determinant of a 3x1 matrix. The generalized determinant is given by det(T) = sqrt(det(T'T));
rM | The matrix of which to find the generalized determinant. |
Definition at line 135 of file UblasCustomFunctions.hpp.
T Determinant | ( | const boost::numeric::ublas::c_matrix< T, 1, 1 > & | rM | ) |
1x1 Determinant. Get the determinant of a ublas matrix.
rM | The matrix of which to find the determinant. |
Definition at line 73 of file UblasCustomFunctions.hpp.
Referenced by AbstractCardiacMechanicsSolver< ELASTICITY_SOLVER, DIM >::AddActiveStressAndStressDerivative(), AbstractNonlinearElasticitySolver< DIM >::AssembleOnBoundaryElementForPressureOnDeformedBc(), IncompressibleNonlinearElasticitySolver< DIM >::AssembleOnElement(), AbstractTetrahedralElement< ELEMENT_DIM, SPACE_DIM >::CalculateJacobian(), AbstractMaterialLaw< DIM >::ComputeCauchyStress(), CompressibleExponentialLaw< DIM >::ComputeStressAndStressDerivative(), AbstractIsotropicCompressibleMaterialLaw< DIM >::ComputeStressAndStressDerivative(), Determinant(), Inverse(), and SecondInvariant().
T Determinant | ( | const boost::numeric::ublas::c_matrix< T, 2, 1 > & | rM | ) |
2x1 (Generalized determinant). Calculate the generalized determinant of a 2x1 matrix. The generalized determinant is given by det(T) = sqrt(det(T'T));
rM | The matrix of which to find the generalized determinant. |
Definition at line 149 of file UblasCustomFunctions.hpp.
T Determinant | ( | const boost::numeric::ublas::c_matrix< T, 3, 3 > & | rM | ) |
3x3 Determinant. Get the determinant of a ublas matrix.
rM | The matrix of which to find the determinant. |
Definition at line 101 of file UblasCustomFunctions.hpp.
T Determinant | ( | const boost::numeric::ublas::c_matrix< T, 3, 0 > & | rM | ) |
3x0 (Generalized determinant) - not implement, but needed by some compilers.
rM | The matrix of which to find the generalized determinant. |
Definition at line 161 of file UblasCustomFunctions.hpp.
References NEVER_REACHED.
boost::numeric::ublas::c_matrix<T, 1, 2> Inverse | ( | const boost::numeric::ublas::c_matrix< T, 2, 1 > & | rM | ) |
2x1 pseudo-inverse of a matrix. The pseudo-inverse is given by pinv(T) = (T'T)^(-1)*T'.
rM | The matrix of which to find the inverse. |
Definition at line 491 of file UblasCustomFunctions.hpp.
References Determinant().
boost::numeric::ublas::c_matrix<T, 1, 1> Inverse | ( | const boost::numeric::ublas::c_matrix< T, 1, 1 > & | rM | ) |
1x1 Inverse. Get the inverse of a ublas matrix.
rM | The matrix of which to find the inverse. |
Definition at line 378 of file UblasCustomFunctions.hpp.
References Determinant().
Referenced by AbstractCardiacMechanicsSolver< ELASTICITY_SOLVER, DIM >::AddActiveStressAndStressDerivative(), AbstractNonlinearElasticitySolver< DIM >::AssembleOnBoundaryElementForPressureOnDeformedBc(), IncompressibleNonlinearElasticitySolver< DIM >::AssembleOnElement(), CompressibleNonlinearElasticitySolver< DIM >::AssembleOnElement(), AbstractTetrahedralElement< ELEMENT_DIM, SPACE_DIM >::CalculateInverseJacobian(), AbstractMaterialLaw< DIM >::Compute1stPiolaKirchoffStress(), AbstractMaterialLaw< DIM >::Compute2ndPiolaKirchoffStress(), AbstractMaterialLaw< DIM >::ComputeCauchyStress(), and CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::rGetModifiedConductivityTensor().
boost::numeric::ublas::c_matrix<T, 2, 2> Inverse | ( | const boost::numeric::ublas::c_matrix< T, 2, 2 > & | rM | ) |
2x2 Inverse. Get the inverse of a ublas matrix.
rM | The matrix of which to find the inverse. |
Definition at line 397 of file UblasCustomFunctions.hpp.
References Determinant().
boost::numeric::ublas::c_matrix<T, 3, 3> Inverse | ( | const boost::numeric::ublas::c_matrix< T, 3, 3 > & | rM | ) |
3x3 Inverse. Get the inverse of a ublas matrix.
rM | The matrix of which to find the inverse. |
Definition at line 420 of file UblasCustomFunctions.hpp.
References Determinant().
boost::numeric::ublas::c_matrix<T, 2, 3> Inverse | ( | const boost::numeric::ublas::c_matrix< T, 3, 2 > & | rM | ) |
2x3 pseudo-inverse of a matrix. The pseudo-inverse is given by pinv(T) = (T'T)^(-1)*T'.
rM | The matrix of which to find the inverse. |
Definition at line 451 of file UblasCustomFunctions.hpp.
boost::numeric::ublas::c_matrix<T, 1, 3> Inverse | ( | const boost::numeric::ublas::c_matrix< T, 3, 1 > & | rM | ) |
3x1 pseudo-inverse of a matrix. The pseudo-inverse is given by pinv(T) = (T'T)^(-1)*T'.
rM | The matrix of which to find the inverse. |
Definition at line 512 of file UblasCustomFunctions.hpp.
References Determinant().
T SecondInvariant | ( | const c_matrix< T, 2, 2 > & | rM | ) |
2x2 second invariant. Second invariant of a 2d matrix, i.e. the determinant. This function is mainly here just so that the same code can be used in 2d and 3d.
rM | The matrix |
Definition at line 601 of file UblasCustomFunctions.hpp.
References Determinant().
T SecondInvariant | ( | const c_matrix< T, 3, 3 > & | rM | ) |
3x3 second invariant.
rM | The matrix |
Definition at line 587 of file UblasCustomFunctions.hpp.
Referenced by AbstractIsotropicIncompressibleMaterialLaw< DIM >::ComputeStressAndStressDerivative(), and AbstractIsotropicCompressibleMaterialLaw< DIM >::ComputeStressAndStressDerivative().
T SubDeterminant | ( | const boost::numeric::ublas::c_matrix< T, 3, 0 > & | rM, |
const unsigned | missrow, | ||
const unsigned | misscol | ||
) |
SubDeterminant 3x0 - Not implemented, but needed by some compilers for recursive template calls. Determinant of a submatrix after removing a particular row and column.
rM | The matrix of which to find the subdeterminant. |
missrow | The index to the row to remove |
misscol | The index to the column to remove |
Definition at line 334 of file UblasCustomFunctions.hpp.
References NEVER_REACHED.
T SubDeterminant | ( | const boost::numeric::ublas::c_matrix< T, 2, 1 > & | rM, |
const unsigned | missrow, | ||
const unsigned | misscol | ||
) |
SubDeterminant 2x1. Determinant of a submatrix after removing a particular row and column.
rM | The matrix of which to find the subdeterminant. |
missrow | The index to the row to remove |
misscol | The index to the column to remove |
Definition at line 310 of file UblasCustomFunctions.hpp.
T SubDeterminant | ( | const boost::numeric::ublas::c_matrix< T, 2, 0 > & | rM, |
const unsigned | missrow, | ||
const unsigned | misscol | ||
) |
SubDeterminant 2x0 - Not implemented, but needed by some compilers for recursive template calls. Determinant of a submatrix after removing a particular row and column.
rM | The matrix of which to find the subdeterminant. |
missrow | The index to the row to remove |
misscol | The index to the column to remove |
Definition at line 348 of file UblasCustomFunctions.hpp.
References NEVER_REACHED.
T SubDeterminant | ( | const boost::numeric::ublas::c_matrix< T, 1, 0 > & | rM, |
const unsigned | missrow, | ||
const unsigned | misscol | ||
) |
SubDeterminant 1x0 - Not implemented, but needed by some compilers for recursive template calls. Determinant of a submatrix after removing a particular row and column.
rM | The matrix of which to find the subdeterminant. |
missrow | The index to the row to remove |
misscol | The index to the column to remove |
Definition at line 362 of file UblasCustomFunctions.hpp.
References NEVER_REACHED.
T SubDeterminant | ( | const boost::numeric::ublas::c_matrix< T, 3, 1 > & | rM, |
const unsigned | missrow, | ||
const unsigned | misscol | ||
) |
SubDeterminant 3x1. Determinant of a submatrix after removing a particular row and column.
rM | The matrix of which to find the subdeterminant. |
missrow | The index to the row to remove |
misscol | The index to the column to remove |
Definition at line 287 of file UblasCustomFunctions.hpp.
T SubDeterminant | ( | const boost::numeric::ublas::c_matrix< T, 1, 1 > & | rM, |
const unsigned | missrow, | ||
const unsigned | misscol | ||
) |
1x1 SubDeterminant. Return the determinant of a submatrix after removing a particular row and column For a 1x1 matrix this should always remove the only row and column (0,0).
rM | The matrix of which to find the subdeterminant. |
missrow | The index to the row to remove |
misscol | The index to the column to remove |
Definition at line 200 of file UblasCustomFunctions.hpp.
Referenced by AbstractTetrahedralElement< ELEMENT_DIM, SPACE_DIM >::CalculateWeightedDirection().
T SubDeterminant | ( | const boost::numeric::ublas::c_matrix< T, 2, 2 > & | rM, |
const unsigned | missrow, | ||
const unsigned | misscol | ||
) |
2x2 SubDeterminant. Return the determinant of a submatrix after removing a particular row and column.
rM | The matrix of which to find the subdeterminant. |
missrow | The index to the row to remove |
misscol | The index to the column to remove |
Definition at line 218 of file UblasCustomFunctions.hpp.
T SubDeterminant | ( | const boost::numeric::ublas::c_matrix< T, 3, 3 > & | rM, |
const unsigned | missrow, | ||
const unsigned | misscol | ||
) |
SubDeterminant 3x3. Determinant of a submatrix after removing a particular row and column.
rM | The matrix of which to find the subdeterminant. |
missrow | The index to the row to remove |
misscol | The index to the column to remove |
Definition at line 239 of file UblasCustomFunctions.hpp.
T SubDeterminant | ( | const boost::numeric::ublas::c_matrix< T, 3, 2 > & | rM, |
const unsigned | missrow, | ||
const unsigned | misscol | ||
) |
SubDeterminant 3x2. Determinant of a submatrix after removing a particular row and column.
rM | The matrix of which to find the subdeterminant. |
missrow | The index to the row to remove |
misscol | The index to the column to remove |
Definition at line 264 of file UblasCustomFunctions.hpp.
T Trace | ( | const c_matrix< T, 1, 1 > & | rM | ) |
1x1 matrix trace (sum of diagonal elements).
rM | The matrix of which to find the trace. |
Definition at line 535 of file UblasCustomFunctions.hpp.
Referenced by AbstractIsotropicIncompressibleMaterialLaw< DIM >::ComputeStressAndStressDerivative(), and AbstractIsotropicCompressibleMaterialLaw< DIM >::ComputeStressAndStressDerivative().
T Trace | ( | const c_matrix< T, 3, 3 > & | rM | ) |
3x3 matrix trace (sum of diagonal elements).
rM | The matrix of which to find the trace. |
Definition at line 559 of file UblasCustomFunctions.hpp.
T Trace | ( | const c_matrix< T, 2, 2 > & | rM | ) |
2x2 matrix trace (sum of diagonal elements).
rM | The matrix of which to find the trace. |
Definition at line 547 of file UblasCustomFunctions.hpp.
T Trace | ( | const c_matrix< T, 4, 4 > & | rM | ) |
4x4 matrix trace (sum of diagonal elements).
rM | The matrix of which to find the trace. |
Definition at line 571 of file UblasCustomFunctions.hpp.
c_vector<T, 3> VectorProduct | ( | const c_vector< T, 3 > & | rA, |
const c_vector< T, 3 > & | rB | ||
) |
This is a cross-product aka vector-product, only implemented for 3-vectors.
rA | first vector |
rB | second vector |
Definition at line 627 of file UblasCustomFunctions.hpp.
Referenced by StreeterFibreGenerator< SPACE_DIM >::GenerateOrthotropicFibreOrientation().