|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.jstacs.algorithms.graphs.tensor.Tensor
de.jstacs.algorithms.graphs.tensor.SymmetricTensor
public class SymmetricTensor
This class can be used for Tensors with a special symmetry property. This property states that for a given target node and for all permutations of parents nodes the edge weight is constant. This is very helpful to save storage and time in some algorithms. Since it is very useful it also enables you to use this class if your tensor does not fulfill this property. For that case the tensor saves only the maximum edge weight and the permutation of the parent nodes.
| Field Summary |
|---|
| Fields inherited from class de.jstacs.algorithms.graphs.tensor.Tensor |
|---|
L, order, powers |
| Constructor Summary | |
|---|---|
SymmetricTensor(AsymmetricTensor asym_tensor)
|
|
SymmetricTensor(double[][][] asym_tensor,
int N,
byte k)
|
|
SymmetricTensor(int n,
byte k)
|
|
SymmetricTensor(SymmetricTensor[] parts,
double[] weights)
The constructor can be used creating a new SymmetricTensor as weighted sum of SymmetricTensors |
|
| Method Summary | |
|---|---|
double |
getBest(int child,
int[] par,
byte k)
Returns the maximal weight which can be reached for an edge from k |
int[] |
getEdgeFromIndex(int idx,
int k)
|
int[] |
getMaximalEdgeFor(byte k,
int child,
int... parents)
Returns the edge permute(parents[0],... |
double |
getRootValue(int child)
Returns the value for child as root. |
int |
getTrueIndexForLastGetBest()
Returns the edge from getBest in an endcoded index. |
double |
getValue(byte k,
int child,
int... parents)
Returns the value for the edge parents[0],... |
void |
resetValue(byte k,
int child,
int... parents)
Set the value for the edge parents -> child to
Double.NEGATIVE_INFTINITY. |
void |
setRootValue(int child,
double val)
Sets the value val for the root node child. |
void |
setValue(byte k,
double val,
int child,
int... parents)
Sets the value if it is bigger than the current value and keeps the parents information |
| Methods inherited from class de.jstacs.algorithms.graphs.tensor.Tensor |
|---|
getAsymIndex, getNumberOfNodes, getOrder, readTensorFromFile, toDouble3DArray, writeTensorToFile |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SymmetricTensor(int n,
byte k)
public SymmetricTensor(SymmetricTensor[] parts,
double[] weights)
throws IllegalArgumentException
parts - the SymmetricTensorsweights - the weight for each SymmetricTensor
IllegalArgumentException - if something went wrongpublic SymmetricTensor(AsymmetricTensor asym_tensor)
public SymmetricTensor(double[][][] asym_tensor,
int N,
byte k)
| Method Detail |
|---|
public double getBest(int child,
int[] par,
byte k)
k nodes from the (encoded) set par to the node child.
- Parameters:
child - the target nodepar - an encoded set, elements are sorted and for all elements e >= child the real value is (e+1), e.g. child = 3 and possible parents = {5,2,0,6,1} than par = {0,1,2,4,5}k - the number of parentes used from par
- Returns:
- the best (=maximal) weight
public int[] getEdgeFromIndex(int idx,
int k)
public int[] getMaximalEdgeFor(byte k,
int child,
int... parents)
Tensorpermute(parents[0],...,parents[k-1]) -> child that maximizes the score.
getMaximalEdgeFor in class Tensorpublic double getRootValue(int child)
Tensorchild as root.
getRootValue in class Tensorchild - the name of the node
public int getTrueIndexForLastGetBest()
getBest(int, int[], byte)
public double getValue(byte k,
int child,
int... parents)
Tensorparents[0],...,parents[k-1] -> child.
getValue in class Tensork - the number parents to be usedchild - the child nodeparents - the parents nodes (only the first k will be used
parents[0],...,parents[k-1] -> child
public void resetValue(byte k,
int child,
int... parents)
parents -> child to
Double.NEGATIVE_INFTINITY.
resetValue in class Tensork - the number parents to be usedchild - the child nodeparents - the parents nodes (only the first k will be used
public void setRootValue(int child,
double val)
Tensorval for the root node child.
setRootValue in class Tensorchild - the name of the nodeval - the value for the node
public void setValue(byte k,
double val,
int child,
int... parents)
setValue in class Tensork - the number parents to be usedval - the new valuechild - the child nodeparents - the parents nodes (only the first k will be used
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||