![]() |
Quantum Fog
0.9.3
|


Public Member Functions | |
| def | __init__ (self, is_quantum, ord_nodes, pot_arr=None, bias=1) |
| def | get_probs_from_amps (self) |
| def | normalize_self (self, postpone=False) |
| def | get_total_probs (self, brief=False) |
| def | __deepcopy__ (self, memo) |
Public Member Functions inherited from potentials.Potential.Potential | |
| def | __init__ (self, is_quantum, ord_nodes, pot_arr=None, bias=1) |
| def | set_pot_arr_to (self, val) |
| def | set_pot_arr_to_one (self) |
| def | mask_self (self) |
| def | get_new_marginal (self, fin_node_list) |
| def | get_axes (self, node_list) |
| def | get_slicex_ax (self, indices, axes) |
| def | get_slicex_nd (self, indices, node_list) |
| def | set_to_transpose (self, node_list) |
| def | conj (self) |
| def | __getitem__ (self, slicex) |
| def | __setitem__ (self, slicex, value) |
| def | __eq__ (self, other) |
| def | __ne__ (self, other) |
| def | __add__ (self, right) |
| def | __iadd__ (self, right) |
| def | __sub__ (self, right) |
| def | __isub__ (self, right) |
| def | __mul__ (self, right) |
| def | __imul__ (self, right) |
| def | __truediv__ (self, right) |
| def | __itruediv__ (self, right) |
| def | __deepcopy__ (self, memo) |
| def | __str__ (self) |
Public Attributes | |
| focus_node | |
| num_nodes | |
Public Attributes inherited from potentials.Potential.Potential | |
| is_quantum | |
| ord_nodes | |
| nodes | |
| num_nodes | |
| nd_sizes | |
| pot_arr | |
Additional Inherited Members | |
Static Public Member Functions inherited from potentials.Potential.Potential | |
| def | mag (pot) |
| def | distance (pot1, pot2) |
CondPot = Conditional Potential. A CondPot is a Potential that stores a node as a focus node and checks to make sure that that node remains the last node of its ord_nodes and pot_arr. CondPots can hold either conditional PDs like P(x| y_1, y_2, ..) or conditional PADs like A(x| y_1, y_2, ...), where x is the focus node. abbreviations in MyConstants.py. CondPots need not be normalized, but there is a method in the class to normalize them. Normalization depends on whether we are dealing with CNets or QNets, which correspondS to is_quantum= False or True respectively. Attributes ---------- focus_node : Node is_quantum : bool nd_sizes : int nodes : set[Node] num_nodes : int ord_nodes : list[Node] pot_arr : numpy.ndarray
| def potentials.DiscreteCondPot.DiscreteCondPot.__init__ | ( | self, | |
| is_quantum, | |||
| ord_nodes, | |||
pot_arr = None, |
|||
bias = 1 |
|||
| ) |
Constructor Parameters ---------- is_quantum : bool ord_nodes : list[Node] pot_arr : numpy.ndarray bias : complex Returns -------
| def potentials.DiscreteCondPot.DiscreteCondPot.__deepcopy__ | ( | self, | |
| memo | |||
| ) |
We want deepcopy to produce a copy of pot_arr but not of the nodes in self.nodes so need to override the usual deepcopy. Parameters ---------- memo : Returns ------- DiscreteCondPot
| def potentials.DiscreteCondPot.DiscreteCondPot.get_probs_from_amps | ( | self | ) |
First checks that is_quantum=True and if so returns a new DiscreteCondPot calculated by taking the magnitude squared of self.pot_arr. Thus, this function gets probabilities from amplitudes. Returns ------- DiscreteCondPot
| def potentials.DiscreteCondPot.DiscreteCondPot.get_total_probs | ( | self, | |
brief = False |
|||
| ) |
This function is just a flavor of normalize_self(). When brief=False, it returns a dictionary giving total prob for each input state. When brief=True, it returns a dictionary with only the total probs that are less than 1. Parameters ---------- brief : bool Returns ------- float | dict[str, float]
| def potentials.DiscreteCondPot.DiscreteCondPot.normalize_self | ( | self, | |
postpone = False |
|||
| ) |
This normalizes pot_arr so that it becomes a conditional potential ( a conditional PD for is_quantum=False or a conditional PAD for is_quantum=True) of last node given the others. Last node corresponds to last axis which corresponds to innermost bracket of pot_arr. postpone=True saves the normalization constants in a dictionary with the input states as keys, but does not apply them to pot_arr. Parameters ---------- postpone : bool Returns ------- None | float | dict[str, float]
1.8.11