chsvlib
chsv helper source code

◆ Det()

value_type Det ( ) const

Calculates the determinant of the matrix.

Returns
The determinant of the current matrix.

The method is implemented differently for different algebraic structures that can be implemented by the value_type type. If the type does not define multiplicative identity and multiplicative inversion, the only way to calculate the determinant is use its fundamental definition involving permutations of elements which requires \(O(n!)\) operations, where \(n\) is a dimension of the matrix.

On the other hand, if both multiplicative identity and multiplicative inversion is defined for elements of matrix, it is possible to use Gaussian elimination for the calculation which has \(O({n}^{3})\) complexity. For this the method calls RowEchelonMe method, see it for the details.

Note
In any way the multiplication defined over value_type must be commutative for the method to be available, because otherwise the determinant would not be unique and sole.
Exceptions
Chusov::Exceptions::InvalidParameterExceptionThe current matrix is not square