Package org.ejml.dense.row.misc
Class NaiveDeterminant
java.lang.Object
org.ejml.dense.row.misc.NaiveDeterminant
Computes the determinant using different very simple and computationally expensive algorithms.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic doubleleibniz(org.ejml.data.DMatrixRMaj mat) Computes the determinant of the matrix using Leibniz's formulastatic doublerecursive(org.ejml.data.DMatrixRMaj mat) A simple and inefficient algorithm for computing the determinant.static floatrecursive(org.ejml.data.FMatrixRMaj mat)
-
Constructor Details
-
NaiveDeterminant
public NaiveDeterminant()
-
-
Method Details
-
leibniz
public static double leibniz(org.ejml.data.DMatrixRMaj mat) Computes the determinant of the matrix using Leibniz's formula
A direct implementation of Leibniz determinant equation. This is of little practical use because of its slow runtime of O(n!) where n is the width of the matrix. LU decomposition should be used instead. One advantage of Leibniz's equation is how simplistic it is.
det(A) = Sum( σ in Sn ; sgn(σ) Prod( i = 1 to n ; ai,σ(i)) )
- sgn is the sign function of permutations. +1 or -1 for even and odd permutations
- a set of permutations. if n=3 then the possible permutations are (1,2,3) (1,3,2), (3,2,1), ... etc
- Parameters:
mat- The matrix whose determinant is computed.- Returns:
- The value of the determinant
-
recursive
public static double recursive(org.ejml.data.DMatrixRMaj mat) A simple and inefficient algorithm for computing the determinant. This should never be used. It is at least two orders of magnitude slower than
DeterminantFromMinor_DDRM. This is included to provide a point of comparison for other algorithms.- Parameters:
mat- The matrix that the determinant is to be computed from- Returns:
- The determinant.
-
recursive
public static float recursive(org.ejml.data.FMatrixRMaj mat)
-