Package org.la4j.matrix
Class DenseMatrix
- java.lang.Object
-
- org.la4j.Matrix
-
- org.la4j.matrix.DenseMatrix
-
- All Implemented Interfaces:
java.lang.Iterable<java.lang.Double>
- Direct Known Subclasses:
Basic1DMatrix,Basic2DMatrix
public abstract class DenseMatrix extends Matrix
-
-
Constructor Summary
Constructors Constructor Description DenseMatrix(int rows, int columns)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description <T> Tapply(MatrixMatrixOperation<T> operation, Matrix that)Pipes this matrix to a givenoperation.<T> Tapply(MatrixOperation<T> operation)Pipes this matrix to a givenoperation.<T> Tapply(MatrixVectorOperation<T> operation, Vector that)Pipes this matrix to a givenoperation.static DenseMatrixblock(Matrix a, Matrix b, Matrix c, Matrix d)static DenseMatrixconstant(int rows, int columns, double constant)Creates a constantDenseMatrixof the given shape andvalue.static DenseMatrixdiagonal(int size, double diagonal)static DenseMatrixfrom1DArray(int rows, int columns, double[] array)Creates aDenseMatrixof the given 1Darrayw/o copying the underlying array.static DenseMatrixfrom2DArray(double[][] array)Creates aDenseMatrixof the given 2Darrayw/o copying the underlying array.static DenseMatrixfromCSV(java.lang.String csv)ParsesDenseMatrixfrom the given CSV string.static DenseMatrixfromMatrixMarket(java.lang.String mm)ParsesDenseMatrixfrom the given Matrix Market string.VectorgetColumn(int j)Copies the specified column of this matrix into the vector.VectorgetRow(int i)Copies the specified row of this matrix into the vector.static DenseMatrixidentity(int size)Creates an identityDenseMatrixof the givensize.static DenseMatrixrandom(int rows, int columns, java.util.Random random)static DenseMatrixrandomSymmetric(int size, java.util.Random random)Creates a random symmetricDenseMatrixof the givensize.abstract double[][]toArray()Converts this dense matrix to double array.java.lang.StringtoMatrixMarket(java.text.NumberFormat formatter)Converts this matrix into the Matrix Market string using the given numberformatter.static DenseMatrixunit(int rows, int columns)static DenseMatrixzero(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
-
-
-
-
Method Detail
-
zero
public static DenseMatrix zero(int rows, int columns)
-
constant
public static DenseMatrix constant(int rows, int columns, double constant)
Creates a constantDenseMatrixof the given shape andvalue.
-
diagonal
public static DenseMatrix diagonal(int size, double diagonal)
-
unit
public static DenseMatrix unit(int rows, int columns)
-
identity
public static DenseMatrix identity(int size)
Creates an identityDenseMatrixof the givensize.
-
random
public static DenseMatrix random(int rows, int columns, java.util.Random random)
-
randomSymmetric
public static DenseMatrix randomSymmetric(int size, java.util.Random random)
Creates a random symmetricDenseMatrixof the givensize.
-
from1DArray
public static DenseMatrix from1DArray(int rows, int columns, double[] array)
Creates aDenseMatrixof the given 1Darrayw/o copying the underlying array.
-
from2DArray
public static DenseMatrix from2DArray(double[][] array)
Creates aDenseMatrixof the given 2Darrayw/o copying the underlying array.
-
block
public static DenseMatrix block(Matrix a, Matrix b, Matrix c, Matrix d)
-
fromCSV
public static DenseMatrix fromCSV(java.lang.String csv)
ParsesDenseMatrixfrom the given CSV string.- Parameters:
csv- the CSV string representing a matrix- Returns:
- a parsed matrix
-
fromMatrixMarket
public static DenseMatrix fromMatrixMarket(java.lang.String mm)
ParsesDenseMatrixfrom 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
public Vector getRow(int i)
Description copied from class:MatrixCopies the specified row of this matrix into the vector.
-
getColumn
public Vector getColumn(int j)
Description copied from class:MatrixCopies the specified column of this matrix into the vector.
-
apply
public <T> T apply(MatrixOperation<T> operation)
Description copied from class:MatrixPipes this matrix to a givenoperation.
-
apply
public <T> T apply(MatrixMatrixOperation<T> operation, Matrix that)
Description copied from class:MatrixPipes this matrix to a givenoperation.
-
apply
public <T> T apply(MatrixVectorOperation<T> operation, Vector that)
Description copied from class:MatrixPipes this matrix to a givenoperation.
-
toMatrixMarket
public java.lang.String toMatrixMarket(java.text.NumberFormat formatter)
Description copied from class:MatrixConverts this matrix into the Matrix Market string using the given numberformatter.- Specified by:
toMatrixMarketin classMatrix- Returns:
- a string in Matrix Market format representing this matrix;
-
-