public class MatrixVectorMult_DDRM
extends java.lang.Object
This class contains various types of matrix vector multiplcation operations for DMatrixRMaj
.
If a matrix has only one column or row then it is a vector. There are faster algorithms that can be used to multiply matrices by vectors. Strangely, even though the operations count smaller, the difference between this and a regular matrix multiply is insignificant for large matrices. The smaller matrices there is about a 40% speed improvement. In practice the speed improvement for smaller matrices is not noticeable unless 10s of millions of matrix multiplications are being performed.
Constructor and Description |
---|
MatrixVectorMult_DDRM() |
Modifier and Type | Method and Description |
---|---|
static void |
mult(DMatrix1Row A,
DMatrixD1 B,
DMatrixD1 C)
Performs a matrix vector multiply.
c = A * b and c = A * b^{T} c_{i} = Sum{ j=1:n, a_{ij} * b_{j}} where A is a matrix, b is a column or transposed row vector, and c is a column vector. |
static void |
multAdd(DMatrix1Row A,
DMatrixD1 B,
DMatrixD1 C)
Performs a matrix vector multiply.
C = C + A * B or C = C + A * B^{T} c_{i} = Sum{ j=1:n, c_{i} + a_{ij} * b_{j}} where A is a matrix, B is a column or transposed row vector, and C is a column vector. |
static void |
multAddTransA_reorder(DMatrix1Row A,
DMatrixD1 B,
DMatrixD1 C)
An alternative implementation of
multAddTransA_small(org.ejml.data.DMatrix1Row, org.ejml.data.DMatrixD1, org.ejml.data.DMatrixD1) that performs well on large
matrices. |
static void |
multAddTransA_small(DMatrix1Row A,
DMatrixD1 B,
DMatrixD1 C)
Performs a matrix vector multiply.
C = C + A^{T} * B or C = C^{T} + A^{T} * B^{T} c_{i} = Sum{ j=1:n, c_{i} + a_{ji} * b_{j}} where A is a matrix, B is a column or transposed row vector, and C is a column vector. |
static void |
multTransA_reorder(DMatrix1Row A,
DMatrixD1 B,
DMatrixD1 C)
An alternative implementation of
multTransA_small(org.ejml.data.DMatrix1Row, org.ejml.data.DMatrixD1, org.ejml.data.DMatrixD1) that performs well on large
matrices. |
static void |
multTransA_small(DMatrix1Row A,
DMatrixD1 B,
DMatrixD1 C)
Performs a matrix vector multiply.
C = A^{T} * B where B is a column vector. or C = A^{T} * B^{T} where B is a row vector. |
public static void mult(DMatrix1Row A, DMatrixD1 B, DMatrixD1 C)
Performs a matrix vector multiply.
c = A * b
and
c = A * b^{T}
c_{i} = Sum{ j=1:n, a_{ij} * b_{j}}
where A is a matrix, b is a column or transposed row vector, and c is a column vector.
A
- A matrix that is m by n. Not modified.B
- A vector that has length n. Not modified.C
- A column vector that has length m. Modified.public static void multAdd(DMatrix1Row A, DMatrixD1 B, DMatrixD1 C)
Performs a matrix vector multiply.
C = C + A * B
or
C = C + A * B^{T}
c_{i} = Sum{ j=1:n, c_{i} + a_{ij} * b_{j}}
where A is a matrix, B is a column or transposed row vector, and C is a column vector.
A
- A matrix that is m by n. Not modified.B
- A vector that has length n. Not modified.C
- A column vector that has length m. Modified.public static void multTransA_small(DMatrix1Row A, DMatrixD1 B, DMatrixD1 C)
Performs a matrix vector multiply.
C = A^{T} * B
where B is a column vector.
or
C = A^{T} * B^{T}
where B is a row vector.
c_{i} = Sum{ j=1:n, a_{ji} * b_{j}}
where A is a matrix, B is a column or transposed row vector, and C is a column vector.
This implementation is optimal for small matrices. There is a huge performance hit when used on large matrices due to CPU cache issues.
A
- A matrix that is m by n. Not modified.B
- A that has length m and is a column. Not modified.C
- A column vector that has length n. Modified.public static void multTransA_reorder(DMatrix1Row A, DMatrixD1 B, DMatrixD1 C)
multTransA_small(org.ejml.data.DMatrix1Row, org.ejml.data.DMatrixD1, org.ejml.data.DMatrixD1)
that performs well on large
matrices. There is a relative performance hit when used on small matrices.A
- A matrix that is m by n. Not modified.B
- A Vector that has length m. Not modified.C
- A column vector that has length n. Modified.public static void multAddTransA_small(DMatrix1Row A, DMatrixD1 B, DMatrixD1 C)
Performs a matrix vector multiply.
C = C + A^{T} * B
or
C = C^{T} + A^{T} * B^{T}
c_{i} = Sum{ j=1:n, c_{i} + a_{ji} * b_{j}}
where A is a matrix, B is a column or transposed row vector, and C is a column vector.
This implementation is optimal for small matrices. There is a huge performance hit when used on large matrices due to CPU cache issues.
A
- A matrix that is m by n. Not modified.B
- A vector that has length m. Not modified.C
- A column vector that has length n. Modified.public static void multAddTransA_reorder(DMatrix1Row A, DMatrixD1 B, DMatrixD1 C)
multAddTransA_small(org.ejml.data.DMatrix1Row, org.ejml.data.DMatrixD1, org.ejml.data.DMatrixD1)
that performs well on large
matrices. There is a relative performance hit when used on small matrices.A
- A matrix that is m by n. Not modified.B
- A vector that has length m. Not modified.C
- A column vector that has length n. Modified.
Copyright © 2009-2018 Peter Abeles