Class AbstractMatrixOperations

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double[][] abs​(boolean[][] booleans)  
      double[][] addColumnVector​(double[][] matrix, double[][] colvector)  
      double[][] addRowVector​(double[][] matrix, double[][] rowvector)  
      void assignAllLessThan​(double[][] matrix, double lessthan, double assign)
      All values in matrix that is less than lessthan is assigned the value assign
      void assignAtIndex​(double[][] num, int[] range, int[] range1, double value)  
      void assignValuesToRow​(double[][] matrix, int row, int[] indicies, double[] values)  
      boolean[][] biggerThan​(double[][] matrix, double value)
      Returns a new matrix of booleans where true is set if the value in the matrix is bigger than value
      int[] concatenate​(int[] v1, int[] v2)  
      double[][] diag​(double[][] ds)  
      boolean[][] equal​(boolean[][] matrix1, boolean[][] matrix2)
      Returns a new matrix of booleans where true is set if the values to the two matrices are the same at that index
      double[][] exp​(double[][] v1)
      Destructively sets the values in matrix to its exponentiated value
      double[][] fillMatrix​(int rows, int cols, double fillvalue)  
      double[][] getValuesFromRow​(double[][] matrix, int row, int[] indicies)  
      double[][] maximum​(double[][] matrix, double maxval)
      Return a new matrix with the max value of either the value in the matrix or maxval otherwise
      double[][] mean​(double[][] matrix, int axis)  
      boolean[][] negate​(boolean[][] booleans)
      Returns new matrix with booleans which are the negations of the input
      double[][] plus​(double[][] m1, double[][] m2)  
      int[] range​(int n)  
      int[] range​(int a, int b)  
      double[][] rnorm​(int m, int n)
      Returns new 2D matrix with normal random values with mean 0 and std.
      double[][] scalarDivide​(double[][] numerator, double denom)  
      double[][] scalarInverse​(double[][] m1)
      Returns scalar inverse of matrix
      double[][] scalarMult​(double[][] m1, double mul)  
      double[][] scalarPlus​(double[][] m1, double m2)  
      double[][] scalarPow​(double[][] matrix, double power)  
      double[][] square​(double[][] matrix)
      Returns a new matrix with the values of matrix squared
      double sum​(double[][] matrix)
      Returns sum of all values in the matrix
      double[][] sum​(double[][] matrix, int axis)  
      double[][] tile​(double[][] matrix, int rowtimes, int coltimes)  
      double[][] times​(double[][] a, double[][] b)  
      • Methods inherited from class java.lang.Object

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

      • AbstractMatrixOperations

        public AbstractMatrixOperations()
    • Method Detail

      • mean

        public double[][] mean​(double[][] matrix,
                               int axis)
        Specified by:
        mean in interface MatrixOperations
      • exp

        public double[][] exp​(double[][] v1)
        Description copied from interface: MatrixOperations
        Destructively sets the values in matrix to its exponentiated value
        Specified by:
        exp in interface MatrixOperations
        Returns:
        same matrix with values exponentiated
      • rnorm

        public double[][] rnorm​(int m,
                                int n)
        Description copied from interface: MatrixOperations
        Returns new 2D matrix with normal random values with mean 0 and std. dev 1
        Specified by:
        rnorm in interface MatrixOperations
      • equal

        public boolean[][] equal​(boolean[][] matrix1,
                                 boolean[][] matrix2)
        Description copied from interface: MatrixOperations
        Returns a new matrix of booleans where true is set if the values to the two matrices are the same at that index
        Specified by:
        equal in interface MatrixOperations
        Returns:
        new matrix with booelans with values matrix1[i,j] == matrix2[i,j]
      • biggerThan

        public boolean[][] biggerThan​(double[][] matrix,
                                      double value)
        Description copied from interface: MatrixOperations
        Returns a new matrix of booleans where true is set if the value in the matrix is bigger than value
        Specified by:
        biggerThan in interface MatrixOperations
        Returns:
        new matrix with booelans with values matrix1[i,j] == matrix2[i,j]
      • negate

        public boolean[][] negate​(boolean[][] booleans)
        Description copied from interface: MatrixOperations
        Returns new matrix with booleans which are the negations of the input
        Specified by:
        negate in interface MatrixOperations
      • abs

        public double[][] abs​(boolean[][] booleans)
        Specified by:
        abs in interface MatrixOperations
      • sum

        public double[][] sum​(double[][] matrix,
                              int axis)
        Specified by:
        sum in interface MatrixOperations
      • sum

        public double sum​(double[][] matrix)
        Description copied from interface: MatrixOperations
        Returns sum of all values in the matrix
        Specified by:
        sum in interface MatrixOperations
      • maximum

        public double[][] maximum​(double[][] matrix,
                                  double maxval)
        Description copied from interface: MatrixOperations
        Return a new matrix with the max value of either the value in the matrix or maxval otherwise
        Specified by:
        maximum in interface MatrixOperations
      • assignAllLessThan

        public void assignAllLessThan​(double[][] matrix,
                                      double lessthan,
                                      double assign)
        Description copied from interface: MatrixOperations
        All values in matrix that is less than lessthan is assigned the value assign
        Specified by:
        assignAllLessThan in interface MatrixOperations
      • square

        public double[][] square​(double[][] matrix)
        Description copied from interface: MatrixOperations
        Returns a new matrix with the values of matrix squared
        Specified by:
        square in interface MatrixOperations
      • scalarPow

        public double[][] scalarPow​(double[][] matrix,
                                    double power)
        Specified by:
        scalarPow in interface MatrixOperations
      • addColumnVector

        public double[][] addColumnVector​(double[][] matrix,
                                          double[][] colvector)
        Specified by:
        addColumnVector in interface MatrixOperations
      • addRowVector

        public double[][] addRowVector​(double[][] matrix,
                                       double[][] rowvector)
        Specified by:
        addRowVector in interface MatrixOperations
      • tile

        public double[][] tile​(double[][] matrix,
                               int rowtimes,
                               int coltimes)
        Specified by:
        tile in interface MatrixOperations
      • assignAtIndex

        public void assignAtIndex​(double[][] num,
                                  int[] range,
                                  int[] range1,
                                  double value)
        Specified by:
        assignAtIndex in interface MatrixOperations
      • getValuesFromRow

        public double[][] getValuesFromRow​(double[][] matrix,
                                           int row,
                                           int[] indicies)
        Specified by:
        getValuesFromRow in interface MatrixOperations
      • assignValuesToRow

        public void assignValuesToRow​(double[][] matrix,
                                      int row,
                                      int[] indicies,
                                      double[] values)
        Specified by:
        assignValuesToRow in interface MatrixOperations
      • fillMatrix

        public double[][] fillMatrix​(int rows,
                                     int cols,
                                     double fillvalue)
        Specified by:
        fillMatrix in interface MatrixOperations
      • plus

        public double[][] plus​(double[][] m1,
                               double[][] m2)
        Specified by:
        plus in interface MatrixOperations
      • scalarPlus

        public double[][] scalarPlus​(double[][] m1,
                                     double m2)
        Specified by:
        scalarPlus in interface MatrixOperations
      • scalarDivide

        public double[][] scalarDivide​(double[][] numerator,
                                       double denom)
        Specified by:
        scalarDivide in interface MatrixOperations
      • scalarMult

        public double[][] scalarMult​(double[][] m1,
                                     double mul)
        Specified by:
        scalarMult in interface MatrixOperations
      • times

        public double[][] times​(double[][] a,
                                double[][] b)
        Specified by:
        times in interface MatrixOperations
      • diag

        public double[][] diag​(double[][] ds)
        Specified by:
        diag in interface MatrixOperations