SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.matrix.doubles.matrixtype.mathoperation
Class SimpleMatrixMathOperation

java.lang.Object
  extended by com.numericalmethod.suanshu.matrix.doubles.matrixtype.mathoperation.SimpleMatrixMathOperation
All Implemented Interfaces:
MatrixMathOperation

public class SimpleMatrixMathOperation
extends java.lang.Object
implements MatrixMathOperation

This class is one implementation of MatrixMathOperation.

It exists only for the purpose of code reuse by subclasses.

Since these functions work with all Matrix implementations, they are bound to have suboptimal performance. Subclasses can override them by taking advantage of having access to the internal members to increase performance.


Constructor Summary
SimpleMatrixMathOperation()
           
 
Method Summary
 Matrix add(Matrix A1, Matrix A2)
          A1 + A2.
 Matrix minus(Matrix A1, Matrix A2)
          A1 - A2.
 Matrix multiply(Matrix A1, Matrix A2)
          A1 %*% A2.
 Vector multiply(Matrix A, Vector v)
          A %*% v
 Matrix scaled(Matrix A, double scalar)
          s * A
 Matrix transpose(Matrix A)
          t(A)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleMatrixMathOperation

public SimpleMatrixMathOperation()
Method Detail

add

public Matrix add(Matrix A1,
                  Matrix A2)
A1 + A2.

Specified by:
add in interface MatrixMathOperation
Parameters:
A1 - the first matrix
A2 - the second matrix
Returns:
a matrix which is the sum of A1 and A2

minus

public Matrix minus(Matrix A1,
                    Matrix A2)
A1 - A2.

Specified by:
minus in interface MatrixMathOperation
Parameters:
A1 - the first matrix
A2 - the second matrix
Returns:
a matrix which is the difference between A1 and A2

multiply

public Matrix multiply(Matrix A1,
                       Matrix A2)
A1 %*% A2.

Specified by:
multiply in interface MatrixMathOperation
Parameters:
A1 - the first matrix
A2 - the second matrix
Returns:
a matrix which is the product of A1 and A2

multiply

public Vector multiply(Matrix A,
                       Vector v)
Description copied from interface: MatrixMathOperation
A %*% v

Specified by:
multiply in interface MatrixMathOperation
Parameters:
A - a matrix
v - a vector
Returns:
the product of A and v

scaled

public Matrix scaled(Matrix A,
                     double scalar)
Description copied from interface: MatrixMathOperation
s * A

Specified by:
scaled in interface MatrixMathOperation
Parameters:
A - a matrix
scalar - a scalar
Returns:
A scaled by s

transpose

public Matrix transpose(Matrix A)
Description copied from interface: MatrixMathOperation
t(A)

Specified by:
transpose in interface MatrixMathOperation
Parameters:
A - a matrix
Returns:
the transpose of A

SuanShu, a Java numerical and statistical library

Copyright © 2011 Numerical Method Inc. Ltd. All Rights Reserved.