aGrUM
3.2.0
a C++ library for (probabilistic) graphical models
Toggle main menu visibility
multiDimCompleteProjection_tpl.h
Go to the documentation of this file.
1
/****************************************************************************
2
* This file is part of the aGrUM/pyAgrum library. *
3
* *
4
* Copyright (c) 2005-2026 by *
5
* - Pierre-Henri WUILLEMIN(_at_LIP6) *
6
* - Christophe GONZALES(_at_AMU) *
7
* *
8
* The aGrUM/pyAgrum library is free software; you can redistribute it *
9
* and/or modify it under the terms of either : *
10
* *
11
* - the GNU Lesser General Public License as published by *
12
* the Free Software Foundation, either version 3 of the License, *
13
* or (at your option) any later version, *
14
* - the MIT license (MIT), *
15
* - or both in dual license, as here. *
16
* *
17
* (see https://agrum.gitlab.io/articles/dual-licenses-lgplv3mit.html) *
18
* *
19
* This aGrUM/pyAgrum library is distributed in the hope that it will be *
20
* useful, but WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
21
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES MERCHANTABILITY or FITNESS *
22
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
23
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
24
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
25
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR *
26
* OTHER DEALINGS IN THE SOFTWARE. *
27
* *
28
* See LICENCES for more details. *
29
* *
30
* SPDX-FileCopyrightText: Copyright 2005-2026 *
31
* - Pierre-Henri WUILLEMIN(_at_LIP6) *
32
* - Christophe GONZALES(_at_AMU) *
33
* SPDX-License-Identifier: LGPL-3.0-or-later OR MIT *
34
* *
35
* Contact : info_at_agrum_dot_org *
36
* homepage : http://agrum.gitlab.io *
37
* gitlab : https://gitlab.com/agrumery/agrum *
38
* *
39
****************************************************************************/
40
41
#pragma once
42
43
51
52
#include <
agrum/base/multidim/utils/operators/multiDimCompleteProjection.h
>
// to ease IDE parser
53
#ifndef DOXYGEN_SHOULD_SKIP_THIS
54
55
# include <limits>
56
57
# include <
agrum/agrum.h
>
58
59
namespace
gum
{
60
61
// constructor
62
template
<
typename
GUM_ELEMENT,
template
<
typename
>
class
TABLE >
63
MultiDimCompleteProjection< GUM_ELEMENT, TABLE >::MultiDimCompleteProjection
(
64
GUM_ELEMENT (*proj)(
const
TABLE< GUM_ELEMENT >&,
Instantiation
*)) : proj_(proj) {
65
// for debugging purposes
66
GUM_CONSTRUCTOR(MultiDimCompleteProjection);
67
}
68
69
// copy constructor
70
template
<
typename
GUM_ELEMENT,
template
<
typename
>
class
TABLE >
71
MultiDimCompleteProjection< GUM_ELEMENT, TABLE >::MultiDimCompleteProjection(
72
const
MultiDimCompleteProjection< GUM_ELEMENT, TABLE >& from) : proj_(from.proj_) {
73
// for debugging purposes
74
GUM_CONS_CPY(MultiDimCompleteProjection);
75
}
76
77
// destructor
78
template
<
typename
GUM_ELEMENT,
template
<
typename
>
class
TABLE >
79
MultiDimCompleteProjection< GUM_ELEMENT, TABLE >::~MultiDimCompleteProjection() {
80
// for debugging purposes
81
GUM_DESTRUCTOR(MultiDimCompleteProjection);
82
}
83
84
// virtual constructor
85
template
<
typename
GUM_ELEMENT,
template
<
typename
>
class
TABLE >
86
MultiDimCompleteProjection< GUM_ELEMENT, TABLE >*
87
MultiDimCompleteProjection< GUM_ELEMENT, TABLE >::newFactory()
const
{
88
return
new
MultiDimCompleteProjection< GUM_ELEMENT, TABLE >(*
this
);
89
}
90
91
// creates and returns the projection of the table over a subset of its vars
92
template
<
typename
GUM_ELEMENT,
template
<
typename
>
class
TABLE >
93
GUM_ELEMENT
94
MultiDimCompleteProjection< GUM_ELEMENT, TABLE >::project(
const
TABLE< GUM_ELEMENT >& table,
95
Instantiation* inst) {
96
return
proj_(table, inst);
97
}
98
99
// changes the function used for projecting TABLES
100
template
<
typename
GUM_ELEMENT,
template
<
typename
>
class
TABLE >
101
void
MultiDimCompleteProjection< GUM_ELEMENT, TABLE >::setProjectFunction(
102
GUM_ELEMENT (*proj)(
const
TABLE< GUM_ELEMENT >&, Instantiation*)) {
103
proj_ = proj;
104
}
105
106
// returns the projection function currently used by the projector
107
template
<
typename
GUM_ELEMENT,
template
<
typename
>
class
TABLE >
108
GUM_ELEMENT (*MultiDimCompleteProjection< GUM_ELEMENT, TABLE >::projectFunction())(
109
const
TABLE< GUM_ELEMENT >&,
110
Instantiation*) {
111
return
proj_;
112
}
113
114
}
/* namespace gum */
115
116
#endif
/* DOXYGEN_SHOULD_SKIP_THIS */
agrum.h
gum::Instantiation
Class for assigning/browsing values to tuples of discrete variables.
Definition
instantiation.h:102
gum::MultiDimCompleteProjection::MultiDimCompleteProjection
MultiDimCompleteProjection(GUM_ELEMENT(*proj)(const TABLE< GUM_ELEMENT > &, Instantiation *))
Default constructor.
multiDimCompleteProjection.h
gum
gum is the global namespace for all aGrUM entities
Definition
agrum.h:46
aGrUM
3.2.0
© PHW&CG&others - 2022
DoXyGeN 1.18.0