Package org.nuiton.math.matrix
Class DoubleSparseHashVector
java.lang.Object
org.nuiton.math.matrix.DoubleSparseHashVector
- All Implemented Interfaces:
SparseVector,Vector
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 de
Integer.MAX_VALUE cellules mais
on ne permet pas que la matrice est plus que Integer.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 -
Constructor Summary
ConstructorsConstructorDescriptionDoubleSparseHashVector(long capacity) DoubleSparseHashVector(long capacity, double defaultValue) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcheckPos(long pos) booleanvoidlong[]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[]Return an array in same order that getAssignedPosition.doubleValue to used if not un assigned valuegetInfo()return information on this vector.doubleDeprecated.doubleRetourne la valeur la plus utilise dans le vectorlongReturne number of assigned value, assigned value is value stored in memorydoublegetValue(long pos) inthashCode()voidinit(long capacity) Init vector, before this method call, vector is in indetermined state.booleanPermet de savoir si map est implanté par ce vector.booleanPermet de savoir si paste est implanté par ce vector.iterator()Retourne un objet Inc pret a etre utilisé pour boucler sur tous les element de la matrice.Retourne un objet Inc pret a etre utilisé pour boucler sur tous les element different de 0 de la matrice.voidmap(MapFunction f) applique a chaque valeur du vector laMapFunction.voidCopie les valeurs du vector passé en argument dans ce vector.voidsetValue(long pos, double value) longsize()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.nuiton.math.matrix.Vector
add, forEach, isImplementedAdd, isImplementedMinus, minus
-
Field Details
-
defaultValue
protected double defaultValue -
data
-
capacity
protected long capacity
-
-
Constructor Details
-
DoubleSparseHashVector
public DoubleSparseHashVector() -
DoubleSparseHashVector
public DoubleSparseHashVector(long capacity) -
DoubleSparseHashVector
public DoubleSparseHashVector(long capacity, double defaultValue)
-
-
Method Details
-
init
public void init(long capacity) Description copied from interface:VectorInit 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
Description copied from interface:Vectorreturn information on this vector. This information depends on implementation example: - size - max occurence number - ... -
getNumberOfAssignedValue
public long getNumberOfAssignedValue()Description copied from interface:VectorReturne number of assigned value, assigned value is value stored in memory- Specified by:
getNumberOfAssignedValuein interfaceVector
-
size
public long size() -
getMaxOccurence
Deprecated.- Specified by:
getMaxOccurencein interfaceVector
-
getMaxOccurrence
public double getMaxOccurrence()Description copied from interface:VectorRetourne la valeur la plus utilise dans le vector- Specified by:
getMaxOccurrencein interfaceVector- Returns:
-
checkPos
protected void checkPos(long pos) -
getValue
public double getValue(long pos) -
setValue
public void setValue(long pos, double value) -
equals
-
hashCode
public int hashCode() -
isImplementedPaste
Description copied from interface:VectorPermet de savoir si paste est implanté par ce vector.- Specified by:
isImplementedPastein interfaceVector- Parameters:
v- vector to test- Returns:
trueif operation is supported
-
isImplementedMap
public boolean isImplementedMap()Description copied from interface:VectorPermet de savoir si map est implanté par ce vector.- Specified by:
isImplementedMapin interfaceVector- Returns:
trueif operation is supported
-
paste
Description copied from interface:VectorCopie les valeurs du vector passé en argument dans ce vector. -
map
Description copied from interface:Vectorapplique 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:SparseVectorReturn 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:
getAssignedPositionin interfaceSparseVector- Returns:
-
getAssignedValue
public double[] getAssignedValue()Description copied from interface:SparseVectorReturn 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:
getAssignedValuein interfaceSparseVector- Returns:
-
getDefaultValue
public double getDefaultValue()Description copied from interface:SparseVectorValue to used if not un assigned value- Specified by:
getDefaultValuein interfaceSparseVector- Returns:
-
iterator
Description copied from interface:VectorRetourne un objet Inc pret a etre utilisé pour boucler sur tous les element de la matrice. -
iteratorNotZero
Description copied from interface:VectorRetourne un objet Inc pret a etre utilisé pour boucler sur tous les element different de 0 de la matrice.- Specified by:
iteratorNotZeroin interfaceVector- Returns:
- un objet Inc pret à être utilisé
-
forEachNotZero
- Specified by:
forEachNotZeroin interfaceVector
-