Package org.jscience.mathematics.vector
Class ComplexVector
- java.lang.Object
-
- org.jscience.mathematics.vector.Vector<Complex>
-
- 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>
-
-
Field Summary
Fields Modifier and Type Field Description protected static javolution.xml.XMLFormat<ComplexVector>
XML
Holds the default XML representation.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ComplexVector
copy()
Returns a copy of this vectorallocated
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(List<Complex> elements)
Returns a new vector holding the elements from the specified collection.static ComplexVector
valueOf(Complex... elements)
Returns a new vector holding the specified complex numbers.static ComplexVector
valueOf(Vector<Complex> that)
Returns aComplexVector
instance equivalent to the specified vector.
-
-
-
Field Detail
-
XML
protected static final javolution.xml.XMLFormat<ComplexVector> XML
Holds the default XML representation. For example: [code]
-
-
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(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 aComplexVector
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:
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:
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 interfaceVectorSpaceNormed<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 classVector<Complex>
- Returns:
- this vector dimension.
-
get
public Complex get(int i)
Description copied from class:Vector
Returns a single element from this vector.
-
opposite
public ComplexVector opposite()
Description copied from class:Vector
Returns the negation of this vector.
-
plus
public ComplexVector plus(Vector<Complex> that)
Description copied from class:Vector
Returns the sum of this vector with the one specified.
-
minus
public ComplexVector minus(Vector<Complex> that)
Description copied from class:Vector
Returns the difference between this vector and the one specified.
-
times
public ComplexVector times(Complex k)
Description copied from class:Vector
Returns the product of this vector with the specified coefficient.
-
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 classVector<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 vectorallocated
by the calling thread (possibly on the stack).
-
-