OGS 6.2.1-76-gbb689931b
MathLib::LinAlg Namespace Reference

Detailed Description

Some general linear algebra functionality.

By using the provided functions linear algebra capabilities can be used for different matrix and vector types in a way that is agnostic towards the specific type used.

For documentation, refer to that of the templated method. All specializations or overload must behave in the same way.

Functions

template<typename MatrixOrVector >
void copy (MatrixOrVector const &x, MatrixOrVector &y)
 Copies x to y. More...
 
template<typename MatrixOrVector >
void scale (MatrixOrVector &x, double const a)
 Scales x by a. More...
 
template<typename MatrixOrVector >
void aypx (MatrixOrVector &y, double const a, MatrixOrVector const &x)
 Computes $ y = a \cdot y + x $. More...
 
template<typename MatrixOrVector >
void axpy (MatrixOrVector &y, double const a, MatrixOrVector const &x)
 Computes $ y = a \cdot x + y $. More...
 
template<typename MatrixOrVector >
void axpby (MatrixOrVector &y, double const a, double const b, MatrixOrVector const &x)
 Computes $ y = a \cdot x + b \cdot y $. More...
 
template<typename MatrixOrVector >
void componentwiseDivide (MatrixOrVector &w, MatrixOrVector const &x, MatrixOrVector const &y)
 Computes $w = x/y$ componentwise. More...
 
template<typename MatrixOrVector >
double norm1 (MatrixOrVector const &x)
 Computes the Manhattan norm of x. More...
 
template<typename MatrixOrVector >
double norm2 (MatrixOrVector const &x)
 Computes the Euclidean norm of x. More...
 
template<typename MatrixOrVector >
double normMax (MatrixOrVector const &x)
 Computes the maximum norm of x. More...
 
template<typename MatrixOrVector >
double norm (MatrixOrVector const &x, MathLib::VecNormType type)
 
template<typename Matrix >
void finalizeAssembly (Matrix &)
 
template<typename Matrix , typename Vector >
void matMult (Matrix const &A, Vector const &x, Vector &y)
 
template<typename Matrix , typename Vector >
void matMultAdd (Matrix const &A, Vector const &v1, Vector const &v2, Vector &v3)
 

Function Documentation

◆ axpby()

template<typename MatrixOrVector >
void MathLib::LinAlg::axpby ( MatrixOrVector &  y,
double const  a,
double const  b,
MatrixOrVector const &  x 
)

Computes $ y = a \cdot x + b \cdot y $.

Definition at line 64 of file LinAlg.h.

References componentwiseDivide(), norm1(), norm2(), and normMax().

Referenced by NumLib::TimeDiscretization::getXdot(), and matMultAdd().

65 {
66  y = a*x + b*y;
67 }

◆ axpy()

◆ aypx()

◆ componentwiseDivide()

template<typename MatrixOrVector >
void MathLib::LinAlg::componentwiseDivide ( MatrixOrVector &  w,
MatrixOrVector const &  x,
MatrixOrVector const &  y 
)

Computes $w = x/y$ componentwise.

Referenced by axpby(), and NumLib::LocalLinearLeastSquaresExtrapolator::extrapolate().

◆ copy()

template<typename MatrixOrVector >
void MathLib::LinAlg::copy ( MatrixOrVector const &  x,
MatrixOrVector &  y 
)

Copies x to y.

Definition at line 36 of file LinAlg.h.

