ug4
Math

Modules

 Matrix
 
 Tensor
 
 Vectors
 
 Math Utilities
 

Functions

void AdjustNearestPoints (number A1x, number A1y, number A1z, number Lax, number Lay, number Laz, number B1x, number B1y, number B1z, number Lbx, number Lby, number Lbz, number epsilon_squared, number s, number t, number &PointOnSegAx, number &PointOnSegAy, number &PointOnSegAz, number &PointOnSegBx, number &PointOnSegBy, number &PointOnSegBz)
 
bool ug::CalculateEigenvalues (const ug::matrix33 &mat, number &lambdaMinOut, number &lambdaMedOut, number &lambdaMaxOut, ug::vector3 &evMinOut, ug::vector3 &evMedOut, ug::vector3 &evMaxOut)
 
void FindNearestPointOfParallelLineSegments (number A1x, number A1y, number A1z, number A2x, number A2y, number A2z, number Lax, number Lay, number Laz, number B1x, number B1y, number B1z, number B2x, number B2y, number B2z, number Lbx, number Lby, number Lbz, bool infinite_lines, number epsilon_squared, number &PointOnSegAx, number &PointOnSegAy, number &PointOnSegAz, number &PointOnSegBx, number &PointOnSegBy, number &PointOnSegBz)
 
void FindNearestPointOnLineSegment (const number A1x, const number A1y, const number A1z, const number Lx, const number Ly, const number Lz, const number Bx, const number By, const number Bz, bool infinite_line, number epsilon_squared, number &NearestPointX, number &NearestPointY, number &NearestPointZ, number &parameter)
 
template<typename matrix_t , typename vector_t >
void ug::GivensMatVecMult (matrix_t &A, vector_t &v)
 Multiplication by the Givens rotation of the QR-Decomposition. More...
 
void IntersectLineSegments (const number A1x, const number A1y, const number A1z, const number A2x, const number A2y, const number A2z, const number B1x, const number B1y, const number B1z, const number B2x, const number B2y, const number B2z, bool infinite_lines, number epsilon, number &PointOnSegAx, number &PointOnSegAy, number &PointOnSegAz, number &PointOnSegBx, number &PointOnSegBy, number &PointOnSegBz, number &NearestPointX, number &NearestPointY, number &NearestPointZ, number &NearestVectorX, number &NearestVectorY, number &NearestVectorZ, bool &true_intersection)
 
template<typename matrix_t , typename vector_t >
void ug::InvMatVecMult_byGivens (matrix_t &A, vector_t &v)
 Multiplication by the inverse using the Givens rotations. More...
 
template<typename vector_t_out , typename matrix_t , typename vector_t_in >
void ug::MatVecMult (vector_t_out &vOut, const matrix_t &m, const vector_t_in &v)
 Matrix - Vector Multiplication. More...
 
template<typename vector_t_out , typename matrix_t , typename vector_t_in >
void ug::MatVecMultAppend (vector_t_out &vOut, const matrix_t &m, const vector_t_in &v)
 Matrix - Vector Multiplication adding to a second vector. More...
 
template<typename vector_t_out , typename matrix_t , typename vector_t_in >
void ug::MatVecScaleMultAppend (vector_t_out &vOut, typename vector_t_out::value_type s, const matrix_t &m, const vector_t_in &v)
 Matrix - Vector Multiplication added scaled to a second vector. More...
 
template<typename matrix_t , typename vector_t >
void ug::OrthogProjectVec (vector_t &v, const matrix_t &A)
 Orthogonal projection. More...
 
template<typename vector_t_out , typename matrix_t , typename vector_t_in >
void ug::TransposedMatVecMult (vector_t_out &vOut, const matrix_t &m, const vector_t_in &v)
 Transposed Matrix - Vector Muliplication. More...
 
template<typename vector_t_out , typename matrix_t , typename vector_t_in >
void ug::TransposedMatVecMultAdd (vector_t_out &vOut, const matrix_t &m, const vector_t_in &v)
 Transposed Matrix - Vector Muliplication. More...
 

Detailed Description

General math types and utilities

Function Documentation

◆ AdjustNearestPoints()

void AdjustNearestPoints ( number  A1x,
number  A1y,
number  A1z,
number  Lax,
number  Lay,
number  Laz,
number  B1x,
number  B1y,
number  B1z,
number  Lbx,
number  Lby,
number  Lbz,
number  epsilon_squared,
number  s,
number  t,
number PointOnSegAx,
number PointOnSegAy,
number PointOnSegAz,
number PointOnSegBx,
number PointOnSegBy,
number PointOnSegBz 
)

◆ CalculateEigenvalues()

bool ug::CalculateEigenvalues ( const ug::matrix33 mat,
number lambdaMinOut,
number lambdaMedOut,
number lambdaMaxOut,
ug::vector3 evMinOut,
ug::vector3 evMedOut,
ug::vector3 evMaxOut 
)

References ug::rot(), and s.

Referenced by ug::FindClosestPlane().

◆ FindNearestPointOfParallelLineSegments()

void FindNearestPointOfParallelLineSegments ( number  A1x,
number  A1y,
number  A1z,
number  A2x,
number  A2y,
number  A2z,
number  Lax,
number  Lay,
number  Laz,
number  B1x,
number  B1y,
number  B1z,
number  B2x,
number  B2y,
number  B2z,
number  Lbx,
number  Lby,
number  Lbz,
bool  infinite_lines,
number  epsilon_squared,
number PointOnSegAx,
number PointOnSegAy,
number PointOnSegAz,
number PointOnSegBx,
number PointOnSegBy,
number PointOnSegBz 
)

◆ FindNearestPointOnLineSegment()

void FindNearestPointOnLineSegment ( const number  A1x,
const number  A1y,
const number  A1z,
const number  Lx,
const number  Ly,
const number  Lz,
const number  Bx,
const number  By,
const number  Bz,
bool  infinite_line,
number  epsilon_squared,
number NearestPointX,
number NearestPointY,
number NearestPointZ,
number parameter 
)

◆ GivensMatVecMult()

template<typename matrix_t , typename vector_t >
void ug::GivensMatVecMult ( matrix_t &  A,
vector_t &  v 
)
inline

Multiplication by the Givens rotation of the QR-Decomposition.

Multiplication of a vector v by the Givens rotation transforming a given matrix A to an upper triangular form R. After the call A stores the upper triangular form R. Thus, this function computes the QR-decomposition \( A = Q R \) with \( Q^T = Q^{-1} \) and performs the multiplication \( v \gets Q^{-1} v \). Note that A is not necessarily a square matrix, but it should have more lines than columns.

References s.

Referenced by ug::InvMatVecMult_byGivens().

◆ IntersectLineSegments()

void IntersectLineSegments ( const number  A1x,
const number  A1y,
const number  A1z,
const number  A2x,
const number  A2y,
const number  A2z,
const number  B1x,
const number  B1y,
const number  B1z,
const number  B2x,
const number  B2y,
const number  B2z,
bool  infinite_lines,
number  epsilon,
number PointOnSegAx,
number PointOnSegAy,
number PointOnSegAz,
number PointOnSegBx,
number PointOnSegBy,
number PointOnSegBz,
number NearestPointX,
number NearestPointY,
number NearestPointZ,
number NearestVectorX,
number NearestVectorY,
number NearestVectorZ,
bool &  true_intersection 
)

◆ InvMatVecMult_byGivens()

template<typename matrix_t , typename vector_t >
void ug::InvMatVecMult_byGivens ( matrix_t &  A,
vector_t &  v 
)
inline

Multiplication by the inverse using the Givens rotations.

Multiplication of a vector v by \( A^{-1} \) fr a given matrix A ( \( v := A^{-1} v \)) using the QR-decomposition based on the Givens rotations. Note that A is not necessarily a square matrix, but it should have more lines than columns. In the latter case, the result is stored in v[0]...v[A.num_cols() - 1], whereas the Euclidean norm of the rest is the Euclidean distance between the original v and its projection to the space spanned by the columns of the matrix. If the matrix is singular (i.e. its columns are linearly dependent) then an exception is thrown.

This function can be used in the least square method and for the orthogonal projection of v to the space spanned by the columns of (the original) A.

Remark: After the call, A stores the upper triangular form of the QR-decomposition, i.e. the original matrix is destroyed.

References ug::GivensMatVecMult(), ug::SMALL, and UG_THROW.

Referenced by ug::OrthogProjectVec().

◆ MatVecMult()

template<typename vector_t_out , typename matrix_t , typename vector_t_in >
void ug::MatVecMult ( vector_t_out &  vOut,
const matrix_t &  m,
const vector_t_in &  v 
)
inline

Matrix - Vector Multiplication.

Referenced by ug::StdLinConsistentGravity< refDim >::compute(), ug::StdLinConsistentGravityX< refDim >::compute(), ug::ComputeGradientCrouzeixRaviart(), ug::ComputeGradientLagrange1(), ug::DarcyVelocityLinker< dim >::eval_and_deriv(), ug::GridFunctionGradientData< TGridFunction >::eval_and_deriv(), ug::GradientDataExport< dim >::eval_and_deriv(), ug::GridFunctionGradientComponentData< TGridFunction >::eval_and_deriv(), ug::GradientEvaluator_LagrangeP1< TFunction >::evaluate(), ug::DarcyVelocityLinker< dim >::evaluate(), ug::GlobalGridFunctionGradientData< TGridFunction >::evaluate(), ug::ExplicitGridFunctionGradient< TGridFunction >::evaluate(), ug::H1SemiDistIntegrand< TGridFunction >::evaluate(), ug::H1EnergyDistIntegrand< TGridFunction >::evaluate(), ug::H1DistIntegrand< TGridFunction >::evaluate(), ug::H1ErrorIntegrand< TGridFunction >::evaluate(), ug::H1SemiIntegrand< TGridFunction >::evaluate(), ug::H1EnergyIntegrand< TGridFunction >::evaluate(), ug::H1NormIntegrand< TGridFunction >::evaluate(), ug::BaseReferenceMapping< dim, worldDim, isLinear, TImpl >::global_to_local(), ug::IntersectCoplanarTriangles(), ug::OrthogProjectVec(), ug::StdLinConsistentGravity< refDim >::prepare_edge(), ug::StdLinConsistentGravity< refDim >::prepare_hexahedron(), ug::StdLinConsistentGravity< refDim >::prepare_prism(), ug::StdLinConsistentGravity< refDim >::prepare_pyramid(), ug::StdLinConsistentGravity< refDim >::prepare_quadrilateral(), ug::StdLinConsistentGravity< refDim >::prepare_tetrahedron(), ug::StdLinConsistentGravity< refDim >::prepare_triangle(), ug::RayRayIntersection2d(), ug::TransformVertex(), ug::ConvectionShapesPartialUpwind< TDim >::update(), ug::FV1Geometry_gen< TElem, TWorldDim, TCondensed >::update(), ug::DimFV1Geometry< TDim, TWorldDim >::update(), ug::FV1IBGeometry< TElem, TWorldDim >::update(), ug::DimFV1IBGeometry< TDim, TWorldDim >::update(), ug::DimCRFVGeometry< TDim, TWorldDim >::update(), ug::CRFVGeometry< TElem, TWorldDim >::update(), ug::FVGeometry< TOrder, TElem, TWorldDim, TQuadOrder >::update(), ug::HCRFVGeometry< TElem, TWorldDim >::update(), ug::FEGeometry< TElem, TWorldDim, TTrialSpace, TQuadratureRule >::update(), ug::DimFEGeometry< TWorldDim, TRefDim >::update(), ug::HFV1Geometry< TElem, TWorldDim >::update(), ug::DimHFV1Geometry< TDim, TWorldDim >::update(), ug::DimFVGeometry< TWorldDim, TDim >::update(), ug::DimFV1Geometry< TDim, TWorldDim >::update_boundary_faces(), ug::FV1IBGeometry< TElem, TWorldDim >::update_boundary_faces(), ug::DimFV1IBGeometry< TDim, TWorldDim >::update_boundary_faces(), ug::DimCRFVGeometry< TDim, TWorldDim >::update_boundary_faces(), ug::CRFVGeometry< TElem, TWorldDim >::update_boundary_faces(), ug::FVGeometry< TOrder, TElem, TWorldDim, TQuadOrder >::update_boundary_faces(), ug::DimFVGeometry< TWorldDim, TDim >::update_boundary_faces(), ug::DimFEGeometry< TWorldDim, TRefDim >::update_boundary_faces(), ug::DimCRFVGeometry< TDim, TWorldDim >::update_hanging(), and ug::VecDistanceSq().

◆ MatVecMultAppend()

template<typename vector_t_out , typename matrix_t , typename vector_t_in >
void ug::MatVecMultAppend ( vector_t_out &  vOut,
const matrix_t &  m,
const vector_t_in &  v 
)
inline

Matrix - Vector Multiplication adding to a second vector.

Matrix - Vector Multiplication adding to a second matrix.

Referenced by ug::linker_traits< MathVector< dim >, MathMatrix< dim, dim > >::mult_add().

◆ MatVecScaleMultAppend()

template<typename vector_t_out , typename matrix_t , typename vector_t_in >
void ug::MatVecScaleMultAppend ( vector_t_out &  vOut,
typename vector_t_out::value_type  s,
const matrix_t &  m,
const vector_t_in &  v 
)
inline

Matrix - Vector Multiplication added scaled to a second vector.

References s.

Referenced by ug::BaseReferenceMapping< dim, worldDim, isLinear, TImpl >::global_to_local().

◆ OrthogProjectVec()

template<typename matrix_t , typename vector_t >
void ug::OrthogProjectVec ( vector_t &  v,
const matrix_t &  A 
)
inline

Orthogonal projection.

Orthogonal projection of a given vector v to the space spanned by the columns of a given matrix A. The projection is written to v.

References ug::InvMatVecMult_byGivens(), and ug::MatVecMult().

Referenced by ug::ProjectionLinker< dim >::eval_and_deriv(), ug::ProjectionLinker< dim >::evaluate(), and ug::OutNormCmp< TDomain >::evaluate().

◆ TransposedMatVecMult()

template<typename vector_t_out , typename matrix_t , typename vector_t_in >
void ug::TransposedMatVecMult ( vector_t_out &  vOut,
const matrix_t &  m,
const vector_t_in &  v 
)
inline

◆ TransposedMatVecMultAdd()

template<typename vector_t_out , typename matrix_t , typename vector_t_in >
void ug::TransposedMatVecMultAdd ( vector_t_out &  vOut,
const matrix_t &  m,
const vector_t_in &  v 
)
inline

Transposed Matrix - Vector Muliplication.