public static class ObjectIntMultiVector.MultiWeightProvider extends java.lang.Object implements ObjectIntMultiVector.WeightProvider, java.io.Serializable
ObjectIntMultiVector.WeightProvider
that has a single weight for every data array
of the ObjectIntMultiVector
.Modifier and Type | Field and Description |
---|---|
protected float[] |
weights
Weights for data arrays - all the items in the respective data array has a single weight
|
Constructor and Description |
---|
ObjectIntMultiVector.MultiWeightProvider(float[] weights)
Creates a new instance of MultiWeightProvider with the the given array of weights.
|
Modifier and Type | Method and Description |
---|---|
float |
getWeight(int array)
Returns the weight for the given data array encapsulated in this
ObjectIntMultiVector.WeightProvider . |
float |
getWeight(ObjectIntMultiVector.SortedDataIterator iterator)
Returns the weight for the item that the
iterator points to. |
double |
getWeightNorm(ObjectIntMultiVector obj)
Returns the square root of the sum of all weight squares for the given object.
|
float[] |
getWeights()
Returns the weights for data arrays encapsulated in this
ObjectIntMultiVector.WeightProvider . |
float |
getWeightSum(ObjectIntMultiVector obj)
Returns the sum of all weights for the given object.
|
protected final float[] weights
public ObjectIntMultiVector.MultiWeightProvider(float[] weights)
weights
- the weights for the data arrayspublic float getWeight(ObjectIntMultiVector.SortedDataIterator iterator)
ObjectIntMultiVector.WeightProvider
iterator
points to.getWeight
in interface ObjectIntMultiVector.WeightProvider
iterator
- this iterator's current object weight is to be retrievedpublic float[] getWeights()
ObjectIntMultiVector.WeightProvider
.
Note that a copy is returned, so any modifications in the returned array are
not reflected by the provider.public float getWeight(int array)
ObjectIntMultiVector.WeightProvider
.array
- the index of the data array for which to get the weightpublic float getWeightSum(ObjectIntMultiVector obj)
ObjectIntMultiVector.WeightProvider
ObjectIntMultiVector.WeightProvider.getWeight(messif.objects.impl.ObjectIntMultiVector.SortedDataIterator)
,
i.e. the returned sum is the sum of the weight retrieved by iterating over
all items from the obj.getSortedIterator()
.getWeightSum
in interface ObjectIntMultiVector.WeightProvider
obj
- the object for which the weights are givenpublic double getWeightNorm(ObjectIntMultiVector obj)
ObjectIntMultiVector.WeightProvider
ObjectIntMultiVector.WeightProvider.getWeight(messif.objects.impl.ObjectIntMultiVector.SortedDataIterator)
,
i.e. the returned number is the square root of the sum of all weight squares retrieved by iterating over
all items from the obj.getSortedIterator()
.getWeightNorm
in interface ObjectIntMultiVector.WeightProvider
obj
- the object for which the weights are given