public class CCSMatrix extends ColumnMajorSparseMatrix
cardinality| Constructor and Description |
|---|
CCSMatrix() |
CCSMatrix(int rows,
int columns) |
CCSMatrix(int rows,
int columns,
int capacity) |
CCSMatrix(int rows,
int columns,
int cardinality,
double[] values,
int[] rowIndices,
int[] columnPointers) |
| Modifier and Type | Method and Description |
|---|---|
Matrix |
blankOfShape(int rows,
int columns)
Creates the blank matrix (a zero matrix with same size) of this matrix
of the given shape:
rows x columns. |
static CCSMatrix |
block(Matrix a,
Matrix b,
Matrix c,
Matrix d)
|
ColumnMajorMatrixIterator |
columnMajorIterator()
Returns a column-major matrix iterator.
|
Matrix |
copyOfShape(int rows,
int columns)
Copies this matrix into the new matrix with specified dimensions:
rows and columns. |
static CCSMatrix |
diagonal(int size,
double diagonal)
|
void |
each(MatrixProcedure procedure)
Applies given
procedure to each element of this matrix. |
void |
eachInColumn(int j,
VectorProcedure procedure)
Applies given
procedure to each element of specified column of this matrix. |
void |
eachNonZero(MatrixProcedure procedure)
Applies given
procedure to each non-zero element of this matrix. |
void |
eachNonZeroInColumn(int j,
VectorProcedure procedure)
Applies the given
procedure to each non-zero element of the specified column of this matrix. |
static CCSMatrix |
from1DArray(int rows,
int columns,
double[] array)
Creates a new
CCSMatrix from the given 1D array with
compressing (copying) the underlying array. |
static CCSMatrix |
from2DArray(double[][] array)
Creates a new
CCSMatrix from the given 2D array with
compressing (copying) the underlying array. |
static CCSMatrix |
fromBinary(byte[] array)
Decodes
CCSMatrix from the given byte array. |
static CCSMatrix |
fromCSV(String csv)
Parses
CCSMatrix from the given CSV string. |
static CCSMatrix |
fromMatrixMarket(String mm)
Parses
CCSMatrix from the given Matrix Market string. |
Vector |
getColumn(int j)
Copies the specified column of this matrix into the vector.
|
double |
getOrElse(int i,
int j,
double defaultValue)
Gets the specified element, or a
defaultValue if there
is no actual element at (i, j) in this sparse matrix. |
Vector |
getRow(int i)
Copies the specified row of this matrix into the vector.
|
static CCSMatrix |
identity(int size)
Creates an identity
CCSMatrix of the given size. |
VectorIterator |
iteratorOfColumn(int j)
Returns a vector iterator of the given column {code j}.
|
Iterator<Integer> |
iteratorOrNonZeroColumns() |
double |
max()
Searches for the maximum value of the elements of this matrix.
|
double |
maxInColumn(int j)
Searches for the maximum value of specified column in this matrix.
|
double |
min()
Searches for the minimum value of the elements of this matrix.
|
double |
minInColumn(int j)
Searches for the minimum value of specified column in this matrix.
|
boolean |
nonZeroAt(int i,
int j)
Whether or not the specified element is not zero.
|
ColumnMajorMatrixIterator |
nonZeroColumnMajorIterator()
Returns a non-zero column-major matrix iterator.
|
VectorIterator |
nonZeroIteratorOfColumn(int j)
Returns a non-zero vector iterator of the given column
j. |
static CCSMatrix |
random(int rows,
int columns,
double density,
Random random)
|
static CCSMatrix |
randomSymmetric(int size,
double density,
Random random)
Creates a random symmetric
CCSMatrix of the given size. |
Matrix |
select(int[] rowIndices,
int[] columnIndices)
Returns a CCSMatrix with the selected rows and columns.
|
void |
set(int i,
int j,
double value)
Sets the specified element of this matrix to given
value. |
void |
setAll(double value)
Sets all elements of this matrix to the given
value. |
<T extends Matrix> |
to(MatrixFactory<T> factory)
Converts this matrix using the given
factory. |
byte[] |
toBinary()
Encodes this matrix into a byte array.
|
void |
updateAt(int i,
int j,
MatrixFunction function)
Updates the specified element of this matrix by applying given
function. |
static CCSMatrix |
zero(int rows,
int columns)
|
static CCSMatrix |
zero(int rows,
int columns,
int capacity)
|
apply, apply, apply, isRowMajor, iterator, nonZeroIterator, rotate, transposeadd, capacity, cardinality, density, eachNonZeroInRow, ensureCardinalityIsCorrect, foldNonZero, foldNonZeroInColumn, foldNonZeroInColumns, foldNonZeroInRow, foldNonZeroInRows, get, isColumnMajor, isZeroAt, multiply, nonZeroIteratorOfRow, nonZeroRowMajorIterator, toMatrixMarketadd, blank, blankOfColumns, blankOfRows, columns, constant, copy, copyOfColumns, copyOfRows, determinant, diagonalProduct, divide, eachInRow, ensureDimensionsAreCorrect, ensureIndexesAreInBounds, equals, equals, euclideanNorm, fail, fold, foldColumn, foldColumns, foldRow, foldRows, hadamardProduct, hashCode, infinityNorm, insert, insert, insert, insert, insertColumn, insertRow, is, is, iteratorOfRow, kroneckerProduct, manhattanNorm, maxInRow, minInRow, mkString, mkString, mkString, multiply, multiply, multiplyByItsTranspose, non, non, norm, power, product, random, randomSymmetric, rank, removeColumn, removeFirstColumn, removeFirstRow, removeLastColumn, removeLastRow, removeRow, rowMajorIterator, rows, setColumn, setColumn, setRow, setRow, shuffle, slice, sliceBottomRight, sliceTopLeft, subtract, subtract, sum, swapColumns, swapRows, toColumnMajorSparseMatrix, toColumnVector, toCSV, toCSV, toDenseMatrix, toMatrixMarket, toRowMajorSparseMatrix, toRowVector, toSparseMatrix, toString, trace, transform, transformColumn, transformRow, unit, update, updateColumn, updateRow, withDecompositor, withInverter, withSolverpublic CCSMatrix()
public CCSMatrix(int rows,
int columns)
public CCSMatrix(int rows,
int columns,
int capacity)
public CCSMatrix(int rows,
int columns,
int cardinality,
double[] values,
int[] rowIndices,
int[] columnPointers)
public static CCSMatrix zero(int rows, int columns)
public static CCSMatrix zero(int rows, int columns, int capacity)
public static CCSMatrix diagonal(int size, double diagonal)
public static CCSMatrix identity(int size)
CCSMatrix of the given size.public static CCSMatrix randomSymmetric(int size, double density, Random random)
CCSMatrix of the given size.public static CCSMatrix from1DArray(int rows, int columns, double[] array)
CCSMatrix from the given 1D array with
compressing (copying) the underlying array.public static CCSMatrix from2DArray(double[][] array)
CCSMatrix from the given 2D array with
compressing (copying) the underlying array.public static CCSMatrix fromBinary(byte[] array)
CCSMatrix from the given byte array.array - the byte array representing a matrixpublic static CCSMatrix fromCSV(String csv)
CCSMatrix from the given CSV string.csv - the CSV string representing a matrixpublic static CCSMatrix fromMatrixMarket(String mm)
CCSMatrix from the given Matrix Market string.mm - the string in Matrix Market formatpublic double getOrElse(int i,
int j,
double defaultValue)
SparseMatrixdefaultValue if there
is no actual element at (i, j) in this sparse matrix.getOrElse in class SparseMatrixi - the element's row indexj - the element's column indexdefaultValue - the default valuepublic void set(int i,
int j,
double value)
Matrixvalue.public void setAll(double value)
Matrixvalue.public Vector getColumn(int j)
MatrixgetColumn in class SparseMatrixj - the column indexpublic Vector getRow(int i)
MatrixgetRow in class SparseMatrixi - the row indexpublic Matrix copyOfShape(int rows, int columns)
Matrixrows and columns.copyOfShape in class Matrixrows - the number of rows in new matrixcolumns - the number of columns in new matrixpublic void eachNonZero(MatrixProcedure procedure)
SparseMatrixprocedure to each non-zero element of this matrix.eachNonZero in class SparseMatrixprocedure - the matrix procedurepublic void each(MatrixProcedure procedure)
Matrixprocedure to each element of this matrix.public void eachInColumn(int j,
VectorProcedure procedure)
Matrixprocedure to each element of specified column of this matrix.eachInColumn in class Matrixj - the column indexprocedure - the vector procedurepublic void eachNonZeroInColumn(int j,
VectorProcedure procedure)
SparseMatrixprocedure to each non-zero element of the specified column of this matrix.eachNonZeroInColumn in class SparseMatrixj - the column index.procedure - the VectorProcedure.public void updateAt(int i,
int j,
MatrixFunction function)
Matrixfunction.public boolean nonZeroAt(int i,
int j)
SparseMatrixnonZeroAt in class SparseMatrixi - element's row indexj - element's column indextrue if specified element is not zero, false otherwisepublic double max()
Matrixpublic double min()
Matrixpublic double maxInColumn(int j)
MatrixmaxInColumn in class Matrixj - the column indexpublic double minInColumn(int j)
MatrixminInColumn in class Matrixj - the column indexpublic Matrix select(int[] rowIndices, int[] columnIndices)
public <T extends Matrix> T to(MatrixFactory<T> factory)
Matrixfactory.public Matrix blankOfShape(int rows, int columns)
Matrixrows x columns.blankOfShape in class Matrixpublic Iterator<Integer> iteratorOrNonZeroColumns()
iteratorOrNonZeroColumns in class ColumnMajorSparseMatrixpublic ColumnMajorMatrixIterator columnMajorIterator()
MatrixcolumnMajorIterator in class Matrixpublic ColumnMajorMatrixIterator nonZeroColumnMajorIterator()
SparseMatrixnonZeroColumnMajorIterator in class SparseMatrixpublic VectorIterator nonZeroIteratorOfColumn(int j)
SparseMatrixj.nonZeroIteratorOfColumn in class SparseMatrixpublic VectorIterator iteratorOfColumn(int j)
MatrixiteratorOfColumn in class MatrixCopyright © 2015. All rights reserved.