Class CommonOps_FSCC


  • public class CommonOps_FSCC
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      CommonOps_FSCC()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void add​(float alpha, org.ejml.data.FMatrixSparseCSC A, float beta, org.ejml.data.FMatrixSparseCSC B, org.ejml.data.FMatrixSparseCSC C, org.ejml.data.IGrowArray gw, org.ejml.data.FGrowArray gx)
      Performs matrix addition:
      C = αA + βB
      static void changeSign​(org.ejml.data.FMatrixSparseCSC A, org.ejml.data.FMatrixSparseCSC B)
      B = -A.
      static boolean checkDuplicateElements​(org.ejml.data.FMatrixSparseCSC A)
      Checks for duplicate elements.
      static boolean checkIndicesSorted​(org.ejml.data.FMatrixSparseCSC A)
      Checks to see if row indicies are sorted into ascending order.
      static boolean checkSortedFlag​(org.ejml.data.FMatrixSparseCSC A)  
      static boolean checkStructure​(org.ejml.data.FMatrixSparseCSC A)  
      static void columnMaxAbs​(org.ejml.data.FMatrixSparseCSC A, float[] values)
      Finds the maximum abs in each column of A and stores it into values
      static org.ejml.data.FMatrixSparseCSC concatColumns​(org.ejml.data.FMatrixSparseCSC left, org.ejml.data.FMatrixSparseCSC right, org.ejml.data.FMatrixSparseCSC out)
      Concats two matrices along their columns (horizontal).
      static org.ejml.data.FMatrixSparseCSC concatRows​(org.ejml.data.FMatrixSparseCSC top, org.ejml.data.FMatrixSparseCSC bottom, org.ejml.data.FMatrixSparseCSC out)
      Concats two matrices along their rows (vertical).
      static float det​(org.ejml.data.FMatrixSparseCSC A)
      Returns the determinant of the matrix.
      static org.ejml.data.FMatrixSparseCSC diag​(float... values)
      Returns a diagonal matrix with the specified diagonal elements.
      static org.ejml.data.FMatrixSparseCSC diag​(org.ejml.data.FMatrixSparseCSC A, float[] values, int offset, int length)
      Creates a diagonal matrix from an array.
      static void divide​(float scalar, org.ejml.data.FMatrixSparseCSC A, org.ejml.data.FMatrixSparseCSC B)
      B = scalar/A.
      static void divide​(org.ejml.data.FMatrixSparseCSC A, float scalar, org.ejml.data.FMatrixSparseCSC B)
      B = A/scalar.
      static void divideColumns​(org.ejml.data.FMatrixSparseCSC A, float[] values, int offset)
      Divides all elements of column 'i' by values[i].
      static void divideRows​(float[] diag, int offset, org.ejml.data.FMatrixSparseCSC A)
      Divides all elements of row 'i' by value[i].
      static void divideRowsCols​(float[] diagA, int offsetA, org.ejml.data.FMatrixSparseCSC B, float[] diagC, int offsetC)
      Equivalent to multiplying a matrix B by the inverse of two diagonal matrices.
      static float dotInnerColumns​(org.ejml.data.FMatrixSparseCSC A, int colA, org.ejml.data.FMatrixSparseCSC B, int colB, org.ejml.data.IGrowArray gw, org.ejml.data.FGrowArray gx)
      Computes the inner product of two column vectors taken from the input matrices.
      static float elementMax​(org.ejml.data.FMatrixSparseCSC A)
      Returns the value of the element with the largest value
      static float elementMaxAbs​(org.ejml.data.FMatrixSparseCSC A)
      Returns the value of the element with the largest abs()
      static float elementMin​(org.ejml.data.FMatrixSparseCSC A)
      Returns the value of the element with the minimum value
      static float elementMinAbs​(org.ejml.data.FMatrixSparseCSC A)
      Returns the value of the element with the smallest abs()
      static void elementMult​(org.ejml.data.FMatrixSparseCSC A, org.ejml.data.FMatrixSparseCSC B, org.ejml.data.FMatrixSparseCSC C, org.ejml.data.IGrowArray gw, org.ejml.data.FGrowArray gx)
      Performs an element-wise multiplication.
      C[i,j] = A[i,j]*B[i,j]
      All matrices must have the same shape.
      static float elementSum​(org.ejml.data.FMatrixSparseCSC A)
      Sum of all elements
      static void extract​(org.ejml.data.FMatrixSparseCSC src, int srcY0, int srcY1, int srcX0, int srcX1, org.ejml.data.FMatrixSparseCSC dst, int dstY0, int dstX0)
      Extracts a submatrix from 'src' and inserts it in a submatrix in 'dst'.
      static org.ejml.data.FMatrixSparseCSC extractColumn​(org.ejml.data.FMatrixSparseCSC A, int column, org.ejml.data.FMatrixSparseCSC out)
      Extracts a column from A and stores it into out.
      static void extractDiag​(org.ejml.data.FMatrixSparseCSC src, org.ejml.data.FMatrixRMaj dst)
      Extracts the diagonal elements 'src' write it to the 'dst' vector.
      static void extractDiag​(org.ejml.data.FMatrixSparseCSC src, org.ejml.data.FMatrixSparseCSC dst)
      Extracts the diagonal elements 'src' write it to the 'dst' vector.
      static org.ejml.data.FMatrixSparseCSC extractRows​(org.ejml.data.FMatrixSparseCSC A, int row0, int row1, org.ejml.data.FMatrixSparseCSC out)
      Creates a submatrix by extracting the specified rows from A.
      static void fill​(org.ejml.data.FMatrixSparseCSC A, float value)
      Sets every element in the matrix to the specified value.
      static org.ejml.data.FMatrixSparseCSC identity​(int length)  
      static org.ejml.data.FMatrixSparseCSC identity​(int numRows, int numCols)  
      static void innerProductLower​(org.ejml.data.FMatrixSparseCSC A, org.ejml.data.FMatrixSparseCSC B, org.ejml.data.IGrowArray gw, org.ejml.data.FGrowArray gx)
      Computes the inner product of A times A and stores the results in B.
      static boolean invert​(org.ejml.data.FMatrixSparseCSC A, org.ejml.data.FMatrixRMaj inverse)
      Performs a matrix inversion operation that does not modify the original and stores the results in another matrix.
      static org.ejml.data.FMatrixRMaj maxCols​(org.ejml.data.FMatrixSparseCSC input, org.ejml.data.FMatrixRMaj output)
      Computes the maximums of each column in the input matrix and returns the results in a vector:

      bj = max(i=1:m ; aij)
      static org.ejml.data.FMatrixRMaj maxRows​(org.ejml.data.FMatrixSparseCSC input, org.ejml.data.FMatrixRMaj output, org.ejml.data.IGrowArray gw)
      Computes the maximum of each row in the input matrix and returns the results in a vector:

      bj = max(i=1:n ; aji)
      static org.ejml.data.FMatrixRMaj minCols​(org.ejml.data.FMatrixSparseCSC input, org.ejml.data.FMatrixRMaj output)
      Computes the minimum of each column in the input matrix and returns the results in a vector:

      bj = min(i=1:m ; aij)
      static org.ejml.data.FMatrixRMaj minRows​(org.ejml.data.FMatrixSparseCSC input, org.ejml.data.FMatrixRMaj output, org.ejml.data.IGrowArray gw)
      Computes the minimum of each row in the input matrix and returns the results in a vector:

      bj = min(i=1:n ; aji)
      static void mult​(org.ejml.data.FMatrixSparseCSC A, org.ejml.data.FMatrixRMaj B, org.ejml.data.FMatrixRMaj C)
      Performs matrix multiplication.
      static void mult​(org.ejml.data.FMatrixSparseCSC A, org.ejml.data.FMatrixSparseCSC B, org.ejml.data.FMatrixSparseCSC C)  
      static void mult​(org.ejml.data.FMatrixSparseCSC A, org.ejml.data.FMatrixSparseCSC B, org.ejml.data.FMatrixSparseCSC C, org.ejml.data.IGrowArray gw, org.ejml.data.FGrowArray gx)
      Performs matrix multiplication.
      static void multAdd​(org.ejml.data.FMatrixSparseCSC A, org.ejml.data.FMatrixRMaj B, org.ejml.data.FMatrixRMaj C)
      C = C + A*B
      static void multAddTransA​(org.ejml.data.FMatrixSparseCSC A, org.ejml.data.FMatrixRMaj B, org.ejml.data.FMatrixRMaj C)
      C = C + AT*B
      static void multAddTransAB​(org.ejml.data.FMatrixSparseCSC A, org.ejml.data.FMatrixRMaj B, org.ejml.data.FMatrixRMaj C)
      C = C + AT*BT
      static void multAddTransB​(org.ejml.data.FMatrixSparseCSC A, org.ejml.data.FMatrixRMaj B, org.ejml.data.FMatrixRMaj C)
      C = C + A*BT
      static void multColumns​(org.ejml.data.FMatrixSparseCSC A, float[] values, int offset)
      Multiply all elements of column 'i' by value[i].
      static void multRows​(float[] diag, int offset, org.ejml.data.FMatrixSparseCSC A)
      Multiply all elements of row 'i' by value[i].
      static void multRowsCols​(float[] diagA, int offsetA, org.ejml.data.FMatrixSparseCSC B, float[] diagC, int offsetC)
      Equivalent to multiplying a matrix B by two diagonal matrices.
      static void multTransA​(org.ejml.data.FMatrixSparseCSC A, org.ejml.data.FMatrixRMaj B, org.ejml.data.FMatrixRMaj C)
      Performs matrix multiplication.
      static void multTransA​(org.ejml.data.FMatrixSparseCSC A, org.ejml.data.FMatrixSparseCSC B, org.ejml.data.FMatrixSparseCSC C, org.ejml.data.IGrowArray gw, org.ejml.data.FGrowArray gx)  
      static void multTransAB​(org.ejml.data.FMatrixSparseCSC A, org.ejml.data.FMatrixRMaj B, org.ejml.data.FMatrixRMaj C)
      Performs matrix multiplication.
      static void multTransB​(org.ejml.data.FMatrixSparseCSC A, org.ejml.data.FMatrixRMaj B, org.ejml.data.FMatrixRMaj C)
      Performs matrix multiplication.
      static void multTransB​(org.ejml.data.FMatrixSparseCSC A, org.ejml.data.FMatrixSparseCSC B, org.ejml.data.FMatrixSparseCSC C, org.ejml.data.IGrowArray gw, org.ejml.data.FGrowArray gx)
      Performs matrix multiplication.
      static int[] permutationInverse​(int[] original, int length)  
      static void permutationInverse​(int[] original, int[] inverse, int length)
      Computes the inverse permutation vector
      static org.ejml.data.FMatrixSparseCSC permutationMatrix​(int[] p, boolean inverse, int N, org.ejml.data.FMatrixSparseCSC P)
      Converts the permutation vector into a matrix.
      static void permutationVector​(org.ejml.data.FMatrixSparseCSC P, int[] vector)
      Converts the permutation matrix into a vector
      static void permute​(int[] perm, float[] input, float[] output, int N)
      Permutes a vector.
      static void permute​(int[] permRowInv, org.ejml.data.FMatrixSparseCSC input, int[] permCol, org.ejml.data.FMatrixSparseCSC output)
      Applies the forward column and inverse row permutation specified by the two vector to the input matrix and save the results in the output matrix.
      static void permuteInv​(int[] perm, float[] input, float[] output, int N)
      Permutes a vector in the inverse.
      static void permuteRowInv​(int[] permInv, org.ejml.data.FMatrixSparseCSC input, org.ejml.data.FMatrixSparseCSC output)
      Applies the row permutation specified by the vector to the input matrix and save the results in the output matrix.
      static void permuteSymmetric​(org.ejml.data.FMatrixSparseCSC input, int[] permInv, org.ejml.data.FMatrixSparseCSC output, org.ejml.data.IGrowArray gw)
      Applies the permutation to upper triangular symmetric matrices.
      static void removeZeros​(org.ejml.data.FMatrixSparseCSC A, float tol)
      Removes all elements from the matrix that are > tol.
      static void removeZeros​(org.ejml.data.FMatrixSparseCSC input, org.ejml.data.FMatrixSparseCSC output, float tol)
      Copies all elements from input into output which are > tol.
      static void scale​(float scalar, org.ejml.data.FMatrixSparseCSC A, org.ejml.data.FMatrixSparseCSC B)
      B = scalar*A.
      static void setIdentity​(org.ejml.data.FMatrixSparseCSC A)  
      static boolean solve​(org.ejml.data.FMatrixSparseCSC a, org.ejml.data.FMatrixRMaj b, org.ejml.data.FMatrixRMaj x)
      Solves for x in the following equation:

      A*x = b
      static boolean solve​(org.ejml.data.FMatrixSparseCSC a, org.ejml.data.FMatrixSparseCSC b, org.ejml.data.FMatrixSparseCSC x)
      Solves for x in the following equation:

      A*x = b
      static org.ejml.data.FMatrixRMaj sumCols​(org.ejml.data.FMatrixSparseCSC input, org.ejml.data.FMatrixRMaj output)
      Computes the sum of each column in the input matrix and returns the results in a vector:

      bj = sum(i=1:m ; aij)
      static org.ejml.data.FMatrixRMaj sumRows​(org.ejml.data.FMatrixSparseCSC input, org.ejml.data.FMatrixRMaj output)
      Computes the sum of each row in the input matrix and returns the results in a vector:

      bj = sum(i=1:n ; aji)
      static void symmLowerToFull​(org.ejml.data.FMatrixSparseCSC A, org.ejml.data.FMatrixSparseCSC B, org.ejml.data.IGrowArray gw)
      Given a symmetric matrix, which is represented by a lower triangular matrix, convert it back into a full symmetric matrix
      static float trace​(org.ejml.data.FMatrixSparseCSC A)
      This computes the trace of the matrix:

      trace = ∑i=1:n { aii }
      where n = min(numRows,numCols)
      static org.ejml.data.FMatrixSparseCSC transpose​(org.ejml.data.FMatrixSparseCSC a, org.ejml.data.FMatrixSparseCSC a_t, org.ejml.data.IGrowArray gw)
      Perform matrix transpose
      static void zero​(org.ejml.data.FMatrixSparseCSC A, int row0, int row1, int col0, int col1)
      Zeros an inner rectangle inside the matrix.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CommonOps_FSCC

        public CommonOps_FSCC()
    • Method Detail

      • checkIndicesSorted

        public static boolean checkIndicesSorted​(org.ejml.data.FMatrixSparseCSC A)
        Checks to see if row indicies are sorted into ascending order. O(N)
        Returns:
        true if sorted and false if not
      • checkStructure

        public static boolean checkStructure​(org.ejml.data.FMatrixSparseCSC A)
      • checkSortedFlag

        public static boolean checkSortedFlag​(org.ejml.data.FMatrixSparseCSC A)
      • checkDuplicateElements

        public static boolean checkDuplicateElements​(org.ejml.data.FMatrixSparseCSC A)
        Checks for duplicate elements. A is sorted
        Parameters:
        A - Matrix to be tested.
        Returns:
        true if duplicates or false if false duplicates
      • transpose

        public static org.ejml.data.FMatrixSparseCSC transpose​(org.ejml.data.FMatrixSparseCSC a,
                                                               @Nullable
                                                               org.ejml.data.FMatrixSparseCSC a_t,
                                                               @Nullable
                                                               org.ejml.data.IGrowArray gw)
        Perform matrix transpose
        Parameters:
        a - Input matrix. Not modified
        a_t - Storage for transpose of 'a'. Must be correct shape. data length might be adjusted.
        gw - (Optional) Storage for internal workspace. Can be null.
        Returns:
        The transposed matrix
      • mult

        public static void mult​(org.ejml.data.FMatrixSparseCSC A,
                                org.ejml.data.FMatrixSparseCSC B,
                                org.ejml.data.FMatrixSparseCSC C)
      • mult

        public static void mult​(org.ejml.data.FMatrixSparseCSC A,
                                org.ejml.data.FMatrixSparseCSC B,
                                org.ejml.data.FMatrixSparseCSC C,
                                @Nullable
                                org.ejml.data.IGrowArray gw,
                                @Nullable
                                org.ejml.data.FGrowArray gx)
        Performs matrix multiplication. C = A*B
        Parameters:
        A - (Input) Matrix. Not modified.
        B - (Input) Matrix. Not modified.
        C - (Output) Storage for results. Data length is increased if increased if insufficient.
        gw - (Optional) Storage for internal workspace. Can be null.
        gx - (Optional) Storage for internal workspace. Can be null.
      • multTransA

        public static void multTransA​(org.ejml.data.FMatrixSparseCSC A,
                                      org.ejml.data.FMatrixSparseCSC B,
                                      org.ejml.data.FMatrixSparseCSC C,
                                      @Nullable
                                      org.ejml.data.IGrowArray gw,
                                      @Nullable
                                      org.ejml.data.FGrowArray gx)
      • multTransB

        public static void multTransB​(org.ejml.data.FMatrixSparseCSC A,
                                      org.ejml.data.FMatrixSparseCSC B,
                                      org.ejml.data.FMatrixSparseCSC C,
                                      @Nullable
                                      org.ejml.data.IGrowArray gw,
                                      @Nullable
                                      org.ejml.data.FGrowArray gx)
        Performs matrix multiplication. C = A*BT. B needs to be sorted and will be sorted if it has not already been sorted.
        Parameters:
        A - (Input) Matrix. Not modified.
        B - (Input) Matrix. Value not modified but indicies will be sorted if not sorted already.
        C - (Output) Storage for results. Data length is increased if increased if insufficient.
        gw - (Optional) Storage for internal workspace. Can be null.
        gx - (Optional) Storage for internal workspace. Can be null.
      • mult

        public static void mult​(org.ejml.data.FMatrixSparseCSC A,
                                org.ejml.data.FMatrixRMaj B,
                                org.ejml.data.FMatrixRMaj C)
        Performs matrix multiplication. C = A*B
        Parameters:
        A - Matrix
        B - Dense Matrix
        C - Dense Matrix
      • multAdd

        public static void multAdd​(org.ejml.data.FMatrixSparseCSC A,
                                   org.ejml.data.FMatrixRMaj B,
                                   org.ejml.data.FMatrixRMaj C)

        C = C + A*B

      • multTransA

        public static void multTransA​(org.ejml.data.FMatrixSparseCSC A,
                                      org.ejml.data.FMatrixRMaj B,
                                      org.ejml.data.FMatrixRMaj C)
        Performs matrix multiplication. C = AT*B
        Parameters:
        A - Matrix
        B - Dense Matrix
        C - Dense Matrix
      • multAddTransA

        public static void multAddTransA​(org.ejml.data.FMatrixSparseCSC A,
                                         org.ejml.data.FMatrixRMaj B,
                                         org.ejml.data.FMatrixRMaj C)

        C = C + AT*B

      • multTransB

        public static void multTransB​(org.ejml.data.FMatrixSparseCSC A,
                                      org.ejml.data.FMatrixRMaj B,
                                      org.ejml.data.FMatrixRMaj C)
        Performs matrix multiplication. C = A*BT
        Parameters:
        A - Matrix
        B - Dense Matrix
        C - Dense Matrix
      • multAddTransB

        public static void multAddTransB​(org.ejml.data.FMatrixSparseCSC A,
                                         org.ejml.data.FMatrixRMaj B,
                                         org.ejml.data.FMatrixRMaj C)

        C = C + A*BT

      • multTransAB

        public static void multTransAB​(org.ejml.data.FMatrixSparseCSC A,
                                       org.ejml.data.FMatrixRMaj B,
                                       org.ejml.data.FMatrixRMaj C)
        Performs matrix multiplication. C = AT*BT
        Parameters:
        A - Matrix
        B - Dense Matrix
        C - Dense Matrix
      • multAddTransAB

        public static void multAddTransAB​(org.ejml.data.FMatrixSparseCSC A,
                                          org.ejml.data.FMatrixRMaj B,
                                          org.ejml.data.FMatrixRMaj C)

        C = C + AT*BT

      • innerProductLower

        public static void innerProductLower​(org.ejml.data.FMatrixSparseCSC A,
                                             org.ejml.data.FMatrixSparseCSC B,
                                             @Nullable
                                             org.ejml.data.IGrowArray gw,
                                             @Nullable
                                             org.ejml.data.FGrowArray gx)
        Computes the inner product of A times A and stores the results in B. The inner product is symmetric and this function will only store the lower triangle. If the full matrix is needed then. If you need the full matrix use symmLowerToFull(org.ejml.data.FMatrixSparseCSC, org.ejml.data.FMatrixSparseCSC, org.ejml.data.IGrowArray).

        B = AT*A

        Parameters:
        A - (Input) Matrix
        B - (Output) Storage for output.
        gw - (Optional) Workspace
        gx - (Optional) Workspace
      • symmLowerToFull

        public static void symmLowerToFull​(org.ejml.data.FMatrixSparseCSC A,
                                           org.ejml.data.FMatrixSparseCSC B,
                                           @Nullable
                                           org.ejml.data.IGrowArray gw)
        Given a symmetric matrix, which is represented by a lower triangular matrix, convert it back into a full symmetric matrix
        Parameters:
        A - (Input) Lower triangular matrix
        B - (Output) Symmetric matrix.
        gw - (Optional) Workspace. Can be null.
      • add

        public static void add​(float alpha,
                               org.ejml.data.FMatrixSparseCSC A,
                               float beta,
                               org.ejml.data.FMatrixSparseCSC B,
                               org.ejml.data.FMatrixSparseCSC C,
                               @Nullable
                               org.ejml.data.IGrowArray gw,
                               @Nullable
                               org.ejml.data.FGrowArray gx)
        Performs matrix addition:
        C = αA + βB
        Parameters:
        alpha - scalar value multiplied against A
        A - Matrix
        beta - scalar value multiplied against B
        B - Matrix
        C - Output matrix.
        gw - (Optional) Storage for internal workspace. Can be null.
        gx - (Optional) Storage for internal workspace. Can be null.
      • identity

        public static org.ejml.data.FMatrixSparseCSC identity​(int length)
      • identity

        public static org.ejml.data.FMatrixSparseCSC identity​(int numRows,
                                                              int numCols)
      • setIdentity

        public static void setIdentity​(org.ejml.data.FMatrixSparseCSC A)
      • scale

        public static void scale​(float scalar,
                                 org.ejml.data.FMatrixSparseCSC A,
                                 org.ejml.data.FMatrixSparseCSC B)
        B = scalar*A. A and B can be the same instance.
        Parameters:
        scalar - (Input) Scalar value
        A - (Input) Matrix. Not modified.
        B - (Output) Matrix. Modified.
      • divide

        public static void divide​(org.ejml.data.FMatrixSparseCSC A,
                                  float scalar,
                                  org.ejml.data.FMatrixSparseCSC B)
        B = A/scalar. A and B can be the same instance.
        Parameters:
        scalar - (Input) Scalar value
        A - (Input) Matrix. Not modified.
        B - (Output) Matrix. Modified.
      • divide

        public static void divide​(float scalar,
                                  org.ejml.data.FMatrixSparseCSC A,
                                  org.ejml.data.FMatrixSparseCSC B)
        B = scalar/A. A and B can be the same instance. Only non-zero values are affected
        Parameters:
        A - (Input) Matrix. Not modified.
        scalar - (Input) Scalar value
        B - (Output) Matrix. Modified.
      • changeSign

        public static void changeSign​(org.ejml.data.FMatrixSparseCSC A,
                                      org.ejml.data.FMatrixSparseCSC B)
        B = -A. Changes the sign of elements in A and stores it in B. A and B can be the same instance.
        Parameters:
        A - (Input) Matrix. Not modified.
        B - (Output) Matrix. Modified.
      • elementMinAbs

        public static float elementMinAbs​(org.ejml.data.FMatrixSparseCSC A)
        Returns the value of the element with the smallest abs()
        Parameters:
        A - (Input) Matrix. Not modified.
        Returns:
        scalar
      • elementMaxAbs

        public static float elementMaxAbs​(org.ejml.data.FMatrixSparseCSC A)
        Returns the value of the element with the largest abs()
        Parameters:
        A - (Input) Matrix. Not modified.
        Returns:
        scalar
      • elementMin

        public static float elementMin​(org.ejml.data.FMatrixSparseCSC A)
        Returns the value of the element with the minimum value
        Parameters:
        A - (Input) Matrix. Not modified.
        Returns:
        scalar
      • elementMax

        public static float elementMax​(org.ejml.data.FMatrixSparseCSC A)
        Returns the value of the element with the largest value
        Parameters:
        A - (Input) Matrix. Not modified.
        Returns:
        scalar
      • elementSum

        public static float elementSum​(org.ejml.data.FMatrixSparseCSC A)
        Sum of all elements
        Parameters:
        A - (Input) Matrix. Not modified.
        Returns:
        scalar
      • elementMult

        public static void elementMult​(org.ejml.data.FMatrixSparseCSC A,
                                       org.ejml.data.FMatrixSparseCSC B,
                                       org.ejml.data.FMatrixSparseCSC C,
                                       @Nullable
                                       org.ejml.data.IGrowArray gw,
                                       @Nullable
                                       org.ejml.data.FGrowArray gx)
        Performs an element-wise multiplication.
        C[i,j] = A[i,j]*B[i,j]
        All matrices must have the same shape.
        Parameters:
        A - (Input) Matrix.
        B - (Input) Matrix
        C - (Output) Matrix. data array is grown to min(A.nz_length,B.nz_length), resulting a in a large speed boost.
        gw - (Optional) Storage for internal workspace. Can be null.
        gx - (Optional) Storage for internal workspace. Can be null.
      • columnMaxAbs

        public static void columnMaxAbs​(org.ejml.data.FMatrixSparseCSC A,
                                        float[] values)
        Finds the maximum abs in each column of A and stores it into values
        Parameters:
        A - (Input) Matrix
        values - (Output) storage for column max abs
      • multColumns

        public static void multColumns​(org.ejml.data.FMatrixSparseCSC A,
                                       float[] values,
                                       int offset)
        Multiply all elements of column 'i' by value[i]. A[:,i] *= values[i].
        Equivalent to A = A*diag(values)
        Parameters:
        A - (Input/Output) Matrix. Modified.
        values - (Input) multiplication factor for each column
        offset - (Input) first index in values to start at
      • divideColumns

        public static void divideColumns​(org.ejml.data.FMatrixSparseCSC A,
                                         float[] values,
                                         int offset)
        Divides all elements of column 'i' by values[i]. A[:,i] /= values[i].
        Equivalent to A = A*inv(diag(values))
        Parameters:
        A - (Input/Output) Matrix. Modified.
        values - (Input) multiplication factor for each column
        offset - (Input) first index in values to start at
      • multRowsCols

        public static void multRowsCols​(float[] diagA,
                                        int offsetA,
                                        org.ejml.data.FMatrixSparseCSC B,
                                        float[] diagC,
                                        int offsetC)
        Equivalent to multiplying a matrix B by two diagonal matrices. B = A*B*C, where A=diag(a) and C=diag(c).
        Parameters:
        diagA - Array of length offsteA + B.numRows
        offsetA - First index in A
        B - Rectangular matrix
        diagC - Array of length indexC + B.numCols
        offsetC - First index in C
      • divideRowsCols

        public static void divideRowsCols​(float[] diagA,
                                          int offsetA,
                                          org.ejml.data.FMatrixSparseCSC B,
                                          float[] diagC,
                                          int offsetC)
        Equivalent to multiplying a matrix B by the inverse of two diagonal matrices. B = inv(A)*B*inv(C), where A=diag(a) and C=diag(c).
        Parameters:
        diagA - Array of length offsteA + B.numRows
        offsetA - First index in A
        B - Rectangular matrix
        diagC - Array of length indexC + B.numCols
        offsetC - First index in C
      • diag

        public static org.ejml.data.FMatrixSparseCSC diag​(float... values)
        Returns a diagonal matrix with the specified diagonal elements.
        Parameters:
        values - values of diagonal elements
        Returns:
        A diagonal matrix
      • diag

        public static org.ejml.data.FMatrixSparseCSC diag​(@Nullable
                                                          org.ejml.data.FMatrixSparseCSC A,
                                                          float[] values,
                                                          int offset,
                                                          int length)
        Creates a diagonal matrix from an array. Elements in the array can be offset.
        Parameters:
        A - (Optional) Storage for diagonal matrix. If null a new one will be declared.
        values - First index in the diagonal matirx
        length - Length of the diagonal matrix
        offset - First index in values
        Returns:
        The diagonal matrix
      • extractDiag

        public static void extractDiag​(org.ejml.data.FMatrixSparseCSC src,
                                       org.ejml.data.FMatrixSparseCSC dst)

        Extracts the diagonal elements 'src' write it to the 'dst' vector. 'dst' can either be a row or column vector.

        Parameters:
        src - Matrix whose diagonal elements are being extracted. Not modified.
        dst - A vector the results will be written into. Modified.
      • extractDiag

        public static void extractDiag​(org.ejml.data.FMatrixSparseCSC src,
                                       org.ejml.data.FMatrixRMaj dst)

        Extracts the diagonal elements 'src' write it to the 'dst' vector. 'dst' can either be a row or column vector.

        Parameters:
        src - Matrix whose diagonal elements are being extracted. Not modified.
        dst - A vector the results will be written into. Modified.
      • permutationMatrix

        public static org.ejml.data.FMatrixSparseCSC permutationMatrix​(int[] p,
                                                                       boolean inverse,
                                                                       int N,
                                                                       org.ejml.data.FMatrixSparseCSC P)
        Converts the permutation vector into a matrix. B = P*A. B[p[i],:] = A[i,:]
        Parameters:
        p - (Input) Permutation vector
        inverse - (Input) If it is the inverse. B[i,:] = A[p[i],:)
        P - (Output) Permutation matrix
      • permutationVector

        public static void permutationVector​(org.ejml.data.FMatrixSparseCSC P,
                                             int[] vector)
        Converts the permutation matrix into a vector
        Parameters:
        P - (Input) Permutation matrix
        vector - (Output) Permutation vector
      • permutationInverse

        public static void permutationInverse​(int[] original,
                                              int[] inverse,
                                              int length)
        Computes the inverse permutation vector
        Parameters:
        original - Original permutation vector
        inverse - It's inverse
      • permutationInverse

        public static int[] permutationInverse​(int[] original,
                                               int length)
      • permuteRowInv

        public static void permuteRowInv​(int[] permInv,
                                         org.ejml.data.FMatrixSparseCSC input,
                                         org.ejml.data.FMatrixSparseCSC output)
        Applies the row permutation specified by the vector to the input matrix and save the results in the output matrix. output[perm[j],:] = input[j,:]
        Parameters:
        permInv - (Input) Inverse permutation vector. Specifies new order of the rows.
        input - (Input) Matrix which is to be permuted
        output - (Output) Matrix which has the permutation stored in it. Is reshaped.
      • permute

        public static void permute​(@Nullable
                                   int[] permRowInv,
                                   org.ejml.data.FMatrixSparseCSC input,
                                   @Nullable
                                   int[] permCol,
                                   org.ejml.data.FMatrixSparseCSC output)
        Applies the forward column and inverse row permutation specified by the two vector to the input matrix and save the results in the output matrix. output[permRow[j],permCol[i]] = input[j,i]
        Parameters:
        permRowInv - (Input) Inverse row permutation vector. Null is the same as passing in identity.
        input - (Input) Matrix which is to be permuted
        permCol - (Input) Column permutation vector. Null is the same as passing in identity.
        output - (Output) Matrix which has the permutation stored in it. Is reshaped.
      • permute

        public static void permute​(int[] perm,
                                   float[] input,
                                   float[] output,
                                   int N)
        Permutes a vector. output[i] = input[perm[i]]
        Parameters:
        perm - (Input) permutation vector
        input - (Input) Vector which is to be permuted
        output - (Output) Where the permuted vector is stored.
        N - Number of elements in the vector.
      • permuteInv

        public static void permuteInv​(int[] perm,
                                      float[] input,
                                      float[] output,
                                      int N)
        Permutes a vector in the inverse. output[perm[k]] = input[k]
        Parameters:
        perm - (Input) permutation vector
        input - (Input) Vector which is to be permuted
        output - (Output) Where the permuted vector is stored.
        N - Number of elements in the vector.
      • permuteSymmetric

        public static void permuteSymmetric​(org.ejml.data.FMatrixSparseCSC input,
                                            int[] permInv,
                                            org.ejml.data.FMatrixSparseCSC output,
                                            @Nullable
                                            org.ejml.data.IGrowArray gw)
        Applies the permutation to upper triangular symmetric matrices. Typically a symmetric matrix only stores the upper triangular part, so normal permutation will have undesirable results, e.g. the zeros will get mixed in and will no longer be symmetric. This algorithm will handle the implicit lower triangular and construct new upper triangular matrix.

        See page cs_symperm() on Page 22 of "Direct Methods for Sparse Linear Systems"

        Parameters:
        input - (Input) Upper triangular symmetric matrix which is to be permuted. Entries below the diagonal are ignored.
        permInv - (Input) Inverse permutation vector. Specifies new order of the rows and columns.
        output - (Output) Upper triangular symmetric matrix which has the permutation stored in it. Reshaped.
        gw - (Optional) Storage for internal workspace. Can be null.
      • concatRows

        public static org.ejml.data.FMatrixSparseCSC concatRows​(org.ejml.data.FMatrixSparseCSC top,
                                                                org.ejml.data.FMatrixSparseCSC bottom,
                                                                @Nullable
                                                                org.ejml.data.FMatrixSparseCSC out)
        Concats two matrices along their rows (vertical).
        Parameters:
        top - Matrix on the top
        bottom - Matrix on the bototm
        out - (Output) (Optional) Storage for combined matrix. Resized.
        Returns:
        Combination of the two matrices
      • concatColumns

        public static org.ejml.data.FMatrixSparseCSC concatColumns​(org.ejml.data.FMatrixSparseCSC left,
                                                                   org.ejml.data.FMatrixSparseCSC right,
                                                                   @Nullable
                                                                   org.ejml.data.FMatrixSparseCSC out)
        Concats two matrices along their columns (horizontal).
        Parameters:
        left - Matrix on the left
        right - Matrix on the right
        out - (Output) (Optional) Storage for combined matrix. Resized.
        Returns:
        Combination of the two matrices
      • extractColumn

        public static org.ejml.data.FMatrixSparseCSC extractColumn​(org.ejml.data.FMatrixSparseCSC A,
                                                                   int column,
                                                                   @Nullable
                                                                   org.ejml.data.FMatrixSparseCSC out)
        Extracts a column from A and stores it into out.
        Parameters:
        A - (Input) Source matrix. not modified.
        column - The column in A
        out - (Output, Optional) Storage for column vector
        Returns:
        The column of A.
      • extractRows

        public static org.ejml.data.FMatrixSparseCSC extractRows​(org.ejml.data.FMatrixSparseCSC A,
                                                                 int row0,
                                                                 int row1,
                                                                 org.ejml.data.FMatrixSparseCSC out)
        Creates a submatrix by extracting the specified rows from A. rows = {row0 %le; i %le; row1}.
        Parameters:
        A - (Input) matrix
        row0 - First row. Inclusive
        row1 - Last row+1.
        out - (Output, Option) Storage for output matrix
        Returns:
        The submatrix
      • extract

        public static void extract​(org.ejml.data.FMatrixSparseCSC src,
                                   int srcY0,
                                   int srcY1,
                                   int srcX0,
                                   int srcX1,
                                   org.ejml.data.FMatrixSparseCSC dst,
                                   int dstY0,
                                   int dstX0)

        Extracts a submatrix from 'src' and inserts it in a submatrix in 'dst'.

        si-y0 , j-x0 = oij for all y0 ≤ i < y1 and x0 ≤ j < x1

        where 'sij' is an element in the submatrix and 'oij' is an element in the original matrix.

        WARNING: This is a very slow operation for sparse matrices. The current implementation is simple but involves excessive memory copying.

        Parameters:
        src - The original matrix which is to be copied. Not modified.
        srcX0 - Start column.
        srcX1 - Stop column+1.
        srcY0 - Start row.
        srcY1 - Stop row+1.
        dst - Where the submatrix are stored. Modified.
        dstY0 - Start row in dst.
        dstX0 - start column in dst.
      • fill

        public static void fill​(org.ejml.data.FMatrixSparseCSC A,
                                float value)

        Sets every element in the matrix to the specified value. This can require a very large amount of memory and might exceed the maximum array size

        Aij = value

        Parameters:
        A - A matrix whose elements are about to be set. Modified.
        value - The value each element will have.
      • sumCols

        public static org.ejml.data.FMatrixRMaj sumCols​(org.ejml.data.FMatrixSparseCSC input,
                                                        @Nullable
                                                        org.ejml.data.FMatrixRMaj output)

        Computes the sum of each column in the input matrix and returns the results in a vector:

        bj = sum(i=1:m ; aij)

        Parameters:
        input - Input matrix
        output - Optional storage for output. Reshaped into a row vector. Modified.
        Returns:
        Vector containing the sum of each column
      • minCols

        public static org.ejml.data.FMatrixRMaj minCols​(org.ejml.data.FMatrixSparseCSC input,
                                                        @Nullable
                                                        org.ejml.data.FMatrixRMaj output)

        Computes the minimum of each column in the input matrix and returns the results in a vector:

        bj = min(i=1:m ; aij)

        Parameters:
        input - Input matrix
        output - Optional storage for output. Reshaped into a row vector. Modified.
        Returns:
        Vector containing the minimums of each column
      • maxCols

        public static org.ejml.data.FMatrixRMaj maxCols​(org.ejml.data.FMatrixSparseCSC input,
                                                        @Nullable
                                                        org.ejml.data.FMatrixRMaj output)

        Computes the maximums of each column in the input matrix and returns the results in a vector:

        bj = max(i=1:m ; aij)

        Parameters:
        input - Input matrix
        output - Optional storage for output. Reshaped into a row vector. Modified.
        Returns:
        Vector containing the maximums of each column
      • sumRows

        public static org.ejml.data.FMatrixRMaj sumRows​(org.ejml.data.FMatrixSparseCSC input,
                                                        @Nullable
                                                        org.ejml.data.FMatrixRMaj output)

        Computes the sum of each row in the input matrix and returns the results in a vector:

        bj = sum(i=1:n ; aji)

        Parameters:
        input - Input matrix
        output - Optional storage for output. Reshaped into a column vector. Modified.
        Returns:
        Vector containing the sum of each row
      • minRows

        public static org.ejml.data.FMatrixRMaj minRows​(org.ejml.data.FMatrixSparseCSC input,
                                                        @Nullable
                                                        org.ejml.data.FMatrixRMaj output,
                                                        @Nullable
                                                        org.ejml.data.IGrowArray gw)

        Computes the minimum of each row in the input matrix and returns the results in a vector:

        bj = min(i=1:n ; aji)

        Parameters:
        input - Input matrix
        output - Optional storage for output. Reshaped into a column vector. Modified.
        gw - work space
        Returns:
        Vector containing the minimum of each row
      • maxRows

        public static org.ejml.data.FMatrixRMaj maxRows​(org.ejml.data.FMatrixSparseCSC input,
                                                        @Nullable
                                                        org.ejml.data.FMatrixRMaj output,
                                                        @Nullable
                                                        org.ejml.data.IGrowArray gw)

        Computes the maximum of each row in the input matrix and returns the results in a vector:

        bj = max(i=1:n ; aji)

        Parameters:
        input - Input matrix
        output - Optional storage for output. Reshaped into a column vector. Modified.
        gw - work space
        Returns:
        Vector containing the maximum of each row
      • zero

        public static void zero​(org.ejml.data.FMatrixSparseCSC A,
                                int row0,
                                int row1,
                                int col0,
                                int col1)
        Zeros an inner rectangle inside the matrix.
        Parameters:
        A - Matrix that is to be modified.
        row0 - Start row.
        row1 - Stop row+1.
        col0 - Start column.
        col1 - Stop column+1.
      • dotInnerColumns

        public static float dotInnerColumns​(org.ejml.data.FMatrixSparseCSC A,
                                            int colA,
                                            org.ejml.data.FMatrixSparseCSC B,
                                            int colB,
                                            org.ejml.data.IGrowArray gw,
                                            org.ejml.data.FGrowArray gx)
        Computes the inner product of two column vectors taken from the input matrices.

        dot = A(:,colA)'*B(:,colB)

        Parameters:
        A - Matrix
        colA - Column in A
        B - Matrix
        colB - Column in B
        Returns:
        Dot product
      • solve

        public static boolean solve​(org.ejml.data.FMatrixSparseCSC a,
                                    org.ejml.data.FMatrixRMaj b,
                                    org.ejml.data.FMatrixRMaj x)

        Solves for x in the following equation:

        A*x = b

        If the system could not be solved then false is returned. If it returns true that just means the algorithm finished operating, but the results could still be bad because 'A' is singular or nearly singular.

        If repeat calls to solve are being made then one should consider using LinearSolverFactory_FSCC instead.

        It is ok for 'b' and 'x' to be the same matrix.

        Parameters:
        a - (Input) A matrix that is m by n. Not modified.
        b - (Input) A matrix that is n by k. Not modified.
        x - (Output) A matrix that is m by k. Modified.
        Returns:
        true if it could invert the matrix false if it could not.
      • solve

        public static boolean solve​(org.ejml.data.FMatrixSparseCSC a,
                                    org.ejml.data.FMatrixSparseCSC b,
                                    org.ejml.data.FMatrixSparseCSC x)

        Solves for x in the following equation:

        A*x = b

        If the system could not be solved then false is returned. If it returns true that just means the algorithm finished operating, but the results could still be bad because 'A' is singular or nearly singular.

        If repeat calls to solve are being made then one should consider using LinearSolverFactory_FSCC instead.

        It is ok for 'b' and 'x' to be the same matrix.

        Parameters:
        a - (Input) A matrix that is m by n. Not modified.
        b - (Input) A matrix that is n by k. Not modified.
        x - (Output) A matrix that is m by k. Modified.
        Returns:
        true if it could invert the matrix false if it could not.
      • invert

        public static boolean invert​(org.ejml.data.FMatrixSparseCSC A,
                                     org.ejml.data.FMatrixRMaj inverse)

        Performs a matrix inversion operation that does not modify the original and stores the results in another matrix. The two matrices must have the same dimension.

        B = A-1

        If the algorithm could not invert the matrix then false is returned. If it returns true that just means the algorithm finished. The results could still be bad because the matrix is singular or nearly singular.

        For medium to large matrices there might be a slight performance boost to using LinearSolverFactory_FSCC instead.

        Parameters:
        A - (Input) The matrix that is to be inverted. Not modified.
        inverse - (Output) Where the inverse matrix is stored. Modified.
        Returns:
        true if it could invert the matrix false if it could not.
      • det

        public static float det​(org.ejml.data.FMatrixSparseCSC A)
        Returns the determinant of the matrix. If the inverse of the matrix is also needed, then using LUDecomposition_F32 directly (or any similar algorithm) can be more efficient.
        Parameters:
        A - The matrix whose determinant is to be computed. Not modified.
        Returns:
        The determinant.
      • removeZeros

        public static void removeZeros​(org.ejml.data.FMatrixSparseCSC input,
                                       org.ejml.data.FMatrixSparseCSC output,
                                       float tol)
        Copies all elements from input into output which are > tol.
        Parameters:
        input - (Input) input matrix. Not modified.
        output - (Output) Output matrix. Modified and shaped to match input.
        tol - Tolerance for defining zero
      • removeZeros

        public static void removeZeros​(org.ejml.data.FMatrixSparseCSC A,
                                       float tol)
        Removes all elements from the matrix that are > tol. The modification is done in place and no temporary storage is declared.
        Parameters:
        A - (Input/Output) input matrix. Modified.
        tol - Tolerance for defining zero
      • multRows

        public static void multRows​(float[] diag,
                                    int offset,
                                    org.ejml.data.FMatrixSparseCSC A)
        Multiply all elements of row 'i' by value[i]. A[i,:] *= values[i]
        Parameters:
        diag - (Input) multiplication factors
        offset - (Input) First index in values
        A - (Input/Output) Matrix. Modified.
      • divideRows

        public static void divideRows​(float[] diag,
                                      int offset,
                                      org.ejml.data.FMatrixSparseCSC A)
        Divides all elements of row 'i' by value[i]. A[i,:] /= values[i]
        Parameters:
        diag - (Input) division factors
        offset - (Input) First index in values
        A - (Input/Output) Matrix. Modified.
      • trace

        public static float trace​(org.ejml.data.FMatrixSparseCSC A)

        This computes the trace of the matrix:

        trace = ∑i=1:n { aii }
        where n = min(numRows,numCols)

        Parameters:
        A - (Input) Matrix. Not modified.