| org.jscience.mathematics.vector.SparseVector
SparseVector | final public class SparseVector extends Vector (Code) | | This class represents a sparse vector.
Sparse vectors can be created using an index-to-element mapping or
by adding single elements sparse vectors together.
author: Jean-Marie Dautelle version: 3.3, January 2, 2007 |
Field Summary | |
final protected static XMLFormat<SparseVector> | XML Holds the default XML representation for sparse vectors. | int | _dimension Holds this vector dimension. | final FastMap<Index, F> | _elements Holds the index to element mapping. | F | _zero Holds zero. |
Method Summary | |
public SparseVector<F> | copy() | public F | get(int i) | public int | getDimension() | public F | getZero() Returns the value of the non-set elements for this sparse vector. | static SparseVector<F> | newInstance(int dimension, F zero) | public SparseVector<F> | opposite() | public SparseVector<F> | plus(Vector<F> that) | public SparseVector<F> | times(F k) | public F | times(Vector<F> that) | public static SparseVector<F> | valueOf(int dimension, F zero, int i, F element) Returns a sparse vector having a single element at the specified index.
Parameters: dimension - this vector dimension. Parameters: zero - the element representing zero. Parameters: i - the index value of this vector single element. Parameters: element - the element at the specified index. | public static SparseVector<F> | valueOf(int dimension, F zero, Map<Index, F> elements) Returns a sparse vector from the specified index to element mapping.
Parameters: dimension - this vector dimension. Parameters: zero - the element representing zero. Parameters: elements - the index to element mapping. | public static SparseVector<F> | valueOf(Vector<F> that, F zero) Returns a sparse vector equivalent to the specified vector but with
the zero elements removed removed using a default object equality
comparator.
Parameters: that - the vector to convert. Parameters: zero - the zero element for the sparse vector to return. | public static SparseVector<F> | valueOf(Vector<F> that, F zero, FastComparator<? super F> comparator) Returns a sparse vector equivalent to the specified vector but with
the zero elements removed using the specified object equality comparator.
This method can be used to clean up sparse vectors (to remove elements
close to zero).
Parameters: that - the vector to convert. Parameters: zero - the zero element for the sparse vector to return. Parameters: comparator - the comparator used to determinate zero equality. |
XML | final protected static XMLFormat<SparseVector> XML(Code) | | Holds the default XML representation for sparse vectors.
For example:[code]
[/code]
|
_dimension | int _dimension(Code) | | Holds this vector dimension.
|
_elements | final FastMap<Index, F> _elements(Code) | | Holds the index to element mapping.
|
_zero | F _zero(Code) | | Holds zero.
|
getDimension | public int getDimension()(Code) | | |
getZero | public F getZero()(Code) | | Returns the value of the non-set elements for this sparse vector.
the element corresponding to zero. |
valueOf | public static SparseVector<F> valueOf(int dimension, F zero, int i, F element)(Code) | | Returns a sparse vector having a single element at the specified index.
Parameters: dimension - this vector dimension. Parameters: zero - the element representing zero. Parameters: i - the index value of this vector single element. Parameters: element - the element at the specified index. the corresponding vector. |
valueOf | public static SparseVector<F> valueOf(int dimension, F zero, Map<Index, F> elements)(Code) | | Returns a sparse vector from the specified index to element mapping.
Parameters: dimension - this vector dimension. Parameters: zero - the element representing zero. Parameters: elements - the index to element mapping. the corresponding vector. |
valueOf | public static SparseVector<F> valueOf(Vector<F> that, F zero)(Code) | | Returns a sparse vector equivalent to the specified vector but with
the zero elements removed removed using a default object equality
comparator.
Parameters: that - the vector to convert. Parameters: zero - the zero element for the sparse vector to return. SparseVector.valueOf(that, zero, FastComparator.DEFAULT) |
valueOf | public static SparseVector<F> valueOf(Vector<F> that, F zero, FastComparator<? super F> comparator)(Code) | | Returns a sparse vector equivalent to the specified vector but with
the zero elements removed using the specified object equality comparator.
This method can be used to clean up sparse vectors (to remove elements
close to zero).
Parameters: that - the vector to convert. Parameters: zero - the zero element for the sparse vector to return. Parameters: comparator - the comparator used to determinate zero equality. a sparse vector with zero elements removed. |
|
|