public class Basic2DMatrix extends DenseMatrix
| Constructor and Description |
|---|
Basic2DMatrix() |
Basic2DMatrix(double[][] array) |
Basic2DMatrix(int rows,
int columns) |
| 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 Basic2DMatrix |
block(Matrix a,
Matrix b,
Matrix c,
Matrix d)
|
static Basic2DMatrix |
constant(int rows,
int columns,
double constant)
Creates a constant
Basic2DMatrix of the given shape and value. |
Matrix |
copyOfShape(int rows,
int columns)
Copies this matrix into the new matrix with specified dimensions:
rows and columns. |
static Basic2DMatrix |
diagonal(int size,
double diagonal)
|
static Basic2DMatrix |
from1DArray(int rows,
int columns,
double[] array)
Creates a
Basic2DMatrix of the given 1D array with
copying the underlying array. |
static Basic2DMatrix |
from2DArray(double[][] array)
Creates a
Basic2DMatrix of the given 2D array w/o
copying the underlying array. |
static Basic2DMatrix |
fromBinary(byte[] array)
Decodes
Basic2DMatrix from the given byte array. |
static Basic2DMatrix |
fromCSV(String csv)
Parses
Basic2DMatrix from the given CSV string. |
static Basic2DMatrix |
fromMatrixMarket(String mm)
Parses
Basic2DMatrix from the given Matrix Market string. |
double |
get(int i,
int j)
Gets the specified element of this matrix.
|
Vector |
getRow(int i)
Copies the specified row of this matrix into the vector.
|
static Basic2DMatrix |
identity(int size)
Creates an identity
Basic2DMatrix of the given size. |
static Basic2DMatrix |
random(int rows,
int columns,
Random random)
|
static Basic2DMatrix |
randomSymmetric(int size,
Random random)
Creates a random symmetric
Basic2DMatrix of the given size. |
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. |
void |
swapColumns(int i,
int j)
Swaps the specified columns of this matrix.
|
void |
swapRows(int i,
int j)
Swaps the specified rows of this matrix.
|
<T extends Matrix> |
to(MatrixFactory<T> factory)
Converts this matrix using the given
factory. |
double[][] |
toArray()
Converts this dense matrix to double array.
|
byte[] |
toBinary()
Encodes this matrix into a byte array.
|
static Basic2DMatrix |
unit(int rows,
int columns)
|
static Basic2DMatrix |
zero(int rows,
int columns)
|
apply, apply, apply, getColumn, toMatrixMarketadd, add, blank, blankOfColumns, blankOfRows, columnMajorIterator, columns, copy, copyOfColumns, copyOfRows, determinant, diagonalProduct, divide, each, eachInColumn, eachInRow, ensureDimensionsAreCorrect, ensureIndexesAreInBounds, equals, equals, euclideanNorm, fail, fold, foldColumn, foldColumns, foldRow, foldRows, hadamardProduct, hashCode, infinityNorm, insert, insert, insert, insert, insertColumn, insertRow, is, is, iterator, iteratorOfColumn, iteratorOfRow, kroneckerProduct, manhattanNorm, max, maxInColumn, maxInRow, min, minInColumn, minInRow, mkString, mkString, mkString, multiply, multiply, multiply, multiplyByItsTranspose, non, non, norm, power, product, rank, removeColumn, removeFirstColumn, removeFirstRow, removeLastColumn, removeLastRow, removeRow, rotate, rowMajorIterator, rows, select, setColumn, setColumn, setRow, setRow, shuffle, slice, sliceBottomRight, sliceTopLeft, subtract, subtract, sum, toColumnMajorSparseMatrix, toColumnVector, toCSV, toCSV, toDenseMatrix, toMatrixMarket, toRowMajorSparseMatrix, toRowVector, toSparseMatrix, toString, trace, transform, transformColumn, transformRow, transpose, update, updateAt, updateColumn, updateRow, withDecompositor, withInverter, withSolverpublic Basic2DMatrix()
public Basic2DMatrix(int rows,
int columns)
public Basic2DMatrix(double[][] array)
public static Basic2DMatrix zero(int rows, int columns)
public static Basic2DMatrix constant(int rows, int columns, double constant)
Basic2DMatrix of the given shape and value.public static Basic2DMatrix diagonal(int size, double diagonal)
public static Basic2DMatrix unit(int rows, int columns)
public static Basic2DMatrix identity(int size)
Basic2DMatrix of the given size.public static Basic2DMatrix random(int rows, int columns, Random random)
public static Basic2DMatrix randomSymmetric(int size, Random random)
Basic2DMatrix of the given size.public static Basic2DMatrix from1DArray(int rows, int columns, double[] array)
Basic2DMatrix of the given 1D array with
copying the underlying array.public static Basic2DMatrix from2DArray(double[][] array)
Basic2DMatrix of the given 2D array w/o
copying the underlying array.public static Basic2DMatrix block(Matrix a, Matrix b, Matrix c, Matrix d)
public static Basic2DMatrix fromBinary(byte[] array)
Basic2DMatrix from the given byte array.array - the byte array representing a matrixpublic static Basic2DMatrix fromCSV(String csv)
Basic2DMatrix from the given CSV string.csv - the CSV string representing a matrixpublic static Basic2DMatrix fromMatrixMarket(String mm)
Basic2DMatrix from the given Matrix Market string.mm - the string in Matrix Market formatpublic double get(int i,
int j)
Matrixpublic void set(int i,
int j,
double value)
Matrixvalue.public void setAll(double value)
Matrixvalue.public void swapRows(int i,
int j)
Matrixpublic void swapColumns(int i,
int j)
MatrixswapColumns in class Matrixi - the column indexj - the column indexpublic Vector getRow(int i)
MatrixgetRow in class DenseMatrixi - 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 double[][] toArray()
DenseMatrixtoArray in class DenseMatrixpublic <T extends Matrix> T to(MatrixFactory<T> factory)
Matrixfactory.public Matrix blankOfShape(int rows, int columns)
Matrixrows x columns.blankOfShape in class MatrixCopyright © 2015. All rights reserved.