JScience v4.3

org.jscience.mathematics.vector
Class ComplexVector

java.lang.Object
  extended by org.jscience.mathematics.vector.Vector<Complex>
      extended by org.jscience.mathematics.vector.ComplexVector
All Implemented Interfaces:
javolution.lang.Immutable, javolution.lang.Realtime, javolution.lang.ValueType, GroupAdditive<Vector<Complex>>, Structure<Vector<Complex>>, VectorSpace<Vector<Complex>,Complex>, VectorSpaceNormed<Vector<Complex>,Complex>

public final class ComplexVector
extends Vector<Complex>
implements VectorSpaceNormed<Vector<Complex>,Complex>

This class represents an optimized vector implementation for complex numbers elements.

Version:
3.3, January 2, 2007
Author:
Jean-Marie Dautelle

Field Summary
protected static javolution.xml.XMLFormat<ComplexVector> XML
          Holds the default XML representation.
 
Method Summary
 ComplexVector copy()
          Returns a copy of this vector allocated by the calling thread (possibly on the stack).
 Complex get(int i)
          Returns a single element from this vector.
 int getDimension()
          Returns the number of elements held by this vector.
 double getImaginary(int i)
          Returns the imaginary value of a complex number from this vector (fast).
 double getReal(int i)
          Returns the real value of a complex number from this vector (fast).
 ComplexVector minus(Vector<Complex> that)
          Returns the difference between this vector and the one specified.
 Complex norm()
          Returns the Euclidian norm of this vector (square root of the dot product of this vector and itself).
 ComplexVector opposite()
          Returns the negation of this vector.
 ComplexVector plus(Vector<Complex> that)
          Returns the sum of this vector with the one specified.
 ComplexVector times(Complex k)
          Returns the product of this vector with the specified coefficient.
 Complex times(Vector<Complex> that)
          Returns the dot product of this vector with the one specified.
static ComplexVector valueOf(Complex... elements)
          Returns a new vector holding the specified complex numbers.
static ComplexVector valueOf(java.util.List<Complex> elements)
          Returns a new vector holding the elements from the specified collection.
static ComplexVector valueOf(Vector<Complex> that)
          Returns a ComplexVector instance equivalent to the specified vector.
 
Methods inherited from class org.jscience.mathematics.vector.Vector
cross, equals, equals, hashCode, toString, toText
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

XML

protected static final javolution.xml.XMLFormat<ComplexVector> XML
Holds the default XML representation. For example:
    <ComplexVector dimension="2">
        <Complex real="1.0" imaginary="-3.0" />
        <Complex real="0.0" imaginary="2.0" />
    </ComplexVector>

Method Detail

valueOf

public static ComplexVector valueOf(Complex... elements)
Returns a new vector holding the specified complex numbers.

Parameters:
elements - the complex numbers elements.
Returns:
the vector having the specified complex numbers.

valueOf

public static ComplexVector valueOf(java.util.List<Complex> elements)
Returns a new vector holding the elements from the specified collection.

Parameters:
elements - the collection of floating-points numbers.
Returns:
the vector having the specified elements.

valueOf

public static ComplexVector valueOf(Vector<Complex> that)
Returns a ComplexVector instance equivalent to the specified vector.

Parameters:
that - the vector to convert.
Returns:
that or new equivalent ComplexVector.

getReal

public double getReal(int i)
Returns the real value of a complex number from this vector (fast).

Parameters:
i - the complex number index.
Returns:
the real value of complex at i.
Throws:
java.lang.IndexOutOfBoundsException - (i < 0) || (i >= dimension())

getImaginary

public double getImaginary(int i)
Returns the imaginary value of a complex number from this vector (fast).

Parameters:
i - the complex number index.
Returns:
the real value of complex at i.
Throws:
java.lang.IndexOutOfBoundsException - (i < 0) || (i >= dimension())

norm

public Complex norm()
Returns the Euclidian norm of this vector (square root of the dot product of this vector and itself).

Specified by:
norm in interface VectorSpaceNormed<Vector<Complex>,Complex>
Returns:
sqrt(this · this).
See Also:
Wikipedia: Vector Norm

getDimension

public int getDimension()
Description copied from class: Vector
Returns the number of elements held by this vector.

Specified by:
getDimension in class Vector<Complex>
Returns:
this vector dimension.

get

public Complex get(int i)
Description copied from class: Vector
Returns a single element from this vector.

Specified by:
get in class Vector<Complex>
Parameters:
i - the element index (range [0..n[).
Returns:
the element at i.

opposite

public ComplexVector opposite()
Description copied from class: Vector
Returns the negation of this vector.

Specified by:
opposite in interface GroupAdditive<Vector<Complex>>
Specified by:
opposite in class Vector<Complex>
Returns:
-this.

plus

public ComplexVector plus(Vector<Complex> that)
Description copied from class: Vector
Returns the sum of this vector with the one specified.

Specified by:
plus in interface GroupAdditive<Vector<Complex>>
Specified by:
plus in class Vector<Complex>
Parameters:
that - the vector to be added.
Returns:
this + that.

minus

public ComplexVector minus(Vector<Complex> that)
Description copied from class: Vector
Returns the difference between this vector and the one specified.

Overrides:
minus in class Vector<Complex>
Parameters:
that - the vector to be subtracted.
Returns:
this - that.

times

public ComplexVector times(Complex k)
Description copied from class: Vector
Returns the product of this vector with the specified coefficient.

Specified by:
times in interface VectorSpace<Vector<Complex>,Complex>
Specified by:
times in class Vector<Complex>
Parameters:
k - the coefficient multiplier.
Returns:
this · k

times

public Complex times(Vector<Complex> that)
Description copied from class: Vector
Returns the dot product of this vector with the one specified.

Specified by:
times in class Vector<Complex>
Parameters:
that - the vector multiplier.
Returns:
this · that
See Also:
Wikipedia: Dot Product

copy

public ComplexVector copy()
Description copied from class: Vector
Returns a copy of this vector allocated by the calling thread (possibly on the stack).

Specified by:
copy in interface javolution.lang.ValueType
Specified by:
copy in class Vector<Complex>
Returns:
an identical and independant copy of this matrix.

JScience v4.3

Copyright © 2006 JScience.