Package org.la4j.matrix
Class DenseMatrix
java.lang.Object
org.la4j.Matrix
org.la4j.matrix.DenseMatrix
- Direct Known Subclasses:
Basic1DMatrix
,Basic2DMatrix
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> T
apply
(MatrixMatrixOperation<T> operation, Matrix that) Pipes this matrix to a givenoperation
.<T> T
apply
(MatrixOperation<T> operation) Pipes this matrix to a givenoperation
.<T> T
apply
(MatrixVectorOperation<T> operation, Vector that) Pipes this matrix to a givenoperation
.static DenseMatrix
static DenseMatrix
constant
(int rows, int columns, double constant) Creates a constantDenseMatrix
of the given shape andvalue
.static DenseMatrix
diagonal
(int size, double diagonal) static DenseMatrix
from1DArray
(int rows, int columns, double[] array) Creates aDenseMatrix
of the given 1Darray
w/o copying the underlying array.static DenseMatrix
from2DArray
(double[][] array) Creates aDenseMatrix
of the given 2Darray
w/o copying the underlying array.static DenseMatrix
ParsesDenseMatrix
from the given CSV string.static DenseMatrix
ParsesDenseMatrix
from the given Matrix Market string.getColumn
(int j) Copies the specified column of this matrix into the vector.getRow
(int i) Copies the specified row of this matrix into the vector.static DenseMatrix
identity
(int size) Creates an identityDenseMatrix
of the givensize
.static DenseMatrix
static DenseMatrix
randomSymmetric
(int size, Random random) Creates a random symmetricDenseMatrix
of the givensize
.abstract double[][]
toArray()
Converts this dense matrix to double array.toMatrixMarket
(NumberFormat formatter) Converts this matrix into the Matrix Market string using the given numberformatter
.static DenseMatrix
unit
(int rows, int columns) static DenseMatrix
zero
(int rows, int columns) Methods inherited from class org.la4j.Matrix
add, add, blank, blankOfColumns, blankOfRows, blankOfShape, columnMajorIterator, columns, copy, copyOfColumns, copyOfRows, copyOfShape, determinant, diagonalProduct, divide, each, eachInColumn, eachInRow, ensureDimensionsAreCorrect, ensureIndexesAreInBounds, equals, equals, euclideanNorm, fail, fold, foldColumn, foldColumns, foldRow, foldRows, get, 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, set, setAll, setColumn, setColumn, setRow, setRow, shuffle, slice, sliceBottomRight, sliceTopLeft, subtract, subtract, sum, swapColumns, swapRows, to, toBinary, toColumnMajorSparseMatrix, toColumnVector, toCSV, toCSV, toDenseMatrix, toMatrixMarket, toRowMajorSparseMatrix, toRowVector, toSparseMatrix, toString, trace, transform, transformColumn, transformRow, transpose, update, updateAt, updateColumn, updateRow, withDecompositor, withInverter, withSolver
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
DenseMatrix
public DenseMatrix(int rows, int columns)
-
-
Method Details
-
zero
-
constant
Creates a constantDenseMatrix
of the given shape andvalue
. -
diagonal
-
unit
-
identity
Creates an identityDenseMatrix
of the givensize
. -
random
-
randomSymmetric
Creates a random symmetricDenseMatrix
of the givensize
. -
from1DArray
Creates aDenseMatrix
of the given 1Darray
w/o copying the underlying array. -
from2DArray
Creates aDenseMatrix
of the given 2Darray
w/o copying the underlying array. -
block
-
fromCSV
ParsesDenseMatrix
from the given CSV string.- Parameters:
csv
- the CSV string representing a matrix- Returns:
- a parsed matrix
-
fromMatrixMarket
ParsesDenseMatrix
from the given Matrix Market string.- Parameters:
mm
- the string in Matrix Market format- Returns:
- a parsed matrix
-
toArray
public abstract double[][] toArray()Converts this dense matrix to double array.- Returns:
- an array representation of this matrix
-
getRow
Description copied from class:Matrix
Copies the specified row of this matrix into the vector. -
getColumn
Description copied from class:Matrix
Copies the specified column of this matrix into the vector. -
apply
Description copied from class:Matrix
Pipes this matrix to a givenoperation
. -
apply
Description copied from class:Matrix
Pipes this matrix to a givenoperation
. -
apply
Description copied from class:Matrix
Pipes this matrix to a givenoperation
. -
toMatrixMarket
Description copied from class:Matrix
Converts this matrix into the Matrix Market string using the given numberformatter
.- Specified by:
toMatrixMarket
in classMatrix
- Returns:
- a string in Matrix Market format representing this matrix;
-