aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
multiDimBijArray_tpl.h
Go to the documentation of this file.
1 /**
2  *
3  * Copyright (c) 2005-2021 by Pierre-Henri WUILLEMIN(@LIP6) & Christophe GONZALES(@AMU)
4  * info_at_agrum_dot_org
5  *
6  * This library is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this library. If not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 
22 /**
23  * @file
24  * @brief Implementation of the MultiDimBijArray class.
25  *
26  * @author Pierre-Henri WUILLEMIN(@LIP6) & Christophe GONZALES(@AMU)
27  * @author Lionel TORTI
28  */
29 
30 #include <agrum/tools/multidim/implementations/multiDimBijArray.h>
31 
32 namespace gum {
33 
34  template < typename GUM_SCALAR >
35  MultiDimBijArray< GUM_SCALAR >::MultiDimBijArray(const MultiDimBijArray< GUM_SCALAR >& from) :
36  MultiDimWithOffset< GUM_SCALAR >(), _array_(from._array_), _name_(from._name_) {
37  GUM_CONS_CPY(MultiDimBijArray);
38 
39  for (auto var: from.variablesSequence()) {
40  MultiDimWithOffset< GUM_SCALAR >::add(*var);
41  }
42  }
43 
44  template < typename GUM_SCALAR >
46  const MultiDimArray< GUM_SCALAR >& array) :
48  _array_(array), _name_("MultiDimBijArray") {
50 
51  for (auto var: array.variablesSequence()) {
53  }
54  }
55 
56  template < typename GUM_SCALAR >
58  const MultiDimBijArray< GUM_SCALAR >& array) :
60  _array_(array._array_), _name_("MultiDimBijArray") {
62 
63  for (auto var: array.variablesSequence()) {
65  }
66  }
67 
68  template < typename GUM_SCALAR >
71  }
72 
73  template < typename GUM_SCALAR >
76  GUM_ERROR(OperationNotAllowed, "MultiDimBijArray are readonly.")
77  }
78 
79  template < typename GUM_SCALAR >
81  return new MultiDimBijArray< GUM_SCALAR >(*this);
82  }
83 
84  template < typename GUM_SCALAR >
86  return _name_;
87  }
88 
89  template < typename GUM_SCALAR >
91  GUM_ERROR(OperationNotAllowed, "MultiDimBijArray<GUM_SCALAR> are read only.")
92  }
93 
94  template < typename GUM_SCALAR >
96  GUM_ERROR(OperationNotAllowed, "MultiDimBijArray<GUM_SCALAR> are read only.")
97  }
98 
99  template < typename GUM_SCALAR >
101  return (Size)0;
102  }
103 
104  template < typename GUM_SCALAR >
106  GUM_ERROR(OperationNotAllowed, "MultiDimBijArray<GUM_SCALAR> are read only.")
107  }
108 
109  template < typename GUM_SCALAR >
111  // Do nothing
112  }
113 
114  template < typename GUM_SCALAR >
116  if (i.isMaster(this)) {
117  return _array_.values_[this->offsets_[&i]];
118  } else {
119  return _array_.values_[this->getOffs_(i)];
120  }
121  }
122 
123  template < typename GUM_SCALAR >
125  const GUM_SCALAR& value) const {
126  GUM_ERROR(OperationNotAllowed, "MultiDimBijArray<GUM_SCALAR> are read only.")
127  }
128 
129  template < typename GUM_SCALAR >
131  GUM_ERROR(OperationNotAllowed, "MultiDimBijArray<GUM_SCALAR> are read only.")
132  }
133 
134  template < typename GUM_SCALAR >
135  INLINE void
137  GUM_ERROR(OperationNotAllowed, "MultiDimBijArray<GUM_SCALAR> are read only.")
138  }
139 
140  template < typename GUM_SCALAR >
142  GUM_ERROR(OperationNotAllowed, "MultiDimBijArray<GUM_SCALAR> are read only.")
143  }
144 
145  template < typename GUM_SCALAR >
147  const DiscreteVariable* y) {
149  }
150 
151 } // namespace gum
INLINE void emplace(Args &&... args)
Definition: set_tpl.h:643