public final class AlgebraUtils extends Object
Modifier and Type | Method and Description |
---|---|
static RealMatrix |
add(RealMatrix a,
RealMatrix b,
double beta)
Returns C = A + beta * B (linear combination).
|
static RealVector |
add(RealVector v1,
RealVector v2,
double c)
Returns v = v1 + c * v2 (linear combination).
|
static void |
checkRectangularShape(RealMatrix[][] array)
Checks whether the given array is rectangular, that is, whether all rows
have the same number of columns.
|
static RealMatrix |
composeMatrix(RealMatrix[][] parts)
Constructs a block matrix made from the given parts.
|
static RealMatrix |
diagonal(RealVector vector)
Constructs a new diagonal matrix whose diagonal elements are the elements
of vector.
|
static RealMatrix |
diagonalMatrixMult(RealMatrix a,
RealVector diagonalU)
Return A.diagonalU with diagonalU diagonal.
|
static RealMatrix |
diagonalMatrixMult(RealVector diagonalU,
RealMatrix a)
Return diagonalU.A with diagonalU diagonal.
|
static RealMatrix |
diagonalMatrixMult(RealVector diagonalU,
RealMatrix a,
RealVector diagonalV)
Return diagonalU.A.diagonalV with diagonalU and diagonalV diagonal.
|
static RealVector |
diagonalMatrixMult(RealVector diagonalM,
RealVector vector)
Matrix-vector multiplication with diagonal matrix.
|
static RealMatrix |
fillSubdiagonalSymmetricMatrix(RealMatrix s)
Given a symm matrix S that stores just its subdiagonal elements,
reconstructs the full symmetric matrix.
|
static double[] |
getConditionNumberRange(RealMatrix a,
int p)
Returns a lower and an upper bound for the condition number
kp(A) = Norm[A, p] / Norm[A^-1, p] where Norm[A, p] = sup ( Norm[A.x, p]/Norm[x, p] , x ! |
static RealVector |
randomValuesVector(int dim,
double min,
double max,
Long seed)
Return a vector with random values
|
static RealVector |
replaceValues(RealVector v,
double oldValue,
double newValue)
Return a new array with all the occurrences of oldValue replaced by
newValue.
|
static RealMatrix |
subdiagonalMultiply(RealMatrix a,
RealMatrix b)
Return the sub-diagonal result of the multiplication.
|
static RealVector |
zMult(RealMatrix matA,
RealVector a,
RealVector b,
double beta)
Returns v = A.a + beta*b.
|
static RealVector |
zMultTranspose(RealMatrix matA,
RealVector a,
RealVector b,
double beta)
Returns v = A[T].a + beta*b.
|
public static final RealVector diagonalMatrixMult(RealVector diagonalM, RealVector vector)
diagonalM
- diagonal matrix M, in the form of a vector of its diagonal
elementsvector
- vectorpublic static final RealMatrix diagonalMatrixMult(RealVector diagonalU, RealMatrix a)
diagonalU
- matrix U, in the form of a vector of its diagonal elementsa
- matrix Apublic static final RealMatrix diagonalMatrixMult(RealMatrix a, RealVector diagonalU)
a
- matrix AdiagonalU
- matrix U, in the form of a vector of its diagonal elementspublic static final RealMatrix diagonalMatrixMult(RealVector diagonalU, RealMatrix a, RealVector diagonalV)
diagonalU
- diagonal matrix U, in the form of a vector of its diagonal
elementsa
- matrix AdiagonalV
- diagonal matrix V, in the form of a vector of its diagonal
elementspublic static RealMatrix subdiagonalMultiply(RealMatrix a, RealMatrix b)
a
- matrixb
- matrixpublic static final RealVector zMult(RealMatrix matA, RealVector a, RealVector b, double beta)
matA
- matrix Aa
- vectorb
- vectorbeta
- doublepublic static final RealVector zMultTranspose(RealMatrix matA, RealVector a, RealVector b, double beta)
matA
- matrix Aa
- vectorb
- vectorbeta
- constantpublic static final RealMatrix add(RealMatrix a, RealMatrix b, double beta)
a
- matrixb
- matrixbeta
- constantpublic static final RealVector add(RealVector v1, RealVector v2, double c)
v1
- vectorv2
- vectorc
- constantpublic static final RealVector replaceValues(RealVector v, double oldValue, double newValue)
v
- vectoroldValue
- value to be replacednewValue
- value to replace withpublic static double[] getConditionNumberRange(RealMatrix a, int p)
a
- matrix you want the condition number ofp
- norm order (2 or Integer.MAX_VALUE)S. Gajulapalli, Leon S. Lasdon
"Scaling Sparse Matrices for Optimization Algorithms"
public static final RealMatrix fillSubdiagonalSymmetricMatrix(RealMatrix s)
s
- matrixpublic static RealMatrix diagonal(RealVector vector)
vector
- with the diagonal valuespublic static RealVector randomValuesVector(int dim, double min, double max, Long seed)
dim
- dimension of the vectormin
- minimum valuemax
- maximum valueseed
- of the random number generatorpublic static RealMatrix composeMatrix(RealMatrix[][] parts)
parts
- matricespublic static void checkRectangularShape(RealMatrix[][] array)
array
- arrayIllegalArgumentException
- if the array is not rectangular.Copyright © 2021 CNES. All rights reserved.