Go to the documentation of this file.
31 template<
class MatrixType>
35 const RMatrix& reflector,
39 applyLeftReflector(
A, reflector,
k,
k);
41 if (outputType_ == outputTypes::FULL_QR)
43 applyRightReflector(Q_, reflector,
k);
49 template<
class MatrixType>
65 scalar magnitude(
mag(u(0,0)));
66 if (magnitude < VSMALL)
71 <<
"Almost zero leading elem in Householder matrix."
84 <<
"Almost zero norm in the Householder matrix."
95 template<
class MatrixType>
107 for (label j =
k; j <
A.n(); ++j)
110 for (label i = 0; i < reflector.
m(); ++i)
116 for (label i = 0; i < reflector.
m(); ++i)
118 A(i + k1, j) -= reflector(i, 0)*
sum;
124 template<
class MatrixType>
135 for (label i = 0; i <
A.m(); ++i)
138 for (label j = 0; j < reflector.
m(); ++j)
140 sum +=
A(i, j +
k)*reflector(j, 0);
144 for (label j = 0; j < reflector.
m(); ++j)
154 template<
class MatrixType>
157 const_cast<MatrixType&
>(Q_).round();
163 template<
class MatrixType>
170 template<
class MatrixType>
177 template<
class MatrixType>
void applyLeftReflector(MatrixType &A, const RMatrix &reflector, const label k=0, const label k1=0)
Apply (in-place) Householder reflectors from the left side: u*A.
label n() const noexcept
The number of columns.
static constexpr const zero Zero
Global zero (0)
RMatrix householderReflector(RMatrix u)
Compute Householder reflector on a given matrix column, u.
MatrixType::cmptType cmptType
static const Foam::dimensionedScalar A("", Foam::dimPressure, 611.21)
const MatrixType & Q() const
Return the unitary similarity matrix.
#define forAll(list, i)
Loop across all elements in list.
QRMatrix (i.e. QR decomposition, QR factorisation or orthogonal-triangular decomposition) decomposes ...
void applyRightReflector(MatrixType &A, const RMatrix &reflector, const label k=0)
Apply (in-place) Householder reflectors from the right side: (u*A)*u.
scalar columnNorm(const label colIndex, const bool noSqrt=false) const
Return L2-Norm of chosen column.
A templated (M x N) rectangular matrix of objects of <Type>, containing M*N elements,...
const MatrixType & R() const
Return the upper triangular matrix.
errorManip< error > abort(error &err)
errorManipArg< error, int > exit(error &err, const int errNo=1)
A templated (N x N) square matrix of objects of <Type>, containing N*N elements, derived from Matrix.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
label m() const noexcept
The number of rows.
std::enable_if< !std::is_same< complex, T >::value, const T & >::type conj(const T &val)
A traits class, which is primarily used for primitives.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
const labelList & orderP() const
Return the permutation order (P) as a list.
label k
Boltzmann constant.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
SMatrix P() const
Create and return the permutation matrix.