Class Table
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.
Note: Return and argument types for methods in this class vary depending on the particular API DLL (x86/x64 platform, single/double precision) being used. Please read the section Using the Hugin C#/.NET Core/.NET 5/.NET 6 API.
Inherited Members
Namespace: HAPI
Assembly: hugincs-9.7-netstandard2.0-x64.dll
Syntax
public class Table
Remarks
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.
Methods
ComputeProbabilityOfInterval(double, double)
Computes the probability of the given interval for the mixture distribution represented by this Table.
Declaration
public double ComputeProbabilityOfInterval(double x, double y)
Parameters
| Type | Name | Description |
|---|---|---|
| double | x | The left endpoint of the interval. |
| double | y | The right endpoint of the interval. |
Returns
| Type | Description |
|---|---|
| double |
Remarks
The table must have been computed by GetDistribution().
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
Delete()
Deletes this Table. Tables owned by an application should be deleted using this method.
Declaration
public void Delete()
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
GetCGSize()
Returns the CG size of this Table.
Declaration
public ulong GetCGSize()
Returns
| Type | Description |
|---|---|
| ulong |
Remarks
Returns the CG size of this Table. This is the number of CG data elements stored in the table.
Generic declaration:
public size_t GetCGSize ()
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
GetConfiguration(ref ulong[], ulong)
Computes the state configuration corresponding to a given table index.
Declaration
public void GetConfiguration(ref ulong[] configuration, ulong index)
Parameters
| Type | Name | Description |
|---|---|---|
| ulong[] | configuration | The computed state configuration corresponding to a given table index |
| ulong | index | a table index |
Remarks
The computed state configuration is stored in the
configuration array: The state index for the k'th
node in the node list (see the GetNodes()
method) of this Table (if the node is discrete) is stored
in the k'th entry of the array. The length of the array
must be greater than or equal to the number of discrete
nodes of this Table (extra entries are ignored).
Generic declaration:
public void GetConfiguration (ref size_t[] configuration, size_t index)
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
GetCovariance(ulong, ContinuousChanceNode, ContinuousChanceNode)
Returns the covariance of a pair of ContinuousChanceNodes given a configuration of the discrete chance Nodes of this Table.
Declaration
public double GetCovariance(ulong i, ContinuousChanceNode node1, ContinuousChanceNode node2)
Parameters
| Type | Name | Description |
|---|---|---|
| ulong | i | The index of the discrete configuration. |
| ContinuousChanceNode | node1 | One of the ContinuousChanceNodes in question. |
| ContinuousChanceNode | node2 | The other ContinuousChanceNode. |
Returns
| Type | Description |
|---|---|
| double | A double-precision real value. |
Remarks
Generic declaration:
public double GetCovariance (size_t i, ContinuousChanceNode node1, ContinuousChanceNode node2)
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
GetData()
Returns a one-dimensional array of the discrete data of this Table.
Declaration
public float[] GetData()
Returns
| Type | Description |
|---|---|
| float[] |
Remarks
The array is a (row-major) representation of the actual multi-dimensional array. Note that this is a copy of the real data stored in the table. To update the table, the modified data must be copied back using the SetData method.
Generic declaration:
public h_number_t[] GetData ()
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
GetData(ref float[], ulong, ulong)
Returns a region of the discrete data of this Table.
Declaration
public void GetData(ref float[] data, ulong start, ulong count)
Parameters
| Type | Name | Description |
|---|---|---|
| float[] | data | Array to hold the extracted data. |
| ulong | start | Index of the first element to copy. |
| ulong | count | Number of elements to copy. |
Remarks
The region is specified by a start position and the number
of elements to copy. The data is copied to the data
array. Note that since this is a copy of the real data
stored in the table, updates will only take place when the
data is copied back using the setData method.
The indexes start, ..., start+count-1
must be valid indexes of this table. Also, count
must be less than or equal to the size of the data
array.
Generic declaration:
public void GetData (ref h_number_t[] data, size_t start, size_t count)
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
GetDataItem(ulong)
Returns the data item at a particular index of the discrete data of this Table.
Declaration
public float GetDataItem(ulong index)
Parameters
| Type | Name | Description |
|---|---|---|
| ulong | index | the index. |
Returns
| Type | Description |
|---|---|
| float | The data item at |
Remarks
The index is interpreted as the index of a one-dimensional (row-major) representation of the actual multi-dimensional array.
Generic declaration:
public h_number_t GetDataItem (size_t index)
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
GetIndex(ref ulong[])
Computes the table index corresponding to a given state configuration.
Declaration
public ulong GetIndex(ref ulong[] configuration)
Parameters
| Type | Name | Description |
|---|---|---|
| ulong[] | configuration |
Returns
| Type | Description |
|---|---|
| ulong | The table index corresponding to a given state configuration. |
Remarks
The state configuration is specified in the
configuration array: A state index for the k'th
node in the node list (see the GetNodes()
method) of this Table (if the node is discrete) must be
specified in the k'th entry of the array. The length of
the array must be greater than or equal to the number of
discrete nodes of this Table (extra entries are ignored).
Generic declaration:
public size_t GetIndex (ref size_t[] configuration)
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
GetMean(ulong, ContinuousChanceNode)
Returns the mean of a ContinuousChanceNode given a configuration of the discrete chance Nodes of this Table.
Declaration
public double GetMean(ulong i, ContinuousChanceNode node)
Parameters
| Type | Name | Description |
|---|---|---|
| ulong | i | the index of the discrete configuration. |
| ContinuousChanceNode | node | the ContinuousChanceNode in question. |
Returns
| Type | Description |
|---|---|
| double | A double-precision real value. |
Remarks
Generic declaration:
public double GetMean (size_t i, ContinuousChanceNode node)
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
GetNodes()
Returns a NodeList containing the Nodes associated with this Table.
Declaration
public NodeList GetNodes()
Returns
| Type | Description |
|---|---|
| NodeList |
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
GetSize()
Returns the size of this Table.
Declaration
public ulong GetSize()
Returns
| Type | Description |
|---|---|
| ulong |
Remarks
Generic declaration:
public size_t GetSize ()
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
GetVariance(ulong, ContinuousChanceNode)
Returns the variance of a ContinuousChanceNode given a configuration of the discrete chance Nodes of this Table.
Declaration
public double GetVariance(ulong i, ContinuousChanceNode node)
Parameters
| Type | Name | Description |
|---|---|---|
| ulong | i | Returns the variance of a ContinuousChanceNode given a configuration of the discrete chance Nodes of this Table. |
| ContinuousChanceNode | node | the ContinuousChanceNode in question. |
Returns
| Type | Description |
|---|---|
| double |
Remarks
Generic declaration:
public double GetVariance (size_t i, ContinuousChanceNode node)
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
IsAlive()
Is this Table object alive?
Declaration
public bool IsAlive()
Returns
| Type | Description |
|---|---|
| bool |
ReorderNodes(NodeList)
Reorders the list of Nodes of this Table.
Declaration
public void ReorderNodes(NodeList nodes)
Parameters
| Type | Name | Description |
|---|---|---|
| NodeList | nodes | the new order (which must be a permutation of the current order) of the Nodes of this Table. |
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
SetAllDataItems(float)
Sets all data items of the discrete data of this Table.
Declaration
public void SetAllDataItems(float value)
Parameters
| Type | Name | Description |
|---|---|---|
| float | value | the new value of the data items. |
Remarks
Generic declaration:
public void SetAllDataItems (h_number_t value)
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
SetData(float[])
Sets the data of this Table.
Declaration
public void SetData(float[] newData)
Parameters
| Type | Name | Description |
|---|---|---|
| float[] | newData | array holding the data to copy to the table |
Remarks
The contents of the array are copied to the table. The size of the array must equal the size of the table.
Generic declaration:
public void SetData (h_number_t[] newData)
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
SetData(float[], ulong, ulong)
Sets a region of the discrete data of this Table.
Declaration
public void SetData(float[] data, ulong start, ulong count)
Parameters
| Type | Name | Description |
|---|---|---|
| float[] | data | array holding the data to copy to this table. Note that the Table data is a (row-major) representation of the actual multi-dimensional array. |
| ulong | start | index of the first element to be set. |
| ulong | count | number of elements to copy |
Remarks
The region is specified by a start position and the number of elements to copy. The data is copied from the array to the table.
The indexes offset, ..., offset+count-1
must be valid indexes of this table. Also, count
must be less than or equal to the size of the array.
Generic declaration:
public void SetData (h_number_t[] data, size_t start, size_t count)
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
SetDataItem(ulong, float)
Sets a particular data item for this Table.
Declaration
public void SetDataItem(ulong index, float value)
Parameters
| Type | Name | Description |
|---|---|---|
| ulong | index | interpreted as the index of a one-dimensional (row-major) representation of the actual multi-dimensional array. |
| float | value | the new value of the data item at 'index'. |
Remarks
Generic declaration:
public void SetDataItem (size_t index, h_number_t value)
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |