edu.umd.hooka.alignment
Class IndexedFloatArray
java.lang.Object
edu.umd.hooka.alignment.IndexedFloatArray
- All Implemented Interfaces:
- Cloneable, Writable
public final class IndexedFloatArray
- extends Object
- implements Writable, Cloneable
NO_BINSEARCH_THRESHOLD
public static final float NO_BINSEARCH_THRESHOLD
- If the sparse array exceeds this threshold, make the array non-sparse.
- See Also:
- Constant Field Values
MIN_LENGTH_FOR_NONSPARSE_ARRAY
public static final int MIN_LENGTH_FOR_NONSPARSE_ARRAY
- Don't make arrays sparse unless they exceed this length.
- See Also:
- Constant Field Values
_data
public float[] _data
_indices
public int[] _indices
_useBinSearch
public boolean _useBinSearch
IndexedFloatArray
public IndexedFloatArray()
IndexedFloatArray
public IndexedFloatArray(int[] indices,
float[] values)
IndexedFloatArray
public IndexedFloatArray(int[] indices,
float[] values,
boolean isOptimize)
IndexedFloatArray
public IndexedFloatArray(float[] values,
int size)
IndexedFloatArray
public IndexedFloatArray(int[] indices)
IndexedFloatArray
public IndexedFloatArray(int n)
readFields
public void readFields(DataInput in)
throws IOException
- Specified by:
readFields in interface Writable
- Throws:
IOException
write
public void write(DataOutput out)
throws IOException
- Specified by:
write in interface Writable
- Throws:
IOException
clone
public Object clone()
- Overrides:
clone in class Object
maxKey
public int maxKey()
optimizeSpeed
public void optimizeSpeed()
- If sparse array meets the load criteria, optimize it so that it no longer uses
a bin search.
copyTo
public void copyTo(float[] dest,
int destPos)
copyFrom
public void copyFrom(IndexedFloatArray rhs)
addTo
public void addTo(float[] dest)
size
public int size()
getWord
public int getWord(int loc)
getProb
public float getProb(int loc)
get
public final float get(int n)
getLazy
public final float getLazy(int n)
getTranslations
public int[] getTranslations(float probThreshold)
getTranslationsWithProbs
public PriorityQueue<PairOfFloatInt> getTranslationsWithProbs(float probThreshold)
getTranslationsWithProbsAsList
public List<PairOfFloatInt> getTranslationsWithProbsAsList(float probThreshold)
set
public final void set(int index,
float value)
add
public final void add(int index,
float delta)
getAddr
public int getAddr(int index)
- Parameters:
index - the index of the searched term
- Returns:
- the location of the term in the array
clear
public void clear()
plusEqualsMismatchSize
public void plusEqualsMismatchSize(IndexedFloatArray rhs)
plusEquals
public void plusEquals(IndexedFloatArray rhs)
minusEquals
public void minusEquals(IndexedFloatArray rhs)
timesEquals
public void timesEquals(float rhs)
normalize
public void normalize()
normalize
public void normalize(float alpha)
normalize_variationalBayes
public void normalize_variationalBayes(float alpha)
innerProduct
public float innerProduct(IndexedFloatArray rhs)
toString
public String toString(boolean brackets)
toString
public String toString()
- Overrides:
toString in class Object