All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class java.vecmath.GVector

java.lang.Object
   |
   +----java.vecmath.GVector

public class GVector
extends Object
A double precision, general, and dynamically resizeable one dimensional vector class. Index numbering begins with zero.


Constructor Index

 o GVector(double[])
Constructs a new generalized mathematic Vector with zero elements; length reprents the number of elements in the vector.
 o GVector(GVector)
Constructs a new GVector and copies the initial values from the parameter vector.
 o GVector(int)
Constructs a new generalized mathematic Vector with zero elements; length reprents the number of elements in the vector.
 o GVector(Tuple2f)
Constructs a new GVector and copies the initial values from the Tuple
 o GVector(Tuple3d)
Constructs a new GVector and copies the initial values from the Tuple
 o GVector(Tuple3f)
Constructs a new GVector and copies the initial values from the Tuple
 o GVector(Tuple4d)
Constructs a new GVector and copies the initial values from the Tuple
 o GVector(Tuple4f)
Constructs a new GVector and copies the initial values from the Tuple

Method Index

 o add(GVector)
Sets the value of this vector to sum of itself and the specified vector
 o add(GVector, GVector)
Sets the value of this vector to the vector sum of vectors vector1 and vector2.
 o angle(GVector)
Returns the (n-space) angle in radians between this vector and the vector parameter; the return value is constrained to the range [0,PI].
 o dot(GVector)
Returns the dot product of this vector and vector v1.
 o epsilonEquals(GVector, double)
Returns true if the L-infinite distance between this vector and vector v1 is less than or equal to the epsilon parameter, otherwise returns false.
 o equals(GVector)
Returns true if all of the data members of GVector vector1 are equal to the corresponding data members in this GVector.
 o getElement(int)
Retrieves the value at the specified index value of this vector.
 o getSize()
Returns the number of elements in this vector.
 o hashCode()
Returns a hash number based on the data values in this object.
 o interpolate(GVector, float)
Linearly interpolates between this vector and vector v1 and places the result into this tuple: this = alpha*this + (1-alpha)*v1.
 o interpolate(GVector, GVector, float)
Linearly interpolates between vectors v1 and v2 and places the result into this tuple: this = alpha*v1 + (1-alpha)*v2.
 o LUDBackSolve(GMatrix, GVector, GVector)
LU Decomposition Back Solve; this method takes the LU matrix and the permutation vector produced by the GMatrix method LUD and solves the equation this = (LU)*x by placing the solution to the set of linear equations into this vector.
 o mul(GMatrix, GVector)
Multiplies matrix m1 times Vector v1 and places the result into this vector (this = m1*v1).
 o mul(GVector, GMatrix)
Multiplies the transpose of vector v1 (ie, v1 becomes a row vector with respect to the multiplication) times matrix m1 and places the result into this vector (this = transpose(v1)*m1).
 o negate()
Negates the value of this vector: this = -this.
 o norm()
Returns the square root of the sum of the squares of this vector (its length in n-dimensional space).
 o normalize()
Normalizes this vector in place.
 o normalize(GVector)
Sets the value of this vector to the normalization of vector v1.
 o normSquared()
Returns the sum of the squares of this vector (its length sqaured in n-dimensional space).
 o scale(double)
Scales this vector by the scale factor s.
 o scale(double, GVector)
Sets the value of this vector to the scalar multiplication of the scale factor with the vector v1.
 o scaleAdd(double, GVector, GVector)
Sets the value of this vector to the scalar multiplication by s of vector v1 plus vector v2 (this = s*v1 + v2).
 o set(double[])
Sets the value of this vector to the values found in the array parameter.
 o set(GVector)
Sets the value of this vector to the values found in vector vector.
 o set(Tuple2f)
Sets the value of this vector to the values in tuple
 o set(Tuple3d)
Sets the value of this vector to the values in tuple
 o set(Tuple3f)
Sets the value of this vector to the values in tuple
 o set(Tuple4d)
Sets the value of this vector to the values in tuple
 o set(Tuple4f)
Sets the value of this vector to the values in tuple
 o setElement(int, double)
Modifies the value at the specified index of this vector.
 o setSize(int)
Changes the size of this vector dynamically.
 o sub(GVector)
Sets the value of this vector to the vector difference of itself and vector (this = this - vector).
 o sub(GVector, GVector)
Sets the value of this vector to the vector difference of vectors vector1 and vector2 (this = vector1 - vector2).
 o SVDBackSolve(GMatrix, GMatrix, GMatrix, GVector)
Solves for b in b = Ax, where b is this vector (mx1), A is mxn, and A = U*W*transpose(V); U,W,V must be precomputed and can be found by taking the singular value decomposition (SVD) of A using the method SVD found in the GMatrix class.
 o toString()
