Package org.la4j
Class Matrices
java.lang.Object
org.la4j.Matrices
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
private static class
private static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final MatrixFactory
<Basic1DMatrix> A matrix factory that produces zeroBasic1DMatrix
.static final MatrixFactory
<Basic2DMatrix> A matrix factory that produces zeroBasic2DMatrix
.static final MatrixFactory
<CCSMatrix> A matrix factory that produces zeroCCSMatrix
.static final MatrixFactory<?>[]
static final MatrixFactory
<CRSMatrix> A matrix factory that produces zeroCRSMatrix
.static final MatrixFunction
Decreases each element of matrix by1
.static final MatrixFactory
<Basic2DMatrix> A default matrix factory for dense matrices.static final MatrixPredicate
Checks whether the matrix is a diagonal matrix.static final AdvancedMatrixPredicate
Checks whether the matrix is a diagonally dominant matrix.static final double
The machine epsilon, that is calculated at runtime.static final MatrixPredicate
Checks whether the matrix is an identity matrix.static final MatrixFunction
Increases each element of matrix by1
.static final MatrixFunction
Inverts each element of matrix.static final MatrixPredicate
Checks whether the matrix is a lower bi-diagonal matrix.static final MatrixPredicate
Checks whether the matrix is a lower triangular matrix.static final MatrixPredicate
Checks whether the matrix is a negative matrix.static final AdvancedMatrixPredicate
Checks whether the matrix is positive definite.static final MatrixPredicate
Checks whether the matrix is a positive matrix.static final int
Exponent of machine epsilonstatic final MatrixFactory
<CRSMatrix> A default factory for sparse matrices.static final MatrixFactory
<CCSMatrix> A default factory for sparse column-major matrices.static final MatrixFactory
<CRSMatrix> A default factory for sparse row-major matrices.static final AdvancedMatrixPredicate
Checks whether the matrix is a symmetric matrix.static final MatrixPredicate
Checks whether the matrix is a tridiagonal matrix.static final MatrixPredicate
Checks whether the matrix is an upper bidiagonal matrix.static final MatrixPredicate
Checks whether the matrix is an upper triangular matrix.static final MatrixPredicate
Checks whether the matrix is a zero matrix. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic MatrixProcedure
asAccumulatorProcedure
(MatrixAccumulator accumulator) Creates an accumulator procedure that adapts a matrix accumulator for procedure interface.static MatrixFunction
asConstFunction
(double arg) Creates a const function that evaluates it's argument to givenvalue
.static MatrixFunction
asDivFunction
(double arg) Creates a div function that divides it's argument by givenvalue
.static MatrixFunction
asMinusFunction
(double arg) Creates a minus function that subtracts givenvalue
from it's argument.static MatrixFunction
asModFunction
(double arg) Creates a mod function that calculates the modulus of it's argument and givenvalue
.static MatrixFunction
asMulFunction
(double arg) Creates a mul function that multiplies givenvalue
by it's argument.static MatrixFunction
asPlusFunction
(double arg) Creates a plus function that adds givenvalue
to it's argument.static MatrixAccumulator
asProductAccumulator
(double neutral) Creates a product matrix accumulator that calculates the product of all elements in the matrix.static MatrixAccumulator
asProductFunctionAccumulator
(double neutral, MatrixFunction function) Creates a product function accumulator, that calculates the product of all elements in the matrix after applying givenfunction
to each of them.static MatrixAccumulator
asSumAccumulator
(double neutral) Creates a sum matrix accumulator that calculates the sum of all elements in the matrix.static MatrixAccumulator
asSumFunctionAccumulator
(double neutral, MatrixFunction function) Creates a sum function accumulator, that calculates the sum of all elements in the matrix after applying givenfunction
to each of them.static MatrixAccumulator
Makes an Euclidean norm accumulator that allows to useMatrix.fold(org.la4j.vector.functor.MatrixAccumulator)
method for norm calculation.static MatrixAccumulator
Makes an Infinity norm accumulator that allows to useMatrix.fold(org.la4j.vector.functor.MatrixAccumulator)
method for norm calculation.static MatrixAccumulator
Makes an Manhattan norm accumulator that allows to useMatrix.fold(org.la4j.vector.functor.MatrixAccumulator)
method for norm calculation.static MatrixAccumulator
Makes a maximum matrix accumulator that accumulates the maximum of matrix elements.static MatrixAccumulator
Makes a minimum matrix accumulator that accumulates the minimum of matrix elements.
-
Field Details
-
EPS
public static final double EPSThe machine epsilon, that is calculated at runtime. -
ROUND_FACTOR
public static final int ROUND_FACTORExponent of machine epsilon -
DIAGONAL_MATRIX
Checks whether the matrix is a diagonal matrix. -
IDENTITY_MATRIX
Checks whether the matrix is an identity matrix. -
ZERO_MATRIX
Checks whether the matrix is a zero matrix. -
TRIDIAGONAL_MATRIX
Checks whether the matrix is a tridiagonal matrix. -
POSITIVE_MATRIX
Checks whether the matrix is a positive matrix. -
NEGATIVE_MATRIX
Checks whether the matrix is a negative matrix. -
LOWER_BIDIAGONAL_MATRIX
Checks whether the matrix is a lower bi-diagonal matrix. -
UPPER_BIDIAGONAL_MATRIX
Checks whether the matrix is an upper bidiagonal matrix. -
LOWER_TRIANGULAR_MATRIX
Checks whether the matrix is a lower triangular matrix. -
UPPER_TRIANGULAR_MATRIX
Checks whether the matrix is an upper triangular matrix. -
SYMMETRIC_MATRIX
Checks whether the matrix is a symmetric matrix. -
DIAGONALLY_DOMINANT_MATRIX
Checks whether the matrix is a diagonally dominant matrix. -
POSITIVE_DEFINITE_MATRIX
Checks whether the matrix is positive definite. -
BASIC_2D
A matrix factory that produces zeroBasic2DMatrix
. -
BASIC_1D
A matrix factory that produces zeroBasic1DMatrix
. -
DENSE
A default matrix factory for dense matrices. -
CCS
A matrix factory that produces zeroCCSMatrix
. -
CRS
A matrix factory that produces zeroCRSMatrix
. -
SPARSE
A default factory for sparse matrices. -
SPARSE_ROW_MAJOR
A default factory for sparse row-major matrices. -
SPARSE_COLUMN_MAJOR
A default factory for sparse column-major matrices. -
CONVERTERS
-
INC_FUNCTION
Increases each element of matrix by1
. -
DEC_FUNCTION
Decreases each element of matrix by1
. -
INV_FUNCTION
Inverts each element of matrix.
-
-
Constructor Details
-
Matrices
public Matrices()
-
-
Method Details
-
asConstFunction
Creates a const function that evaluates it's argument to givenvalue
.- Parameters:
arg
- a const value- Returns:
- a closure object that does
_
-
asPlusFunction
Creates a plus function that adds givenvalue
to it's argument.- Parameters:
arg
- a value to be added to function's argument- Returns:
- a closure object that does
_ + _
-
asMinusFunction
Creates a minus function that subtracts givenvalue
from it's argument.- Parameters:
arg
- a value to be subtracted from function's argument- Returns:
- a closure that does
_ - _
-
asMulFunction
Creates a mul function that multiplies givenvalue
by it's argument.- Parameters:
arg
- a value to be multiplied by function's argument- Returns:
- a closure that does
_ * _
-
asDivFunction
Creates a div function that divides it's argument by givenvalue
.- Parameters:
arg
- a divisor value- Returns:
- a closure that does
_ / _
-
asModFunction
Creates a mod function that calculates the modulus of it's argument and givenvalue
.- Parameters:
arg
- a divisor value- Returns:
- a closure that does
_ % _
-
mkMinAccumulator
Makes a minimum matrix accumulator that accumulates the minimum of matrix elements.- Returns:
- a minimum vector accumulator
-
mkMaxAccumulator
Makes a maximum matrix accumulator that accumulates the maximum of matrix elements.- Returns:
- a maximum vector accumulator
-
mkEuclideanNormAccumulator
Makes an Euclidean norm accumulator that allows to useMatrix.fold(org.la4j.vector.functor.MatrixAccumulator)
method for norm calculation.- Returns:
- an Euclidean norm accumulator
-
mkManhattanNormAccumulator
Makes an Manhattan norm accumulator that allows to useMatrix.fold(org.la4j.vector.functor.MatrixAccumulator)
method for norm calculation.- Returns:
- a Manhattan norm accumulator
-
mkInfinityNormAccumulator
Makes an Infinity norm accumulator that allows to useMatrix.fold(org.la4j.vector.functor.MatrixAccumulator)
method for norm calculation.- Returns:
- an Infinity norm accumulator
-
asSumAccumulator
Creates a sum matrix accumulator that calculates the sum of all elements in the matrix.- Parameters:
neutral
- the neutral value- Returns:
- a sum accumulator
-
asProductAccumulator
Creates a product matrix accumulator that calculates the product of all elements in the matrix.- Parameters:
neutral
- the neutral value- Returns:
- a product accumulator
-
asSumFunctionAccumulator
Creates a sum function accumulator, that calculates the sum of all elements in the matrix after applying givenfunction
to each of them.- Parameters:
neutral
- the neutral valuefunction
- the matrix function- Returns:
- a sum function accumulator
-
asProductFunctionAccumulator
public static MatrixAccumulator asProductFunctionAccumulator(double neutral, MatrixFunction function) Creates a product function accumulator, that calculates the product of all elements in the matrix after applying givenfunction
to each of them.- Parameters:
neutral
- the neutral valuefunction
- the matrix function- Returns:
- a product function accumulator
-
asAccumulatorProcedure
Creates an accumulator procedure that adapts a matrix accumulator for procedure interface. This is useful for reusing a single accumulator for multiple fold operations in multiple matrices.- Parameters:
accumulator
- the matrix accumulator- Returns:
- an accumulator procedure
-