Class LinearAlgebra


  • public class LinearAlgebra
    extends java.lang.Object
    Collection of Linear Algebra functions
    • Constructor Detail

      • LinearAlgebra

        public LinearAlgebra​(long cPtr,
                             boolean cMemoryOwn)
      • LinearAlgebra

        public LinearAlgebra()
    • Method Detail

      • delete

        public void delete()
      • svd

        public static void svd​(EigenMatrixXd M,
                               EigenMatrixXd U,
                               EigenVectorXd sigma,
                               EigenMatrixXd V)
        Performs a singular value decomposition (SVD)

        The SVD computes the decomposition
        \mathbf{M}=\mathbf{U}*\mathbf{DiagonalMatrix(\sigma)}*\mathbf{V}^T .

        Parameters:
        M - [in] the matrix to decomposite
        U - [out] Result matrix \mathbf{U}
        sigma - [out] The \mathbf{sigma} vector with diagonal elements
        V - [out] Result matrix \mathbf{V}
      • pseudoInverse

        public static EigenMatrixXd pseudoInverse​(EigenMatrixXd am,
                                                  double precision)
        Calculates the moore-penrose (pseudo) inverse of a matrix
        \mathbf{M}^+

        Parameters:
        am - [in] the matrix \mathbf{M} to be inverted

        precision - [in] the precision to use, values below this
        treshold are considered singular

        Returns:
        the pseudo-inverse \mathbf{M}^+ of \mathbf{M}

        \mathbf{M}^+=\mathbf{V}\mathbf{\Sigma} ^+\mathbf{U}^T where
        \mathbf{V} , \mathbf{\Sigma} and \mathbf{U}
        are optained using Singular Value Decomposition (SVD)
      • pseudoInverse

        public static EigenMatrixXd pseudoInverse​(EigenMatrixXd am)
        Calculates the moore-penrose (pseudo) inverse of a matrix
        \mathbf{M}^+

        Parameters:
        am - [in] the matrix \mathbf{M} to be inverted



        Returns:
        the pseudo-inverse \mathbf{M}^+ of \mathbf{M}

        \mathbf{M}^+=\mathbf{V}\mathbf{\Sigma} ^+\mathbf{U}^T where
        \mathbf{V} , \mathbf{\Sigma} and \mathbf{U}
        are optained using Singular Value Decomposition (SVD)
      • checkPenroseConditions

        public static boolean checkPenroseConditions​(EigenMatrixXd A,
                                                     EigenMatrixXd X,
                                                     double prec)
        Checks the penrose conditions
        Parameters:
        A - [in] a matrix
        X - [in] a pseudoinverse of A
        prec - [in] the tolerance

        Returns:
        true if the pseudoinverse X of A fullfills the penrose
        conditions, false otherwise

        Checks the penrose conditions:

        AXA = A

        XAX = X

        (AX)^T = AX

        (XA)^T = XA