TASSELpy.net.maizegenetics.matrixalgebra.Matrix package

Submodules

TASSELpy.net.maizegenetics.matrixalgebra.Matrix.DoubleMatrix module

class TASSELpy.net.maizegenetics.matrixalgebra.Matrix.DoubleMatrix.DoubleMatrix(*args, **kwargs)[source]

Bases: TASSELpy.java.lang.Object.Object

Wrapper for the DoubleMatrix interface, which is implemented by several classes that call native methods

Methods

castTo(pyType) Casts this object to another java/python type
clone(*args) Creates and returns a copy of this object
column(*args) Gets the column of the matrix as a column vector
columnRank(*args) Gets the column rank of this matrix
columnSum(*args) Sums a column
concatenate(*args) Puts two matrices together
copy(*args) Gets a copy of the matrix
crossproduct(*args) Get X’X or X’dm, where X is this matrix
equals(*args) Indicates whether some other object is “equal to” this one
generalizedInverse(*args) Gets the generalized inverse of a square matrix
generalizedInverseWithRank(*args) Inverts the matrix and returns the rank as the first element in rank[].
get(*args) Gets data and doesn’t check to make sure they are in the matrix
getArray(size) Gets an empty wrapped java array that can accept the type of the wrapped
getChecked(*args) Gets data and checks to make sure they are in the matrix
getClass(*args) Returns the runtime class of this Object.
getDblArray(rows[, cols]) Gets an empty wrapped java array that can accept the type of other wrapped java arrays: i.e.
getEigenvalueDecomposition(*args) Gets the Eigenvalue decomposition of this matrix
getSelection(*args) Creates a new matrix consisting of the rows and columns of this matrix in the order specified.
getSingularValueDecomposition(*args) Gets the Singular Value decomposition of this matrix
getXtXGM(*args) Gets an array of three DoubleMatrices.
hashCode(*args) Returns a hash code vlaue for the object
inverse(*args) Returns the inverse of a square matrix, without modifying the original matrix.
invert(*args) This inverts a square matrix, replacing the original with the inverse
minus(*args) Subtracts a matrix from this matrix, X, without modifying X
minusEquals(*args) This function subtracts dm, modifying the original matrix
mult(*args) Multiply this matrix times another
multadd(*args) Using this function for combining multiplication and addition allows the
numberOfColumns(*args) Gets the number of columns in this matrix
numberOfRows(*args) Gets the number of rows in this matrix
plus(*args) Adds a matrix from this matrix, X, without modifying X
plusEquals(*args) This function adds dm, modifying the original matrix
row(*args) Gets the row of the matrix as a row vector
rowSum(*args) Sums a row
scalarAdd(*args) Adds a scalar to this matrix and returns a new matrix.
scalarAddEquals(*args) Adds a scalar s to this matrix, replacing the original matrix with the result
scalarMult(*args) Multiplies a scalar to this matrix and returns a new matrix.
scalarMultEquals(*args) Multiplies a scalar s to this matrix, replacing the original matrix with the result
set(*args) Sets the matrix value at row, col.
setChecked(*args) Sets the matrix value at row, col.
solve(*args) Solves the matrix
tcrossproduct(*args) Gets XX’ or Xdm’, where X is this matrix
toString(*args) Returns a string representation of the object
transpose(*args) Gets the tranpose of this matrix
wrap_existing_array(arr_instance) Wraps a java array of this class’s type
__init__(*args, **kwargs)[source]
column(*args)[source]

Gets the column of the matrix as a column vector

Signature:column (int j)
Parameters:j (int) – A column index
Returns:The jth row of this matrix as a column vector
Return type:DoubleMatrix
columnRank(*args)[source]

Gets the column rank of this matrix

Signature:columnRank ()
Returns:The column rank of this matrix
Return type:int
columnSum(*args)[source]

Sums a column

Signature:columnSum (int column)
Parameters:column (int) – The column index to sum
Returns:The sum of the elements in this column
Return type:double
concatenate(*args)[source]

Puts two matrices together

Signature:

