本文整理汇总了C++中DiagonalMatrix::size方法的典型用法代码示例。如果您正苦于以下问题:C++ DiagonalMatrix::size方法的具体用法?C++ DiagonalMatrix::size怎么用?C++ DiagonalMatrix::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DiagonalMatrix
的用法示例。
在下文中一共展示了DiagonalMatrix::size方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: abort
void Foam::multiply
(
scalarRectangularMatrix& ans, // value changed in return
const scalarRectangularMatrix& A,
const DiagonalMatrix<scalar>& B,
const scalarRectangularMatrix& C
)
{
if (A.m() != B.size())
{
FatalErrorIn
(
"multiply("
"const scalarRectangularMatrix& A, "
"const DiagonalMatrix<scalar>& B, "
"const scalarRectangularMatrix& C, "
"scalarRectangularMatrix& answer)"
) << "A and B must have identical inner dimensions but A.m = "
<< A.m() << " and B.n = " << B.size()
<< abort(FatalError);
}
if (B.size() != C.n())
{
FatalErrorIn
(
"multiply("
"const scalarRectangularMatrix& A, "
"const DiagonalMatrix<scalar>& B, "
"const scalarRectangularMatrix& C, "
"scalarRectangularMatrix& answer)"
) << "B and C must have identical inner dimensions but B.m = "
<< B.size() << " and C.n = " << C.n()
<< abort(FatalError);
}
ans = scalarRectangularMatrix(A.n(), C.m(), scalar(0));
for(register label i = 0; i < A.n(); i++)
{
for(register label g = 0; g < C.m(); g++)
{
for(register label l = 0; l < C.n(); l++)
{
ans[i][g] += C[l][g] * A[i][l]*B[l];
}
}
}
}
示例2: Matrix
TEST(CholeskyTest, testCholesky)
{
Matrix A = Matrix(3,3,false);
A.fillWithArgs(
2.0,-1.0, 1.0,
-1.0, 2.0,-1.0,
1.0,-1.0, 2.0 );
/* A.fillWithArgs(
2.0, 0.0, 0.0,
0.0, 2.0, 0.0,
0.0, 0.0, 2.0 );*/
cout << "Input Matrix:" << endl << A << endl;
Matrix *U;
DiagonalMatrix *D;
Cholesky::udutDecompose(&A, &U, &D);
cout << *U;
cout << endl << "[";
for (int i = 0; i < D->size(); i++)
{
cout << D->at(i) << " ";
}
cout << "]" << endl;
UpperUnitaryMatrix *U1;
DiagonalMatrix *D1;
Cholesky::udutDecompose(&A,&U1,&D1);
cout << *U1;
cout << endl << "[";
for (int i = 0; i < D->size(); i++)
{
cout << D->at(i) << " ";
}
cout << "]" << endl;
delete U;
delete U1;
delete D;
delete D1;
}