Quantum Fog  0.9.3
Public Member Functions | List of all members
potentials.DiscreteUniPot.DiscreteUniPot Class Reference
Inheritance diagram for potentials.DiscreteUniPot.DiscreteUniPot:
Inheritance graph
[legend]
Collaboration diagram for potentials.DiscreteUniPot.DiscreteUniPot:
Collaboration graph
[legend]

Public Member Functions

def __init__ (self, is_quantum, node, pot_arr=None, bias=1)
 
def size (self)
 
def sample (self)
 
def get_probs_from_amps (self)
 
def __deepcopy__ (self, memo)
 
- Public Member Functions inherited from potentials.DiscreteCondPot.DiscreteCondPot
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)
 

Additional Inherited Members

- Static Public Member Functions inherited from potentials.Potential.Potential
def mag (pot)
 
def distance (pot1, pot2)
 
- Public Attributes inherited from potentials.DiscreteCondPot.DiscreteCondPot
 focus_node
 
 num_nodes
 
- Public Attributes inherited from potentials.Potential.Potential
 is_quantum
 
 ord_nodes
 
 nodes
 
 num_nodes
 
 nd_sizes
 
 pot_arr
 

Detailed Description

A DiscreteUniPot or discrete uni-potential is a DiscreteCondPot that
depends on a single node. Hence it represents either P(x) or A(x),
where x is the focus node.

Attributes
----------
focus_node : BayesNode

is_quantum : bool
nd_sizes : list[int]
nodes ; set[Node]
num_nodes : int
ord_nodes : list[Node]
por_arr : numpy.ndarray

Constructor & Destructor Documentation

def potentials.DiscreteUniPot.DiscreteUniPot.__init__ (   self,
  is_quantum,
  node,
  pot_arr = None,
  bias = 1 
)
Constructor

Parameters
----------
is_quantum : bool
node : BayesNode
pot_arr : numpy.ndarray
bias : complex

Returns
-------

Member Function Documentation

def potentials.DiscreteUniPot.DiscreteUniPot.__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
-------
DiscreteUniPot
def potentials.DiscreteUniPot.DiscreteUniPot.get_probs_from_amps (   self)
First checks that is_quantum=True and if so returns a new
DiscreteUniPot calculated by taking the magnitude squared of
self.pot_arr. Thus, this function gets probabilities from
amplitudes. Analogous function in DiscreteCondPot returns a
DiscreteCondPot instead of a DiscreteUniPot.


Returns
-------
DiscreteUniPot
def potentials.DiscreteUniPot.DiscreteUniPot.sample (   self)
This samples a state of the focus node using pot_arr as a
distribution. It first normalizes pot_arr (1-norm for classical and
2-norm for quantum). For the quantum case, it actually samples from
the classical PD obtained by taking the absolute value squared of
pot_arr.

Returns
-------
int
def potentials.DiscreteUniPot.DiscreteUniPot.size (   self)
This returns the size (number of states) of the focus node.

Returns
-------
int

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