Returns a string that contains the values of this GVector.
 o zero()
Sets all the values in this vector to zero.

Constructors

 o GVector
 public GVector(int length)
Constructs a new generalized mathematic Vector with zero elements; length reprents the number of elements in the vector.

Parameters:
length - number of elements in this vector.
 o GVector
 public GVector(double vector[])
Constructs a new generalized mathematic Vector with zero elements; length reprents the number of elements in the vector.

Parameters:
length - number of elements in this vector.
vector - the values for the new vector.
 o GVector
 public GVector(GVector vector)
Constructs a new GVector and copies the initial values from the parameter vector.

Parameters:
vector - the source for the new GVector's initial values
 o GVector
 public GVector(Tuple2f tuple)
Constructs a new GVector and copies the initial values from the Tuple

Parameters:
vector - the source for the new GVector's initial values
 o GVector
 public GVector(Tuple3f tuple)
Constructs a new GVector and copies the initial values from the Tuple

Parameters:
vector - the source for the new GVector's initial values
 o GVector
 public GVector(Tuple3d tuple)
Constructs a new GVector and copies the initial values from the Tuple

Parameters:
vector - the source for the new GVector's initial values
 o GVector
 public GVector(Tuple4f tuple)
Constructs a new GVector and copies the initial values from the Tuple

Parameters:
vector - the source for the new GVector's initial values
 o GVector
 public GVector(Tuple4d tuple)
Constructs a new GVector and copies the initial values from the Tuple

Parameters:
vector - the source for the new GVector's initial values

Methods

 o norm
 public final double norm()
Returns the square root of the sum of the squares of this vector (its length in n-dimensional space).

Returns:
length of this vector
 o normSquared
 public final double normSquared()
Returns the sum of the squares of this vector (its length sqaured in n-dimensional space).

Returns:
length squared of this vector
 o normalize
 public final void normalize(GVector v1)
Sets the value of this vector to the normalization of vector v1.

Parameters:
v1 - the un-normalized vector
 o normalize
 public final void normalize()
Normalizes this vector in place.

 o scale
 public final void scale(double s,
                         GVector v1)
Sets the value of this vector to the scalar multiplication of the scale factor with the vector v1.

Parameters:
s - the scalar value
v1 - the source vector
 o scale
 public final void scale(double s)
Scales this vector by the scale factor s.

Parameters:
s - the scalar value
 o scaleAdd
 public final void scaleAdd(double s,
                            GVector v1,
                            GVector v2)
Sets the value of this vector to the scalar multiplication by s of vector v1 plus vector v2 (this = s*v1 + v2).

Parameters:
s - the scalar value
v1 - the vector to be multiplied
v2 - the vector to be added
 o add
 public final void add(GVector vector)
Sets the value of this vector to sum of itself and the specified vector

Parameters:
vector - the second vector
 o add
 public final void add(GVector vector1,
                       GVector vector2)
Sets the value of this vector to the vector sum of vectors vector1 and vector2.

Parameters:
vector1 - the first vector
vector2 - the second vector
 o sub
 public final void sub(GVector vector)
Sets the value of this vector to the vector difference of itself and vector (this = this - vector).

Parameters:
vector - the other vector
 o sub
 public final void sub(GVector vector1,
                       GVector vector2)
Sets the value of this vector to the vector difference of vectors vector1 and vector2 (this = vector1 - vector2).

Parameters:
vector1 - the first vector
vector2 - the second vector
 o mul
 public final void mul(GMatrix m1,
                       GVector v1)
Multiplies matrix m1 times Vector v1 and places the result into this vector (this = m1*v1).

Parameters:
m1 - The matrix in the multiplication
v1 - The vector that is multiplied
 o mul
 public final void mul(GVector v1,
                       GMatrix m1)
Multiplies the transpose of vector v1 (ie, v1 becomes a row vector with respect to the multiplication) times matrix m1 and places the result into this vector (this = transpose(v1)*m1). The result is technically a row vector, but the GVector class only knows about column vectors, and so the result is stored as a column vector.

Parameters:
m1 - The matrix in the multiplication
v1 - The vector that is temporarily transposed
 o negate
 public final void negate()
Negates the value of this vector: this = -this.

 o zero
 public final void zero()
Sets all the values in this vector to zero.

 o setSize
 public final void setSize(int length)
Changes the size of this vector dynamically. If the size is increased no data values will be lost. If the size is decreased, only those data values whose vector positions were eliminated will be lost.

Parameters:
length - number of desired elements in this vector
 o set
 public final void set(double vector[])
Sets the value of this vector to the values found in the array parameter. The array should be at least equal in length to the number of elements in the vector.

