JSci.maths.matrices
Class AbstractIntegerMatrix

java.lang.Object
  extended by JSci.maths.matrices.Matrix
      extended by JSci.maths.matrices.AbstractIntegerMatrix
All Implemented Interfaces:
java.io.Serializable, Algebra.Member, Module.Member, VectorSpace.Member, Ring.Member, AbelianGroup.Member, Member
Direct Known Subclasses:
AbstractIntegerSquareMatrix, IntegerMatrix

public abstract class AbstractIntegerMatrix
extends Matrix

The AbstractIntegerMatrix class provides an object for encapsulating integer matrices.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class JSci.maths.matrices.Matrix
numCols, numRows
 
Constructor Summary
protected AbstractIntegerMatrix(int rows, int cols)
          Constructs a matrix.
 
Method Summary
 AbelianGroup.Member add(AbelianGroup.Member m)
          Returns the addition of this matrix and another.
 AbstractIntegerMatrix add(AbstractIntegerMatrix m)
          Returns the addition of this matrix and another.
 AbstractIntegerMatrix directSum(AbstractIntegerMatrix m)
          Returns the direct sum of this matrix and another.
 boolean equals(AbstractIntegerMatrix m)
          Compares two ${nativeTyp} matrices for equality.
 boolean equals(AbstractIntegerMatrix m, double tol)
           
 boolean equals(java.lang.Object obj)
          Compares two ${nativeTyp} matrices for equality.
 double frobeniusNorm()
          Returns the Frobenius or Hilbert-Schmidt (l2) norm.
abstract  int getElement(int i, int j)
          Returns an element of the matrix.
 java.lang.Object getSet()
           
 int hashCode()
          Returns a hashcode for this matrix.
 int infNorm()
          Returns the linfinity-norm.
 AbstractIntegerMatrix multiply(AbstractIntegerMatrix m)
          Returns the multiplication of this matrix and another.
 AbstractIntegerVector multiply(AbstractIntegerVector v)
          Returns the multiplication of a vector by this matrix.
 Ring.Member multiply(Ring.Member m)
          Returns the multiplication of this matrix and another.
 AbelianGroup.Member negate()
          Returns the negative of this matrix.
 VectorSpace.Member scalarDivide(Field.Member x)
          Returns the division of this matrix by a scalar.
 AbstractIntegerMatrix scalarMultiply(int x)
          Returns the multiplication of this matrix by a scalar.
 Module.Member scalarMultiply(Ring.Member x)
          Returns the multiplication of this matrix by a scalar.
 int scalarProduct(AbstractIntegerMatrix m)
          Returns the scalar product of this matrix and another.
abstract  void setElement(int i, int j, int x)
          Sets the value of an element of the matrix.
 AbelianGroup.Member subtract(AbelianGroup.Member m)
          Returns the subtraction of this matrix by another.
 AbstractIntegerMatrix subtract(AbstractIntegerMatrix m)
          Returns the subtraction of this matrix by another.
 AbstractIntegerMatrix tensor(AbstractIntegerMatrix m)
          Returns the tensor product of this matrix and another.
 AbstractComplexMatrix toComplexMatrix()
          Converts this matrix to a complex matrix.
 AbstractDoubleMatrix toDoubleMatrix()
          Converts this matrix to a double matrix.
 java.lang.String toString()
          Returns a string representing this matrix.
 Matrix transpose()
          Returns the transpose of this matrix.
 
Methods inherited from class JSci.maths.matrices.Matrix
columns, getInvalidElementMsg, rows
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractIntegerMatrix

protected AbstractIntegerMatrix(int rows,
                                int cols)
Constructs a matrix.

Method Detail

equals

public final boolean equals(java.lang.Object obj)
Compares two ${nativeTyp} matrices for equality.

Overrides:
equals in class java.lang.Object
Parameters:
obj - a int matrix

equals

public final boolean equals(AbstractIntegerMatrix m)
Compares two ${nativeTyp} matrices for equality. Two matrices are considered to be equal if the Frobenius norm of their difference is within the zero tolerance.

