Class PMMLRealMatrix<T extends Number>


  • public abstract class PMMLRealMatrix<T extends Number>
    extends Object
    Object representation of a PMML matrix
    • Constructor Detail

      • PMMLRealMatrix

        public PMMLRealMatrix()
    • Method Detail

      • get

        public abstract T get​(int row,
                              int col)
        Returns the value of the given matrix element
        Parameters:
        row - the row of the element
        col - the column of the element
        Returns:
        the value of the element
      • set

        public abstract void set​(int row,
                                 int col,
                                 T value)
        Sets the value of the given matrix element. Setting to a row/column beyond the size of the matrix will automatically resize as-needed.
        Parameters:
        row - the row of the element
        col - the column of the element
        value - the value of the element
      • ensureSize

        public abstract PMMLRealMatrix<T> ensureSize​(int numRows,
                                                     int numCols)
        Sizes the matrix to the given number of rows and columns
        Parameters:
        numRows - the number of rows.
        numCols - the number of columns
        Returns:
        a "this" reference
      • getNumRows

        public abstract int getNumRows()
        Returns the number of rows in the matrix
        Returns:
        the number of rows in the matrix
      • getNumColumns

        public abstract int getNumColumns()
        Returns the number of columns in the matrix
        Returns:
        the number of columns in the matrix
      • parse

        public static <T extends NumberPMMLRealMatrix<T> parse​(Element e)
        Parses the given matrix element
        Parameters:
        e - the element
        Returns:
        a matrix object
      • toPMML

        public abstract void toPMML​(Element parent)
        Adds this matrix element as a child of the given element
        Parameters:
        parent - the parent element
      • getType

        public abstract Class<?> getType()
        Gets the numeric datatype of this matrix.
        Returns:
      • symmetric

        public static <T extends NumberPMMLRealMatrix<T> symmetric​(Class<?> type)
        Creates a new symmetric matrix. Values set will automatically appear on both sides of the diagonal
        Returns:
        a new symmetric matrix
      • diagonal

        public static <T extends NumberPMMLRealMatrix<T> diagonal​(Class<?> type)
        Creates a new diagonal matrix. Non-zero values may only be specified on the diagonal.
        Returns:
        a new diagonal matrix
      • dense

        public static <T extends NumberPMMLRealMatrix<T> dense​(Class<?> type)
        Creates a new dense matrix
        Returns:
        a new dense matrix
      • sparse

        public static <T extends NumberPMMLRealMatrix<T> sparse​(T diagDefault,
                                                                  T offDiagDefault)
        Creates a new sparse matrix
        Parameters:
        diagDefault - the default value for values on the diagonal
        offDiagDefault - the default value for values not on the diagonal
        Returns:
        a new sparse matrix
      • getFieldClass

        public static Class<?> getFieldClass​(Class<?> clazz,
                                             String name)