public class FixIndexSquaredNormCache extends Object implements SquaredNormCache
Constructor and Description |
---|
FixIndexSquaredNormCache() |
FixIndexSquaredNormCache(int cacheSize)
Initializes a cache with a defined dimension for squared norms
|
Modifier and Type | Method and Description |
---|---|
void |
flush()
Empties the cache
|
int |
getSize()
Returns the size of the cache, i.e.
|
Float |
getSquaredNorm(Example example)
Returns a previously stored norm of a given example
|
void |
setSize(int cacheSize)
Sets the size of the cache, i.e.
|
void |
setSquaredNormValue(Example example,
float squaredNorm)
Stores a squared norm in the cache
|
public FixIndexSquaredNormCache(int cacheSize)
cacheSize
- the number of squared norms the cache can simultaneously storepublic FixIndexSquaredNormCache()
public int getSize()
public void setSize(int cacheSize)
size
- the size to set
NOTE: when this methods is invoked, the cache is initialized from scratch, so all the currently stored norms will be lost
public Float getSquaredNorm(Example example)
SquaredNormCache
getSquaredNorm
in interface SquaredNormCache
example
- the instance whose squared norm is requirednull
if a cache miss occurspublic void setSquaredNormValue(Example example, float squaredNorm)
SquaredNormCache
setSquaredNormValue
in interface SquaredNormCache
example
- the example whose quadratic norm must be storedsquaredNorm
- the squared norm to be storedpublic void flush()
SquaredNormCache
flush
in interface SquaredNormCache
Copyright © 2018 Semantic Analytics Group @ Uniroma2. All rights reserved.