aGrUM  0.20.2
a C++ library for (probabilistic) graphical models
multiDimBijArray_tpl.h
Go to the documentation of this file.
1 /**
2  *
3  * Copyright 2005-2020 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(
36  const MultiDimBijArray< GUM_SCALAR >& from) :
37  MultiDimWithOffset< GUM_SCALAR >(),
38  array__(from.array__), name__(from.name__) {
39  GUM_CONS_CPY(MultiDimBijArray);
40 
41  for (auto var: from.variablesSequence()) {
42  MultiDimWithOffset< GUM_SCALAR >::add(*var);
43  }
44  }
45 
46  template < typename GUM_SCALAR >
48  const VarBijection& bijection,
49  const MultiDimArray< GUM_SCALAR >& array) :
51  array__(array), name__("MultiDimBijArray") {
53 
54  for (auto var: array.variablesSequence()) {
56  }
57  }
58 
59  template < typename GUM_SCALAR >
61  const VarBijection& bijection,
62  const MultiDimBijArray< GUM_SCALAR >& array) :
64  array__(array.array__), name__("MultiDimBijArray") {
66 
67  for (auto var: array.variablesSequence()) {
69  }
70  }
71 
72  template < typename GUM_SCALAR >
75  }
76 
77  template < typename GUM_SCALAR >
79  const MultiDimBijArray< GUM_SCALAR >& from) {
80  GUM_ERROR(OperationNotAllowed, "MultiDimBijArray are readonly.");
81  }
82 
83  template < typename GUM_SCALAR >
86  return new MultiDimBijArray< GUM_SCALAR >(*this);
87  }
88 
89  template < typename GUM_SCALAR >
91  return name__;
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  GUM_ERROR(OperationNotAllowed, "MultiDimBijArray<GUM_SCALAR> are read only.");
102  }
103 
104  template < typename GUM_SCALAR >
106  return (Size)0;
107  }
108 
109  template < typename GUM_SCALAR >
111  GUM_ERROR(OperationNotAllowed, "MultiDimBijArray<GUM_SCALAR> are read only.");
112  }
113 
114  template < typename GUM_SCALAR >
116  // Do nothing
117  }
118 
119  template < typename GUM_SCALAR >
122  if (i.isMaster(this)) {
123  return array__.values_[this->offsets_[&i]];
124  } else {
125  return array__.values_[this->getOffs_(i)];
126  }
127  }
128 
129  template < typename GUM_SCALAR >
131  const GUM_SCALAR& value) const {
132  GUM_ERROR(OperationNotAllowed, "MultiDimBijArray<GUM_SCALAR> are read only.");
133  }
134 
135  template < typename GUM_SCALAR >
137  const std::vector< GUM_SCALAR >& v) const {
138  GUM_ERROR(OperationNotAllowed, "MultiDimBijArray<GUM_SCALAR> are read only.");
139  }
140 
141  template < typename GUM_SCALAR >
143  std::initializer_list< GUM_SCALAR > l) const {
144  GUM_ERROR(OperationNotAllowed, "MultiDimBijArray<GUM_SCALAR> are read only.");
145  }
146 
147  template < typename GUM_SCALAR >
150  GUM_ERROR(OperationNotAllowed, "MultiDimBijArray<GUM_SCALAR> are read only.");
151  }
152 
153  template < typename GUM_SCALAR >
155  const DiscreteVariable* y) {
157  }
158 
159 } // namespace gum
INLINE void emplace(Args &&... args)
Definition: set_tpl.h:669