drasys.or.matrix
Interface VectorI

All Known Subinterfaces:
ContiguousVectorI, SizableVectorI
All Known Implementing Classes:
Vect

public interface VectorI
extends RealContainerI

Abstract interface to a generic vector.


Method Summary
 double elementAt(int index)
          Gets the value of an element by its index.
 java.util.Enumeration elements()
          Returns an enumeration of the non-null elements in the vector.
 boolean equals(VectorI vector)
          Returns true if the vectors are numerically equal.
 double[] getArray()
          Returns a new array containing the values in vector.
 boolean isNull(int index)
          Returns true if an element has no value associated with it.
 void setElementAt(int index, double value)
          Sets the value of an element by its index.
 void setElements(double value)
          Sets the value of all the non-null elements.
 void setElements(VectorI values)
          Sets the value of the elements from the non-null values in 'values'.
 int size()
          Returns the number of elements in the vector.
 int sizeOfElements()
          Returns the number of non-null elements in the vector.
 double sum()
          Returns the sum of the elements in the vector.
 double sum(int begin)
          Returns the sum of the elements in the subvector.
 double sum(int begin, int end)
          Returns the sum of the elements in the subvector.
 double sumOfSquaredDifferences(double scaler)
          Returns the sum the squared differences between 'scaler' and the elements in the vector.
 double sumOfSquaredDifferences(int begin, double scaler)
          Returns the sum the squared differences between 'scaler' and the elements in the subvector.
 double sumOfSquaredDifferences(int begin, int end, double scaler)
          Returns the sum the squared differences between 'scaler' and the selected elements in the subvector.
 double sumOfSquares()
          Returns the sum of the squares of the elements in the vector.
 double sumOfSquares(int begin)
          Returns the sum of the squares of the elements in the subvector.
 double sumOfSquares(int begin, int end)
          Returns the sum of the squares of the selected elements in the subvector.
 
Methods inherited from interface drasys.or.matrix.RealContainerI
equals, getEpsilon, setEpsilon
 

Method Detail

isNull

public boolean isNull(int index)
Returns true if an element has no value associated with it. Elements which have no value assigned return 0.0 when accessed.

size

public int size()
Returns the number of elements in the vector.

sizeOfElements

public int sizeOfElements()
Returns the number of non-null elements in the vector.

getArray

public double[] getArray()
Returns a new array containing the values in vector.

setElementAt

public void setElementAt(int index,
                         double value)
Sets the value of an element by its index.

setElements

public void setElements(double value)
Sets the value of all the non-null elements.

setElements

public void setElements(VectorI values)
Sets the value of the elements from the non-null values in 'values'. Elements corresponding to null elements in 'values' are not changed.

elementAt

public double elementAt(int index)
Gets the value of an element by its index.
Returns:
zero if the element is null.

elements

public java.util.Enumeration elements()
Returns an enumeration of the non-null elements in the vector. The Enumeration is free to reuse the same object for each call to 'nextElement', so the contents must be use before getting another element.
Returns:
an enumeration whose elements are mutable and of type 'MatrixElementI'

sum

public double sum()
Returns the sum of the elements in the vector.

sum

public double sum(int begin)
Returns the sum of the elements in the subvector.

sum

public double sum(int begin,
                  int end)
Returns the sum of the elements in the subvector.

sumOfSquares

public double sumOfSquares()
Returns the sum of the squares of the elements in the vector.

sumOfSquares

public double sumOfSquares(int begin)
Returns the sum of the squares of the elements in the subvector.

sumOfSquares

public double sumOfSquares(int begin,
                           int end)
Returns the sum of the squares of the selected elements in the subvector.

sumOfSquaredDifferences

public double sumOfSquaredDifferences(double scaler)
Returns the sum the squared differences between 'scaler' and the elements in the vector.

sumOfSquaredDifferences

public double sumOfSquaredDifferences(int begin,
                                      double scaler)
Returns the sum the squared differences between 'scaler' and the elements in the subvector.

sumOfSquaredDifferences

public double sumOfSquaredDifferences(int begin,
                                      int end,
                                      double scaler)
Returns the sum the squared differences between 'scaler' and the selected elements in the subvector.

equals

public boolean equals(VectorI vector)
Returns true if the vectors are numerically equal. To be numerically equal the vectors must be the same size and all the elements must be equal to within this vector's 'epsilon'. All null elements have a value of zero for the compare.


Copyright(C)1997-2000 by DRA Systems all rights reserved. OpsResearch.com