org.jscience.mathematics.algebraic
Class AbstractVector

java.lang.Object
  extended by org.jscience.mathematics.algebraic.AbstractHypermatrix
      extended by org.jscience.mathematics.algebraic.AbstractMatrix
          extended by org.jscience.mathematics.algebraic.AbstractVector
All Implemented Interfaces:
java.io.Serializable, Algebra.Member, Ring.Member, AbelianGroup.Member, Hypermatrix, Matrix, Module.Member, VectorSpace.Member, Vector, Member
Direct Known Subclasses:
AbstractBooleanVector, AbstractComplexVector, AbstractDoubleVector, AbstractIntegerVector, BraVector, KetVector, RingVector

public abstract class AbstractVector
extends AbstractMatrix
implements Vector, Module.Member, java.io.Serializable

The Vector superclass provides an abstract encapsulation for vectors. Vectors are basically a matrix with 1 column. Concrete implementations of this class should implement additional interfaces. See subclasses.

See Also:
Serialized Form

Constructor Summary
AbstractVector(int n)
          Constructs a mathematical vector.
 
Method Summary
 int getDimension()
          Returns the vector's dimension.
abstract  java.lang.Number getElement(int i)
          Returns the element at position i,j.
 java.lang.Number getElement(int i, int j)
          Returns the element at position i.
protected static java.lang.String getInvalidElementMsg(int i)
          Returns an "invalid element" error message.
 java.lang.Object toArray()
          public AbstractVector getColumn(int j) {

if (j==1) { return this; } else throw new IllegalDimensionException("Requested element out of bounds.");

}

 java.lang.Number[] toArray(Vector v)
          Converts a vector to an array.
 
Methods inherited from class org.jscience.mathematics.algebraic.AbstractMatrix
getElement, getInvalidElementMsg, numColumns, numRows, print, print, print, print, toArray
 
Methods inherited from class org.jscience.mathematics.algebraic.AbstractHypermatrix
getDimensions, numDimensions, numElements, numElements, toArray
 
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.Matrix
getColumn, getRow, numColumns, numRows, toArray, transpose
 
Methods inherited from interface org.jscience.mathematics.algebraic.Hypermatrix
getDimensions, getElement, numDimensions, numElements, numElements, toArray
 
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.modules.VectorSpace.Member
scalarDivide
 
Methods inherited from interface org.jscience.mathematics.algebraic.fields.Ring.Member
multiply
 

Constructor Detail

AbstractVector

public AbstractVector(int n)
Constructs a mathematical vector.

Parameters:
n - the dimension of the vector.
Method Detail

getDimension

public final int getDimension()
Returns the vector's dimension.

Specified by:
getDimension in interface Vector
Returns:
DOCUMENT ME!

getElement

public abstract java.lang.Number getElement(int i)
                                     throws IllegalDimensionException
Returns the element at position i,j.

Specified by:
getElement in interface Vector
Parameters:
i - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
IllegalDimensionException - DOCUMENT ME!

getElement

public final java.lang.Number getElement(int i,
                                         int j)
                                  throws IllegalDimensionException
Returns the element at position i.

Specified by:
getElement in interface Matrix
Parameters:
i - DOCUMENT ME!
j - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
IllegalDimensionException - DOCUMENT ME!

toArray

public java.lang.Object toArray()
public AbstractVector getColumn(int j) {

if (j==1) { return this; } else throw new IllegalDimensionException("Requested element out of bounds.");

}

Specified by:
toArray in interface Hypermatrix
Overrides:
toArray in class AbstractMatrix
Returns:
DOCUMENT ME!

toArray

public java.lang.Number[] toArray(Vector v)
Converts a vector to an array.

Specified by:
toArray in interface Vector
Parameters:
v - DOCUMENT ME!
Returns:
DOCUMENT ME!

getInvalidElementMsg

protected static java.lang.String getInvalidElementMsg(int i)
Returns an "invalid element" error message.

Parameters:
i - row index of the element