aGrUM  0.14.2
projectionPattern4MultiDimFunctionGraph.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005 by Pierre-Henri WUILLEMIN et Christophe GONZALES *
3  * {prenom.nom}_at_lip6.fr *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
30 
31 // check if we allowed these patterns to be used
32 #ifndef GUM_PROJECTION_PATTERN_ALLOWED
33 
34 // #warning To use projectionPattern, you must define
35 // GUM_PROJECTION_PATTERN_ALLOWED
36 
37 #else
38 
42 
43 namespace gum {
44 
45  // a specialized function for projecting a multiDimFunctionGraph over a subset
46  // of its vars
47 
48 # ifdef GUM_MULTI_DIM_PROJECTION_NAME
49 # define GUM_MULTI_DIM_PROJECTION_TYPE GUM_SCALAR
50  template < typename GUM_SCALAR >
51  MultiDimFunctionGraph< GUM_SCALAR >* GUM_MULTI_DIM_PROJECTION_NAME(
53  const Set< const DiscreteVariable* >& delVars)
54 # endif
55 
56 
57 # ifdef GUM_MULTI_DIM_PROJECTION_IMPL2DECISION_GRAPH_NAME
58 # define GUM_MULTI_DIM_PROJECTION_TYPE GUM_SCALAR
59  template < typename GUM_SCALAR >
60  MultiDimImplementation< GUM_SCALAR >* GUM_MULTI_DIM_PROJECTION_IMPL2DECISION_GRAPH_NAME(
61  const MultiDimImplementation< GUM_SCALAR >* ttable,
62  const Set< const DiscreteVariable* >& delVars)
63 # endif
64  {
65 
66 # ifdef GUM_MULTI_DIM_PROJECTION_IMPL2DECISION_GRAPH_NAME
68  reinterpret_cast< const MultiDimFunctionGraph< GUM_SCALAR >* >(ttable);
69 # endif
70 
71  MultiDimFunctionGraphProjector< GUM_MULTI_DIM_PROJECTION_TYPE,
72  GUM_MULTI_DIM_PROJECTION_OPERATOR >
73  proj(table, delVars, GUM_MULTI_DIM_PROJECTION_NEUTRAL);
74 
75  return proj.project();
76  }
77 
78 
79 # undef GUM_MULTI_DIM_PROJECTION_TYPE
80 } // namespace gum
81 #endif /* GUM_PROJECTION_PATTERN_ALLOWED */
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
Headers of gum::MultiDimImplementation.
Header files of gum::Instantiation.
Headers of MultiDimFunctionGraph.
Class used to compute the projection of a function graph.