Class Matrices
java.lang.Object
org.la4j.Matrices
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classprivate static classprivate 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 MatrixFunctionDecreases each element of matrix by1.static final MatrixFactory<Basic2DMatrix> A default matrix factory for dense matrices.static final MatrixPredicateChecks whether the matrix is a diagonal matrix.static final AdvancedMatrixPredicateChecks whether the matrix is a diagonally dominant matrix.static final doubleThe machine epsilon, that is calculated at runtime.static final MatrixPredicateChecks whether the matrix is an identity matrix.static final MatrixFunctionIncreases each element of matrix by1.static final MatrixFunctionInverts each element of matrix.static final MatrixPredicateChecks whether the matrix is a lower bi-diagonal matrix.static final MatrixPredicateChecks whether the matrix is a lower triangular matrix.static final MatrixPredicateChecks whether the matrix is a negative matrix.static final AdvancedMatrixPredicateChecks whether the matrix is positive definite.static final MatrixPredicateChecks whether the matrix is a positive matrix.static final intExponent 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 AdvancedMatrixPredicateChecks whether the matrix is a symmetric matrix.static final MatrixPredicateChecks whether the matrix is a tridiagonal matrix.static final MatrixPredicateChecks whether the matrix is an upper bidiagonal matrix.static final MatrixPredicateChecks whether the matrix is an upper triangular matrix.static final MatrixPredicateChecks whether the matrix is a zero matrix. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic MatrixProcedureasAccumulatorProcedure(MatrixAccumulator accumulator) Creates an accumulator procedure that adapts a matrix accumulator for procedure interface.static MatrixFunctionasConstFunction(double arg) Creates a const function that evaluates it's argument to givenvalue.static MatrixFunctionasDivFunction(double arg) Creates a div function that divides it's argument by givenvalue.static MatrixFunctionasMinusFunction(double arg) Creates a minus function that subtracts givenvaluefrom it's argument.static MatrixFunctionasModFunction(double arg) Creates a mod function that calculates the modulus of it's argument and givenvalue.static MatrixFunctionasMulFunction(double arg) Creates a mul function that multiplies givenvalueby it's argument.static MatrixFunctionasPlusFunction(double arg) Creates a plus function that adds givenvalueto it's argument.static MatrixAccumulatorasProductAccumulator(double neutral) Creates a product matrix accumulator that calculates the product of all elements in the matrix.static MatrixAccumulatorasProductFunctionAccumulator(double neutral, MatrixFunction function) Creates a product function accumulator, that calculates the product of all elements in the matrix after applying givenfunctionto each of them.static MatrixAccumulatorasSumAccumulator(double neutral) Creates a sum matrix accumulator that calculates the sum of all elements in the matrix.static MatrixAccumulatorasSumFunctionAccumulator(double neutral, MatrixFunction function) Creates a sum function accumulator, that calculates the sum of all elements in the matrix after applying givenfunctionto each of them.static MatrixAccumulatorMakes an Euclidean norm accumulator that allows to useMatrix.fold(org.la4j.vector.functor.MatrixAccumulator)method for norm calculation.static MatrixAccumulatorMakes an Infinity norm accumulator that allows to useMatrix.fold(org.la4j.vector.functor.MatrixAccumulator)method for norm calculation.static MatrixAccumulatorMakes an Manhattan norm accumulator that allows to useMatrix.fold(org.la4j.vector.functor.MatrixAccumulator)method for norm calculation.static MatrixAccumulatorMakes a maximum matrix accumulator that accumulates the maximum of matrix elements.static MatrixAccumulatorMakes 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 givenvalueto 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 givenvaluefrom 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 givenvalueby 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 givenfunctionto 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 givenfunctionto 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
-