Package org.la4j.matrix
Class RowMajorSparseMatrix
- java.lang.Object
-
- org.la4j.Matrix
-
- org.la4j.matrix.SparseMatrix
-
- org.la4j.matrix.RowMajorSparseMatrix
-
- All Implemented Interfaces:
java.lang.Iterable<java.lang.Double>
- Direct Known Subclasses:
CRSMatrix
public abstract class RowMajorSparseMatrix extends SparseMatrix
-
-
Field Summary
-
Fields inherited from class org.la4j.matrix.SparseMatrix
cardinality
-
-
Constructor Summary
Constructors Constructor Description RowMajorSparseMatrix(int rows, int columns)
RowMajorSparseMatrix(int rows, int columns, int cardinality)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description <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 RowMajorSparseMatrix
block(Matrix a, Matrix b, Matrix c, Matrix d)
static RowMajorSparseMatrix
diagonal(int size, double diagonal)
Creates a diagonalRowMajorSparseMatrix
of the givensize
whose diagonal elements are equal todiagonal
.static RowMajorSparseMatrix
from1DArray(int rows, int columns, double[] array)
Creates a newRowMajorSparseMatrix
from the given 1Darray
with compressing (copying) the underlying array.static RowMajorSparseMatrix
from2DArray(double[][] array)
Creates a newRowMajorSparseMatrix
from the given 2Darray
with compressing (copying) the underlying array.static RowMajorSparseMatrix
fromCSV(java.lang.String csv)
ParsesRowMajorSparseMatrix
from the given CSV string.static RowMajorSparseMatrix
fromMatrixMarket(java.lang.String mm)
ParsesRowMajorSparseMatrix
from the given Matrix Market string.static RowMajorSparseMatrix
identity(int size)
Creates an identityRowMajorSparseMatrix
of the givensize
.boolean
isRowMajor()
Checks whether or not this sparse matrix row-major.abstract java.util.Iterator<java.lang.Integer>
iteratorOfNonZeroRows()
static RowMajorSparseMatrix
random(int rows, int columns, double density, java.util.Random random)
static RowMajorSparseMatrix
randomSymmetric(int size, double density, java.util.Random random)
Creates a random symmetricRowMajorSparseMatrix
of the givensize
.Matrix
rotate()
Rotates this matrix by 90 degrees to the right.Matrix
transpose()
Transposes this matrix.static RowMajorSparseMatrix
zero(int rows, int columns)
static RowMajorSparseMatrix
zero(int rows, int columns, int capacity)
-
Methods inherited from class org.la4j.matrix.SparseMatrix
add, capacity, cardinality, density, eachNonZero, eachNonZeroInColumn, eachNonZeroInRow, ensureCardinalityIsCorrect, foldNonZero, foldNonZeroInColumn, foldNonZeroInColumns, foldNonZeroInRow, foldNonZeroInRows, get, getColumn, getOrElse, getRow, isColumnMajor, isZeroAt, multiply, nonZeroAt, nonZeroColumnMajorIterator, nonZeroIterator, nonZeroIteratorOfColumn, nonZeroIteratorOfRow, nonZeroRowMajorIterator, toMatrixMarket
-
Methods inherited from class org.la4j.Matrix
add, blank, blankOfColumns, blankOfRows, blankOfShape, columnMajorIterator, columns, constant, copy, copyOfColumns, copyOfRows, copyOfShape, 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, multiplyByItsTranspose, non, non, norm, power, product, random, randomSymmetric, rank, removeColumn, removeFirstColumn, removeFirstRow, removeLastColumn, removeLastRow, removeRow, 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, unit, update, updateAt, updateColumn, updateRow, withDecompositor, withInverter, withSolver
-
-
-
-
Method Detail
-
zero
public static RowMajorSparseMatrix zero(int rows, int columns)
-
zero
public static RowMajorSparseMatrix zero(int rows, int columns, int capacity)
-
diagonal
public static RowMajorSparseMatrix diagonal(int size, double diagonal)
Creates a diagonalRowMajorSparseMatrix
of the givensize
whose diagonal elements are equal todiagonal
.
-
identity
public static RowMajorSparseMatrix identity(int size)
Creates an identityRowMajorSparseMatrix
of the givensize
.
-
random
public static RowMajorSparseMatrix random(int rows, int columns, double density, java.util.Random random)
-
randomSymmetric
public static RowMajorSparseMatrix randomSymmetric(int size, double density, java.util.Random random)
Creates a random symmetricRowMajorSparseMatrix
of the givensize
.
-
from1DArray
public static RowMajorSparseMatrix from1DArray(int rows, int columns, double[] array)
Creates a newRowMajorSparseMatrix
from the given 1Darray
with compressing (copying) the underlying array.
-
from2DArray
public static RowMajorSparseMatrix from2DArray(double[][] array)
Creates a newRowMajorSparseMatrix
from the given 2Darray
with compressing (copying) the underlying array.
-
block
public static RowMajorSparseMatrix block(Matrix a, Matrix b, Matrix c, Matrix d)
-
fromCSV
public static RowMajorSparseMatrix fromCSV(java.lang.String csv)
ParsesRowMajorSparseMatrix
from the given CSV string.- Parameters:
csv
- the CSV string representing a matrix- Returns:
- a parsed matrix
-
fromMatrixMarket
public static RowMajorSparseMatrix fromMatrixMarket(java.lang.String mm)
ParsesRowMajorSparseMatrix
from the given Matrix Market string.- Parameters:
mm
- the string in Matrix Market format- Returns:
- a parsed matrix
-
isRowMajor
public boolean isRowMajor()
Description copied from class:SparseMatrix
Checks whether or not this sparse matrix row-major.- Specified by:
isRowMajor
in classSparseMatrix
-
rotate
public Matrix rotate()
Description copied from class:Matrix
Rotates this matrix by 90 degrees to the right.
-
iteratorOfNonZeroRows
public abstract java.util.Iterator<java.lang.Integer> iteratorOfNonZeroRows()
-
apply
public <T> T apply(MatrixOperation<T> operation)
Description copied from class:Matrix
Pipes this matrix to a givenoperation
.
-
apply
public <T> T apply(MatrixMatrixOperation<T> operation, Matrix that)
Description copied from class:Matrix
Pipes this matrix to a givenoperation
.
-
apply
public <T> T apply(MatrixVectorOperation<T> operation, Vector that)
Description copied from class:Matrix
Pipes this matrix to a givenoperation
.
-
-