Quantum Fog  0.9.3
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
prefabricated_nodes.BeamSplitter.BeamSplitter Class Reference
Inheritance diagram for prefabricated_nodes.BeamSplitter.BeamSplitter:
Inheritance graph
[legend]
Collaboration diagram for prefabricated_nodes.BeamSplitter.BeamSplitter:
Collaboration graph
[legend]

Public Member Functions

def __init__ (self, id_num, name, in_nd1, in_nd2, tau_mag, tau_degs, rho_degs, num_of_comps, max_n_sum=10000)
 
def get_bs_amp_self (self, n1, n2, m1, m2)
 
def fill_trans_mat_and_st_names_of_nd (self, m1x, m2x, m1y, m2y, dry_run=False)
 
def get_expected_degen (self, m1x, m2x, m1y, m2y)
 
- Public Member Functions inherited from nodes.BayesNode.BayesNode
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)
 
- Public Member Functions inherited from nodes.DirectedNode.DirectedNode
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)
 
- Public Member Functions inherited from nodes.Node.Node
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)
 

Static Public Member Functions

def get_bs_amp (n1, n2, m1, m2, tau_mag, tau_degs, rho_degs)
 

Public Attributes

 tau_mag
 
 tau_degs
 
 rho_degs
 
 num_of_comps
 
 true_max_n_sum
 
 max_n_sum
 
 potential
 
- Public Attributes inherited from nodes.BayesNode.BayesNode
 size
 
 state_names
 
 clique
 
 potential
 
- Public Attributes inherited from nodes.DirectedNode.DirectedNode
 parents
 
 children
 
 neighbors
 
- Public Attributes inherited from nodes.Node.Node
 id_num
 
 topo_index
 
 name
 
 neighbors
 
 visited
 

Additional Inherited Members

- Properties inherited from nodes.BayesNode.BayesNode
 active_states = property(get_active_states, set_active_states)
 

Detailed Description

The Constructor of this class builds a BayesNode that has a transition
matrix appropriate for a beam splitter.

The following is expected:

* the focus node has exactly two parent nodes,

* Both parent nodes are scalar-field nodes OR both parent nodes are
vector-field nodes.

M1   M2
  \|/
   |
  /|\
N2   N1
all arrows pointing downward
(mnemonic: N for New beams=modes)

In the scalar-field case, M2, M1, N1 and N2 are the numbers of photons
that pass through the two incoming and the two outgoing ports. In this
case, Quantum Fog gives names of the form (N1,N2) to the states of the
beam-splitter.

In the vector-field case, M2, M1, N1 and N2  also correspond in a 1-1
fashion to the incoming and outgoing ports, but instead of being
non-negative integers, they are 2-component vectors. For example,
M1 = (M1x, M1y), where M1x and M1y are non-negative integers. In this
case, Quantum Fog gives names of the form ((N1x, N1y), (N2x, N2y)) to
the states of the beam-splitter.

tau and rho, satisfying |tau|^2 + |rho|^2 = 1, are the complex
transmission and reflection coefficients of the beam-splitter. You must
enter tau_mag = the magnitude tau, tau_degs = phase of tau in degrees,
and rho_degs = phase of rho in degrees. These 3 parameters completely
specify the complex numbers tau and rho.

Consider the scalar-field case, for example. Frequently, nets which
contain a beam-splitter node are such that we know what is the maximum
number of photons that will ever enter the beam-splitter. For example,
suppose that a net starts with 2 photons in its root nodes, and that for
one of the input states (M1, M2) of the beam-splitter, M1 + M2 = 3. Then
the list of states of the beam-splitter node would be forced to include
all states with N1 + N2 = 3. Or would it? Clearly, such states would
never occur in any of the possible stories of the net. So if we were to
exclude such states from the list of states of the beam-splitter node,
the physical predictions of the net (that is, the stories with non-zero
amplitude and their amplitudes) would still be the same. That's where
the input parameter 'max_n_sum' comes in. In the scalar case, Quantum
Fog lists those and only those states (N1, N2) for which N1 + N2 <=
max_n_sum. In our example, we could set 'max_n_sum' to 2 and thus
exclude states with N1 + N2 = 3. Of course, excluding some states would
cause the Total Probability sum_x P(x|input states) for some input
states to be different from 1. But the physical predictions of the net
would not change, and we would save memory by excluding unused baggage
from the transition matrix.

In the vector-field case, Quantum Fog lists those and only those states
((N1x, N1y), (N2x, N2y)) for which N1x + N1y+ N2x+ N2y <= max_n_sum

More information about beam splitter 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
----------
num_of_comps : int
    number of components, equals 1 for scalar case and 2 for vector case.
tau_mag : float
tau_degs : float
rho_degs : float
max_n_sum : int
true_max_n_sum : int

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

Constructor & Destructor Documentation

def prefabricated_nodes.BeamSplitter.BeamSplitter.__init__ (   self,
  id_num,
  name,
  in_nd1,
  in_nd2,
  tau_mag,
  tau_degs,
  rho_degs,
  num_of_comps,
  max_n_sum = 10000 
)
Constructor

Parameters
----------
id_num : int
    id number of self (focus node)
name : str
    name of self (focus node)
in_nd1 : BayesNode
    input node (parent) 1
in_nd2 : BayesNode
    input node (parent) 2
tau_mag : float
tau_degs : float
rho_degs : float
num_of_comps : int
    number of components, 1 for scalar fields and 2 for vector ones
max_n_sum : int

Returns
-------

Member Function Documentation

def prefabricated_nodes.BeamSplitter.BeamSplitter.fill_trans_mat_and_st_names_of_nd (   self,
  m1x,
  m2x,
  m1y,
  m2y,
  dry_run = False 
)
When dry_run=False, this method fills the transition matrix and
state names of the focus node. For dry_run=True, this method doesn't
change any of the attributes of the self object; it just calculates
the expected size=degeneracy of the focus node.

notation: transition matrix = <n1, n2 |operator| m1, m2>
where n1 scalar or n1 = (n1x, n1y), etc.

Parameters
----------
m1x : list[int]
m2x : list[int]
m1y : list[int]
m2y : list[int]
dry_run : bool

Returns
-------
None | int
def prefabricated_nodes.BeamSplitter.BeamSplitter.get_bs_amp (   n1,
  n2,
  m1,
  m2,
  tau_mag,
  tau_degs,
  rho_degs 
)
static
Get beam splitter amplitude for arbitrary tau and rho, not self.tau,
self.rho.

Parameters
----------
n1 : int
n2 : int
m1 : int
m2 : int
tau_mag : float
tau_degs : float
rho_degs : float

Returns
-------
complex
def prefabricated_nodes.BeamSplitter.BeamSplitter.get_bs_amp_self (   self,
  n1,
  n2,
  m1,
  m2 
)
Get beam splitter amplitude using the focus node values of tau and
rho.

Parameters
----------
n1 : int
n2 : int
m1 : int
m2 : int

Returns
-------
complex
def prefabricated_nodes.BeamSplitter.BeamSplitter.get_expected_degen (   self,
  m1x,
  m2x,
  m1y,
  m2y 
)
Get expected degeneracy=size of focus node.

Parameters
----------
m1x : list[int]
m2x : list[int]
m1y : list[int]
m2y : list[int]

Returns
-------
int

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