Referenced by FileIO::Gocad::GocadSGridReader::addFaceSetQuad(), FileIO::Gocad::GocadSGridReader::addGocadPropertiesToMesh(), addIntegrationPointData(), addIntegrationPointMetaData(), MeshLib::MeshLayerMapper::addLayerToMesh(), MeshLib::addLayerToMesh(), MeshLib::addPropertyToMesh(), FileIO::SwmmInterface::addResultsToMesh(), MeshGeoToolsLib::appendLinesAlongPolylines(), NumLib::TimeDiscretizedODESystem< ODESystemTag::FirstOrderImplicitQuasilinear, NonlinearSolverTag::Newton >::applyKnownSolutionsNewton(), NumLib::TimeDiscretizedODESystem< ODESystemTag::FirstOrderImplicitQuasilinear, NonlinearSolverTag::Picard >::applyKnownSolutionsPicard(), NumLib::MatrixTranslatorGeneral< ODESystemTag::FirstOrderImplicitQuasilinear >::computeA(), NumLib::MatrixTranslatorForwardEuler< ODESystemTag::FirstOrderImplicitQuasilinear >::computeA(), NumLib::MatrixTranslatorCrankNicolson< ODESystemTag::FirstOrderImplicitQuasilinear >::computeA(), NumLib::MatrixTranslatorGeneral< ODESystemTag::FirstOrderImplicitQuasilinear >::computeJacobian(), NumLib::MatrixTranslatorForwardEuler< ODESystemTag::FirstOrderImplicitQuasilinear >::computeJacobian(), NumLib::MatrixTranslatorCrankNicolson< ODESystemTag::FirstOrderImplicitQuasilinear >::computeJacobian(), NumLib::TimeDiscretization::computeRelativeChangeFromPreviousTimestep(), MeshLib::VtkMeshConverter::convertTypedArray(), ProcessLib::LIE::PostProcessTool::copyProperties(), ProcessLib::RichardsComponentTransport::createPorousMediaProperties(), MeshLib::createQuadraticOrderMesh(), ChemistryLib::createReactionRates(), MathLib::DenseMatrix< double >::DenseMatrix(), ProcessLib::CachedSecondaryVariable::evalFieldNoArgs(), BaseLib::excludeObjectCopy(), MeshLib::getBaseNodes(), ProcessLib::PhaseFieldIrreversibleDamageOracleBoundaryCondition::getEssentialBCValues(), ProcessLib::LIE::getFractureMatrixDataInMesh(), NumLib::SimpleMatrixVectorProvider::getMatrix(), LayeredMeshGenerator::getMesh(), NumLib::SimpleMatrixVectorProvider::getVector(), NumLib::BackwardEuler::getWeightedOldX(), NumLib::ForwardEuler::getWeightedOldX(), NumLib::CrankNicolson::getWeightedOldX(), NumLib::BackwardDifferentiationFormula::getWeightedOldX(), FileIO::Gocad::GocadSGridReader::GocadSGridReader(), ProcessLib::SmallDeformation::SmallDeformationProcess< DisplacementDim >::initializeConcreteProcess(), MaterialLib::Solids::MFront::MFront< DisplacementDim >::integrateStress(), matMultAdd(), MeshLib::NodePartitionedMesh::NodePartitionedMesh(), operator<<(), FileIO::Gocad::operator<<(), ChemistryLib::anonymous_namespace{PhreeqcIO.cpp}::operator<<(), BaseLib::operator<<(), NumLib::operator<<(), MathLib::DenseMatrix< double >::operator=(), ApplicationUtils::NodeWiseMeshPartitioner::partitionOtherMesh(), NumLib::BackwardEuler::popState(), NumLib::ForwardEuler::popState(), NumLib::CrankNicolson::popState(), NumLib::BackwardDifferentiationFormula::popState(), ProcessLib::ThermoMechanics::ThermoMechanicsProcess< DisplacementDim >::preTimestepConcreteProcess(), ProcessLib::HT::HTProcess::preTimestepConcreteProcess(), ProcessLib::ComponentTransport::ComponentTransportProcess::preTimestepConcreteProcess(), MeshLib::PropertyVector< T *>::print(), ApplicationUtils::NodeWiseMeshPartitioner::processPartition(), NumLib::MatrixTranslatorCrankNicolson< ODESystemTag::FirstOrderImplicitQuasilinear >::pushMatrices(), NumLib::BackwardEuler::pushState(), NumLib::ForwardEuler::pushState(), NumLib::CrankNicolson::pushState(), NumLib::BackwardDifferentiationFormula::pushState(), GeoLib::Raster::Raster(), MathLib::TemplatePoint< FP_T, DIM >::read(), FileIO::Gocad::GocadSGridReader::readElementPropertiesBinary(), FileIO::GMSInterface::readGMS3DMMesh(), FileIO::SwmmInterface::readSwmmInputToLineMesh(), FileIO::TetGenInterface::readTetGenMesh(), GeoLib::MinimalBoundingSphere::recurseCalculation(), ProcessLib::TimeLoop::setCoupledSolutions(), NumLib::BackwardEuler::setInitialState(), NumLib::ForwardEuler::setInitialState(), NumLib::CrankNicolson::setInitialState(), DiagramList::setList(), NumLib::NonlinearSolver< NonlinearSolverTag::Newton >::solve(), NumLib::NonlinearSolver< NonlinearSolverTag::Picard >::solve(), ProcessLib::TimeLoop::solveCoupledEquationSystemsByStaggeredScheme(), BaseLib::splitString(), MeshLib::TemplateElement< ELEMENT_RULE >::TemplateElement(), anonymous_namespace{IdentifySubdomainMesh.cpp}::updateOrCheckExistingSubdomainProperty(), MathLib::TemplatePoint< FP_T, DIM >::write(), and writeDataToMesh().

37 {
38  y = x;
39 }

◆ finalizeAssembly()

◆ matMult()

template<typename Matrix , typename Vector >
void MathLib::LinAlg::matMult ( Matrix const &  A,
Vector const &  x,
Vector &  y 
)

◆ matMultAdd()

template<typename Matrix , typename Vector >
void MathLib::LinAlg::matMultAdd ( Matrix const &  A,
Vector const &  v1,
Vector const &  v2,
Vector &  v3 
)

◆ norm()

template<typename MatrixOrVector >
double MathLib::LinAlg::norm ( MatrixOrVector const &  x,
MathLib::VecNormType  type 
)

◆ norm1()

template<typename MatrixOrVector >
double MathLib::LinAlg::norm1 ( MatrixOrVector const &  x)

Computes the Manhattan norm of x.

Referenced by axpby(), and norm().

◆ norm2()

template<typename MatrixOrVector >
double MathLib::LinAlg::norm2 ( MatrixOrVector const &  x)

Computes the Euclidean norm of x.

Referenced by axpby(), and norm().

◆ normMax()

template<typename MatrixOrVector >
double MathLib::LinAlg::normMax ( MatrixOrVector const &  x)

Computes the maximum norm of x.

Referenced by axpby(), and norm().

◆ scale()