Parameters:
m - a int matrix

equals

public boolean equals(AbstractIntegerMatrix m,
                      double tol)

toString

public java.lang.String toString()
Returns a string representing this matrix.

Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Returns a hashcode for this matrix.

Overrides:
hashCode in class java.lang.Object

toDoubleMatrix

public AbstractDoubleMatrix toDoubleMatrix()
Converts this matrix to a double matrix.

Returns:
a double matrix

toComplexMatrix

public AbstractComplexMatrix toComplexMatrix()
Converts this matrix to a complex matrix.

Returns:
a complex matrix

getElement

public abstract int getElement(int i,
                               int j)
Returns an element of the matrix.

Parameters:
i - row index of the element
j - column index of the element
Throws:
MatrixDimensionException - If attempting to access an invalid element.

setElement

public abstract void setElement(int i,
                                int j,
                                int x)
Sets the value of an element of the matrix. Should only be used to initialise this matrix.

Parameters:
i - row index of the element
j - column index of the element
x - a number
Throws:
MatrixDimensionException - If attempting to access an invalid element.

getSet

public final java.lang.Object getSet()

infNorm

public int infNorm()
Returns the linfinity-norm.


frobeniusNorm

public double frobeniusNorm()
Returns the Frobenius or Hilbert-Schmidt (l2) norm.

PlanetMath references:
FrobeniusMatrixNorm

negate

public AbelianGroup.Member negate()
Returns the negative of this matrix.


add

public final AbelianGroup.Member add(AbelianGroup.Member m)
Returns the addition of this matrix and another.

Parameters:
m - a group member

add

public AbstractIntegerMatrix add(AbstractIntegerMatrix m)
Returns the addition of this matrix and another.

Parameters:
m - a int matrix
Throws:
MatrixDimensionException - If the matrices are different sizes.

subtract

public final AbelianGroup.Member subtract(AbelianGroup.Member m)
Returns the subtraction of this matrix by another.

Parameters:
m - a group member

subtract

public AbstractIntegerMatrix subtract(AbstractIntegerMatrix m)
Returns the subtraction of this matrix by another.

Parameters:
m - a int matrix
Throws:
MatrixDimensionException - If the matrices are different sizes.

scalarMultiply

public final Module.Member scalarMultiply(Ring.Member x)
Returns the multiplication of this matrix by a scalar.

Parameters:
x - a ring member

scalarMultiply

public AbstractIntegerMatrix scalarMultiply(int x)
Returns the multiplication of this matrix by a scalar.

Parameters:
x - a int.
Returns:
a int matrix.

scalarDivide

public final VectorSpace.Member scalarDivide(Field.Member x)
Returns the division of this matrix by a scalar. Always throws an exception.

Parameters:
x - a field member

scalarProduct

public int scalarProduct(AbstractIntegerMatrix m)
Returns the scalar product of this matrix and another.

Parameters:
m - a int matrix.
Throws:
MatrixDimensionException - If the matrices are different sizes.

multiply

public AbstractIntegerVector multiply(AbstractIntegerVector v)
Returns the multiplication of a vector by this matrix.

Parameters:
v - a int vector.
Throws:
DimensionException - If the matrix and vector are incompatible.

multiply

public final Ring.Member multiply(Ring.Member m)
Returns the multiplication of this matrix and another.

Parameters:
m - a ring member

multiply

public AbstractIntegerMatrix multiply(AbstractIntegerMatrix m)
Returns the multiplication of this matrix and another.

Parameters:
m - a int matrix
Returns:
a AbstractIntegerMatrix or a AbstractIntegerSquareMatrix as appropriate
Throws:
MatrixDimensionException - If the matrices are incompatible.

directSum

public AbstractIntegerMatrix directSum(AbstractIntegerMatrix m)
Returns the direct sum of this matrix and another.


tensor

public AbstractIntegerMatrix tensor(AbstractIntegerMatrix m)
Returns the tensor product of this matrix and another.


transpose

public Matrix transpose()
Returns the transpose of this matrix.

Specified by:
transpose in class Matrix
Returns:
a int matrix