Skip navigation links
org.jscience.mathematics.vector

Class LUDecomposition<F extends Field<F>>

    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.util.Comparator<Field> NUMERIC_COMPARATOR
      Holds the default comparator for pivoting.
    • Field Detail

      • NUMERIC_COMPARATOR

        public static final java.util.Comparator<Field> NUMERIC_COMPARATOR
        Holds the default comparator for pivoting.
    • Method Detail

      • valueOf

        public static <F extends Field<F>> LUDecomposition<F> valueOf(Matrix<F> source)
        Returns the lower/upper decomposition of the specified matrix.
        Parameters:
        source - the matrix for which the decomposition is calculated.
        Returns:
        the lower/upper decomposition of the specified matrix.
        Throws:
        DimensionException - if the specified matrix is not square.
      • setPivotComparator

        public static void setPivotComparator(java.util.Comparator<Field> cmp)
        Sets the local comparator used for pivoting or null to disable pivoting.
        Parameters:
        cmp - the comparator for pivoting or null.
      • getPivotComparator

        public static java.util.Comparator<FieldgetPivotComparator()
        Returns the local comparator used for pivoting or null if pivoting is not performed (default NUMERIC_COMPARATOR).
        Returns:
        the comparator for pivoting or null.
      • solve

        public DenseMatrix<Fsolve(Matrix<F> B)
        Returns the solution X of the equation: A * X = B with this = A.lu() using back and forward substitutions.
        Parameters:
        B - the input matrix.
        Returns:
        the solution X = (1 / A) * B.
        Throws:
        DimensionException - if the dimensions do not match.
      • inverse

        public DenseMatrix<Finverse()
        Returns the solution X of the equation: A * X = Identity with this = A.lu() using back and forward substitutions.
        Returns:
        this.solve(Identity)
      • determinant

        public F determinant()
        Returns the determinant of the Matrix having this decomposition.
        Returns:
        the determinant of the matrix source.
      • getLower

        public DenseMatrix<FgetLower(F zero,
                                       F one)
        Returns the lower matrix decomposition (L) with diagonal elements equal to the multiplicative identity for F.
        Parameters:
        zero - the additive identity for F.
        one - the multiplicative identity for F.
        Returns:
        the lower matrix.
      • getUpper

        public DenseMatrix<FgetUpper(F zero)
        Returns the upper matrix decomposition (U).
        Parameters:
        zero - the additive identity for F.
        Returns:
        the upper matrix.
      • getPermutation

        public SparseMatrix<FgetPermutation(F zero,
                                              F one)
        Returns the permutation matrix (P).
        Parameters:
        zero - the additive identity for F.
        one - the multiplicative identity for F.
        Returns:
        the permutation matrix.
      • getLU

        public DenseMatrix<FgetLU()
        Returns the lower/upper decomposition in one single matrix.
        Returns:
        the lower/upper matrix merged in a single matrix.
      • getPivots

        public <any> getPivots()
        Returns the pivots elements of this decomposition.
        Returns:
        the row indices after permutation.