org.jutil.math.matrix
Class  NMatrix
java.lang.Object
  |
  +--org.jutil.math.matrix.NMatrix
- Direct Known Subclasses: 
- Matrix
- public abstract class NMatrix- extends java.lang.Object
This is a class of N-dimensional matrices
 The name Matrix has been reserved for 2D matrices since they are
 use more frequently than a general N-dimensional matrix.
 Since java has no generic classes, a matrix contains double values.
| Class Specifications | 
| public invariant getDimensions().length == getNbDimensions(); public invariant ( \forall int i; i >= 0&&i < getNbDimensions(); getDimensions()[i] > 0);
 | 
 
 
| Method Summary | 
| abstract  double | elementAt(int[] index)Return the element at the given index.
 | 
| abstract  int[] | getDimensions()Return the dimensions of this matrix
 | 
| abstract  int | getNbDimensions()Return the number of dimensions of this matrix.
 | 
| abstract  void | setElementAt(int[] index,
             double value)Set the element at the given index to the given value.
 | 
|  boolean | validIndex(int[] index)Check whether or not the given index is a valid index for this matrix.
 | 
 
| Methods inherited from class java.lang.Object | 
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
 
CVS_REVISION
public static final java.lang.String CVS_REVISION
NMatrix
public NMatrix()
getNbDimensions
public abstract int getNbDimensions()
- Return the number of dimensions of this matrix.
getDimensions
public abstract int[] getDimensions()
- Return the dimensions of this matrix
- 
- Specifications:
- 
ensures \result .length == getNbDimensions();
 
 
elementAt
public abstract double elementAt(int[] index)
- Return the element at the given index.
 
- 
- Parameters:
- index- The index of the requested element.
 
- 
- Specifications:
- 
requires validIndex(index);
 
 
setElementAt
public abstract void setElementAt(int[] index,
                                  double value)
- Set the element at the given index to the given value.
 
- 
- Parameters:
- index- The index of the element to be changed.
- value- The new value for the element at index .
 
- 
- Specifications:
- 
requires validIndex(index);
 ensures elementAt(index) == value;
 
 
validIndex
public boolean validIndex(int[] index)
- Check whether or not the given index is a valid index for this matrix.
 
- 
- Parameters:
- index- The index to be verified.
 
- 
- Specifications:
- 
ensures \result  == (index != null)&&(index.length == getNbDimensions())&&( \forall int i; i >= 0&&i < getNbDimensions(); (index[i] > 0)&&(index[i] <= getDimensions()[i]));