LinearAlgebra
jhplot.math

Class LinearAlgebra



  • public class LinearAlgebraextends DoubleArray
    A collection of static methods for performing math operations on matrices and arrays. Advanced Linear Algebra methods (decompositions, norm, ...) are just call for JAMA routines.
    • Constructor Detail

      • LinearAlgebra

        public LinearAlgebra()
    • Method Detail

      • minus

        public static double[] minus(double[] v1,             double[] v2)
        Element-wise subtraction of two arrays. Arrays must be same size.
        Parameters:
        v1 - Minuend.
        v2 - Subtrahend
        Returns:
        Array v1 - v2
      • minus

        public static double[] minus(double[] v1,             double v)
        Subtracts a scalar value from each element of an array
        Parameters:
        v1 - Minuend Array.
        v - Subtrahend scalar
        Returns:
        Array v1 - v
      • minus

        public static double[] minus(double v,             double[] v1)
        Subtracts each element of an array from a scalar value.
        Parameters:
        v - Scalar Minuend
        v1 - Subtrahend array
        Returns:
        Array v - v1
      • minus

        public static double[][] minus(double[][] v1,               double[][] v2)
        Element-wise subtraction of two matrices. Matrices must be same size.
        Parameters:
        v1 - Minuend matrix
        v2 - Subtrahend matrix
        Returns:
        Matrix v1 - v2
      • minus

        public static double[][] minus(double[][] v1,               double v2)
        Subtract a scalar from each element of a matrix.
        Parameters:
        v1 - Minuend matrix
        v2 - Scalar subtrahend
        Returns:
        Matrix v1 - v2
      • minus

        public static double[][] minus(double v2,               double[][] v1)
        Subtract each element of a matrix from a scalar.
        Parameters:
        v2 - Scalar minuend
        v1 - Matrix subtrahend
        Returns:
        Matrix v2 - v1
      • plus

        public static double[] plus(double[]... v)
        Element-wise sum of any number of arrays. Each array must be of same length.
        Parameters:
        v - Any number of arrays
        Returns:
        Element-wise sum of input arrays.
      • plus

        public static double[] plus(double[] v1,            double v)
        Add a scalar value to each element of an array.
        Parameters:
        v1 - Array
        v - Scalar
        Returns:
        v1 + v
      • plus

        public static double[][] plus(double[][] v1,              double[][] v2)
        Element-wise sum of two matrices
        Parameters:
        v1 - Matrix
        v2 - Matrix
        Returns:
        Matrix v1 + v2
      • plus

        public static double[][] plus(double[][] v1,              double v2)
        Add a scalar to each element of a matrix.
        Parameters:
        v1 - Matrix
        v2 - Scalar
        Returns:
        Matrix v1 + v2
      • times

        public static double[] times(double[]... v)
        Element-wise product of any number of arrays. Each array must be same size.
        Parameters:
        v - Any number of arrays.
        Returns:
        Array. i'th element = v1(i)*v2(i)*v3(i)...
      • divide

        public static double[] divide(double[] v1,              double[] v2)
        Element-wise ratio of two arrays.
        Parameters:
        v1 - Numerators
        v2 - Denominators
        Returns:
        Array. i'th element = v1(i)/v2(i)
      • times

        public static double[] times(double[] v1,             double v)
        Multiply each element of an array by a scalar.
        Parameters:
        v1 - Array
        v - Scalar
        Returns:
        v1 * v
      • times

        public static double[][] times(double[][] v1,               double v)
        Multiply each element in a matrix by a scalar
        Parameters:
        v1 - Matrix
        v - Scalar
        Returns:
        v1 * v
      • divide

        public static double[] divide(double[] v1,              double v)
        Divide each element of an array by a scalar.
        Parameters:
        v1 - Numerator Array
        v - Scalar denominator
        Returns:
        Array. i'th element is v1(i)/v
      • divide

        public static double[][] divide(double[][] v1,                double v)
        Divide each element of a matrix by a scalar
        Parameters:
        v1 - Matrix numerator
        v - Scalar denominator
        Returns:
        Matrix v1 / v
      • raise

        public static double[] raise(double[] v1,             double n)
        Raise each element of an array to a scalar power.
        Parameters:
        v1 - Array
        n - Scalar exponent
        Returns:
        Array. i'th element is v(i)^n
      • raise

        public static double[][] raise(double[][] v,               double n)
        Raise each element of a matrix to a scalar power
        Parameters:
        v - Matrix
        n - exponent
        Returns:
        Matrix
      • times

        public static double[][] times(double[][] v1,               double[][] v2)
        Matrix multiplication according to the rules of linear algebra. Matrices must be same size.
        Parameters:
        v1 - Matrix
        v2 - Matrix
        Returns:
        Matrix v1 * v2
      • times

        public static double[] times(double[][] v1,             double[] v2)
        Product of a matrix and a vector (array) according to the rules of linear algebra. Number of columns in v1 must equal number of elements in v2.
        Parameters:
        v1 - m x n Matrix
        v2 - n element array
        Returns:
        m element array v1 * v2
        See Also:
        times(double[][], double[][])
      • divideLU

        public static double[][] divideLU(double[][] v1,                  double[]... v2)
      • divideQR

        public static double[][] divideQR(double[][] v1,                  double[]... v2)
      • divide

        public static double[][] divide(double[][] v1,                double[]... v2)
      • inverseLU

        public static double[][] inverseLU(double[][] v1)
      • inverseQR

        public static double[][] inverseQR(double[][] v1)
      • inverse

        public static double[][] inverse(double[][] v1)
      • solve

        public static double[][] solve(double[][] A,               double[][] B)
      • solveTranspose

        public static double[][] solveTranspose(double[][] A,                        double[][] B)
      • cond

        public static double cond(double[][] v)
      • det

        public static double det(double[][] v)
      • rank

        public static int rank(double[][] v)
      • trace

        public static double trace(double[][] v)
      • norm1

        public static double norm1(double[][] v)
      • norm2

        public static double norm2(double[][] v)
      • normF

        public static double normF(double[][] v)
      • normInf

        public static double normInf(double[][] v)

SCaVis 2.0 © jWork.ORG