Class SimpleMatrixMathOperation
- java.lang.Object
-
- dev.nm.algebra.linear.matrix.doubles.matrixtype.mathoperation.SimpleMatrixMathOperation
-
- All Implemented Interfaces:
MatrixMathOperation
public class SimpleMatrixMathOperation extends Object implements MatrixMathOperation
This is a generic, single-threaded implementation of matrix math operations. It assumes no knowledge of how a matrix is implemented. Consequently, they are bound to have suboptimal performance. A particular implementation ofMatrix
can improve performance by taking advantage of having access to the internal members.
-
-
Constructor Summary
Constructors Constructor Description SimpleMatrixMathOperation()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Matrix
add(MatrixAccess A1, MatrixAccess A2)
A1 + A2Matrix
minus(MatrixAccess A1, MatrixAccess A2)
A1 - A2Matrix
multiply(MatrixAccess A1, MatrixAccess A2)
A1 * A2Vector
multiply(MatrixAccess A, Vector v)
A * vMatrix
scaled(MatrixAccess A, double scalar)
c * AMatrix
transpose(MatrixAccess A)
Get the transpose of A.
-
-
-
Method Detail
-
add
public Matrix add(MatrixAccess A1, MatrixAccess A2)
Description copied from interface:MatrixMathOperation
A1 + A2- Specified by:
add
in interfaceMatrixMathOperation
- Parameters:
A1
- a matrixA2
- a matrix- Returns:
- the sum of A1 and A2
-
minus
public Matrix minus(MatrixAccess A1, MatrixAccess A2)
Description copied from interface:MatrixMathOperation
A1 - A2- Specified by:
minus
in interfaceMatrixMathOperation
- Parameters:
A1
- a matrixA2
- a matrix- Returns:
- the difference between A1 and A2
-
multiply
public Matrix multiply(MatrixAccess A1, MatrixAccess A2)
Description copied from interface:MatrixMathOperation
A1 * A2- Specified by:
multiply
in interfaceMatrixMathOperation
- Parameters:
A1
- a matrixA2
- a matrix- Returns:
- the product of A1 and A2
-
multiply
public Vector multiply(MatrixAccess A, Vector v)
Description copied from interface:MatrixMathOperation
A * v- Specified by:
multiply
in interfaceMatrixMathOperation
- Parameters:
A
- a matrixv
- a vector- Returns:
- the product of A and v
-
scaled
public Matrix scaled(MatrixAccess A, double scalar)
Description copied from interface:MatrixMathOperation
c * A- Specified by:
scaled
in interfaceMatrixMathOperation
- Parameters:
A
- a matrixscalar
- a scalar- Returns:
- A scaled by c
-
transpose
public Matrix transpose(MatrixAccess A)
Description copied from interface:MatrixMathOperation
Get the transpose of A.- Specified by:
transpose
in interfaceMatrixMathOperation
- Parameters:
A
- a matrix- Returns:
- the transpose of A
-
-