concatenate (DoubleMatrix dm, boolean rows)

Parameters:
  • dm (DoubleMatrix) – a DoubleMatrix
  • rows (boolean) – true if rows are to be concatenated, false if columns are to be concatenated
Returns:

Returns X with dm appended, where X is this matrix

Return type:

DoubleMatrix

copy(*args)[source]

Gets a copy of the matrix

Signature:copy ()
Returns:A copy of the matrix
Return type:DoubleMatrix
crossproduct(*args)[source]

Get X’X or X’dm, where X is this matrix

Signature:crossproduct ()
Signature:crossproduct (DoubleMatrix dm)
Parameters:dm (DoubleMatrix) – The second matrix
Returns:The cross product
Return type:DoubleMatrix
generalizedInverse(*args)[source]

Gets the generalized inverse of a square matrix

Signature:generalizedInverse ()
Returns:The generalized inverse of a square matrix
Return type:DoubleMatrix
generalizedInverseWithRank(*args)[source]

Inverts the matrix and returns the rank as the first element in rank[]. The original matrix is not modified

Signature:generalizedInverseWithRank (int[] rank)
Parameters:rank (int[]) – Array to hold element where rank will be stored
Returns:A generalized inverse of this matrix
Return type:DoubleMatrix
get(*args)[source]

Gets data and doesn’t check to make sure they are in the matrix

Signature:

get (int row, int col)

Parameters:
  • row (int) – The zero-based row index
  • col (int) – The zero-based column index
Returns:

The value at row, col

Return type:

double

getChecked(*args)[source]

Gets data and checks to make sure they are in the matrix

Signature:

getChecked (int row, int col)

Parameters:
  • row (int) – The zero-based row index
  • col (int) – The zero-based column index
Returns:

The value at row, col

Return type:

double

getEigenvalueDecomposition(*args)[source]

Gets the Eigenvalue decomposition of this matrix

Signature:getEigenvalueDecomposition ()
Returns:An Eigenvalue Decomposition of this matrix
Return type:EigenvalueDecomposition
getSelection(*args)[source]

Creates a new matrix consisting of the rows and columns of this matrix in the order specified. If rows or columns is null, then all rows or columns, respectively, will be included

Signature:

getSelection (int[] rows, int[] columns)

Parameters:
  • rows (int[]) – The rows to be included in the new matrix
  • columns (int[]) – The columns to be included in the new matrix
Returns:

A new matrix consisting of the specified rows and columns

Return type:

DoubleMatrix

getSingularValueDecomposition(*args)[source]

Gets the Singular Value decomposition of this matrix

Signature:getSingularValueDecomposition ()
Returns:An Singular Value Decomposition of this matrix
Return type:SingularValueDecomposition
getXtXGM(*args)[source]

Gets an array of three DoubleMatrices. Where X is this matrix, the first is X’X, the second is the inverse of X’X, and the third is I-XGX’

Signature:getXtXGM ()
Returns:An array of three DoubleMatrices. Where X is this matrix, the first is X’X, the second is the inverse of X’X, and the third is I-XGX’
Return type:DoubleMatrix[]
inverse(*args)[source]

Returns the inverse of a square matrix, without modifying the original matrix.

Signature:inverse ()
Returns:The inverse of a square matrix if it is non-singular, null otherwise
Return type:DoubleMatrix
invert(*args)[source]

This inverts a square matrix, replacing the original with the inverse

Signature:invert ()
minus(*args)[source]

Subtracts a matrix from this matrix, X, without modifying X

Signature:minus (DoubleMatrix dm)
Parameters:dm (DoubleMatrix) – A DoubleMatrix to subtract
Returns:A new DoubleMatrix created by subtracting dm from this matrix
Return type:DoubleMatrix
minusEquals(*args)[source]

This function subtracts dm, modifying the original matrix

Signature:minusEquals (DoubleMatrix dm)
Parameters:dm (DoubleMatrix) – A DoubleMatrix to subtract
mult(*args)[source]

Multiply this matrix times another

Signature:

