Class AlgebraicVector

java.lang.Object
  |
  +--AlgebraicVector

class AlgebraicVector
extends java.lang.Object

This class defines an Algebric Vector entity and what can be managing Trapezim


Field Summary
private  double[] algebricVector
           
 
Constructor Summary
AlgebraicVector(double[] data)
          Construct a new vector with the given double values
AlgebraicVector(int dimension)
          Construct a new vector with the specified dimension.
 
Method Summary
 AlgebraicVector add(AlgebraicVector other)
          Adds the current vector to the other vector and returns the result as a new AlgebraicVector object
 void addToThis(AlgebraicVector other)
          Adds the other vector to the current vector and stores the result in the current vector.
 double elementAt(int i)
          Returns the value of the i'th element in the vector.
 int getDimension()
          Returns the dimension of the vector (the number of elements in the vector).
 double mul(AlgebraicVector other)
          Construct a new ITrapezoid with the given vertices and widths
 AlgebraicVector mul(double scalar)
          Computes the Scalar multiplication (dot product) of the current vector and the other vector.
 void mulToThis(double scalar)
          Computes the multiplication of the current vector with the given scalar.
 void setElementAt(double value, int i)
          Sets the element in the i'th index to value.
 AlgebraicVector sub(AlgebraicVector other)
          Substracts the current vector to the other vector and returns the result as a new AlgebraicVector object.
 void subToThis(AlgebraicVector other)
          Substracts the current vector to the other vector and stores the result in the current vector.
 java.lang.String toString()
          Returns a string representation of the vector in the following format: “[2.0, 3.1, 5.4]” (there is a single space between each element and there are no other characthers but [,] (no ‘\n’ also!)
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

algebricVector

private double[] algebricVector
Constructor Detail

AlgebraicVector

public AlgebraicVector(int dimension)
Construct a new vector with the specified dimension. Initial values are set to zero
Parameters:
dimension - how many values in a vector

AlgebraicVector

public AlgebraicVector(double[] data)
Construct a new vector with the given double values
Parameters:
data - the raw vector stored in an array (double[])
Method Detail

getDimension

public int getDimension()
Returns the dimension of the vector (the number of elements in the vector).
Returns:
Dimention of vector

elementAt

public double elementAt(int i)
Returns the value of the i'th element in the vector. Assumes that the index i is legal.
Parameters:
i - location of value requested
Returns:
the value found at given location

setElementAt

public void setElementAt(double value,
                         int i)
Sets the element in the i'th index to value. Assumes i is legal.
Parameters:
value - the value you want to store
i - position in the vector to store given value

add

public AlgebraicVector add(AlgebraicVector other)
Adds the current vector to the other vector and returns the result as a new AlgebraicVector object
Parameters:
other - a vector to add
Returns:
the result vector

addToThis

public void addToThis(AlgebraicVector other)
Adds the other vector to the current vector and stores the result in the current vector.
Parameters:
other - a vector to add

sub

public AlgebraicVector sub(AlgebraicVector other)
Substracts the current vector to the other vector and returns the result as a new AlgebraicVector object.
Parameters:
other - a vector to substract.
Returns:
the result Vector

subToThis

public void subToThis(AlgebraicVector other)
Substracts the current vector to the other vector and stores the result in the current vector.
Parameters:
other - a vector to substract.

mul

public AlgebraicVector mul(double scalar)
Computes the Scalar multiplication (dot product) of the current vector and the other vector. Returns the result as a double.
Parameters:
scalar - a scalar value to multiply by
Returns:
a Vector which is the result of the multiplication

mul

public double mul(AlgebraicVector other)
Construct a new ITrapezoid with the given vertices and widths
Parameters:
other - a vector to multiply by
Returns:
a double value which is the result of the multiplication

mulToThis

public void mulToThis(double scalar)
Computes the multiplication of the current vector with the given scalar. Stores the result in the current vector.
Parameters:
scalar - a scalar value to multiply by

toString

public java.lang.String toString()
Returns a string representation of the vector in the following format: “[2.0, 3.1, 5.4]” (there is a single space between each element and there are no other characthers but [,] (no ‘\n’ also!)
Overrides:
toString in class java.lang.Object
Returns:
a string containing the AlgebraicVector values