示例#1
0
Foam::scalar Foam::det(SquareMatrix<Type>& matrix)
{
    labelList pivotIndices(matrix.n());
    label sign;
    LUDecompose(matrix, pivotIndices, sign);

    return detDecomposed(matrix, sign);
}
示例#2
0
Foam::scalar Foam::det(const SquareMatrix<Type>& matrix)
{
    SquareMatrix<Type> matrixTmp = matrix;

    labelList pivotIndices(matrix.n());
    label sign;
    LUDecompose(matrixTmp, pivotIndices, sign);

    return detDecomposed(matrixTmp, sign);
}
示例#3
0
Foam::scalar Foam::detDecomposed
(
    const SquareMatrix<Type>& matrix,
    const label sign
)
{
    scalar diagProduct = 1.0;

    for (label i = 0; i < matrix.n(); ++i)
    {
        diagProduct *= matrix[i][i];
    }

    return sign*diagProduct;
}