Class JsVect

java.lang.Object
  extended byJsVect

public class JsVect
extends java.lang.Object


Constructor Summary
JsVect(double[] values)
          Construtor for Js Vects
JsVect(int size)
          Construtor for Js Vects
 
Method Summary
 JsVect add(JsVect v2)
          Add two vectors of arbitrary dimension
 JsVect com(int a, int b, JsVect v2)
          Compute a vector linear combination of two double precision vectors of arbitrary dimension
 double dist(JsVect v2)
          Return the distance between two vectors of arbitrary dimension
 double dot(JsVect v2)
          Compute the dot product of two vectors of arbitrary dimension
 int getSize()
          Construtor for Js Vects
 double[] getVect()
          Construtor for Js Vects
 double getVect(int i)
          Construtor for Js Vects
 JsVect hat()
          Find the unit vector along an arbitrary vector
 JsVect negate()
          Find the unit vector along an arbitrary vector
 double norm()
          Compute the magnitude of a double precision vector of arbitrary dimension
 double rel(JsVect v2)
          Return the relative difference between two vectors of general dimension.
 JsVect scl(double scale)
          Multiply a scalar and a double precision vector of arbitrary dimension.
 double sep(JsVect v2)
          finds the separation angle in radians between two double precision vectors of arbitrary dimension.
 void setVect(int i, double value)
          Construtor for Js Vects
 JsVect sub(JsVect v2)
          Sub two vectors of arbitrary dimension
 boolean zero()
          Indicate whether a vector is the zero vector
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JsVect

public JsVect(int size)
Construtor for Js Vects

Parameters:
size - size of the vector

JsVect

public JsVect(double[] values)
Construtor for Js Vects

Method Detail

setVect

public void setVect(int i,
                    double value)
Construtor for Js Vects

Parameters:
value - the value to set

getVect

public double getVect(int i)
Construtor for Js Vects

Returns:
value the value of the N component

getSize

public int getSize()
Construtor for Js Vects

Returns:
value the value of the N component

getVect

public double[] getVect()
Construtor for Js Vects

Returns:
value the value of the vector

add

public JsVect add(JsVect v2)
           throws java.lang.Exception
Add two vectors of arbitrary dimension

Parameters:
v2 - the vector to be added
Returns:
This is vector sum of v1 and v2. vout may overwrite either
Throws:
java.lang.Exception

dist

public double dist(JsVect v2)
            throws java.lang.Exception
Return the distance between two vectors of arbitrary dimension

Parameters:
v2 - the vector to be added
Returns:
The function returns the distance between v1 and v2. This is defined as
|| v1 - v2 ||,
where || x || indicates the Euclidean norm of the vector x
Throws:
java.lang.Exception

dot

public double dot(JsVect v2)
           throws java.lang.Exception
Compute the dot product of two vectors of arbitrary dimension

Parameters:
v2 - the vector to be added
Returns:
The function returns the value of the dot product of v1 and v2
Throws:
java.lang.Exception

hat

public JsVect hat()
           throws java.lang.Exception
Find the unit vector along an arbitrary vector

Returns:
vout contains the unit vector in the direction of v1. If v1 represents the zero vector, then vout will also be the zero vector. vout may overwrite v1.
Throws:
java.lang.Exception

com

public JsVect com(int a,
                  int b,
                  JsVect v2)
           throws java.lang.Exception
Compute a vector linear combination of two double precision vectors of arbitrary dimension

Parameters:
v2 - the vector to be added
Throws:
java.lang.Exception

negate

public JsVect negate()
              throws java.lang.Exception
Find the unit vector along an arbitrary vector

Returns:
vout contains the unit vector in the direction of v1. If v1 represents the zero vector, then vout will also be the zero vector. vout may overwrite v1.
Throws:
java.lang.Exception

norm

public double norm()
            throws java.lang.Exception
Compute the magnitude of a double precision vector of arbitrary dimension

Returns:
is the magnitude of v1 calculated in a numerically stable way.
Throws:
java.lang.Exception

rel

public double rel(JsVect v2)
           throws java.lang.Exception
Return the relative difference between two vectors of general dimension.

Parameters:
v2 - the vector to be added
Returns:
the relative difference between V1 and V2.
It is defined as:
|| v1 - v2 ||
vrel_c = ----------------------
max ( ||v1||, ||v2|| )

where || x || indicates the Euclidean norm of the vector x ( ||x|| = sqrt( x . x ) ).

vrel_c assumes values in the range [0,2]. If both v1 and v2 are zero vectors then vrel_c is defined to be zero.
Throws:
java.lang.Exception

scl

public JsVect scl(double scale)
           throws java.lang.Exception
Multiply a scalar and a double precision vector of arbitrary dimension.

Returns:
is a double precision vector of arbitrary dimension containing the product of the scalar with the vector v1. vout may overwrite v1
Throws:
java.lang.Exception

sep

public double sep(JsVect v2)
           throws java.lang.Exception
finds the separation angle in radians between two double precision vectors of arbitrary dimension. This angle is defined as zero if either vector is zero

Parameters:
v2 - the vector to be added
Returns:
the angle between v1 and v2 expressed in radians. is strictly non-negative. For input vectors of four or more dimensions, the angle is defined as the generalization of the definition for three dimensions. If either v1 or v2 is the zero vector, then vsepg_c is defined to be 0 radians
Throws:
java.lang.Exception

sub

public JsVect sub(JsVect v2)
           throws java.lang.Exception
Sub two vectors of arbitrary dimension

Parameters:
v2 - the vector to be added
Returns:
This is vector sub of v1 and v2. vout may overwrite either
Throws:
java.lang.Exception

zero

public boolean zero()
             throws java.lang.Exception
Indicate whether a vector is the zero vector

Returns:
The function returns the value TRUE if and only if v is the zero vector
Throws:
java.lang.Exception