Package org.nuiton.math.matrix
Class DoubleSparseHashVector
- java.lang.Object
-
- org.nuiton.math.matrix.DoubleSparseHashVector
-
- All Implemented Interfaces:
SparseVector
,Vector
public class DoubleSparseHashVector extends Object implements SparseVector
Permet de stocker des données differente de la valeur par defaut (0.0) dans une Map<int, double>. L'implantation pcj ne supporte pas la modification de la valeur par defaut. On permet que la matrice est plus deInteger.MAX_VALUE
cellules mais on ne permet pas que la matrice est plus queInteger.MAX_VALUE
valeur différente que le default value. Created: 05 septembre 2012- Version:
- $Revision$ Last update: $Date$ by : $Author$
- Author:
- Benjamin POUSSIN <poussin@codelutin.com>
-
-
Field Summary
Fields Modifier and Type Field Description protected long
capacity
protected OpenLongDoubleHashMap
data
protected double
defaultValue
-
Constructor Summary
Constructors Constructor Description DoubleSparseHashVector()
DoubleSparseHashVector(long capacity)
DoubleSparseHashVector(long capacity, double defaultValue)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected void
checkPos(long pos)
boolean
equals(Object o)
void
forEachNotZero(VectorForEachFunction f)
long[]
getAssignedPosition()
Return an orderer array of position assigned, this array can be longer than realy assigned value, you must used getNumberOfAssignedValue to know number of significant position in arraydouble[]
getAssignedValue()
Return an array in same order that getAssignedPosition.double
getDefaultValue()
Value to used if not un assigned valueString
getInfo()
return information on this vector.double
getMaxOccurence()
Deprecated.double
getMaxOccurrence()
Retourne la valeur la plus utilise dans le vectorlong
getNumberOfAssignedValue()
Returne number of assigned value, assigned value is value stored in memorydouble
getValue(long pos)
int
hashCode()
void
init(long capacity)
Init vector, before this method call, vector is in indetermined state.boolean
isImplementedMap()
Permet de savoir si map est implanté par ce vector.boolean
isImplementedPaste(Vector v)
Permet de savoir si paste est implanté par ce vector.VectorIterator
iterator()
Retourne un objet Inc pret a etre utilisé pour boucler sur tous les element de la matrice.VectorIterator
iteratorNotZero()
Retourne un objet Inc pret a etre utilisé pour boucler sur tous les element different de 0 de la matrice.void
map(MapFunction f)
applique a chaque valeur du vector laMapFunction
.void
paste(Vector v)
Copie les valeurs du vector passé en argument dans ce vector.void
setValue(long pos, double value)
long
size()
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.nuiton.math.matrix.Vector
add, forEach, isImplementedAdd, isImplementedMinus, minus
-
-
-
-
Field Detail
-
defaultValue
protected double defaultValue
-
data
protected OpenLongDoubleHashMap data
-
capacity
protected long capacity
-
-
Method Detail
-
init
public void init(long capacity)
Description copied from interface:Vector
Init vector, before this method call, vector is in indetermined state. multiple call to init method must be permit. Only first call must do some work, extra call must do nothing
-
getInfo
public String getInfo()
Description copied from interface:Vector
return information on this vector. This information depends on implementation example: - size - max occurence number - ...
-
getNumberOfAssignedValue
public long getNumberOfAssignedValue()
Description copied from interface:Vector
Returne number of assigned value, assigned value is value stored in memory- Specified by:
getNumberOfAssignedValue
in interfaceVector
-
getMaxOccurence
@Deprecated public double getMaxOccurence()
Deprecated.- Specified by:
getMaxOccurence
in interfaceVector
-
getMaxOccurrence
public double getMaxOccurrence()
Description copied from interface:Vector
Retourne la valeur la plus utilise dans le vector- Specified by:
getMaxOccurrence
in interfaceVector
- Returns:
-
checkPos
protected void checkPos(long pos)
-
isImplementedPaste
public boolean isImplementedPaste(Vector v)
Description copied from interface:Vector
Permet de savoir si paste est implanté par ce vector.- Specified by:
isImplementedPaste
in interfaceVector
- Parameters:
v
- vector to test- Returns:
true
if operation is supported
-
isImplementedMap
public boolean isImplementedMap()
Description copied from interface:Vector
Permet de savoir si map est implanté par ce vector.- Specified by:
isImplementedMap
in interfaceVector
- Returns:
true
if operation is supported
-
paste
public void paste(Vector v)
Description copied from interface:Vector
Copie les valeurs du vector passé en argument dans ce vector.
-
map
public void map(MapFunction f)
Description copied from interface:Vector
applique a chaque valeur du vector laMapFunction
. ATTENTION cette function ne doit pas converser d'etat interne qui modifierait son comportement a chaque execution, sinon cette methode ne fonctionne pas, car pour les Vector implanter a base de Map la fonction n'est appliqué qu'au defaultValue et au valeur deja existante
-
getAssignedPosition
public long[] getAssignedPosition()
Description copied from interface:SparseVector
Return an orderer array of position assigned, this array can be longer than realy assigned value, you must used getNumberOfAssignedValue to know number of significant position in array- Specified by:
getAssignedPosition
in interfaceSparseVector
- Returns:
-
getAssignedValue
public double[] getAssignedValue()
Description copied from interface:SparseVector
Return an array in same order that getAssignedPosition. This array contains values. This array can be longer than realy assigned value, you must used getNumberOfAssignedValue to know number of significant position in array- Specified by:
getAssignedValue
in interfaceSparseVector
- Returns:
-
getDefaultValue
public double getDefaultValue()
Description copied from interface:SparseVector
Value to used if not un assigned value- Specified by:
getDefaultValue
in interfaceSparseVector
- Returns:
-
iterator
public VectorIterator iterator()
Description copied from interface:Vector
Retourne un objet Inc pret a etre utilisé pour boucler sur tous les element de la matrice.
-
iteratorNotZero
public VectorIterator iteratorNotZero()
Description copied from interface:Vector
Retourne un objet Inc pret a etre utilisé pour boucler sur tous les element different de 0 de la matrice.- Specified by:
iteratorNotZero
in interfaceVector
- Returns:
- un objet Inc pret à être utilisé
-
forEachNotZero
public void forEachNotZero(VectorForEachFunction f)
- Specified by:
forEachNotZero
in interfaceVector
-
-