edu.northwestern.at.utils.math.matrix
Class MatricesMeasure

java.lang.Object
  extended by edu.northwestern.at.utils.math.matrix.MatricesMeasure

public class MatricesMeasure
extends java.lang.Object

MatricesMeasure provides methods applicable to two (or more) matrices.

Given two matrices A and B, returns a single value which is a function of A and B.


Constructor Summary
MatricesMeasure()
           
 
Method Summary
static boolean areEqual(Matrix a, Matrix b)
          Compares all elements of two matrices for equality.
static boolean areEqual(Matrix a, Matrix b, double tolerance)
          Compares all elements of two matrices for equality to specified tolerance.
static boolean areSameSize(Matrix a, Matrix b)
          Compares size of two matrices.
static double dotProduct(Matrix a, Matrix b)
          Dot product of two matrices.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MatricesMeasure

public MatricesMeasure()
Method Detail

dotProduct

public static double dotProduct(Matrix a,
                                Matrix b)
Dot product of two matrices.

Parameters:
a - First matrix.
b - Second matrix.
Returns:
The dot product of the two matrices.

The two matrices must be the same size. The dot product is the sum of the element-wise products of the two matrices.


areEqual

public static boolean areEqual(Matrix a,
                               Matrix b,
                               double tolerance)
Compares all elements of two matrices for equality to specified tolerance.

Parameters:
a - First matrix.
b - Second matrix.
tolerance - Tolerance.
Returns:
true if all corresponding elements in a and b are equal.

Two matrix elements are deemed equal if |a(i,j) - b(i,j)| <= tolerance.


areEqual

public static boolean areEqual(Matrix a,
                               Matrix b)
Compares all elements of two matrices for equality.

Parameters:
a - First matrix.
b - Second matrix.
Returns:
true if all corresponding elements in a and b are exactly equal.

areSameSize

public static boolean areSameSize(Matrix a,
                                  Matrix b)
Compares size of two matrices.

Parameters:
a - First matrix.
b - Second matrix.
Returns:
True if a and b have the same number of rows and columns.