JScience v4.3

org.jscience.mathematics.vector
Class DenseVector<F extends Field<F>>

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

public final class DenseVector<F extends Field<F>>
extends Vector<F>

This class represents a dense vector.

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

Field Summary
protected static javolution.xml.XMLFormat<DenseVector> XML
          Holds the default XML representation for dense vectors.
 
Method Summary
 DenseVector<F> copy()
          Returns a copy of this vector allocated by the calling thread (possibly on the stack).
 F get(int i)
          Returns a single element from this vector.
 int getDimension()
          Returns the number of elements held by this vector.
 DenseVector<F> minus(Vector<F> that)
          Returns the difference between this vector and the one specified.
 DenseVector<F> opposite()
          Returns the negation of this vector.
 DenseVector<F> plus(Vector<F> that)
          Returns the sum of this vector with the one specified.
 DenseVector<F> times(F k)
          Returns the product of this vector with the specified coefficient.
 F times(Vector<F> that)
          Returns the dot product of this vector with the one specified.
static
<F extends Field<F>>
DenseVector<F>
valueOf(F... elements)
          Returns a dense vector holding the specified elements.
static
<F extends Field<F>>
DenseVector<F>
valueOf(java.util.List<F> elements)
          Returns a dense vector holding the elements from the specified collection.
static
<F extends Field<F>>
DenseVector<F>
valueOf(Vector<F> that)
          Returns a dense vector 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<DenseVector> XML
Holds the default XML representation for dense vectors. For example:
    <DenseVector dimension="2">
        <Rational value="1/3" />
        <Rational value="3/5" />
    </DenseVector>

Method Detail

valueOf

public static <F extends Field<F>> DenseVector<F> valueOf(F... elements)
Returns a dense vector holding the specified elements.

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

valueOf

public static <F extends Field<F>> DenseVector<F> valueOf(java.util.List<F> elements)
Returns a dense vector holding the elements from the specified collection.

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

valueOf

public static <F extends Field<F>> DenseVector<F> valueOf(Vector<F> that)
Returns a dense vector equivalent to the specified vector.

Parameters:
that - the vector to convert.
Returns:
that or a dense vector holding the same elements as the specified vector.

getDimension

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

Specified by:
getDimension in class Vector<F extends Field<F>>
Returns:
this vector dimension.

get

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

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

opposite

public DenseVector<F> opposite()
Description copied from class: Vector
Returns the negation of this vector.

Specified by:
opposite in interface GroupAdditive<Vector<F extends Field<F>>>
Specified by:
opposite in class Vector<F extends Field<F>>
Returns:
-this.

plus

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

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

minus

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

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

times

public DenseVector<F> times(F k)
Description copied from class: Vector
Returns the product of this vector with the specified coefficient.

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

times

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

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

copy

public DenseVector<F> 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<F extends Field<F>>
Returns:
an identical and independant copy of this matrix.

JScience v4.3

Copyright © 2006 JScience.