mult (DoubleMatrix dm, boolean transpose, boolean transposedm)

Signature:

mult (DoubleMatrix dm)

Parameters:
  • dm (DoubleMatrix) – A double matrix
  • transpose (boolean) – If true, this matrix will be transposed before multiplying
  • transposedm (boolean) – If true, dm will be transposed before multiplying
Returns:

The multiplied matrix

Return type:

DoubleMatrix

multadd(*args)[source]

Using this function for combining multiplication and addition allows the implementing library to optimize the operations

Signature:

multadd (DoubleMatrix A, DoubleMatrix B, double alpha, double beta, boolean transpose, boolean transposeA)

Parameters:
  • A (DoubleMatrix) – The matrix to be multiplied
  • B (DoubleMatrix) – The matrix to be added, can be null
  • alpha (double) – scalar multiplier for A
  • beta (double) – scalar multiplier for B
  • transpose (boolean) – If true, X is transposed
  • transposeA (boolean) – If true, A is transposed
  • transposeB – If true, B is transposed
Returns:

alpha*XA+beta*B where X is this matrix

Return type:

DoubleMatrix

numberOfColumns(*args)[source]

Gets the number of columns in this matrix

Signature:numberOfColumns ()
Returns:Number of columns in this matrix
Return type:int
numberOfRows(*args)[source]

Gets the number of rows in this matrix

Signature:numberOfRows ()
Returns:Number of rows in this matrix
Return type:int
plus(*args)[source]

Adds a matrix from this matrix, X, without modifying X

Signature:plus (DoubleMatrix dm)
Parameters:dm (DoubleMatrix) – A DoubleMatrix to add
Returns:A new DoubleMatrix created by adding dm from this matrix
Return type:DoubleMatrix
plusEquals(*args)[source]

This function adds dm, modifying the original matrix

Signature:plusEquals (DoubleMatrix dm)
Parameters:dm (DoubleMatrix) – A DoubleMatrix to add
row(*args)[source]

Gets the row of the matrix as a row vector

Signature:row (int i)
Parameters:i (int) – a row index
Returns:The ith row of this matrix as a column vector
Return type:DoubleMatrix
rowSum(*args)[source]

Sums a row

Signature:rowSum (int row)
Parameters:row (int) – The row index to sum
Returns:The sum of the elements in this row
Return type:double
scalarAdd(*args)[source]

Adds a scalar to this matrix and returns a new matrix. The original is not modified

Signature:scalarAdd (double s)
Parameters:s (double) – a scalar
Returns:The sum of this matrix and a scalar s
Return type:DoubleMatrix
scalarAddEquals(*args)[source]

Adds a scalar s to this matrix, replacing the original matrix with the result

Signature:scalarAddEquals (double s)
Parameters:s (double) – a scalar
scalarMult(*args)[source]

Multiplies a scalar to this matrix and returns a new matrix. The original is not modified

Signature:scalarMult (double s)
Parameters:s (double) – a scalar
Returns:The sum of this matrix and a scalar s
Return type:DoubleMatrix
scalarMultEquals(*args)[source]

Multiplies a scalar s to this matrix, replacing the original matrix with the result

Signature:scalarMultEquals (double s)
Parameters:s (double) – a scalar
set(*args)[source]

Sets the matrix value at row, col. The coordinates are not checked to make sure they fall in the matrix

Signature:

set (int row, int col, double value)

Parameters:
  • row (int) – The zero-based row index
  • col (int) – The zero-based column index
  • value (double) – The value to be set at row, col
setChecked(*args)[source]

Sets the matrix value at row, col. The coordinates are checked to make sure they fall in the matrix

Signature:

setChecked (int row, int col, double value)

Parameters:
  • row (int) – The zero-based row index
  • col (int) – The zero-based column index
  • value (double) – The value to be set at row, col
solve(*args)[source]

Solves the matrix

Signature:solve (DoubleMatrix Y)
Parameters:Y (DoubleMatrix) – a DoubleMatrix
Returns:The least squares solutions for B, where XB = Y and X is this matrix
Return type:DoubleMatrix
tcrossproduct(*args)[source]

