# SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.algebra.linear.matrix.doubles.operation

## Class FastKroneckerProduct

• java.lang.Object
• com.numericalmethod.suanshu.algebra.linear.matrix.doubles.operation.FastKroneckerProduct
• ### Constructor Summary

Constructors
Constructor and Description
FastKroneckerProduct(Matrix A, Matrix B)
Construct a Kronecker product for read-only.
• ### Method Summary

All Methods
Modifier and Type Method and Description
Matrix add(Matrix that)
this + that
FastKroneckerProduct deepCopy()
Return this as this Matrix is immutable.
double get(int i, int j)
Get the matrix entry at [i,j].
DenseVector getColumn(int j)
Get the specified column in the matrix as a vector.
DenseVector getRow(int i)
Get the specified row in the matrix as a vector.
Matrix minus(Matrix that)
this - that
Matrix multiply(Matrix that)
this * that
Vector multiply(Vector v)
Right multiply this matrix, A, by a vector.
int nCols()
Gets the number of columns.
int nRows()
Gets the number of rows.
DenseMatrix ONE()
Get an identity matrix that has the same dimension as this matrix.
Matrix opposite()
Get the opposite of this matrix.
Matrix scaled(double scalar)
Scale this matrix, A, by a constant.
void set(int i, int j, double value)
Set the matrix entry at [i,j] to a value.
Matrix t()
Get the transpose of this matrix.
DenseMatrix ZERO()
Get a zero matrix that has the same dimension as this matrix.
• ### Methods inherited from class java.lang.Object

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

• #### FastKroneckerProduct

public FastKroneckerProduct(Matrix A,
Matrix B)
Construct a Kronecker product for read-only.
Parameters:
A - a matrix
B - a matrix
• ### Method Detail

• #### nRows

public int nRows()
Description copied from interface: Table
Gets the number of rows. Rows count from 1.
Specified by:
nRows in interface Table
Returns:
the number of rows
• #### nCols

public int nCols()
Description copied from interface: Table
Gets the number of columns. Columns count from 1.
Specified by:
nCols in interface Table
Returns:
the number of columns
• #### set

public void set(int i,
int j,
double value)
throws MatrixAccessException
Description copied from interface: MatrixAccess
Set the matrix entry at [i,j] to a value. This is the only method that may change a matrix.
Specified by:
set in interface MatrixAccess
Parameters:
i - the row index
j - the column index
value - the value to set A[i,j] to
Throws:
MatrixAccessException - if i or j is out of range
• #### get

public double get(int i,
int j)
throws MatrixAccessException
Description copied from interface: MatrixAccess
Get the matrix entry at [i,j].
Specified by:
get in interface MatrixAccess
Parameters:
i - the row index
j - the column index
Returns:
A[i,j]
Throws:
MatrixAccessException - if i or j is out of range
• #### getRow

public DenseVector getRow(int i)
throws MatrixAccessException
Description copied from interface: Matrix
Get the specified row in the matrix as a vector.
Specified by:
getRow in interface Matrix
Parameters:
i - the row index
Returns:
the vector A[i, ]
Throws:
MatrixAccessException - when i < 1, or when i > the number of rows
• #### getColumn

public DenseVector getColumn(int j)
throws MatrixAccessException
Description copied from interface: Matrix
Get the specified column in the matrix as a vector.
Specified by:
getColumn in interface Matrix
Parameters:
j - the column index
Returns:
a vector A[, j]
Throws:
MatrixAccessException - when j < 1, or when j > the number of columns

public Matrix add(Matrix that)
Description copied from interface: MatrixRing
this + that
Specified by:
add in interface MatrixRing
Specified by:
add in interface AbelianGroup<Matrix>
Parameters:
that - a matrix
Returns:
the sum of this and that
• #### minus

public Matrix minus(Matrix that)
Description copied from interface: MatrixRing
this - that
Specified by:
minus in interface MatrixRing
Specified by:
minus in interface AbelianGroup<Matrix>
Parameters:
that - a matrix
Returns:
the difference between this and that
• #### multiply

public Matrix multiply(Matrix that)
Description copied from interface: MatrixRing
this * that
Specified by:
multiply in interface MatrixRing
Specified by:
multiply in interface Monoid<Matrix>
Parameters:
that - a matrix
Returns:
the product ofthis and that
• #### multiply

public Vector multiply(Vector v)
Description copied from interface: Matrix
Right multiply this matrix, A, by a vector.
Specified by:
multiply in interface Matrix
Parameters:
v - a vector
Returns:
Av, a vector
• #### scaled

public Matrix scaled(double scalar)
Description copied from interface: Matrix
Scale this matrix, A, by a constant.
Specified by:
scaled in interface Matrix
Parameters:
scalar - a double
Returns:
cA
• #### opposite

public Matrix opposite()
Description copied from interface: MatrixRing
Get the opposite of this matrix.
Specified by:
opposite in interface MatrixRing
Specified by:
opposite in interface AbelianGroup<Matrix>
Returns:
-this
• #### ZERO

public DenseMatrix ZERO()
Description copied from interface: MatrixRing
Get a zero matrix that has the same dimension as this matrix.
Specified by:
ZERO in interface MatrixRing
Specified by:
ZERO in interface AbelianGroup<Matrix>
Returns:
the 0 matrix
• #### ONE

public DenseMatrix ONE()
Description copied from interface: MatrixRing
Get an identity matrix that has the same dimension as this matrix. For a non-square matrix, it zeros out the rows (columns) with index > nCols (nRows).
Specified by:
ONE in interface MatrixRing
Specified by:
ONE in interface Monoid<Matrix>
Returns:
an identity matrix
• #### t

public Matrix t()
Description copied from interface: MatrixRing
Get the transpose of this matrix. This is the involution on the matrix ring.
Specified by:
t in interface MatrixRing
Returns:
the transpose of this matrix
• #### deepCopy

public FastKroneckerProduct deepCopy()
Return this as this Matrix is immutable.
Specified by:
deepCopy in interface Matrix
Specified by:
deepCopy in interface DeepCopyable
Returns:
this