org.jscience.mathematics.algebraic.matrices
Class RingHypermatrix

java.lang.Object
  extended by org.jscience.mathematics.algebraic.AbstractHypermatrix
      extended by org.jscience.mathematics.algebraic.matrices.RingHypermatrix
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Algebra.Member, Ring.Member, AbelianGroup.Member, Hypermatrix, Module.Member, VectorSpace.Member, Member

public class RingHypermatrix
extends AbstractHypermatrix
implements java.lang.Cloneable, java.io.Serializable

The RingHypermatrix class provides an implementation for extended matrices.

See Also:
Serialized Form

Constructor Summary
RingHypermatrix(int[] dimensions)
          Constructs a RingHypermatrix.
RingHypermatrix(int[] dimensions, java.lang.Object[] elements)
          Constructs an hypermatrix.
RingHypermatrix(java.lang.Object array)
          Constructs an hypermatrix.
RingHypermatrix(RingHypermatrix matrix)
           
 
Method Summary
 AbelianGroup.Member add(AbelianGroup.Member m)
          Returns the addition of this matrix and another.
 RingHypermatrix add(RingHypermatrix m)
          Returns the addition of this matrix and another.
 java.lang.Object clone()
          Clone matrix into a new matrix.
 boolean equals(java.lang.Object m)
          Compares two hypermatrices for equality.
 java.lang.Number getElement(int[] position)
          Returns the element at position given by the array of int.
 java.lang.Object getElements()
          Returns a projection of this hypermatrix.
 RingHypermatrix mapElements(NumberMapping f)
          Applies a function on all the Hypermatrix components.
 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.
 Module.Member scalarMultiply(Ring.Member r)
          Returns the multiplication of this matrix by a scalar.
 void setAllElements(Ring.Member m)
          DOCUMENT ME!
 void setElement(int[] position, Ring.Member m)
          Sets the element at position given by the array of int.
 AbelianGroup.Member subtract(AbelianGroup.Member m)
          Returns the subtraction of this matrix and another.
 RingHypermatrix subtract(RingHypermatrix m)
          Returns the subtraction of this matrix and another.
 Ring.Member[] toFlatArray()
          Returns a flat array (that is a one dimension array) of all elements given "row first", given "row first".
 java.lang.String toString()
          Returns a string representing this matrix.
 
Methods inherited from class org.jscience.mathematics.algebraic.AbstractHypermatrix
getDimensions, numDimensions, numElements, numElements, toArray, toArray
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RingHypermatrix

public RingHypermatrix(int[] dimensions)
Constructs a RingHypermatrix.

Parameters:
dimensions - DOCUMENT ME!

RingHypermatrix

public RingHypermatrix(RingHypermatrix matrix)

RingHypermatrix

public RingHypermatrix(java.lang.Object array)
Constructs an hypermatrix.


RingHypermatrix

public RingHypermatrix(int[] dimensions,
                       java.lang.Object[] elements)
Constructs an hypermatrix.

Method Detail

setAllElements

public void setAllElements(Ring.Member m)
DOCUMENT ME!

Parameters:
m - DOCUMENT ME!

getElement

public java.lang.Number getElement(int[] position)
                            throws IllegalDimensionException
Returns the element at position given by the array of int. Each element of the array must be between 0 and getDimension(i)-1.

Specified by:
getElement in interface Hypermatrix
Specified by:
getElement in class AbstractHypermatrix
Parameters:
position - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
IllegalDimensionException - DOCUMENT ME!
java.lang.IllegalArgumentException - DOCUMENT ME!

setElement

public void setElement(int[] position,
                       Ring.Member m)
                throws IllegalDimensionException
Sets the element at position given by the array of int. Each element of the array must be between 0 and getDimension(i)-1.

Parameters:
position - DOCUMENT ME!
m - DOCUMENT ME!
Throws:
IllegalDimensionException - DOCUMENT ME!
java.lang.IllegalArgumentException - DOCUMENT ME!

equals

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

Overrides:
equals in class java.lang.Object
Parameters:
m - an hypermatrix
Returns:
DOCUMENT ME!

toString

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

Overrides:
toString in class java.lang.Object
Returns:
DOCUMENT ME!

getElements

public java.lang.Object getElements()
Returns a projection of this hypermatrix.

Returns:
DOCUMENT ME!

toFlatArray

public Ring.Member[] toFlatArray()
Returns a flat array (that is a one dimension array) of all elements given "row first", given "row first". Useful to iterate over all the matrix elements.

Returns:
DOCUMENT ME!

negate

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

Specified by:
negate in interface AbelianGroup.Member
Returns:
DOCUMENT ME!

add

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

Specified by:
add in interface AbelianGroup.Member
Parameters:
m - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
java.lang.IllegalArgumentException - DOCUMENT ME!

add

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

Parameters:
m - a matrix
Returns:
DOCUMENT ME!
Throws:
IllegalDimensionException - If the matrices are different sizes.

subtract

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

Specified by:
subtract in interface AbelianGroup.Member
Parameters:
m - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
java.lang.IllegalArgumentException - DOCUMENT ME!

subtract

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

Parameters:
m - a matrix
Returns:
DOCUMENT ME!
Throws:
IllegalDimensionException - If the matrices are different sizes.

scalarMultiply

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

Specified by:
scalarMultiply in interface Module.Member
Parameters:
r - a ring element.
Returns:
DOCUMENT ME!

scalarDivide

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

Specified by:
scalarDivide in interface VectorSpace.Member
Parameters:
x - a field element.
Returns:
DOCUMENT ME!

multiply

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

Specified by:
multiply in interface Ring.Member
Parameters:
m - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
java.lang.UnsupportedOperationException - DOCUMENT ME!

mapElements

public RingHypermatrix mapElements(NumberMapping f)
Applies a function on all the Hypermatrix components.

Parameters:
f - a user-defined function.
Returns:
a RingHypermatrix.
Throws:
java.lang.IllegalArgumentException - DOCUMENT ME!

clone

public java.lang.Object clone()
Clone matrix into a new matrix.

Overrides:
clone in class java.lang.Object
Returns:
the cloned matrix.