Class MatrixVectorMult
- java.lang.Object
-
- org.ejml.alg.dense.mult.MatrixVectorMult
-
public class MatrixVectorMult extends java.lang.ObjectThis class contains various types of matrix vector multiplcation operations for
DenseMatrix64F.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 Summary
Constructors Constructor and Description MatrixVectorMult()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static voidmult(RowD1Matrix64F A, D1Matrix64F B, D1Matrix64F C)Performs a matrix vector multiply.
c = A * b
and
c = A * bT
ci = Sum{ j=1:n, aij * bj}
where A is a matrix, b is a column or transposed row vector, and c is a column vector.static voidmultAdd(RowD1Matrix64F A, D1Matrix64F B, D1Matrix64F C)Performs a matrix vector multiply.
C = C + A * B
or
C = C + A * BT
ci = Sum{ j=1:n, ci + aij * bj}
where A is a matrix, B is a column or transposed row vector, and C is a column vector.static voidmultAddTransA_reorder(RowD1Matrix64F A, D1Matrix64F B, D1Matrix64F C)An alternative implementation ofmultAddTransA_small(org.ejml.data.RowD1Matrix64F, org.ejml.data.D1Matrix64F, org.ejml.data.D1Matrix64F)that performs well on large matrices.static voidmultAddTransA_small(RowD1Matrix64F A, D1Matrix64F B, D1Matrix64F C)Performs a matrix vector multiply.
C = C + AT * B
or
C = CT + AT * BT
ci = Sum{ j=1:n, ci + aji * bj}
where A is a matrix, B is a column or transposed row vector, and C is a column vector.static voidmultTransA_reorder(RowD1Matrix64F A, D1Matrix64F B, D1Matrix64F C)An alternative implementation ofmultTransA_small(org.ejml.data.RowD1Matrix64F, org.ejml.data.D1Matrix64F, org.ejml.data.D1Matrix64F)that performs well on large matrices.static voidmultTransA_small(RowD1Matrix64F A, D1Matrix64F B, D1Matrix64F C)Performs a matrix vector multiply.
C = AT * B
where B is a column vector.
or
C = AT * BT
where B is a row vector.
-
-
-
Method Detail
-
mult
public static void mult(RowD1Matrix64F A, D1Matrix64F B, D1Matrix64F C)
Performs a matrix vector multiply.
c = A * b
and
c = A * bT
ci = Sum{ j=1:n, aij * bj}
where A is a matrix, b is a column or transposed row vector, and c is a column vector.- Parameters:
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.
-
multAdd
public static void multAdd(RowD1Matrix64F A, D1Matrix64F B, D1Matrix64F C)
Performs a matrix vector multiply.
C = C + A * B
or
C = C + A * BT
ci = Sum{ j=1:n, ci + aij * bj}
where A is a matrix, B is a column or transposed row vector, and C is a column vector.- Parameters:
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.
-
multTransA_small
public static void multTransA_small(RowD1Matrix64F A, D1Matrix64F B, D1Matrix64F C)
Performs a matrix vector multiply.
C = AT * B
where B is a column vector.
or
C = AT * BT
where B is a row vector.
ci = Sum{ j=1:n, aji * bj}
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.
- Parameters:
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.
-
multTransA_reorder
public static void multTransA_reorder(RowD1Matrix64F A, D1Matrix64F B, D1Matrix64F C)
An alternative implementation ofmultTransA_small(org.ejml.data.RowD1Matrix64F, org.ejml.data.D1Matrix64F, org.ejml.data.D1Matrix64F)that performs well on large matrices. There is a relative performance hit when used on small matrices.- Parameters:
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.
-
multAddTransA_small
public static void multAddTransA_small(RowD1Matrix64F A, D1Matrix64F B, D1Matrix64F C)
Performs a matrix vector multiply.
C = C + AT * B
or
C = CT + AT * BT
ci = Sum{ j=1:n, ci + aji * bj}
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.
- Parameters:
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.
-
multAddTransA_reorder
public static void multAddTransA_reorder(RowD1Matrix64F A, D1Matrix64F B, D1Matrix64F C)
An alternative implementation ofmultAddTransA_small(org.ejml.data.RowD1Matrix64F, org.ejml.data.D1Matrix64F, org.ejml.data.D1Matrix64F)that performs well on large matrices. There is a relative performance hit when used on small matrices.- Parameters:
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.
-
-
DMelt 3.0 © DataMelt by jWork.ORG