edu.umd.hooka.alignment
Class IndexedFloatArray

java.lang.Object
  extended by edu.umd.hooka.alignment.IndexedFloatArray
All Implemented Interfaces:
Cloneable, Writable

public final class IndexedFloatArray
extends Object
implements Writable, Cloneable


Field Summary
 float[] _data
           
 int[] _indices
           
 boolean _useBinSearch
           
static int MIN_LENGTH_FOR_NONSPARSE_ARRAY
          Don't make arrays sparse unless they exceed this length.
static float NO_BINSEARCH_THRESHOLD
          If the sparse array exceeds this threshold, make the array non-sparse.
 
Constructor Summary
IndexedFloatArray()
           
IndexedFloatArray(float[] values, int size)
           
IndexedFloatArray(int n)
           
IndexedFloatArray(int[] indices)
           
IndexedFloatArray(int[] indices, float[] values)
           
IndexedFloatArray(int[] indices, float[] values, boolean isOptimize)
           
 
Method Summary
 void add(int index, float delta)
           
 void addTo(float[] dest)
           
 void clear()
           
 Object clone()
           
 void copyFrom(IndexedFloatArray rhs)
           
 void copyTo(float[] dest, int destPos)
           
 float get(int n)
           
 int getAddr(int index)
           
 float getLazy(int n)
           
 float getProb(int loc)
           
 int[] getTranslations(float probThreshold)
           
 PriorityQueue<PairOfFloatInt> getTranslationsWithProbs(float probThreshold)
           
 List<PairOfFloatInt> getTranslationsWithProbsAsList(float probThreshold)
           
 int getWord(int loc)
           
 float innerProduct(IndexedFloatArray rhs)
           
 int maxKey()
           
 void minusEquals(IndexedFloatArray rhs)
           
 void normalize_variationalBayes(float alpha)
           
 void normalize()
           
 void normalize(float alpha)
           
 void optimizeSpeed()
          If sparse array meets the load criteria, optimize it so that it no longer uses a bin search.
 void plusEquals(IndexedFloatArray rhs)
           
 void plusEqualsMismatchSize(IndexedFloatArray rhs)
           
 void readFields(DataInput in)
           
 void set(int index, float value)
           
 int size()
           
 void timesEquals(float rhs)
           
 String toString()
           
 String toString(boolean brackets)
           
 void write(DataOutput out)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

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
Constructor Detail

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)
Method Detail

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