Gymbo

Public Member Functions | Public Attributes | List of all members
gymbo::SymProb Struct Reference

Represents a symbolic probability with a numerator and denominator. More...

`#include <type.h>`

Collaboration diagram for gymbo::SymProb:
[legend]

## Public Member Functions
| SymProb ()
| Default constructor for SymProb. More...
| SymProb (Sym *numerator, Sym *denominator)
| Parameterized constructor for SymProb. More...
std::string | toString ()
| Converts SymProb to a string. More...
SymProb | operator* (SymProb other)
| Multiplies two SymProb instances. More...
SymProb * | pmul (SymProb *other)
| Multiplies two SymProb instances. More...
std::pair< Sym *, Sym * > | marginalize (std::unordered_map< int, DiscreteDist > &var2dist, std::vector< std::vector< int >> &D)
| Marginalizes the SymProb over given variable assignments. More...
float | eval (std::unordered_map< int, float > &params, float eps, std::unordered_map< int, DiscreteDist > &var2dist, std::vector< std::vector< int >> &D)
| Evaluates the SymProb for given parameters, epsilon, variable assignments, and distributions. More...
Sym | query (SymType symtype, Sym &other, std::unordered_map< int, DiscreteDist > &var2dist, std::vector< std::vector< int >> &D)
| Queries the SymProb with a given symbolic type, another symbolic expression, and variable assignments. More...

## Public Attributes
Sym * | numerator
Sym * | denominator

## Detailed Description

Represents a symbolic probability with a numerator and denominator.

The SymProb struct is designed to handle symbolic probabilities using symbolic expressions.

## Constructor & Destructor Documentation

## ◆ SymProb() [1/2]

gymbo::SymProb::SymProb | ( |  | ) |
| inline

Default constructor for SymProb.

Initializes the numerator and denominator with constant symbolic expressions representing 1.0.

## ◆ SymProb() [2/2]

gymbo::SymProb::SymProb | ( | Sym * | numerator,
|  | Sym * | denominator
| ) |  |
| inline

Parameterized constructor for SymProb.

Parameters

  numerator | Pointer to the symbolic expression representing the numerator.
  denominator | Pointer to the symbolic expression representing the denominator.

## Member Function Documentation

## ◆ eval()

float gymbo::SymProb::eval | ( | std::unordered_map< int, float > & | params,
|  | float | eps,
|  | std::unordered_map< int, DiscreteDist > & | var2dist,
|  | std::vector< std::vector< int >> & | D
| ) |  |
| inline

Evaluates the SymProb for given parameters, epsilon, variable assignments, and distributions.

Parameters

  params | Map of variable index to parameter values.
  eps | Epsilon value for numerical stability.
  var2dist | Map of variable index to DiscreteDist.
  D | Vector of variable assignments.

Returns
  The evaluated probability as a float.

## ◆ marginalize()

std::pair<Sym *, Sym *> gymbo::SymProb::marginalize | ( | std::unordered_map< int, DiscreteDist > & | var2dist,
|  | std::vector< std::vector< int >> & | D
| ) |  |
| inline

Marginalizes the SymProb over given variable assignments.

Parameters

  var2dist | Map of variable index to DiscreteDist.
  D | Vector of variable assignments.

Returns
  Pair of Sym pointers representing the marginalized numerator and denominator.

## ◆ operator*()

SymProb gymbo::SymProb::operator* | ( | SymProb | other | ) |
| inline

Multiplies two SymProb instances.

Parameters

  other | The SymProb to multiply with.

Returns
  Result of the multiplication operation as a new SymProb instance.

## ◆ pmul()

SymProb* gymbo::SymProb::pmul | ( | SymProb * | other | ) |
| inline

Multiplies two SymProb instances.

Parameters

  other | The SymProb to multiply with.

Returns
  Result of the multiplication operation as a new SymProb instance.

## ◆ query()

Sym gymbo::SymProb::query | ( | SymType | symtype,
|  | Sym & | other,
|  | std::unordered_map< int, DiscreteDist > & | var2dist,
|  | std::vector< std::vector< int >> & | D
| ) |  |
| inline

Queries the SymProb with a given symbolic type, another symbolic expression, and variable assignments.

Parameters

  symtype | Symbolic type for the resulting Sym.
  other | Another symbolic expression.
  var2dist | Map of variable index to DiscreteDist.
  D | Vector of variable assignments.

Returns
  Resulting Sym based on the query.

## ◆ toString()

std::string gymbo::SymProb::toString | ( |  | ) |
| inline

Converts SymProb to a string.

Returns
  A string representation of the SymProb.

## Member Data Documentation

## ◆ denominator

Sym* gymbo::SymProb::denominator

Pointer to the symbolic expression representing the denominator.

## ◆ numerator

Sym* gymbo::SymProb::numerator

Pointer to the symbolic expression representing the numerator.

The documentation for this struct was generated from the following file:

- libgymbo/type.h