Module datarush.analytics
Class PMMLRealMatrix<T extends Number>
- java.lang.Object
-
- com.pervasive.datarush.analytics.pmml.PMMLRealMatrix<T>
-
-
Constructor Summary
Constructors Constructor Description PMMLRealMatrix()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static <T extends Number>
PMMLRealMatrix<T>dense(Class<?> type)
Creates a new dense matrixstatic <T extends Number>
PMMLRealMatrix<T>diagonal(Class<?> type)
Creates a new diagonal matrix.abstract PMMLRealMatrix<T>
ensureSize(int numRows, int numCols)
Sizes the matrix to the given number of rows and columnsabstract T
get(int row, int col)
Returns the value of the given matrix elementstatic Class<?>
getFieldClass(Class<?> clazz, String name)
abstract int
getNumColumns()
Returns the number of columns in the matrixabstract int
getNumRows()
Returns the number of rows in the matrixabstract Class<?>
getType()
Gets the numeric datatype of this matrix.static <T extends Number>
PMMLRealMatrix<T>parse(Element e)
Parses the given matrix elementabstract void
set(int row, int col, T value)
Sets the value of the given matrix element.static <T extends Number>
PMMLRealMatrix<T>sparse(T diagDefault, T offDiagDefault)
Creates a new sparse matrixstatic <T extends Number>
PMMLRealMatrix<T>symmetric(Class<?> type)
Creates a new symmetric matrix.abstract void
toPMML(Element parent)
Adds this matrix element as a child of the given element
-
-
-
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 elementcol
- 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 elementcol
- the column of the elementvalue
- 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 Number> PMMLRealMatrix<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 Number> PMMLRealMatrix<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 Number> PMMLRealMatrix<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 Number> PMMLRealMatrix<T> dense(Class<?> type)
Creates a new dense matrix- Returns:
- a new dense matrix
-
sparse
public static <T extends Number> PMMLRealMatrix<T> sparse(T diagDefault, T offDiagDefault)
Creates a new sparse matrix- Parameters:
diagDefault
- the default value for values on the diagonaloffDiagDefault
- the default value for values not on the diagonal- Returns:
- a new sparse matrix
-
-