Go to the documentation of this file.
55 scalar largestCoeff = 0.0;
57 const scalar* __restrict__ matrixi = matrix[i];
61 if ((temp =
mag(matrixi[j])) > largestCoeff)
67 if (largestCoeff == 0.0)
73 vv[i] = 1.0/largestCoeff;
78 scalar* __restrict__ matrixj = matrix[j];
80 for (
label i=0; i<j; i++)
82 scalar* __restrict__ matrixi = matrix[i];
84 scalar
sum = matrixi[j];
87 sum -= matrixi[
k]*matrix[
k][j];
94 scalar largestCoeff = 0.0;
97 scalar* __restrict__ matrixi = matrix[i];
98 scalar
sum = matrixi[j];
102 sum -= matrixi[
k]*matrix[
k][j];
108 if ((temp = vv[i]*
mag(
sum)) >= largestCoeff)
115 pivotIndices[j] = iMax;
119 scalar* __restrict__ matrixiMax = matrix[iMax];
123 Swap(matrixj[
k], matrixiMax[
k]);
130 if (matrixj[j] == 0.0)
137 scalar rDiag = 1.0/matrixj[j];
139 for (
label i=j+1; i<
n; i++)
141 matrix[i][j] *= rDiag;
154 for (
label j = 0; j < size; j++)
156 for (
label k = j + 1;
k < size;
k++)
162 for (
label j = 0; j < size; j++)
170 for (
label i = 0; i <
k; i++)
172 s += matrix[i][
k]*matrix[i][j];
175 s = (matrix[j][
k] -
s)/matrix[
k][
k];
183 d = matrix[j][j] - d;
188 <<
"Matrix is not symmetric positive-definite. Unable to "
193 matrix[j][j] =
sqrt(d);
211 <<
"A and B must have identical inner dimensions but A.m = "
212 <<
A.m() <<
" and B.n = " << B.
n()
219 <<
"B and C must have identical inner dimensions but B.m = "
220 << B.
m() <<
" and C.n = " <<
C.n()
226 for (
label i = 0; i <
A.n(); i++)
230 for (
label l = 0; l <
C.n(); l++)
233 for (
label j = 0; j <
A.m(); j++)
235 ab +=
A[i][j]*B[j][l];
237 ans[i][
g] +=
C[l][
g] * ab;
252 if (
A.m() != B.
size())
255 <<
"A and B must have identical inner dimensions but A.m = "
256 <<
A.m() <<
" and B.n = " << B.
size()
260 if (B.
size() !=
C.n())
263 <<
"B and C must have identical inner dimensions but B.m = "
264 << B.
size() <<
" and C.n = " <<
C.n()
270 for (
label i = 0; i <
A.n(); i++)
274 for (
label l = 0; l <
C.n(); l++)
276 ans[i][
g] +=
C[l][
g] *
A[i][l]*B[l];
289 SVD svd(
A, minCondition);
scalarRectangularMatrix SVDinv(const scalarRectangularMatrix &A, scalar minCondition=0)
Return the inverse of matrix A using SVD.
label m() const
Return the number of columns.
const dimensionedVector & g
dimensioned< scalar > mag(const dimensioned< Type > &)
label n() const
Return the number of rows.
dimensionedScalar sign(const dimensionedScalar &ds)
simpleMatrix< scalar > A(Nc)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
errorManip< error > abort(error &err)
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
A templated 2D square symmetric matrix of objects of <T>, where the n x n matrix dimension is known a...
errorManipArg< error, int > exit(error &err, const int errNo=1)
void LUDecompose(scalarSquareMatrix &matrix, labelList &pivotIndices)
LU decompose the matrix with pivoting.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
const scalarRectangularMatrix & VSinvUt() const
Return VSinvUt (the pseudo inverse)
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
dimensionedScalar sqrt(const dimensionedScalar &ds)
Singular value decomposition of a rectangular matrix.
label k
Boltzmann constant.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
void size(const label)
Override size to be inconsistent with allocated storage.
void multiply(FieldField< Field, Type > &f, const FieldField< Field, Type > &f1, const FieldField< Field, scalar > &f2)
Graphite solid properties.
RectangularMatrix< scalar > scalarRectangularMatrix