COM.hugin.HAPI
Class Table

java.lang.Object
  extended byCOM.hugin.HAPI.Table

public class Table
extends java.lang.Object

Hugin uses Tables for representing the conditional probability and utility potentials of individual Nodes, the probability and utility potentials on separators and Cliques of JunctionTrees, evidence potentials, etc.

A potential is a function from the state space of a set of variables into the set of real numbers. A Table is a representation of a potential.


Method Summary
 void delete()
          Deletes this Table.
 double getCovariance(int i, ContinuousChanceNode node1, ContinuousChanceNode node2)
          Returns the covariance of a couple of ContinuousChanceNodes given a configuration of the discrete chance Nodes of this Table.
 double[] getData()
          Returns a one-dimensional array of the discrete data of this Table.
 double getDataItem(int index)
          Returns the data item at a particular index of the discrete data of this Table.
 double getMean(int i, ContinuousChanceNode node)
          Returns the mean of a ContinuousChanceNode given a configuration of the discrete chance Nodes of this Table.
 NodeList getNodes()
          Returns a NodeList containing the Nodes associated with this Table.
 int getSize()
          Returns the size of this Table.
 double getVariance(int i, ContinuousChanceNode node)
          Returns the variance of a ContinuousChanceNode given a configuration of the discrete chance Nodes of this Table.
 void reorderNodes(NodeList nodes)
          Reorders the list of Nodes of this Table.
 void setData(double[] newData)
          Sets the data of this Table.
 void setDataItem(int index, double value)
          Sets a particular data item for this Table.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getData

public double[] getData()
                 throws ExceptionHugin
Returns a one-dimensional array of the discrete data of this Table. The array is a (row-major) representation of the actual multi-dimensional array.

Returns:
A one-dimensional array of doubles.
Throws:
ExceptionHugin

getDataItem

public double getDataItem(int index)
                   throws ExceptionHugin
Returns the data item at a particular index of the discrete data of this Table. The index is interpreted as the index of a one-dimensional (row-major) representation of the actual multi-dimensional array.

Parameters:
index - the index.
Returns:
The data item at 'index' (a double).
Throws:
ExceptionHugin

getNodes

public NodeList getNodes()
                  throws ExceptionHugin
Returns a NodeList containing the Nodes associated with this Table.

Returns:
A NodeList.
Throws:
ExceptionHugin

getSize

public int getSize()
            throws ExceptionHugin
Returns the size of this Table.

Returns:
An int.
Throws:
ExceptionHugin

setData

public void setData(double[] newData)
             throws ExceptionHugin
Sets the data of this Table.

Parameters:
newData - a one-dimensional array of doubles. The array is interpreted as a (row-major) representation of a multi-dimensional array indexed according to the order of the Nodes of the Table.
Throws:
ExceptionHugin

setDataItem

public void setDataItem(int index,
                        double value)
                 throws ExceptionHugin
Sets a particular data item for this Table.

Parameters:
index - interpreted as the index of a one-dimensional (row-major) representation of the actual multi-dimensional array.
value - the new value of the data item at 'index'.
Throws:
ExceptionHugin

getVariance

public double getVariance(int i,
                          ContinuousChanceNode node)
                   throws ExceptionHugin
Returns the variance of a ContinuousChanceNode given a configuration of the discrete chance Nodes of this Table.

Parameters:
i - the index of the discrete configuration.
node - the ContinuousChanceNode in question.
Returns:
A double-precision real value.
Throws:
ExceptionHugin

getMean

public double getMean(int i,
                      ContinuousChanceNode node)
               throws ExceptionHugin
Returns the mean of a ContinuousChanceNode given a configuration of the discrete chance Nodes of this Table.

Parameters:
i - the index of the discrete configuration.
node - the ContinuousChanceNode in question.
Returns:
A double-precision real value.
Throws:
ExceptionHugin

getCovariance

public double getCovariance(int i,
                            ContinuousChanceNode node1,
                            ContinuousChanceNode node2)
                     throws ExceptionHugin
Returns the covariance of a couple of ContinuousChanceNodes given a configuration of the discrete chance Nodes of this Table.

Parameters:
i - the index of the discrete configuration.
node1 - one of the ContinuousChanceNodes in question.
node2 - the other ContinuousChanceNode.
Returns:
A double-precision real value.
Throws:
ExceptionHugin

reorderNodes

public void reorderNodes(NodeList nodes)
                  throws ExceptionHugin
Reorders the list of Nodes of this Table.

Parameters:
nodes - the new order (which must be a permutation of the current order) of the Nodes of this Table.
Throws:
ExceptionHugin

delete

public void delete()
            throws ExceptionObjectNotAlive
Deletes this Table. Tables owned by an application should be deleted using this method.

Throws:
ExceptionObjectNotAlive