Class MatrixFactory


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

      Constructors 
      Constructor Description
      MatrixFactory()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static MatrixD constructWithCopy​(double[][] A)
      Construct a matrix from a copy of a 2-D array.
      static MatrixD identity​(int m, int n)
      Generate identity matrix
      static MatrixD random​(int m, int n)
      Generate matrix with random elements
      • Methods inherited from class java.lang.Object

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

      • MatrixFactory

        public MatrixFactory()
    • Method Detail

      • constructWithCopy

        public static MatrixD constructWithCopy​(double[][] A)
        Construct a matrix from a copy of a 2-D array.
        Parameters:
        A - Two-dimensional array of doubles.
        Returns:
        deep copy
        Throws:
        java.lang.IllegalArgumentException - All rows must have the same length
      • identity

        public static MatrixD identity​(int m,
                                       int n)
        Generate identity matrix
        Parameters:
        m - Number of rows.
        n - Number of colums.
        Returns:
        An m-by-n matrix with ones on the diagonal and zeros elsewhere.
      • random

        public static MatrixD random​(int m,
                                     int n)
        Generate matrix with random elements
        Parameters:
        m - Number of rows.
        n - Number of colums.
        Returns:
        An m-by-n matrix with uniformly distributed random elements.