38 VSinvUt_(A.
n(), A.m()),
53 for (
label i=0; i<Un; i++)
63 scale +=
mag(U_(
k, i));
71 s += U_(
k, i)*U_(
k, i);
79 for (
label j=l-1; j<Un; j++)
84 s += U_(
k, i)*U_(
k, j);
90 U_(
k, j) += f*U_(
k, i);
105 if (i+1 <= Um && i != Un)
109 scale +=
mag(U_(i,
k));
117 s += U_(i,
k)*U_(i,
k);
120 scalar
f = U_[i][l-1];
130 for (
label j=l-1; j<Um; j++)
135 s += U_(j,
k)*U_(i,
k);
140 U_(j,
k) += s*rv1[
k];
150 anorm =
max(anorm,
mag(S_[i]) +
mag(rv1[i]));
153 for (
label i=Un-1; i >= 0; i--)
159 for (
label j=l; j<Un; j++)
161 V_(j, i) = (U_(i, j)/U_(i, l))/g;
164 for (
label j=l; j<Un; j++)
169 s += U_(i,
k)*V_(
k, j);
174 V_(
k, j) += s*V_(
k, i);
179 for (
label j=l; j<Un;j++)
181 V_(i, j) = V_(j, i) = 0.0;
190 for (
label i=
min(Un, Um) - 1; i>=0; i--)
195 for (
label j=l; j<Un; j++)
204 for (
label j=l; j<Un; j++)
209 s += U_(
k, i)*U_(
k, j);
212 scalar
f = (s/U_(i, i))*g;
216 U_(
k, j) += f*U_(
k, i);
220 for (
label j=i; j<Um; j++)
227 for (
label j=i; j<Um; j++)
238 for (
label its = 0; its < 35; its++)
243 for (l =
k; l >= 0; l--)
246 if (
mag(rv1[l]) + anorm == anorm)
251 if (
mag(S_[mn]) + anorm == anorm)
break;
258 for (
label i=l; i<
k+1; i++)
263 if (
mag(f) + anorm == anorm)
break;
272 for (
label j=0; j<Um; j++)
274 scalar
y = U_[j][mn];
276 U_[j][mn] = y*c + z*
s;
277 U_(j, i) = z*c - y*
s;
290 for (
label j=0; j<Un; j++) V_(j,
k) = -V_(j,
k);
297 <<
"No convergence in 35 SVD iterations" 306 scalar
f = ((y - z)*(y + z) + (g -
h)*(g + h))/(2.0*h*y);
308 f = ((x - z)*(x + z) + h*((y/(f + sign(g, f))) -
h))/
x;
312 for (
label j=l; j <= mn; j++)
328 for (
label jj = 0; jj < Un; jj++)
332 V_[jj][j] = x*c + z*
s;
333 V_[jj][i] = z*c - x*
s;
347 for (
label jj=0; jj < Um; jj++)
351 U_[jj][j] = y*c + z*
s;
352 U_[jj][i] = z*c - y*
s;
362 const scalar minS = minCondition*S_[
findMax(S_)];
#define forAll(list, i)
Loop across all elements in list.
void multiply(FieldField< Field, Type > &f, const FieldField< Field, Type > &f1, const FieldField< Field, scalar > &f2)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Form T() const
Return the transpose of the matrix.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
dimensionedScalar sqrt(const dimensionedScalar &ds)
Ostream & endl(Ostream &os)
Add newline and flush stream.
label m() const
Return the number of rows.
label k
Boltzmann constant.
label n() const
Return the number of columns.
Various functions to operate on Lists.
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))
Scalar sqrtSumSqr(const Scalar a, const Scalar b)
label findMax(const ListType &, const label start=0)
Find index of max element (and larger than given element).
const dimensionedVector & g
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
const dimensionedScalar h
Planck constant.
#define WarningInFunction
Report a warning using Foam::Warning.
const dimensionedScalar c
Speed of light in a vacuum.
dimensioned< scalar > mag(const dimensioned< Type > &)