|
| def | __init__ (self, id_num, name, is_quantum, pa1, pa2, pa1_is_control, flipped_by_0) |
| |
| def | final_st (self, pa1_st, pa2_st) |
| |
| def | __init__ (self, id_num, name="blank", size=2) |
| |
| def | set_potential (self, pot) |
| |
| def | resize (self, size) |
| |
| def | set_state_name (self, position, name) |
| |
| def | st_name_index (self, st_name) |
| |
| def | forget_all_evidence (self) |
| |
| def | get_active_states (self) |
| |
| def | set_active_states (self, states) |
| |
| def | set_state_names_to_product (self, list_of_iters, repeat=1, trim=False) |
| |
| def | __init__ (self, id_num, name="blank") |
| |
| def | add_parent (self, node) |
| |
| def | add_parents (self, node_list) |
| |
| def | remove_parent (self, node) |
| |
| def | has_parent (self, node) |
| |
| def | add_child (self, node) |
| |
| def | add_children (self, node_list) |
| |
| def | remove_child (self, node) |
| |
| def | has_child (self, node) |
| |
| def | undirect (self) |
| |
| def | get_markov_blanket (self) |
| |
| def | __init__ (self, id_num, name="blank") |
| |
| def | __lt__ (self, other) |
| |
| def | add_neighbor (self, node) |
| |
| def | remove_neighbor (self, node) |
| |
| def | has_neighbor (self, node) |
| |
The Constructor of this class builds a BayesNode that has a transition
matrix appropriate for a CNot (Controlled Not)
The following is expected:
* the focus node has exactly two parent nodes,
* the parent nodes each has 2 states named, 0 and 1, in that order.
Suppose M1, M2, N1, N2 are elements of {0,1}. Say M1 is the state of the
first parent P1, and M2 is the state of the second parent P2. Define (
N1, N2) in terms of M1 and M2 as follows.
M1 M2 (N1,N2)
0 0 (0,0)
0 1 (0,1)
1 0 (1,1)
1 1 (1,0)
This table may be described by saying that
* N1 = M1 and M2 is transformed into N2 ,
* P1 (the "control" bit) causes P2 (the "target" bit) to flip (i.e.,
to change from 0 to 1 or vice versa) whenever M1 is 1, and
* P1 has no effect on P2 whenever M1 is 0.
Quantum Fog gives names N1N2 (i.e., 00, 01, 10 and 11) to the states of
the Controlled-Not. When the states M1 and M2 are given by a particular
row of the above table, Quantum Fog assigns unit amplitude to the state
N1N2 shown in that row, and it assigns zero amplitude to all the other
states.
More information about CNot nodes can be found in the documents
entitled "Quantum Fog Manual", and "Quantum Fog Library Of Essays" that
are included with the legacy QFog.
Attributes
----------
pa1_is_control : bool
True (False) if parent 1 (parent 2) is the control. In the above
table example, pa1_is_control=True
flipped_by_0 : bool
True (False) if target flips when control is in state 0 (state 1).
In the above table example, flipped_by_0=False
potential : Potential
active_states : list[int]
clique : Clique
size : int
state_names : list[str]
children : set[BayesNode]
neighbors : set[BayesNode]
parents : set[BayesNode]
id_num : int
topo_index : int
name : str
visited : bool