Gets XX’ or Xdm’, where X is this matrix

Signature:tcrossproduct ()
Signature:tcrossproduct (DoubleMatrix dm)
Parameters:dm (DoubleMatrix) – The second matrix
Returns:The tcrossproduct
Return type:DoubleMatrix
transpose(*args)[source]

Gets the tranpose of this matrix

Signature:transpose ()
Returns:The transpose of this matrix
Return type:DoubleMatrix
class TASSELpy.net.maizegenetics.matrixalgebra.Matrix.DoubleMatrix.metaDoubleMatrix[source]

Bases: object

TASSELpy.net.maizegenetics.matrixalgebra.Matrix.DoubleMatrixFactory module

class TASSELpy.net.maizegenetics.matrixalgebra.Matrix.DoubleMatrixFactory.DoubleMatrixFactory(*args, **kwargs)[source]

Bases: TASSELpy.java.lang.Object.Object

Builder for creating DoubleMatrix objects

Methods

castTo(pyType) Casts this object to another java/python type
clone(*args) Creates and returns a copy of this object
compose(*args) Puts together a DoubleMatrix out of multiple matrices
diagonal(*args) Makes a diagonal matrix
equals(*args) Indicates whether some other object is “equal to” this one
getArray(size) Gets an empty wrapped java array that can accept the type of the wrapped
getClass(*args) Returns the runtime class of this Object.
getDblArray(rows[, cols]) Gets an empty wrapped java array that can accept the type of other wrapped java arrays: i.e.
getType(*args) Gets the FactoryType
hashCode(*args) Returns a hash code vlaue for the object
identity(*args) Makes an identity matrix
make(*args) Produces a DoubleMatrix
setDefault(*args) Sets the default DoubleMatrix type
toString(*args) Returns a string representation of the object
wrap_existing_array(arr_instance) Wraps a java array of this class’s type
FactoryType = <ejml: 0, jblas: 1, colt: 2, blas: 3>
__init__(*args, **kwargs)[source]

Constructor for DoubleMatrixFactory

Signature:DoubleMatrixFactory (FactoryType type)
Parameters:type (FactoryType) – One of the DoubleMatrixFactory.FactoryType types (ejml,jblas,colt,blas)
compose(*args)[source]

Puts together a DoubleMatrix out of multiple matrices

Signature:compose (DoubleMatrix[][] components)
Parameters:components (DoubleMatrix[][]) – 2D array of submatrices to form the matrix
Returns:A DoubleMatrix composed of the submatrices
Return type:DoubleMatrix
diagonal(*args)[source]

Makes a diagonal matrix

Signature:diagonal (double[] diag)
Parameters:diag (double[]) – The elements for the diagonal of the matrix
Returns:A DoubleMatrix with the specified elements along the diagonal
Return type:DoubleMatrix
getType(*args)[source]

Gets the FactoryType

Signature:getType ()
Returns:The FactoryType
Return type:FactoryType
identity(*args)[source]

Makes an identity matrix

Signature:identity (int n)
Parameters:n (int) – The size of the identity matrix
Returns:A DoubleMatrix representing an identity matrix
Return type:DoubleMatrix
make(*args)[source]

Produces a DoubleMatrix

Signature:

make (int row, int col)

Signature:

make (int row, int col, double[] values)

Signature:

make (int row, int col, double[] values, boolean columnMajor)

Signature:

make (double[][] values)

Signature:

make (int row, int col, double val)

Parameters:
  • row (int) – The number of rows in this matrix
  • col (int) – The number of columns in this matrix
  • values (double[][]) – The values for the matrix, listed row-wise
  • columnMajor (boolean) – Flag the values as listed column-wise
  • val (double) – A value to fill the matrix with
Returns:

A DoubleMatrix

Return type:

DoubleMatrix

static setDefault(*args)[source]

Sets the default DoubleMatrix type

Signature:setDefault (FactoryType type)
Parameters:type (FactoryType) – One of the DoubleMatrixFactory.FactoryType types

Module contents