JSci.maths
Class RingMatrix

java.lang.Object
  extended by JSci.maths.Matrix
      extended by JSci.maths.RingMatrix
All Implemented Interfaces:
java.io.Serializable, Algebra.Member, Module.Member, VectorSpace.Member, Ring.Member, AbelianGroup.Member, Member

public class RingMatrix
extends Matrix

The RingMatrix class provides an object for encapsulating matrices over an arbitrary ring.

Version:
1.0
Author:
Mark Hale
See Also:
Serialized Form

Field Summary
protected static int ARRAY_2D
          Storage format identifier.
protected  Ring.Member[][] matrix
          Array containing the elements of the matrix.
 
Fields inherited from class JSci.maths.Matrix
CLASS_SPECIFIC, numCols, numRows, storageFormat
 
Constructor Summary
protected RingMatrix(int rows, int cols, int storeID)
          Constructs a matrix.
  RingMatrix(Ring.Member[][] array)
          Constructs a matrix by wrapping an array.
 
Method Summary
 AbelianGroup.Member add(AbelianGroup.Member m)
          Returns the addition of this matrix and another.
 RingMatrix add(RingMatrix m)
          Returns the addition of this matrix and another.
 RingMatrix directSum(RingMatrix m)
          Returns the direct sum of this matrix and another.
 boolean equals(java.lang.Object m)
          Compares two matrices for equality.
protected  void finalize()
          Finalize.
 Ring.Member getElement(int i, int j)
          Returns an element of the matrix.
 Ring.Member multiply(Ring.Member m)
          Returns the multiplication of this matrix and another.
 RingMatrix multiply(RingMatrix 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.
 Module.Member scalarMultiply(Ring.Member r)
          Returns the multiplication of this matrix by a scalar.
 void setElement(int i, int j, Ring.Member r)
          Sets the value of an element of the matrix.
 AbelianGroup.Member subtract(AbelianGroup.Member m)
          Returns the subtraction of this matrix and another.
 RingMatrix subtract(RingMatrix m)
          Returns the subtraction of this matrix and another.
 RingMatrix tensorProduct(RingMatrix m)
          Returns the tensor product of this matrix and another.
 java.lang.String toString()
          Returns a string representing this matrix.
 Matrix transpose()
          Returns the transpose of this matrix.
 
Methods inherited from class JSci.maths.Matrix
columns, getInvalidElementMsg, rows
 
Methods inherited from class java.lang.Object
clone, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ARRAY_2D

protected static final int ARRAY_2D
Storage format identifier.

See Also:
Constant Field Values

matrix

protected Ring.Member[][] matrix
Array containing the elements of the matrix.

Constructor Detail

RingMatrix

protected RingMatrix(int rows,
                     int cols,
                     int storeID)
Constructs a matrix.


RingMatrix

public RingMatrix(Ring.Member[][] array)
Constructs a matrix by wrapping an array.

Parameters:
array - an assigned value
Method Detail

finalize

protected void finalize()
                 throws java.lang.Throwable
Finalize.

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable - Any that occur.

equals

public boolean equals(java.lang.Object m)
Compares two matrices for equality.

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

toString

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

Overrides:
toString in class java.lang.Object

getElement

public Ring.Member 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 void setElement(int i,
                       int j,
                       Ring.Member r)
Sets the value of an element of the matrix.

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

negate

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


add

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

Parameters:
m - a group member

add

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

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

subtract

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

Parameters:
m - a group member

subtract

public RingMatrix subtract(RingMatrix m)
Returns the subtraction of this matrix and another.

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

scalarMultiply

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

Parameters:
r - a ring element.

scalarDivide

public VectorSpace.Member scalarDivide(Field.Member x)
Returns the division of this matrix by a scalar.

Parameters:
x - a field element.

multiply

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

Parameters:
m - a ring member

multiply

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

Parameters:
m - a matrix
Throws:
MatrixDimensionException - If the matrices are incompatible.

directSum

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


tensorProduct

public RingMatrix tensorProduct(RingMatrix 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 matrix