|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.omegahat.Simulation.MCMC.MultiState | +--org.omegahat.Simulation.MCMC.MultiDoubleState
MCMCState that can hold several Double[] states. Its purpose is to allow a multi-chain sampler to easily store and retrieve the states of individual chains.
Inner Class Summary | |
class |
MultiDoubleState.CovAccumulator
|
Field Summary | |
double[][] |
covCacheMat
|
boolean |
DEBUG
|
double[][] |
distanceCacheMat
|
static int |
Euclidean
|
static int |
Mahalanobis
|
double[] |
maxCache
|
double[] |
meanCacheVec
|
double[] |
minCache
|
double[] |
rangeCache
|
MultiDoubleState.CovAccumulator[] |
sumSqrSubsetCache
|
Fields inherited from class org.omegahat.Simulation.MCMC.MultiState |
attributes, contents |
Constructor Summary | |
MultiDoubleState()
|
|
MultiDoubleState(int size)
|
|
MultiDoubleState(int size,
double[] oneValue)
|
|
MultiDoubleState(int size,
java.lang.Double[] oneValue)
|
|
MultiDoubleState(MultiState state)
This constructor creates a new MultDoubleState by duplicating the contents of the provided MultiState, checking that each non-null component is a Double[]. |
Method Summary | |
static double[][] |
accumToVar(MultiDoubleState.CovAccumulator accum)
Compute the covariance matrix |
void |
add(java.lang.Object value)
|
double[] |
computeDistances(int from,
int method)
|
protected void |
computeMinMaxRange()
|
MultiState |
copy()
creat a new MultiState object by copying the contents of this one. |
MultiDoubleState |
copyFromTo(MultiDoubleState source,
MultiDoubleState target)
|
MultiDoubleState |
copyFromTo(MultiState source,
MultiDoubleState target)
|
double[][] |
correctedVar()
This function checks if the number of component states used to estimate the covariance matrix is less than or equal to the number of dimensions. |
double[] |
cumsum()
|
double[] |
cumsum(double[] cumsum)
Compute accumulated sums |
MultiDoubleState.CovAccumulator |
cumSumSqr()
|
MultiDoubleState.CovAccumulator |
cumSumSqr(MultiDoubleState.CovAccumulator retval)
|
MultiDoubleState.CovAccumulator |
cumSumSqrSubset(int[] closest)
|
MultiDoubleState.CovAccumulator |
cumSumSqrSubsetCache(int which,
int[] closest)
|
double[][] |
diagVar()
Compute the diagonal of the covariance matrix |
double |
distance(int from,
int to,
int method)
|
double |
distanceCache(int from,
int to,
int method)
|
int[] |
findClosest(int which,
int howmany,
int method)
Find closest howmany points to state
which using distance method |
Histogram[] |
histogram(double min,
double max,
int bins)
|
Histogram[] |
histogram(Histogram[] hist)
|
void |
invalidateCache()
|
void |
invalidateCache(int index)
|
double[] |
max()
|
double[] |
mean()
Compute the mean |
java.lang.Double[] |
Mean()
|
double[] |
min()
Compute the minimum 2-way variance vector between a specified state and the other states |
double[][] |
nearestNeighborDiagVar(int which,
int howmany,
int method)
|
double[] |
nearestNeighborMean(int which,
int howmany,
int method)
|
double[][] |
nearestNeighborVar(int which,
int howmany,
int method)
Compute the (local) covariance matrix at one state using a specified number of nearest neighbors |
double[] |
range()
|
void |
remove(int which)
|
void |
set(int index,
java.lang.Object value)
|
double[][] |
var()
Compute the covariance matrix |
java.lang.Double[][] |
Var()
Compute the covariance matrix |
Methods inherited from class org.omegahat.Simulation.MCMC.MultiState |
attr, attr, attributeNames, copyTo, get, size, toString |
Methods inherited from class java.lang.Object |
|
Field Detail |
public static final int Mahalanobis
public static final int Euclidean
public boolean DEBUG
public double[][] distanceCacheMat
public double[][] covCacheMat
public double[] meanCacheVec
public MultiDoubleState.CovAccumulator[] sumSqrSubsetCache
public double[] minCache
public double[] maxCache
public double[] rangeCache
Constructor Detail |
public MultiDoubleState(int size)
public MultiDoubleState(int size, java.lang.Double[] oneValue)
public MultiDoubleState(int size, double[] oneValue)
public MultiDoubleState()
public MultiDoubleState(MultiState state)
Method Detail |
public void invalidateCache()
public void invalidateCache(int index)
public void set(int index, java.lang.Object value)
set
in class MultiState
public void add(java.lang.Object value)
add
in class MultiState
public void remove(int which)
remove
in class MultiState
public MultiState copy()
copy
in class MultiState
public MultiDoubleState copyFromTo(MultiDoubleState source, MultiDoubleState target)
public MultiDoubleState copyFromTo(MultiState source, MultiDoubleState target)
public double[][] nearestNeighborVar(int which, int howmany, int method)
which
- index of state around which covariance is computedhowmany
- number of neighbors to use (Use nn=0 for all neighbors).public double[][] nearestNeighborDiagVar(int which, int howmany, int method)
public double[] nearestNeighborMean(int which, int howmany, int method)
public int[] findClosest(int which, int howmany, int method)
howmany
points to state
which
using distance method which
will be included in the returned list as
the first element.which
- index of state from which distances are computed.howmany
- number of points (including which) to return, must be >= 2.method
- distance method to use. 0=Mahalanobis, 1=Euclidean.public double[] computeDistances(int from, int method)
public double distanceCache(int from, int to, int method)
public double distance(int from, int to, int method)
public MultiDoubleState.CovAccumulator cumSumSqrSubset(int[] closest)
public MultiDoubleState.CovAccumulator cumSumSqrSubsetCache(int which, int[] closest)
public double[] min()
public double[] max()
public double[] range()
protected void computeMinMaxRange()
public double[] cumsum(double[] cumsum)
public double[] cumsum()
public double[] mean()
public java.lang.Double[] Mean()
public MultiDoubleState.CovAccumulator cumSumSqr()
public MultiDoubleState.CovAccumulator cumSumSqr(MultiDoubleState.CovAccumulator retval)
public double[][] diagVar()
public double[][] var()
public double[][] correctedVar()
public static double[][] accumToVar(MultiDoubleState.CovAccumulator accum)
public java.lang.Double[][] Var()
public Histogram[] histogram(Histogram[] hist)
public Histogram[] histogram(double min, double max, int bins)
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |