Quantum Fog  0.9.3
BI_NODE.h
1 #pragma once
2 
3 #include "QFog_constants.h"
4 
5 #include "MATRIX.h"
6 #include "UI_MAP.h"
7 
8 
9 //******************************************
10 class BI_NODE
11 {
12 private:
13  USHORT its_nd1, its_nd2;
14  USHORT its_num_of_rows;
15  USHORT its_num_of_cols;
16  //dynamic info:
17  MATRIX<COMPLEX> its_cum_amps;
18  MATRIX<DOUBLE> its_cum_probs;
19 
20 public:
21 
22  VOID set_degens(USHORT degen1, USHORT degen2);
23  VOID copy(const BI_NODE & bn);
24  BI_NODE();
25  BI_NODE(USHORT nd1, USHORT degen1, USHORT nd2, USHORT degen2);
26  BI_NODE(const BI_NODE & bn);
27  BI_NODE & operator=( const BI_NODE & rhs );
28  virtual ~BI_NODE();
29 
30  USHORT get_nd1() const;
31  USHORT get_nd2() const;
32  friend BOOLEAN operator==(
33  const BI_NODE & bi_x,
34  const BI_NODE & bi_y);
35  friend BOOLEAN operator!=(
36  const BI_NODE & bi_x,
37  const BI_NODE & bi_y);
38  BOOLEAN has(USHORT nd) const;
39  BOOLEAN has(USHORT nd1, USHORT nd2) const;
40  VOID renumber_nds(const UI_MAP & map);
41 
42  const DOUBLE & get_cum_prob(USHORT row, USHORT col) const;
43  VOID normalize_cum_probs();
44  VOID set_cum_info_to_default();
45  VOID add_to_an_entry_of_cum_amps(
46  USHORT row,
47  USHORT col,
48  const COMPLEX & net_amp);
49  VOID prepare_cum_info_for_next_ending();
50 
51 
52 };
53 #pragma mark -
54 
55 //******************************************
56 inline
57 USHORT BI_NODE::get_nd1() const
58 {
59  return its_nd1;
60 }
61 //******************************************
62 inline
63 USHORT BI_NODE::get_nd2() const
64 {
65  return its_nd2;
66 }
67 //******************************************
68 inline
69 BOOLEAN operator==(
70 const BI_NODE & bi_x, //in
71 const BI_NODE & bi_y) //in
72 {
73  return(
74  (bi_x.its_nd1==bi_y.its_nd1 && bi_x.its_nd2==bi_y.its_nd2)||
75  (bi_x.its_nd1==bi_y.its_nd2 && bi_x.its_nd2==bi_y.its_nd1)
76  );
77 }
78 //******************************************
79 inline
80 BOOLEAN operator!=(
81 const BI_NODE & bi_x, //in
82 const BI_NODE & bi_y) //in
83 {
84  return !(bi_x==bi_y);
85 }
86 //******************************************
87 inline
88 BOOLEAN BI_NODE::has(
89 USHORT nd) //in
90 const
91 {
92  return (its_nd1==nd||its_nd2==nd);
93 }
94 //******************************************
95 inline
96 BOOLEAN BI_NODE::has(
97 USHORT nd1, //in
98 USHORT nd2) //in
99 const
100 {
101  return
102  (its_nd1==nd1 && its_nd2==nd2)||
103  (its_nd1==nd2 && its_nd2==nd1)
104  ;
105 }
106 //******************************************
107 inline
108 const DOUBLE & BI_NODE::get_cum_prob(
109 USHORT row, //in
110 USHORT col) //in
111 const
112 {
113  return its_cum_probs.entry(row, col);
114 }
115 //******************************************
116 inline
117 VOID BI_NODE::add_to_an_entry_of_cum_amps(
118 USHORT row, //in
119 USHORT col, //in
120 const COMPLEX & net_amp) //in
121 {
122  its_cum_amps.entry(row, col) += net_amp;
123 }
Definition: BI_NODE.h:10
Definition: UI_MAP.h:7