JADE v6.1

com.dautelle.math
Class Vector

java.lang.Object
  extended bycom.dautelle.realtime.RealtimeObject
      extended bycom.dautelle.math.Matrix
          extended bycom.dautelle.math.Vector
All Implemented Interfaces:
Operable, Realtime, Representable, java.io.Serializable

public class Vector
extends Matrix

This class represents an element of a vector space arranged as single column Matrix.

Version:
6.1, Jun 24, 2004
Author:
Jean-Marie Dautelle
See Also:
Vector -- from MathWorld, Serialized Form

Nested Class Summary
 
Nested classes inherited from class com.dautelle.realtime.RealtimeObject
RealtimeObject.Factory
 
Constructor Summary
protected Vector()
          Default constructor.
 
Method Summary
 Vector cross(Vector that)
          Returns the cross product of two 3-dimensional vectors.
 Operable dot(Vector that)
          Returns the dot product of this vector with the one specified.
 Operable get(int i)
          Returns a single coordinate from this vector.
 int getDimension()
          Returns the dimension of this vector.
static Vector newInstance(int n)
          Returns a n-dimensional vector filled with null coordinates elements.
 void set(int i, Operable coordinate)
          Sets a single coordinate of this vector.
 java.lang.String toString()
          Returns the text representation of this vector.
 void toXml(XmlElement xml)
          Sets the attributes and content of the XML element corresponding to this object.
static Vector valueOf(java.util.Collection coordinates)
          Returns a n-dimensional vector populated from the specified collection of Operable objects.
static Vector valueOf(Operable[] coordinates)
          Returns the vector corresponding to the specified Operable coordinates.
static Matrix valueOf(XmlElement xml)
          XML factory method.
 
Methods inherited from class com.dautelle.math.Matrix
add, adjoint, cofactor, determinant, divide, equals, export, get, getColumnDimension, getMatrix, getMatrix, getRowDimension, hashCode, inverse, isSquare, lu, multiply, multiply, negate, newInstance, opposite, plus, pow, pseudoInverse, reciprocal, set, subtract, tensor, times, toHeap, trace, transpose, valueOf, valueOf, valueOf
 
Methods inherited from class com.dautelle.realtime.RealtimeObject
clone, isLocalObject, isPoolObject, recycle
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Vector

protected Vector()
Default constructor.

Method Detail

newInstance

public static Vector newInstance(int n)
Returns a n-dimensional vector filled with null coordinates elements.

Parameters:
n - the dimension of this vector.
Returns:
a n-by-1 matrix non-initialized.

valueOf

public static Vector valueOf(Operable[] coordinates)
Returns the vector corresponding to the specified Operable coordinates.

Note: It is safe to reuse the specifed array as it is not internally referenced by the vector being returned.

Parameters:
coordinates - the array of Operable objects.
Returns:
the vector having the specified coordinates.

valueOf

public static Vector valueOf(java.util.Collection coordinates)
Returns a n-dimensional vector populated from the specified collection of Operable objects.

Parameters:
coordinates - the collection of Operable objects.
Returns:
the vector having the specified elements.
Throws:
java.lang.ClassCastException - if any of the element is not Operable.

valueOf

public static Matrix valueOf(XmlElement xml)
XML factory method.

Parameters:
xml - the XML element describing the vector to return. For example:
             <math:Vector >
                 <math:Complex real="1.0" imaginary="0.0"/>
                 <math:Complex real="0.0" imaginary="1.0"/>
             </math:Vector>
Returns:
a new vector as described by the specified XML element.

getDimension

public final int getDimension()
Returns the dimension of this vector.

Returns:
n, the number of rows.

get

public final Operable get(int i)
Returns a single coordinate from this vector.

Parameters:
i - the coordinate index (range [0..n[).
Returns:
the coordinates at i.
Throws:
java.lang.IndexOutOfBoundsException - i >= getDimension()

set

public final void set(int i,
                      Operable coordinate)
Sets a single coordinate of this vector.

Parameters:
i - the coordinate index (range [0..n[).
coordinate - the coordinate set at i.
Throws:
java.lang.IndexOutOfBoundsException - i >= getDimension()

dot

public final Operable dot(Vector that)
Returns the dot product of this vector with the one specified.

Parameters:
that - the vector multiplier.
Returns:
this ยท that
Throws:
DimensionException - if this.getDimension() != that.getDimension()
See Also:
Dot Product -- from MathWorld

cross

public final Vector cross(Vector that)
Returns the cross product of two 3-dimensional vectors.

Parameters:
that - the vector multiplier.
Returns:
this x that
Throws:
DimensionException - if (this.getDimension() != 3) && (that.getDimension() != 3)
See Also:
Cross Product -- from MathWorld

toString

public java.lang.String toString()
Returns the text representation of this vector.

Overrides:
toString in class Matrix
Returns:
the text representation of this vector.

toXml

public void toXml(XmlElement xml)
Description copied from interface: Representable
Sets the attributes and content of the XML element corresponding to this object.

Specified by:
toXml in interface Representable
Overrides:
toXml in class Matrix

JADE v6.1

Copyright © 2004 Jean-Marie Dautelle.