edu.buffalo.fs7.mathlib
Class Vect

java.lang.Object
  |
  +--edu.buffalo.fs7.mathlib.MathObject
        |
        +--edu.buffalo.fs7.mathlib.Argument
              |
              +--edu.buffalo.fs7.mathlib.Vect
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
Braket

public class Vect
extends Argument

Class representing a mathematical vector. The string representation of the default vector is given by [a b c]. The default vector therefore is a dual vector. A normal vector is created by parsing [a b c]' or calling the constructor followed by a transpose() operation.

See Also:
Braket

Field Summary
protected  Complex[] data
          holds the components.
 int dimension
          holds the dimension
protected  boolean transpose
          holds the information whether or not the vector is transposed.
 
Fields inherited from class edu.buffalo.fs7.mathlib.MathObject
mathlib
 
Constructor Summary
Vect()
          generates a vector of dimension 0.
Vect(int dimension)
          generates a 0-vector of dimension dimension
Vect(MathObject o)
          clone constructor.
 
Method Summary
 java.lang.Object clone()
          clones the vector.
 void conjugate()
          conjugates the vector
 boolean equals(MathObject o)
          equality predicate
 Complex getElement(int x)
          returns the component of the vector specified by x.
 void negative()
          negates the vector
static Vect parseVector(java.lang.String str)
          parses the vect object from a string.
 java.lang.String toParseableString()
          returns a parseable representation of the object
 java.lang.String toString()
          returns a string representation of the object (not necessarily parseable).
 void transpose()
          transposes the vector
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

data

protected Complex[] data
holds the components. Should not be accessed directly, but via the getElement() method.
See Also:
getElement(int)

transpose

protected boolean transpose
holds the information whether or not the vector is transposed.

dimension

public int dimension
holds the dimension
Constructor Detail

Vect

public Vect()
generates a vector of dimension 0.

Vect

public Vect(int dimension)
generates a 0-vector of dimension dimension
Parameters:
dimension - the dimension of the vector

Vect

public Vect(MathObject o)
clone constructor. If the object given as a parameter is another vect object, a new vector with the same properties is generated.
Method Detail

clone

public java.lang.Object clone()
clones the vector.
Overrides:
clone in class MathObject
See Also:
Vect(MathObject)

parseVector

public static Vect parseVector(java.lang.String str)
                        throws java.lang.NumberFormatException,
                               java.lang.IllegalArgumentException
parses the vect object from a string. Throws NumberFormatException or IllegalArgumentException if parsing failed.
Parameters:
str - string of the form [a b c]
Returns:
a Vect object corresponding to the vector described by the string

transpose

public void transpose()
transposes the vector

conjugate

public void conjugate()
conjugates the vector

negative

public void negative()
negates the vector

equals

public boolean equals(MathObject o)
equality predicate
Overrides:
equals in class Argument
Returns:
true if the MathObject o is equal to this vector

getElement

public Complex getElement(int x)
returns the component of the vector specified by x.
Parameters:
x - number of component starting with 0
Returns:
complex component

toString

public java.lang.String toString()
Description copied from class: MathObject
returns a string representation of the object (not necessarily parseable).
Overrides:
toString in class MathObject
Returns:
string representation of the vector object

toParseableString

public java.lang.String toParseableString()
Description copied from class: MathObject
returns a parseable representation of the object
Overrides:
toParseableString in class MathObject
Returns:
parsable string representation of ths vector object.