public class CommonOps_DDRM
extends java.lang.Object
Common matrix operations are contained here. Which specific underlying algorithm is used is not specified just the out come of the operation. Nor should calls to these functions reply on the underlying implementation. Which algorithm is used can depend on the matrix being passed in.
For more exotic and specialized generic operations see SpecializedOps_DDRM
.
Constructor and Description |
---|
CommonOps_DDRM() |
Modifier and Type | Method and Description |
---|---|
static void |
add(org.ejml.data.DMatrixD1 a,
org.ejml.data.DMatrixD1 b,
org.ejml.data.DMatrixD1 c)
Performs the following operation:
c = a + b cij = aij + bij |
static void |
add(org.ejml.data.DMatrixD1 a,
double val)
Performs an in-place scalar addition:
a = a + val aij = aij + val |
static void |
add(org.ejml.data.DMatrixD1 a,
double val,
org.ejml.data.DMatrixD1 c)
Performs scalar addition:
c = a + val cij = aij + val |
static void |
add(org.ejml.data.DMatrixD1 a,
double beta,
org.ejml.data.DMatrixD1 b,
org.ejml.data.DMatrixD1 c)
Performs the following operation:
c = a + β * b cij = aij + β * bij |
static void |
add(double alpha,
org.ejml.data.DMatrixD1 a,
org.ejml.data.DMatrixD1 b,
org.ejml.data.DMatrixD1 c)
Performs the following operation:
c = α * a + b cij = α * aij + bij |
static void |
add(double alpha,
org.ejml.data.DMatrixD1 a,
double beta,
org.ejml.data.DMatrixD1 b,
org.ejml.data.DMatrixD1 c)
Performs the following operation:
c = α * a + β * b cij = α * aij + β * bij |
static void |
addEquals(org.ejml.data.DMatrixD1 a,
org.ejml.data.DMatrixD1 b)
Performs the following operation:
a = a + b aij = aij + bij |
static void |
addEquals(org.ejml.data.DMatrixD1 a,
double beta,
org.ejml.data.DMatrixD1 b)
Performs the following operation:
a = a + β * b aij = aij + β * bij |
static void |
changeSign(org.ejml.data.DMatrixD1 a)
Changes the sign of every element in the matrix.
aij = -aij |
static void |
changeSign(org.ejml.data.DMatrixD1 input,
org.ejml.data.DMatrixD1 output)
Changes the sign of every element in the matrix.
outputij = -inputij |
static org.ejml.data.DMatrixRMaj[] |
columnsToVector(org.ejml.data.DMatrixRMaj A,
org.ejml.data.DMatrixRMaj[] v)
Converts the columns in a matrix into a set of vectors.
|
static org.ejml.data.DMatrixRMaj |
concatColumns(org.ejml.data.DMatrixRMaj... m)
Concatinates all the matrices together along their columns.
|
static org.ejml.data.DMatrixRMaj |
concatRows(org.ejml.data.DMatrixRMaj... m)
Concatinates all the matrices together along their columns.
|
static int |
countTrue(org.ejml.data.BMatrixRMaj A)
Counts the number of elements in A which are true
|
static double |
det(org.ejml.data.DMatrixRMaj mat)
Returns the determinant of the matrix.
|
static org.ejml.data.DMatrixRMaj |
diag(org.ejml.data.DMatrixRMaj ret,
int width,
double... diagEl) |
static org.ejml.data.DMatrixRMaj |
diag(double... diagEl)
Creates a new square matrix whose diagonal elements are specified by diagEl and all
the other elements are zero.
aij = 0 if i ≤ j aij = diag[i] if i = j |
static org.ejml.data.DMatrixRMaj |
diagR(int numRows,
int numCols,
double... diagEl)
Creates a new rectangular matrix whose diagonal elements are specified by diagEl and all
the other elements are zero.
aij = 0 if i ≤ j aij = diag[i] if i = j |
static void |
divide(org.ejml.data.DMatrixD1 a,
double alpha)
Performs an in-place element by element scalar division with the scalar on bottom.
aij = aij/α |
static void |
divide(org.ejml.data.DMatrixD1 a,
double alpha,
org.ejml.data.DMatrixD1 b)
Performs an element by element scalar division with the scalar on botton.
bij = aij /α |
static void |
divide(double alpha,
org.ejml.data.DMatrixD1 a)
Performs an in-place element by element scalar division with the scalar on top.
aij = α/aij |
static void |
divide(double alpha,
org.ejml.data.DMatrixD1 a,
org.ejml.data.DMatrixD1 b)
Performs an element by element scalar division with the scalar on top.
bij = α/aij |
static double |
dot(org.ejml.data.DMatrixD1 a,
org.ejml.data.DMatrixD1 b)
Computes the dot product or inner product between two vectors.
|
static void |
elementDiv(org.ejml.data.DMatrixD1 a,
org.ejml.data.DMatrixD1 b)
Performs the an element by element division operation:
aij = aij / bij |
static void |
elementDiv(org.ejml.data.DMatrixD1 a,
org.ejml.data.DMatrixD1 b,
org.ejml.data.DMatrixD1 c)
Performs the an element by element division operation:
cij = aij / bij |
static void |
elementExp(org.ejml.data.DMatrixD1 A,
org.ejml.data.DMatrixD1 C)
Element-wise exp operation
cij = Math.log(aij) |
static org.ejml.data.BMatrixRMaj |
elementLessThan(org.ejml.data.DMatrixRMaj A,
org.ejml.data.DMatrixRMaj B,
org.ejml.data.BMatrixRMaj output)
Applies the < operator to each element in A.
|
static org.ejml.data.BMatrixRMaj |
elementLessThan(org.ejml.data.DMatrixRMaj A,
double value,
org.ejml.data.BMatrixRMaj output)
Applies the > operator to each element in A.
|
static org.ejml.data.BMatrixRMaj |
elementLessThanOrEqual(org.ejml.data.DMatrixRMaj A,
org.ejml.data.DMatrixRMaj B,
org.ejml.data.BMatrixRMaj output)
Applies the A ≤ B operator to each element.
|
static org.ejml.data.BMatrixRMaj |
elementLessThanOrEqual(org.ejml.data.DMatrixRMaj A,
double value,
org.ejml.data.BMatrixRMaj output)
Applies the ≥ operator to each element in A.
|
static void |
elementLog(org.ejml.data.DMatrixD1 A,
org.ejml.data.DMatrixD1 C)
Element-wise log operation
cij = Math.log(aij) |
static double |
elementMax(org.ejml.data.DMatrixD1 a)
Returns the value of the element in the matrix that has the largest value.
Max{ aij } for all i and j |
static double |
elementMaxAbs(org.ejml.data.DMatrixD1 a)
Returns the absolute value of the element in the matrix that has the largest absolute value.
Max{ |aij| } for all i and j |
static double |
elementMin(org.ejml.data.DMatrixD1 a)
Returns the value of the element in the matrix that has the minimum value.
Min{ aij } for all i and j |
static double |
elementMinAbs(org.ejml.data.DMatrixD1 a)
Returns the absolute value of the element in the matrix that has the smallest absolute value.
Min{ |aij| } for all i and j |
static org.ejml.data.BMatrixRMaj |
elementMoreThan(org.ejml.data.DMatrixRMaj A,
double value,
org.ejml.data.BMatrixRMaj output)
Applies the > operator to each element in A.
|
static org.ejml.data.BMatrixRMaj |
elementMoreThanOrEqual(org.ejml.data.DMatrixRMaj A,
double value,
org.ejml.data.BMatrixRMaj output)
Applies the ≥ operator to each element in A.
|
static void |
elementMult(org.ejml.data.DMatrixD1 a,
org.ejml.data.DMatrixD1 b)
Performs the an element by element multiplication operation:
aij = aij * bij |
static void |
elementMult(org.ejml.data.DMatrixD1 a,
org.ejml.data.DMatrixD1 b,
org.ejml.data.DMatrixD1 c)
Performs the an element by element multiplication operation:
cij = aij * bij |
static void |
elementPower(org.ejml.data.DMatrixD1 A,
org.ejml.data.DMatrixD1 B,
org.ejml.data.DMatrixD1 C)
Element-wise power operation
cij = aij ^ bij |
static void |
elementPower(org.ejml.data.DMatrixD1 A,
double b,
org.ejml.data.DMatrixD1 C)
Element-wise power operation
cij = aij ^ b |
static void |
elementPower(double a,
org.ejml.data.DMatrixD1 B,
org.ejml.data.DMatrixD1 C)
Element-wise power operation
cij = a ^ bij |
static org.ejml.data.DMatrixRMaj |
elements(org.ejml.data.DMatrixRMaj A,
org.ejml.data.BMatrixRMaj marked,
org.ejml.data.DMatrixRMaj output)
Returns a row matrix which contains all the elements in A which are flagged as true in 'marked'
|
static double |
elementSum(org.ejml.data.DMatrixD1 mat)
Computes the sum of all the elements in the matrix:
sum(i=1:m , j=1:n ; aij) |
static double |
elementSumAbs(org.ejml.data.DMatrixD1 mat)
Computes the sum of the absolute value all the elements in the matrix:
sum(i=1:m , j=1:n ; |aij|) |
static void |
extract(org.ejml.data.DMatrix src,
int srcY0,
int srcY1,
int srcX0,
int srcX1,
org.ejml.data.DMatrix dst,
int dstY0,
int dstX0)
Extracts a submatrix from 'src' and inserts it in a submatrix in 'dst'.
|
static void |
extract(org.ejml.data.DMatrixRMaj src,
int[] indexes,
int length,
org.ejml.data.DMatrixRMaj dst)
Extracts the elements from the source matrix by their 1D index.
|
static void |
extract(org.ejml.data.DMatrixRMaj src,
int[] rows,
int rowsSize,
int[] cols,
int colsSize,
org.ejml.data.DMatrixRMaj dst)
Extracts out a matrix from source given a sub matrix with arbitrary rows and columns specified in
two array lists
|
static org.ejml.data.DMatrixRMaj |
extract(org.ejml.data.DMatrixRMaj src,
int srcY0,
int srcY1,
int srcX0,
int srcX1)
Creates a new matrix which is the specified submatrix of 'src'
|
static org.ejml.data.DMatrixRMaj |
extractColumn(org.ejml.data.DMatrixRMaj a,
int column,
org.ejml.data.DMatrixRMaj out)
Extracts the column from a matrix.
|
static void |
extractDiag(org.ejml.data.DMatrixRMaj src,
org.ejml.data.DMatrixRMaj dst)
Extracts the diagonal elements 'src' write it to the 'dst' vector.
|
static org.ejml.data.DMatrixRMaj |
extractRow(org.ejml.data.DMatrixRMaj a,
int row,
org.ejml.data.DMatrixRMaj out)
Extracts the row from a matrix.
|
static void |
fill(org.ejml.data.DMatrixD1 a,
double value)
Sets every element in the matrix to the specified value.
aij = value |
static org.ejml.data.DMatrixRMaj |
identity(int width)
Creates an identity matrix of the specified size.
aij = 0 if i ≠ j aij = 1 if i = j |
static org.ejml.data.DMatrixRMaj |
identity(int numRows,
int numCols)
Creates a rectangular matrix which is zero except along the diagonals.
|
static void |
insert(org.ejml.data.DMatrix src,
org.ejml.data.DMatrix dest,
int destY0,
int destX0)
Inserts matrix 'src' into matrix 'dest' with the (0,0) of src at (row,col) in dest.
|
static void |
insert(org.ejml.data.DMatrixRMaj src,
org.ejml.data.DMatrixRMaj dst,
int[] rows,
int rowsSize,
int[] cols,
int colsSize)
Inserts into the specified elements of dst the source matrix.
|
static boolean |
invert(org.ejml.data.DMatrixRMaj mat)
Performs a matrix inversion operation on the specified matrix and stores the results
in the same matrix.
a = a-1 |
static boolean |
invert(org.ejml.data.DMatrixRMaj mat,
org.ejml.data.DMatrixRMaj result)
Performs a matrix inversion operation that does not modify the original
and stores the results in another matrix.
|
static void |
kron(org.ejml.data.DMatrixRMaj A,
org.ejml.data.DMatrixRMaj B,
org.ejml.data.DMatrixRMaj C)
The Kronecker product of two matrices is defined as:
Cij = aijB where Cij is a sub matrix inside of C ∈ ℜ m*k × n*l, A ∈ ℜ m × n, and B ∈ ℜ k × l. |
static org.ejml.data.DMatrixRMaj |
maxCols(org.ejml.data.DMatrixRMaj input,
org.ejml.data.DMatrixRMaj output)
Finds the element with the minimum value along column in the input matrix and returns the results in a vector:
bj = min(i=1:m ; aij) |
static org.ejml.data.DMatrixRMaj |
maxRows(org.ejml.data.DMatrixRMaj input,
org.ejml.data.DMatrixRMaj output)
Finds the element with the maximum value along each row in the input matrix and returns the results in a vector:
bj = max(i=1:n ; aji) |
static org.ejml.data.DMatrixRMaj |
minCols(org.ejml.data.DMatrixRMaj input,
org.ejml.data.DMatrixRMaj output)
Finds the element with the minimum value along column in the input matrix and returns the results in a vector:
bj = min(i=1:m ; aij) |
static org.ejml.data.DMatrixRMaj |
minRows(org.ejml.data.DMatrixRMaj input,
org.ejml.data.DMatrixRMaj output)
Finds the element with the minimum value along each row in the input matrix and returns the results in a vector:
bj = min(i=1:n ; aji) |
static void |
mult(org.ejml.data.DMatrix1Row a,
org.ejml.data.DMatrix1Row b,
org.ejml.data.DMatrix1Row c)
Performs the following operation:
c = a * b cij = ∑k=1:n { aik * bkj} |
static void |
mult(double alpha,
org.ejml.data.DMatrix1Row a,
org.ejml.data.DMatrix1Row b,
org.ejml.data.DMatrix1Row c)
Performs the following operation:
c = α * a * b cij = α ∑k=1:n { * aik * bkj} |
static void |
multAdd(org.ejml.data.DMatrix1Row a,
org.ejml.data.DMatrix1Row b,
org.ejml.data.DMatrix1Row c)
Performs the following operation:
c = c + a * b cij = cij + ∑k=1:n { aik * bkj} |
static void |
multAdd(double alpha,
org.ejml.data.DMatrix1Row a,
org.ejml.data.DMatrix1Row b,
org.ejml.data.DMatrix1Row c)
Performs the following operation:
c = c + α * a * b cij = cij + α * ∑k=1:n { aik * bkj} |
static void |
multAddTransA(org.ejml.data.DMatrix1Row a,
org.ejml.data.DMatrix1Row b,
org.ejml.data.DMatrix1Row c)
Performs the following operation:
c = c + aT * b cij = cij + ∑k=1:n { aki * bkj} |
static void |
multAddTransA(double alpha,
org.ejml.data.DMatrix1Row a,
org.ejml.data.DMatrix1Row b,
org.ejml.data.DMatrix1Row c)
Performs the following operation:
c = c + α * aT * b cij =cij + α * ∑k=1:n { aki * bkj} |
static void |
multAddTransAB(org.ejml.data.DMatrix1Row a,
org.ejml.data.DMatrix1Row b,
org.ejml.data.DMatrix1Row c)
Performs the following operation:
c = c + aT * bT cij = cij + ∑k=1:n { aki * bjk} |
static void |
multAddTransAB(double alpha,
org.ejml.data.DMatrix1Row a,
org.ejml.data.DMatrix1Row b,
org.ejml.data.DMatrix1Row c)
Performs the following operation:
c = c + α * aT * bT cij = cij + α * ∑k=1:n { aki * bjk} |
static void |
multAddTransB(org.ejml.data.DMatrix1Row a,
org.ejml.data.DMatrix1Row b,
org.ejml.data.DMatrix1Row c)
Performs the following operation:
c = c + a * bT cij = cij + ∑k=1:n { aik * bjk} |
static void |
multAddTransB(double alpha,
org.ejml.data.DMatrix1Row a,
org.ejml.data.DMatrix1Row b,
org.ejml.data.DMatrix1Row c)
Performs the following operation:
c = c + α * a * bT cij = cij + α * ∑k=1:n { aik * bjk} |
static void |
multInner(org.ejml.data.DMatrix1Row a,
org.ejml.data.DMatrix1Row c)
Computes the matrix multiplication inner product:
c = aT * a cij = ∑k=1:n { aki * akj} |
static void |
multOuter(org.ejml.data.DMatrix1Row a,
org.ejml.data.DMatrix1Row c)
Computes the matrix multiplication outer product:
c = a * aT cij = ∑k=1:m { aik * ajk} |
static void |
multTransA(org.ejml.data.DMatrix1Row a,
org.ejml.data.DMatrix1Row b,
org.ejml.data.DMatrix1Row c)
Performs the following operation:
c = aT * b cij = ∑k=1:n { aki * bkj} |
static void |
multTransA(double alpha,
org.ejml.data.DMatrix1Row a,
org.ejml.data.DMatrix1Row b,
org.ejml.data.DMatrix1Row c)
Performs the following operation:
c = α * aT * b cij = α ∑k=1:n { aki * bkj} |
static void |
multTransAB(org.ejml.data.DMatrix1Row a,
org.ejml.data.DMatrix1Row b,
org.ejml.data.DMatrix1Row c)
Performs the following operation:
c = aT * bT cij = ∑k=1:n { aki * bjk} |
static void |
multTransAB(double alpha,
org.ejml.data.DMatrix1Row a,
org.ejml.data.DMatrix1Row b,
org.ejml.data.DMatrix1Row c)
Performs the following operation:
c = α * aT * bT cij = α ∑k=1:n { aki * bjk} |
static void |
multTransB(org.ejml.data.DMatrix1Row a,
org.ejml.data.DMatrix1Row b,
org.ejml.data.DMatrix1Row c)
Performs the following operation:
c = a * bT cij = ∑k=1:n { aik * bjk} |
static void |
multTransB(double alpha,
org.ejml.data.DMatrix1Row a,
org.ejml.data.DMatrix1Row b,
org.ejml.data.DMatrix1Row c)
Performs the following operation:
c = α * a * bT cij = α ∑k=1:n { aik * bjk} |
static org.ejml.data.DMatrixRMaj |
permuteRowInv(int[] pinv,
org.ejml.data.DMatrixRMaj input,
org.ejml.data.DMatrixRMaj output)
Applies the row permutation specified by the vector to the input matrix and save the results
in the output matrix.
|
static void |
pinv(org.ejml.data.DMatrixRMaj A,
org.ejml.data.DMatrixRMaj invA)
Computes the Moore-Penrose pseudo-inverse:
pinv(A) = (ATA)-1 AT or pinv(A) = AT(AAT)-1 |
static org.ejml.data.DMatrixRMaj[] |
rowsToVector(org.ejml.data.DMatrixRMaj A,
org.ejml.data.DMatrixRMaj[] v)
Converts the rows in a matrix into a set of vectors.
|
static org.ejml.data.DMatrixRMaj |
rref(org.ejml.data.DMatrixRMaj A,
int numUnknowns,
org.ejml.data.DMatrixRMaj reduced)
Puts the augmented system matrix into reduced row echelon form (RREF) using Gauss-Jordan
elimination with row (partial) pivots.
|
static void |
scale(double alpha,
org.ejml.data.DMatrixD1 a)
Performs an in-place element by element scalar multiplication.
aij = α*aij |
static void |
scale(double alpha,
org.ejml.data.DMatrixD1 a,
org.ejml.data.DMatrixD1 b)
Performs an element by element scalar multiplication.
bij = α*aij |
static void |
setIdentity(org.ejml.data.DMatrix1Row mat)
Sets all the diagonal elements equal to one and everything else equal to zero.
|
static boolean |
solve(org.ejml.data.DMatrixRMaj a,
org.ejml.data.DMatrixRMaj b,
org.ejml.data.DMatrixRMaj x)
Solves for x in the following equation:
A*x = b |
static void |
subtract(org.ejml.data.DMatrixD1 a,
org.ejml.data.DMatrixD1 b,
org.ejml.data.DMatrixD1 c)
Performs the following subtraction operation:
c = a - b cij = aij - bij |
static void |
subtract(org.ejml.data.DMatrixD1 a,
double val,
org.ejml.data.DMatrixD1 c)
Performs matrix scalar subtraction:
c = a - val cij = aij - val |
static void |
subtract(double val,
org.ejml.data.DMatrixD1 a,
org.ejml.data.DMatrixD1 c)
Performs matrix scalar subtraction:
c = val - a cij = val - aij |
static void |
subtractEquals(org.ejml.data.DMatrixD1 a,
org.ejml.data.DMatrixD1 b)
Performs the following subtraction operation:
a = a - b aij = aij - bij |
static org.ejml.data.DMatrixRMaj |
sumCols(org.ejml.data.DMatrixRMaj input,
org.ejml.data.DMatrixRMaj output)
Computes the sum of each column in the input matrix and returns the results in a vector:
bj = min(i=1:m ; aij) |
static org.ejml.data.DMatrixRMaj |
sumRows(org.ejml.data.DMatrixRMaj input,
org.ejml.data.DMatrixRMaj output)
Computes the sum of each row in the input matrix and returns the results in a vector:
bj = sum(i=1:n ; aji) |
static double |
trace(org.ejml.data.DMatrix1Row a)
This computes the trace of the matrix:
trace = ∑i=1:n { aii } where n = min(numRows,numCols) |
static void |
transpose(org.ejml.data.DMatrixRMaj mat)
Performs an "in-place" transpose.
|
static org.ejml.data.DMatrixRMaj |
transpose(org.ejml.data.DMatrixRMaj A,
org.ejml.data.DMatrixRMaj A_tran)
Transposes matrix 'a' and stores the results in 'b':
bij = aji where 'b' is the transpose of 'a'. |
public static void mult(org.ejml.data.DMatrix1Row a, org.ejml.data.DMatrix1Row b, org.ejml.data.DMatrix1Row c)
Performs the following operation:
c = a * b
cij = ∑k=1:n { aik * bkj}
a
- The left matrix in the multiplication operation. Not modified.b
- The right matrix in the multiplication operation. Not modified.c
- Where the results of the operation are stored. Modified.public static void mult(double alpha, org.ejml.data.DMatrix1Row a, org.ejml.data.DMatrix1Row b, org.ejml.data.DMatrix1Row c)
Performs the following operation:
c = α * a * b
cij = α ∑k=1:n { * aik * bkj}
alpha
- Scaling factor.a
- The left matrix in the multiplication operation. Not modified.b
- The right matrix in the multiplication operation. Not modified.c
- Where the results of the operation are stored. Modified.public static void multTransA(org.ejml.data.DMatrix1Row a, org.ejml.data.DMatrix1Row b, org.ejml.data.DMatrix1Row c)
Performs the following operation:
c = aT * b
cij = ∑k=1:n { aki * bkj}
a
- The left matrix in the multiplication operation. Not modified.b
- The right matrix in the multiplication operation. Not modified.c
- Where the results of the operation are stored. Modified.public static void multTransA(double alpha, org.ejml.data.DMatrix1Row a, org.ejml.data.DMatrix1Row b, org.ejml.data.DMatrix1Row c)
Performs the following operation:
c = α * aT * b
cij = α ∑k=1:n { aki * bkj}
alpha
- Scaling factor.a
- The left matrix in the multiplication operation. Not modified.b
- The right matrix in the multiplication operation. Not modified.c
- Where the results of the operation are stored. Modified.public static void multTransB(org.ejml.data.DMatrix1Row a, org.ejml.data.DMatrix1Row b, org.ejml.data.DMatrix1Row c)
Performs the following operation:
c = a * bT
cij = ∑k=1:n { aik * bjk}
a
- The left matrix in the multiplication operation. Not modified.b
- The right matrix in the multiplication operation. Not modified.c
- Where the results of the operation are stored. Modified.public static void multTransB(double alpha, org.ejml.data.DMatrix1Row a, org.ejml.data.DMatrix1Row b, org.ejml.data.DMatrix1Row c)
Performs the following operation:
c = α * a * bT
cij = α ∑k=1:n { aik * bjk}
alpha
- Scaling factor.a
- The left matrix in the multiplication operation. Not modified.b
- The right matrix in the multiplication operation. Not modified.c
- Where the results of the operation are stored. Modified.public static void multTransAB(org.ejml.data.DMatrix1Row a, org.ejml.data.DMatrix1Row b, org.ejml.data.DMatrix1Row c)
Performs the following operation:
c = aT * bT
cij = ∑k=1:n { aki * bjk}
a
- The left matrix in the multiplication operation. Not modified.b
- The right matrix in the multiplication operation. Not modified.c
- Where the results of the operation are stored. Modified.public static void multTransAB(double alpha, org.ejml.data.DMatrix1Row a, org.ejml.data.DMatrix1Row b, org.ejml.data.DMatrix1Row c)
Performs the following operation:
c = α * aT * bT
cij = α ∑k=1:n { aki * bjk}
alpha
- Scaling factor.a
- The left matrix in the multiplication operation. Not modified.b
- The right matrix in the multiplication operation. Not modified.c
- Where the results of the operation are stored. Modified.public static double dot(org.ejml.data.DMatrixD1 a, org.ejml.data.DMatrixD1 b)
Computes the dot product or inner product between two vectors. If the two vectors are columns vectors
then it is defined as:
dot(a,b) = a<sup>T</sup> * b
If the vectors are column or row or both is ignored by this function.
a
- Vectorb
- Vectorpublic static void multInner(org.ejml.data.DMatrix1Row a, org.ejml.data.DMatrix1Row c)
Computes the matrix multiplication inner product:
c = aT * a
cij = ∑k=1:n { aki * akj}
Is faster than using a generic matrix multiplication by taking advantage of symmetry. For
vectors there is an even faster option, see VectorVectorMult_DDRM.innerProd(DMatrixD1, DMatrixD1)
a
- The matrix being multiplied. Not modified.c
- Where the results of the operation are stored. Modified.public static void multOuter(org.ejml.data.DMatrix1Row a, org.ejml.data.DMatrix1Row c)
Computes the matrix multiplication outer product:
c = a * aT
cij = ∑k=1:m { aik * ajk}
Is faster than using a generic matrix multiplication by taking advantage of symmetry.
a
- The matrix being multiplied. Not modified.c
- Where the results of the operation are stored. Modified.public static void multAdd(org.ejml.data.DMatrix1Row a, org.ejml.data.DMatrix1Row b, org.ejml.data.DMatrix1Row c)
Performs the following operation:
c = c + a * b
cij = cij + ∑k=1:n { aik * bkj}
a
- The left matrix in the multiplication operation. Not modified.b
- The right matrix in the multiplication operation. Not modified.c
- Where the results of the operation are stored. Modified.public static void multAdd(double alpha, org.ejml.data.DMatrix1Row a, org.ejml.data.DMatrix1Row b, org.ejml.data.DMatrix1Row c)
Performs the following operation:
c = c + α * a * b
cij = cij + α * ∑k=1:n { aik * bkj}
alpha
- scaling factor.a
- The left matrix in the multiplication operation. Not modified.b
- The right matrix in the multiplication operation. Not modified.c
- Where the results of the operation are stored. Modified.public static void multAddTransA(org.ejml.data.DMatrix1Row a, org.ejml.data.DMatrix1Row b, org.ejml.data.DMatrix1Row c)
Performs the following operation:
c = c + aT * b
cij = cij + ∑k=1:n { aki * bkj}
a
- The left matrix in the multiplication operation. Not modified.b
- The right matrix in the multiplication operation. Not modified.c
- Where the results of the operation are stored. Modified.public static void multAddTransA(double alpha, org.ejml.data.DMatrix1Row a, org.ejml.data.DMatrix1Row b, org.ejml.data.DMatrix1Row c)
Performs the following operation:
c = c + α * aT * b
cij =cij + α * ∑k=1:n { aki * bkj}
alpha
- scaling factora
- The left matrix in the multiplication operation. Not modified.b
- The right matrix in the multiplication operation. Not modified.c
- Where the results of the operation are stored. Modified.public static void multAddTransB(org.ejml.data.DMatrix1Row a, org.ejml.data.DMatrix1Row b, org.ejml.data.DMatrix1Row c)
Performs the following operation:
c = c + a * bT
cij = cij + ∑k=1:n { aik * bjk}
a
- The left matrix in the multiplication operation. Not modified.b
- The right matrix in the multiplication operation. Not modified.c
- Where the results of the operation are stored. Modified.public static void multAddTransB(double alpha, org.ejml.data.DMatrix1Row a, org.ejml.data.DMatrix1Row b, org.ejml.data.DMatrix1Row c)
Performs the following operation:
c = c + α * a * bT
cij = cij + α * ∑k=1:n { aik * bjk}
alpha
- Scaling factor.a
- The left matrix in the multiplication operation. Not modified.b
- The right matrix in the multiplication operation. Not modified.c
- Where the results of the operation are stored. Modified.public static void multAddTransAB(org.ejml.data.DMatrix1Row a, org.ejml.data.DMatrix1Row b, org.ejml.data.DMatrix1Row c)
Performs the following operation:
c = c + aT * bT
cij = cij + ∑k=1:n { aki * bjk}
a
- The left matrix in the multiplication operation. Not Modified.b
- The right matrix in the multiplication operation. Not Modified.c
- Where the results of the operation are stored. Modified.public static void multAddTransAB(double alpha, org.ejml.data.DMatrix1Row a, org.ejml.data.DMatrix1Row b, org.ejml.data.DMatrix1Row c)
Performs the following operation:
c = c + α * aT * bT
cij = cij + α * ∑k=1:n { aki * bjk}
alpha
- Scaling factor.a
- The left matrix in the multiplication operation. Not Modified.b
- The right matrix in the multiplication operation. Not Modified.c
- Where the results of the operation are stored. Modified.public static boolean solve(org.ejml.data.DMatrixRMaj a, org.ejml.data.DMatrixRMaj b, org.ejml.data.DMatrixRMaj x)
Solves for x in the following equation:
A*x = b
If the system could not be solved then false is returned. If it returns true that just means the algorithm finished operating, but the results could still be bad because 'A' is singular or nearly singular.
If repeat calls to solve are being made then one should consider using LinearSolverFactory_DDRM
instead.
It is ok for 'b' and 'x' to be the same matrix.
a
- A matrix that is m by n. Not modified.b
- A matrix that is n by k. Not modified.x
- A matrix that is m by k. Modified.public static void transpose(org.ejml.data.DMatrixRMaj mat)
Performs an "in-place" transpose.
For square matrices the transpose is truly in-place and does not require
additional memory. For non-square matrices, internally a temporary matrix is declared and
transpose(DMatrixRMaj, DMatrixRMaj)
is invoked.
mat
- The matrix that is to be transposed. Modified.public static org.ejml.data.DMatrixRMaj transpose(org.ejml.data.DMatrixRMaj A, org.ejml.data.DMatrixRMaj A_tran)
Transposes matrix 'a' and stores the results in 'b':
bij = aji
where 'b' is the transpose of 'a'.
A
- The original matrix. Not modified.A_tran
- Where the transpose is stored. If null a new matrix is created. Modified.public static double trace(org.ejml.data.DMatrix1Row a)
This computes the trace of the matrix:
trace = ∑i=1:n { aii }
where n = min(numRows,numCols)
a
- A square matrix. Not modified.public static double det(org.ejml.data.DMatrixRMaj mat)
LUDecomposition_F64
directly (or any
similar algorithm) can be more efficient.mat
- The matrix whose determinant is to be computed. Not modified.public static boolean invert(org.ejml.data.DMatrixRMaj mat)
Performs a matrix inversion operation on the specified matrix and stores the results
in the same matrix.
a = a-1
If the algorithm could not invert the matrix then false is returned. If it returns true that just means the algorithm finished. The results could still be bad because the matrix is singular or nearly singular.
mat
- The matrix that is to be inverted. Results are stored here. Modified.public static boolean invert(org.ejml.data.DMatrixRMaj mat, org.ejml.data.DMatrixRMaj result)
Performs a matrix inversion operation that does not modify the original
and stores the results in another matrix. The two matrices must have the
same dimension.
b = a-1
If the algorithm could not invert the matrix then false is returned. If it returns true that just means the algorithm finished. The results could still be bad because the matrix is singular or nearly singular.
For medium to large matrices there might be a slight performance boost to using
LinearSolverFactory_DDRM
instead.
mat
- The matrix that is to be inverted. Not modified.result
- Where the inverse matrix is stored. Modified.public static void pinv(org.ejml.data.DMatrixRMaj A, org.ejml.data.DMatrixRMaj invA)
Computes the Moore-Penrose pseudo-inverse:
pinv(A) = (ATA)-1 AT
or
pinv(A) = AT(AAT)-1
Internally it uses SolvePseudoInverseSvd_DDRM
to compute the inverse. For performance reasons, this should only
be used when a matrix is singular or nearly singular.
A
- A m by n Matrix. Not modified.invA
- Where the computed pseudo inverse is stored. n by m. Modified.public static org.ejml.data.DMatrixRMaj[] columnsToVector(org.ejml.data.DMatrixRMaj A, org.ejml.data.DMatrixRMaj[] v)
A
- Matrix. Not modified.v
- public static org.ejml.data.DMatrixRMaj[] rowsToVector(org.ejml.data.DMatrixRMaj A, org.ejml.data.DMatrixRMaj[] v)
A
- Matrix. Not modified.v
- public static void setIdentity(org.ejml.data.DMatrix1Row mat)
mat
- A square matrix.identity(int)
public static org.ejml.data.DMatrixRMaj identity(int width)
Creates an identity matrix of the specified size.
aij = 0 if i ≠ j
aij = 1 if i = j
width
- The width and height of the identity matrix.public static org.ejml.data.DMatrixRMaj identity(int numRows, int numCols)
numRows
- Number of rows in the matrix.numCols
- NUmber of columns in the matrix.public static org.ejml.data.DMatrixRMaj diag(double... diagEl)
Creates a new square matrix whose diagonal elements are specified by diagEl and all
the other elements are zero.
aij = 0 if i ≤ j
aij = diag[i] if i = j
diagEl
- Contains the values of the diagonal elements of the resulting matrix.diagR(int, int, double...)
public static org.ejml.data.DMatrixRMaj diag(org.ejml.data.DMatrixRMaj ret, int width, double... diagEl)
diag(double...)
public static org.ejml.data.DMatrixRMaj diagR(int numRows, int numCols, double... diagEl)
Creates a new rectangular matrix whose diagonal elements are specified by diagEl and all
the other elements are zero.
aij = 0 if i ≤ j
aij = diag[i] if i = j
numRows
- Number of rows in the matrix.numCols
- Number of columns in the matrix.diagEl
- Contains the values of the diagonal elements of the resulting matrix.diag(double...)
public static void kron(org.ejml.data.DMatrixRMaj A, org.ejml.data.DMatrixRMaj B, org.ejml.data.DMatrixRMaj C)
The Kronecker product of two matrices is defined as:
Cij = aijB
where Cij is a sub matrix inside of C ∈ ℜ m*k × n*l,
A ∈ ℜ m × n, and B ∈ ℜ k × l.
A
- The left matrix in the operation. Not modified.B
- The right matrix in the operation. Not modified.C
- Where the results of the operation are stored. Modified.public static void extract(org.ejml.data.DMatrix src, int srcY0, int srcY1, int srcX0, int srcX1, org.ejml.data.DMatrix dst, int dstY0, int dstX0)
Extracts a submatrix from 'src' and inserts it in a submatrix in 'dst'.
si-y0 , j-x0 = oij for all y0 ≤ i < y1 and x0 ≤ j < x1
where 'sij' is an element in the submatrix and 'oij' is an element in the
original matrix.
src
- The original matrix which is to be copied. Not modified.srcX0
- Start column.srcX1
- Stop column+1.srcY0
- Start row.srcY1
- Stop row+1.dst
- Where the submatrix are stored. Modified.dstY0
- Start row in dst.dstX0
- start column in dst.public static org.ejml.data.DMatrixRMaj extract(org.ejml.data.DMatrixRMaj src, int srcY0, int srcY1, int srcX0, int srcX1)
Creates a new matrix which is the specified submatrix of 'src'
si-y0 , j-x0 = oij for all y0 ≤ i < y1 and x0 ≤ j < x1
where 'sij' is an element in the submatrix and 'oij' is an element in the
original matrix.
src
- The original matrix which is to be copied. Not modified.srcX0
- Start column.srcX1
- Stop column+1.srcY0
- Start row.srcY1
- Stop row+1.public static void extract(org.ejml.data.DMatrixRMaj src, int[] rows, int rowsSize, int[] cols, int colsSize, org.ejml.data.DMatrixRMaj dst)
src
- Source matrix. Not modified.rows
- array of row indexesrowsSize
- maximum element in row arraycols
- array of column indexescolsSize
- maximum element in column arraydst
- output matrix. Must be correct shape.public static void extract(org.ejml.data.DMatrixRMaj src, int[] indexes, int length, org.ejml.data.DMatrixRMaj dst)
src
- Source matrix. Not modified.indexes
- array of row indexeslength
- maximum element in row arraydst
- output matrix. Must be a vector of the correct length.public static void insert(org.ejml.data.DMatrixRMaj src, org.ejml.data.DMatrixRMaj dst, int[] rows, int rowsSize, int[] cols, int colsSize)
for i in len(rows): for j in len(cols): dst(rows[i],cols[j]) = src(i,j)
src
- Source matrix. Not modified.dst
- output matrix. Must be correct shape.rows
- array of row indexesrowsSize
- maximum element in row arraycols
- array of column indexescolsSize
- maximum element in column arraypublic static void extractDiag(org.ejml.data.DMatrixRMaj src, org.ejml.data.DMatrixRMaj dst)
Extracts the diagonal elements 'src' write it to the 'dst' vector. 'dst' can either be a row or column vector.
src
- Matrix whose diagonal elements are being extracted. Not modified.dst
- A vector the results will be written into. Modified.public static org.ejml.data.DMatrixRMaj extractRow(org.ejml.data.DMatrixRMaj a, int row, org.ejml.data.DMatrixRMaj out)
a
- Input matrixrow
- Which row is to be extractedout
- output. Storage for the extracted row. If null then a new vector will be returned.public static org.ejml.data.DMatrixRMaj extractColumn(org.ejml.data.DMatrixRMaj a, int column, org.ejml.data.DMatrixRMaj out)
a
- Input matrixcolumn
- Which column is to be extractedout
- output. Storage for the extracted column. If null then a new vector will be returned.public static void insert(org.ejml.data.DMatrix src, org.ejml.data.DMatrix dest, int destY0, int destX0)
src
- matrix that is being copied into dest. Not modified.dest
- Where src is being copied into. Modified.destY0
- Start row for the copy into dest.destX0
- Start column for the copy into dest.public static double elementMax(org.ejml.data.DMatrixD1 a)
Returns the value of the element in the matrix that has the largest value.
Max{ aij } for all i and j
a
- A matrix. Not modified.public static double elementMaxAbs(org.ejml.data.DMatrixD1 a)
Returns the absolute value of the element in the matrix that has the largest absolute value.
Max{ |aij| } for all i and j
a
- A matrix. Not modified.public static double elementMin(org.ejml.data.DMatrixD1 a)
Returns the value of the element in the matrix that has the minimum value.
Min{ aij } for all i and j
a
- A matrix. Not modified.public static double elementMinAbs(org.ejml.data.DMatrixD1 a)
Returns the absolute value of the element in the matrix that has the smallest absolute value.
Min{ |aij| } for all i and j
a
- A matrix. Not modified.public static void elementMult(org.ejml.data.DMatrixD1 a, org.ejml.data.DMatrixD1 b)
Performs the an element by element multiplication operation:
aij = aij * bij
a
- The left matrix in the multiplication operation. Modified.b
- The right matrix in the multiplication operation. Not modified.public static void elementMult(org.ejml.data.DMatrixD1 a, org.ejml.data.DMatrixD1 b, org.ejml.data.DMatrixD1 c)
Performs the an element by element multiplication operation:
cij = aij * bij
a
- The left matrix in the multiplication operation. Not modified.b
- The right matrix in the multiplication operation. Not modified.c
- Where the results of the operation are stored. Modified.public static void elementDiv(org.ejml.data.DMatrixD1 a, org.ejml.data.DMatrixD1 b)
Performs the an element by element division operation:
aij = aij / bij
a
- The left matrix in the division operation. Modified.b
- The right matrix in the division operation. Not modified.public static void elementDiv(org.ejml.data.DMatrixD1 a, org.ejml.data.DMatrixD1 b, org.ejml.data.DMatrixD1 c)
Performs the an element by element division operation:
cij = aij / bij
a
- The left matrix in the division operation. Not modified.b
- The right matrix in the division operation. Not modified.c
- Where the results of the operation are stored. Modified.public static double elementSum(org.ejml.data.DMatrixD1 mat)
Computes the sum of all the elements in the matrix:
sum(i=1:m , j=1:n ; aij)
mat
- An m by n matrix. Not modified.public static double elementSumAbs(org.ejml.data.DMatrixD1 mat)
Computes the sum of the absolute value all the elements in the matrix:
sum(i=1:m , j=1:n ; |aij|)
mat
- An m by n matrix. Not modified.public static void elementPower(org.ejml.data.DMatrixD1 A, org.ejml.data.DMatrixD1 B, org.ejml.data.DMatrixD1 C)
Element-wise power operation
cij = aij ^ bij
A
- left sideB
- right sideC
- output (modified)public static void elementPower(double a, org.ejml.data.DMatrixD1 B, org.ejml.data.DMatrixD1 C)
Element-wise power operation
cij = a ^ bij
a
- left scalarB
- right sideC
- output (modified)public static void elementPower(org.ejml.data.DMatrixD1 A, double b, org.ejml.data.DMatrixD1 C)
Element-wise power operation
cij = aij ^ b
A
- left sideb
- right scalarC
- output (modified)public static void elementLog(org.ejml.data.DMatrixD1 A, org.ejml.data.DMatrixD1 C)
Element-wise log operation
cij = Math.log(aij)
A
- inputC
- output (modified)public static void elementExp(org.ejml.data.DMatrixD1 A, org.ejml.data.DMatrixD1 C)
Element-wise exp operation
cij = Math.log(aij)
A
- inputC
- output (modified)public static org.ejml.data.DMatrixRMaj sumRows(org.ejml.data.DMatrixRMaj input, org.ejml.data.DMatrixRMaj output)
Computes the sum of each row in the input matrix and returns the results in a vector:
bj = sum(i=1:n ; aji)
input
- INput matrix whose rows are summed.output
- Optional storage for output. Must be a vector. If null a row vector is returned. Modified.public static org.ejml.data.DMatrixRMaj minRows(org.ejml.data.DMatrixRMaj input, org.ejml.data.DMatrixRMaj output)
Finds the element with the minimum value along each row in the input matrix and returns the results in a vector:
bj = min(i=1:n ; aji)
input
- Input matrixoutput
- Optional storage for output. Must be a vector. If null a row vector is returned. Modified.public static org.ejml.data.DMatrixRMaj maxRows(org.ejml.data.DMatrixRMaj input, org.ejml.data.DMatrixRMaj output)
Finds the element with the maximum value along each row in the input matrix and returns the results in a vector:
bj = max(i=1:n ; aji)
input
- Input matrixoutput
- Optional storage for output. Must be a vector. If null a row vector is returned. Modified.public static org.ejml.data.DMatrixRMaj sumCols(org.ejml.data.DMatrixRMaj input, org.ejml.data.DMatrixRMaj output)
Computes the sum of each column in the input matrix and returns the results in a vector:
bj = min(i=1:m ; aij)
input
- Input matrixoutput
- Optional storage for output. Must be a vector. If null a column vector is returned. Modified.public static org.ejml.data.DMatrixRMaj minCols(org.ejml.data.DMatrixRMaj input, org.ejml.data.DMatrixRMaj output)
Finds the element with the minimum value along column in the input matrix and returns the results in a vector:
bj = min(i=1:m ; aij)
input
- Input matrixoutput
- Optional storage for output. Must be a vector. If null a column vector is returned. Modified.public static org.ejml.data.DMatrixRMaj maxCols(org.ejml.data.DMatrixRMaj input, org.ejml.data.DMatrixRMaj output)
Finds the element with the minimum value along column in the input matrix and returns the results in a vector:
bj = min(i=1:m ; aij)
input
- Input matrixoutput
- Optional storage for output. Must be a vector. If null a column vector is returned. Modified.public static void addEquals(org.ejml.data.DMatrixD1 a, org.ejml.data.DMatrixD1 b)
Performs the following operation:
a = a + b
aij = aij + bij
a
- A Matrix. Modified.b
- A Matrix. Not modified.public static void addEquals(org.ejml.data.DMatrixD1 a, double beta, org.ejml.data.DMatrixD1 b)
Performs the following operation:
a = a + β * b
aij = aij + β * bij
beta
- The number that matrix 'b' is multiplied by.a
- A Matrix. Modified.b
- A Matrix. Not modified.public static void add(org.ejml.data.DMatrixD1 a, org.ejml.data.DMatrixD1 b, org.ejml.data.DMatrixD1 c)
Performs the following operation:
c = a + b
cij = aij + bij
Matrix C can be the same instance as Matrix A and/or B.
a
- A Matrix. Not modified.b
- A Matrix. Not modified.c
- A Matrix where the results are stored. Modified.public static void add(org.ejml.data.DMatrixD1 a, double beta, org.ejml.data.DMatrixD1 b, org.ejml.data.DMatrixD1 c)
Performs the following operation:
c = a + β * b
cij = aij + β * bij
Matrix C can be the same instance as Matrix A and/or B.
a
- A Matrix. Not modified.beta
- Scaling factor for matrix b.b
- A Matrix. Not modified.c
- A Matrix where the results are stored. Modified.public static void add(double alpha, org.ejml.data.DMatrixD1 a, double beta, org.ejml.data.DMatrixD1 b, org.ejml.data.DMatrixD1 c)
Performs the following operation:
c = α * a + β * b
cij = α * aij + β * bij
Matrix C can be the same instance as Matrix A and/or B.
alpha
- A scaling factor for matrix a.a
- A Matrix. Not modified.beta
- A scaling factor for matrix b.b
- A Matrix. Not modified.c
- A Matrix where the results are stored. Modified.public static void add(double alpha, org.ejml.data.DMatrixD1 a, org.ejml.data.DMatrixD1 b, org.ejml.data.DMatrixD1 c)
Performs the following operation:
c = α * a + b
cij = α * aij + bij
Matrix C can be the same instance as Matrix A and/or B.
alpha
- A scaling factor for matrix a.a
- A Matrix. Not modified.b
- A Matrix. Not modified.c
- A Matrix where the results are stored. Modified.public static void add(org.ejml.data.DMatrixD1 a, double val)
Performs an in-place scalar addition:
a = a + val
aij = aij + val
a
- A matrix. Modified.val
- The value that's added to each element.public static void add(org.ejml.data.DMatrixD1 a, double val, org.ejml.data.DMatrixD1 c)
Performs scalar addition:
c = a + val
cij = aij + val
a
- A matrix. Not modified.c
- A matrix. Modified.val
- The value that's added to each element.public static void subtract(org.ejml.data.DMatrixD1 a, double val, org.ejml.data.DMatrixD1 c)
Performs matrix scalar subtraction:
c = a - val
cij = aij - val
a
- (input) A matrix. Not modified.val
- (input) The value that's subtracted to each element.c
- (Output) A matrix. Modified.public static void subtract(double val, org.ejml.data.DMatrixD1 a, org.ejml.data.DMatrixD1 c)
Performs matrix scalar subtraction:
c = val - a
cij = val - aij
val
- (input) The value that's subtracted to each element.a
- (input) A matrix. Not modified.c
- (Output) A matrix. Modified.public static void subtractEquals(org.ejml.data.DMatrixD1 a, org.ejml.data.DMatrixD1 b)
Performs the following subtraction operation:
a = a - b
aij = aij - bij
a
- A Matrix. Modified.b
- A Matrix. Not modified.public static void subtract(org.ejml.data.DMatrixD1 a, org.ejml.data.DMatrixD1 b, org.ejml.data.DMatrixD1 c)
Performs the following subtraction operation:
c = a - b
cij = aij - bij
Matrix C can be the same instance as Matrix A and/or B.
a
- A Matrix. Not modified.b
- A Matrix. Not modified.c
- A Matrix. Modified.public static void scale(double alpha, org.ejml.data.DMatrixD1 a)
Performs an in-place element by element scalar multiplication.
aij = α*aij
a
- The matrix that is to be scaled. Modified.alpha
- the amount each element is multiplied by.public static void scale(double alpha, org.ejml.data.DMatrixD1 a, org.ejml.data.DMatrixD1 b)
Performs an element by element scalar multiplication.
bij = α*aij
alpha
- the amount each element is multiplied by.a
- The matrix that is to be scaled. Not modified.b
- Where the scaled matrix is stored. Modified.public static void divide(double alpha, org.ejml.data.DMatrixD1 a)
Performs an in-place element by element scalar division with the scalar on top.
aij = α/aij
a
- The matrix whose elements are divide the scalar. Modified.alpha
- top value in divisionpublic static void divide(org.ejml.data.DMatrixD1 a, double alpha)
Performs an in-place element by element scalar division with the scalar on bottom.
aij = aij/α
a
- The matrix whose elements are to be divided. Modified.alpha
- the amount each element is divided by.public static void divide(double alpha, org.ejml.data.DMatrixD1 a, org.ejml.data.DMatrixD1 b)
Performs an element by element scalar division with the scalar on top.
bij = α/aij
alpha
- The numerator.a
- The matrix whose elements are the divisor. Not modified.b
- Where the results are stored. Modified.public static void divide(org.ejml.data.DMatrixD1 a, double alpha, org.ejml.data.DMatrixD1 b)
Performs an element by element scalar division with the scalar on botton.
bij = aij /α
a
- The matrix whose elements are to be divided. Not modified.alpha
- the amount each element is divided by.b
- Where the results are stored. Modified.public static void changeSign(org.ejml.data.DMatrixD1 a)
Changes the sign of every element in the matrix.
aij = -aij
a
- A matrix. Modified.public static void changeSign(org.ejml.data.DMatrixD1 input, org.ejml.data.DMatrixD1 output)
Changes the sign of every element in the matrix.
outputij = -inputij
input
- A matrix. Modified.public static void fill(org.ejml.data.DMatrixD1 a, double value)
Sets every element in the matrix to the specified value.
aij = value
a
- A matrix whose elements are about to be set. Modified.value
- The value each element will have.public static org.ejml.data.DMatrixRMaj rref(org.ejml.data.DMatrixRMaj A, int numUnknowns, org.ejml.data.DMatrixRMaj reduced)
Puts the augmented system matrix into reduced row echelon form (RREF) using Gauss-Jordan elimination with row (partial) pivots. A matrix is said to be in RREF is the following conditions are true:
[1] Page 19 in, Otter Bretscherm "Linear Algebra with Applications" Prentice-Hall Inc, 1997
A
- Input matrix. Unmodified.numUnknowns
- Number of unknowns/columns that are reduced. Set to -1 to default to
Math.min(A.numRows,A.numCols), which works for most systems.reduced
- Storage for reduced echelon matrix. If null then a new matrix is returned. Modified.RrefGaussJordanRowPivot_DDRM
public static org.ejml.data.BMatrixRMaj elementLessThan(org.ejml.data.DMatrixRMaj A, double value, org.ejml.data.BMatrixRMaj output)
A
- Input matrxvalue
- value each element is compared againstoutput
- (Optional) Storage for results. Can be null. Is reshaped.public static org.ejml.data.BMatrixRMaj elementLessThanOrEqual(org.ejml.data.DMatrixRMaj A, double value, org.ejml.data.BMatrixRMaj output)
A
- Input matrixvalue
- value each element is compared againstoutput
- (Optional) Storage for results. Can be null. Is reshaped.public static org.ejml.data.BMatrixRMaj elementMoreThan(org.ejml.data.DMatrixRMaj A, double value, org.ejml.data.BMatrixRMaj output)
A
- Input matrixvalue
- value each element is compared againstoutput
- (Optional) Storage for results. Can be null. Is reshaped.public static org.ejml.data.BMatrixRMaj elementMoreThanOrEqual(org.ejml.data.DMatrixRMaj A, double value, org.ejml.data.BMatrixRMaj output)
A
- Input matrixvalue
- value each element is compared againstoutput
- (Optional) Storage for results. Can be null. Is reshaped.public static org.ejml.data.BMatrixRMaj elementLessThan(org.ejml.data.DMatrixRMaj A, org.ejml.data.DMatrixRMaj B, org.ejml.data.BMatrixRMaj output)
A
- Input matrixB
- Input matrixoutput
- (Optional) Storage for results. Can be null. Is reshaped.public static org.ejml.data.BMatrixRMaj elementLessThanOrEqual(org.ejml.data.DMatrixRMaj A, org.ejml.data.DMatrixRMaj B, org.ejml.data.BMatrixRMaj output)
A
- Input matrixB
- Input matrixoutput
- (Optional) Storage for results. Can be null. Is reshaped.public static org.ejml.data.DMatrixRMaj elements(org.ejml.data.DMatrixRMaj A, org.ejml.data.BMatrixRMaj marked, org.ejml.data.DMatrixRMaj output)
A
- Input matrixmarked
- Input matrix marking elements in Aoutput
- Storage for output row vector. Can be null. Will be reshaped.public static int countTrue(org.ejml.data.BMatrixRMaj A)
A
- input matrixpublic static org.ejml.data.DMatrixRMaj concatColumns(org.ejml.data.DMatrixRMaj... m)
Concatinates all the matrices together along their columns. If the rows do not match the upper elements are set to zero.
A = [ m[0] , ... , m[n-1] ]m
- Set of matricespublic static org.ejml.data.DMatrixRMaj concatRows(org.ejml.data.DMatrixRMaj... m)
Concatinates all the matrices together along their columns. If the rows do not match the upper elements are set to zero.
A = [ m[0] ; ... ; m[n-1] ]m
- Set of matricespublic static org.ejml.data.DMatrixRMaj permuteRowInv(int[] pinv, org.ejml.data.DMatrixRMaj input, org.ejml.data.DMatrixRMaj output)
pinv
- (Input) Inverse permutation vector. Specifies new order of the rows.input
- (Input) Matrix which is to be permutedoutput
- (Output) Matrix which has the permutation stored in it. Is reshaped.