javax.robotics.vecmath
Class RVector

java.lang.Object
  extended by javax.vecmath.GVector
      extended by javax.robotics.vecmath.RVector
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
DMatrix

public class RVector
extends javax.vecmath.GVector

A double precision, general, dynamically-resizable, one-dimensional vector class. Index numbering begins with zero. This class extend printing functionality of GVector class.

Since:
1.0.1
Version:
5/10/2005
Author:
Carmine Lia
See Also:
Serialized Form

Constructor Summary
RVector(double... vector)
          Constructs a new RVector from the specified array elements.
RVector(double[] vector, int length)
          Constructs a new RVector of the specified length and initializes it by copying the specified number of elements from the specified array.
RVector(javax.vecmath.GVector vector)
          Constructs a new RVector from the specified GVector.
RVector(int length)
          Constructs a new RVector of the specified length with all vector elements initialized to 0.
RVector(RVector vector)
          Constructs a new RVector from the specified RVector.
RVector(RVector3d vector)
          Constructs a new RVector from the specified RVector3d.
 
Method Summary
 void add(RVector... v)
          Adds multiple vectors and puts the result in this vector.
 void addScale(double[] s, RVector... v)
          Adds multiple scaled vectors and puts the result in this vector.
 void append(double[] v)
          Appends the input array to this vector.
 void append(RVector v)
          Appends the input vector to this vector.
 void append(RVector3d v)
          Appends the input vector to this vector.
 void get(double[] vector)
          Gets this vector as array
 void mul(DMatrix D, RVector v)
          Multiplies diagonal matrix D times RVector v and places the result into this vector (this = D*v).
 void printf()
          Prints to standard out
 void printf(java.io.PrintStream out)
          Prints to PrintStream
 void printf(java.io.PrintStream out, java.lang.String format)
          Prints to PrintStream according to the format string
 void printf(java.lang.String format)
          Prints to standard out according to the format string.
 void setValues(double... vector)
          Sets this vector from varargs input.
 void split(RVector v1, RVector v2)
          Splits this vector in two new vectors.
 void split(RVector v1, RVector v2, RVector v3)
          Splits this vector in three new vectors.
 java.lang.String toString()
          Returns a string that contains the values of this RVector.
 java.lang.String toString(java.lang.String format)
          Returns a string that contains the values of this RVector, according to the format string
 
Methods inherited from class javax.vecmath.GVector
add, add, angle, clone, dot, epsilonEquals, equals, equals, getElement, getSize, hashCode, interpolate, interpolate, interpolate, interpolate, LUDBackSolve, mul, mul, negate, norm, normalize, normalize, normSquared, scale, scale, scaleAdd, set, set, set, set, set, set, set, setElement, setSize, sub, sub, SVDBackSolve, zero
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RVector

public RVector(RVector vector)
Constructs a new RVector from the specified RVector. The vector elements are copied into this new RVector.

Parameters:
vector - The source RVector for this new RVector.

RVector

public RVector(RVector3d vector)
Constructs a new RVector from the specified RVector3d. The vector elements are copied into this new RVector.

Parameters:
vector - The source RVector3d for this new RVector.

RVector

public RVector(javax.vecmath.GVector vector)
Constructs a new RVector from the specified GVector. The vector elements are copied into this new RVector.

Parameters:
vector - The source GVector for this new RVector.

RVector

public RVector(double... vector)
Constructs a new RVector from the specified array elements. The length of this RVector is set to the length of the specified array. The array elements are copied into this new RVector.

Parameters:
vector - The values for the new RVector.

RVector

public RVector(double[] vector,
               int length)
Constructs a new RVector of the specified length and initializes it by copying the specified number of elements from the specified array. The array must contain at least length elements (i.e., vector.length >= length. The length of this new RVector is set to the specified length.

Parameters:
vector - The array from which the values will be copied.
length - The number of elements of array to be copied in the new RVector.

RVector

public RVector(int length)
Constructs a new RVector of the specified length with all vector elements initialized to 0.

Parameters:
length - The number of elements in this RVector.
Method Detail

printf

public void printf()
Prints to standard out


printf

public void printf(java.lang.String format)
Prints to standard out according to the format string.

The format specifiers for numeric types have the following syntax:

  %[width][.precision]conversion
 

Example:
v.printf("%5.3f");

Parameters:
format - The format string
See Also:
PrintStream.format(java.lang.String, java.lang.Object[])

printf

public void printf(java.io.PrintStream out)
Prints to PrintStream

Parameters:
out - The PrintStream object.

printf

public void printf(java.io.PrintStream out,
                   java.lang.String format)
Prints to PrintStream according to the format string

Parameters:
out - The PrintStream object.
format - The format string.
See Also:
printf(String)

toString

public java.lang.String toString()
Returns a string that contains the values of this RVector.

Overrides:
toString in class javax.vecmath.GVector
Returns:
The string.

toString

public java.lang.String toString(java.lang.String format)
Returns a string that contains the values of this RVector, according to the format string

Parameters:
format - The format string
Returns:
The string
See Also:
printf(String)

get

public void get(double[] vector)
Gets this vector as array

Parameters:
vector - the array

append

public void append(RVector v)
Appends the input vector to this vector.

Parameters:
v - the input vector.

append

public void append(double[] v)
Appends the input array to this vector.

Parameters:
v - the input vector.

append

public void append(RVector3d v)
Appends the input vector to this vector.

Parameters:
v - the input vector.

split

public void split(RVector v1,
                  RVector v2)
Splits this vector in two new vectors. The size of 1st vector is size1=round(this.size/2), the size of 2nd one is size2=this.size-size1.

Parameters:
v1 - the first vector to be copied.
v2 - the second vector to be copied.

split

public void split(RVector v1,
                  RVector v2,
                  RVector v3)
Splits this vector in three new vectors. The size of 1st end 2nd vectors is size=round(this.size/3), the size of 3rd one is size3=this.size-2*size.

Parameters:
v1 - the first vector to be copied.
v2 - the second vector to be copied.
v3 - the second vector to be copied.

add

public void add(RVector... v)
Adds multiple vectors and puts the result in this vector.

Parameters:
v - the input vectors separate by comma

addScale

public void addScale(double[] s,
                     RVector... v)
Adds multiple scaled vectors and puts the result in this vector.

Parameters:
s - the array of scale factors.
v - the input vectors separate by comma.

mul

public void mul(DMatrix D,
                RVector v)
Multiplies diagonal matrix D times RVector v and places the result into this vector (this = D*v).

Parameters:
D - The diagonal matrix in the multiplication
v - The vector that is multiplied

setValues

public void setValues(double... vector)
Sets this vector from varargs input.

Parameters:
vector - the elements of vector separated by comma.