## org.jscience.mathematics.algebraic Class AbstractHypermatrix

```java.lang.Object
org.jscience.mathematics.algebraic.AbstractHypermatrix
```
All Implemented Interfaces:
java.io.Serializable, Algebra.Member, Ring.Member, AbelianGroup.Member, Hypermatrix, Module.Member, VectorSpace.Member, Member
Direct Known Subclasses:
AbstractMatrix, RingHypermatrix

`public abstract class AbstractHypermatrixextends java.lang.Objectimplements Hypermatrix, Algebra.Member, java.io.Serializable`

The Hypermatrix superclass provides an abstract encapsulation for extended matrices. Hypermatrices are also known as MultiArrays. You should be aware when using this class that it is very computationally intensive. First it uses Java data structures that are not really optimized for this sort of task. Then there is additional error checking to ensure you use it the right way. Furthermore there is of course a real temptation to use many dimensions. Please recall that 10 elements in 10 dimensions is 10 power 10 total elements, therefore more than your system is probably able to handle.

Serialized Form

Constructor Summary
`AbstractHypermatrix(int[] dimensions)`
Constructs an hypermatrix.

Method Summary
` int[]` `getDimensions()`
Returns the array of dimensions.
`abstract  java.lang.Number` `getElement(int[] position)`
Returns the element at position given by the array of int.
` int` `numDimensions()`
Returns the number of dimensions.
` int` `numElements()`
Returns the total number of elements.
` int` `numElements(int i)`
Returns the number of elements for the given dimension.
` java.lang.Object` `toArray()`
Converts an hypermatrix to an array of n dimensions
` java.lang.Object` `toArray(Hypermatrix m)`
Converts an hypermatrix to an array of n dimensions

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.jscience.mathematics.algebraic.modules.VectorSpace.Member
`scalarDivide`

Methods inherited from interface org.jscience.mathematics.algebraic.modules.Module.Member
`scalarMultiply`

Methods inherited from interface org.jscience.mathematics.algebraic.groups.AbelianGroup.Member
`add, negate, subtract`

Methods inherited from interface org.jscience.mathematics.algebraic.fields.Ring.Member
`multiply`

Constructor Detail

### AbstractHypermatrix

`public AbstractHypermatrix(int[] dimensions)`
Constructs an hypermatrix. The length of dimensions should be less than 256 although this is dependent upon the JVM implementation.

Parameters:
`dimensions` - DOCUMENT ME!
Throws:
`IllegalDimensionException` - DOCUMENT ME!
Method Detail

### numDimensions

`public final int numDimensions()`
Returns the number of dimensions.

Specified by:
`numDimensions` in interface `Hypermatrix`
Returns:
DOCUMENT ME!

### getDimensions

`public final int[] getDimensions()`
Returns the array of dimensions.

Specified by:
`getDimensions` in interface `Hypermatrix`
Returns:
DOCUMENT ME!

### numElements

`public final int numElements(int i)`
Returns the number of elements for the given dimension.

Specified by:
`numElements` in interface `Hypermatrix`
Parameters:
`i` - DOCUMENT ME!
Returns:
DOCUMENT ME!

### numElements

`public final int numElements()`
Returns the total number of elements.

Specified by:
`numElements` in interface `Hypermatrix`
Returns:
DOCUMENT ME!

### getElement

```public abstract java.lang.Number getElement(int[] position)
throws IllegalDimensionException```
Returns the element at position given by the array of int.

Specified by:
`getElement` in interface `Hypermatrix`
Parameters:
`position` - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
`IllegalDimensionException` - DOCUMENT ME!

### toArray

`public java.lang.Object toArray()`
Converts an hypermatrix to an array of n dimensions

Specified by:
`toArray` in interface `Hypermatrix`
Returns:
DOCUMENT ME!

### toArray

`public java.lang.Object toArray(Hypermatrix m)`
Converts an hypermatrix to an array of n dimensions

Specified by:
`toArray` in interface `Hypermatrix`
Parameters:
`m` - DOCUMENT ME!
Returns:
DOCUMENT ME!