Parameters:
vector - the source array
 o set
 public final void set(GVector vector)
Sets the value of this vector to the values found in vector vector.

Parameters:
vector - the source vector
 o set
 public final void set(Tuple2f tuple)
Sets the value of this vector to the values in tuple

Parameters:
tuple - the source for the new GVector's new values
 o set
 public final void set(Tuple3f tuple)
Sets the value of this vector to the values in tuple

Parameters:
tuple - the source for the new GVector's new values
 o set
 public final void set(Tuple3d tuple)
Sets the value of this vector to the values in tuple

Parameters:
tuple - the source for the new GVector's new values
 o set
 public final void set(Tuple4f tuple)
Sets the value of this vector to the values in tuple

Parameters:
tuple - the source for the new GVector's new values
 o set
 public final void set(Tuple4d tuple)
Sets the value of this vector to the values in tuple

Parameters:
tuple - the source for the new GVector's new values
 o getSize
 public final int getSize()
Returns the number of elements in this vector.

Returns:
number of elements in this vector
 o getElement
 public final double getElement(int index)
Retrieves the value at the specified index value of this vector.

Parameters:
index - the index of the element to retrieve (zero indexed)
Returns:
the value at the indexed element
 o setElement
 public final void setElement(int index,
                              double value)
Modifies the value at the specified index of this vector.

Parameters:
index - the index if the element to modify (zero indexed)
value - the new vector element value
 o toString
 public String toString()
Returns a string that contains the values of this GVector.

Returns:
the String representation
Overrides:
toString in class Object
 o hashCode
 public int hashCode()
Returns a hash number based on the data values in this object. Two different GVector objects with identical data values (ie, returns true for equals(GVector) ) will return the same hash number. Two objects with different data members may return the same hash value, although this is not likely.

Returns:
the integer hash value
Overrides:
hashCode in class Object
 o equals
 public boolean equals(GVector vector1)
Returns true if all of the data members of GVector vector1 are equal to the corresponding data members in this GVector.

Parameters:
vector1 - The vector with which the comparison is made.
Returns:
true or false
 o epsilonEquals
 public boolean epsilonEquals(GVector v1,
                              double epsilon)
Returns true if the L-infinite distance between this vector and vector v1 is less than or equal to the epsilon parameter, otherwise returns false. The L-infinite distance is equal to MAX[abs(x1-x2), abs(y1-y2), . . . ].

Parameters:
v1 - The vector to be compared to this vector
epsilon - the threshold value
 o dot
 public final double dot(GVector v1)
Returns the dot product of this vector and vector v1.

Parameters:
v1 - the other vector
Returns:
the dot product of this and v1
 o SVDBackSolve
 public final void SVDBackSolve(GMatrix U,
                                GMatrix W,
                                GMatrix V,
                                GVector x)
Solves for b in b = Ax, where b is this vector (mx1), A is mxn, and A = U*W*transpose(V); U,W,V must be precomputed and can be found by taking the singular value decomposition (SVD) of A using the method SVD found in the GMatrix class.

Parameters:
U - The U matrix produced by the GMatrix method SVD
W - The W matrix produced by the GMatrix method SVD
V - The V matrix produced by the GMatrix method SVD
x - The x vector in the linear equation Ax = b
 o LUDBackSolve
 public final void LUDBackSolve(GMatrix LU,
                                GVector x,
                                GVector permutation)
LU Decomposition Back Solve; this method takes the LU matrix and the permutation vector produced by the GMatrix method LUD and solves the equation this = (LU)*x by placing the solution to the set of linear equations into this vector.

Parameters:
LU - The matrix into which the lower and upper decompostions have been placed
x - The x vector in the equation (LU)*x = b
permutation - The row permuations that were necessary to produce the LU matrix parameter
 o angle
 public final double angle(GVector v1)
Returns the (n-space) angle in radians between this vector and the vector parameter; the return value is constrained to the range [0,PI].

Parameters:
v1 - The other vector
Returns:
The angle in radians in the range [0,PI]
 o interpolate
 public final void interpolate(GVector v1,
                               GVector v2,
                               float alpha)
Linearly interpolates between vectors v1 and v2 and places the result into this tuple: this = alpha*v1 + (1-alpha)*v2.

Parameters:
v1 - the first vector
v2 - the second vector
alpha - the alpha interpolation parameter
 o interpolate
 public final void interpolate(GVector v1,
                               float alpha)
Linearly interpolates between this vector and vector v1 and places the result into this tuple: this = alpha*this + (1-alpha)*v1.

Parameters:
v1 - the first vector
alpha - the alpha interpolation parameter

All Packages  Class Hierarchy  This Package  Previous  Next  Index