aGrUM  0.14.2
aprioriNoApriori_tpl.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005 by Christophe GONZALES and Pierre-Henri WUILLEMIN *
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  ***************************************************************************/
25 #ifndef DOXYGEN_SHOULD_SKIP_THIS
26 
27 namespace gum {
28 
29  namespace learning {
30 
31 
33  template < template < typename > class ALLOC >
35  const DatabaseTable< ALLOC >& database,
36  const Bijection< NodeId, std::size_t, ALLOC< std::size_t > >&
37  nodeId2columns,
38  const typename AprioriNoApriori< ALLOC >::allocator_type& alloc) :
39  Apriori< ALLOC >(database, nodeId2columns, alloc) {
41  GUM_CONSTRUCTOR(AprioriNoApriori);
42  }
43 
44 
46  template < template < typename > class ALLOC >
48  const AprioriNoApriori< ALLOC >& from,
49  const typename AprioriNoApriori< ALLOC >::allocator_type& alloc) :
50  Apriori< ALLOC >(from, alloc) {
51  GUM_CONS_CPY(AprioriNoApriori);
52  }
53 
54 
56  template < template < typename > class ALLOC >
58  const AprioriNoApriori< ALLOC >& from) :
59  AprioriNoApriori< ALLOC >(from, from.getAllocator()) {}
60 
61 
63  template < template < typename > class ALLOC >
65  AprioriNoApriori< ALLOC >&& from,
66  const typename AprioriNoApriori< ALLOC >::allocator_type& alloc) :
67  Apriori< ALLOC >(std::move(from), alloc) {
68  GUM_CONS_MOV(AprioriNoApriori);
69  }
70 
71 
73  template < template < typename > class ALLOC >
75  AprioriNoApriori< ALLOC >&& from) :
76  AprioriNoApriori< ALLOC >(std::move(from), from.getAllocator()) {}
77 
78 
80  template < template < typename > class ALLOC >
81  AprioriNoApriori< ALLOC >* AprioriNoApriori< ALLOC >::clone(
82  const typename AprioriNoApriori< ALLOC >::allocator_type& alloc) const {
83  ALLOC< AprioriNoApriori< ALLOC > > allocator(alloc);
84  AprioriNoApriori< ALLOC >* apriori = allocator.allocate(1);
85  try {
86  allocator.construct(apriori, *this, alloc);
87  } catch (...) {
88  allocator.deallocate(apriori, 1);
89  throw;
90  }
91 
92  return apriori;
93  }
94 
95 
97  template < template < typename > class ALLOC >
98  INLINE AprioriNoApriori< ALLOC >* AprioriNoApriori< ALLOC >::clone() const {
99  return clone(this->getAllocator());
100  }
101 
102 
104  template < template < typename > class ALLOC >
106  GUM_DESTRUCTOR(AprioriNoApriori);
107  }
108 
109 
111  template < template < typename > class ALLOC >
112  INLINE AprioriNoApriori< ALLOC >& AprioriNoApriori< ALLOC >::
113  operator=(const AprioriNoApriori< ALLOC >& from) {
115  return *this;
116  }
117 
118 
120  template < template < typename > class ALLOC >
121  INLINE AprioriNoApriori< ALLOC >& AprioriNoApriori< ALLOC >::
122  operator=(AprioriNoApriori< ALLOC >&& from) {
123  Apriori< ALLOC >::operator=(std::move(from));
124  return *this;
125  }
126 
127 
129  template < template < typename > class ALLOC >
130  INLINE void AprioriNoApriori< ALLOC >::setWeight(const double) {}
131 
132 
134  template < template < typename > class ALLOC >
135  INLINE bool AprioriNoApriori< ALLOC >::isOfType(const std::string& type) {
136  return AprioriNoAprioriType::isOfType(type);
137  }
138 
139 
141  template < template < typename > class ALLOC >
142  INLINE const std::string& AprioriNoApriori< ALLOC >::getType() const {
144  }
145 
146 
148  template < template < typename > class ALLOC >
149  INLINE bool AprioriNoApriori< ALLOC >::isInformative() const {
150  return false;
151  }
152 
153 
155  template < template < typename > class ALLOC >
157  const IdSet< ALLOC >& idset,
158  std::vector< double, ALLOC< double > >& counts) {}
159 
160 
162  template < template < typename > class ALLOC >
164  const IdSet< ALLOC >& idset,
165  std::vector< double, ALLOC< double > >& counts) {}
166 
167 
168  } /* namespace learning */
169 
170 } /* namespace gum */
171 
172 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
AprioriNoApriori< ALLOC > & operator=(const AprioriNoApriori< ALLOC > &from)
copy operator
virtual bool isOfType(const std::string &type) final
indicates whether an apriori is of a certain type
virtual void setWeight(const double weight)
sets the weight of the a priori (kind of effective sample size)
AprioriNoApriori(const DatabaseTable< ALLOC > &database, const Bijection< NodeId, std::size_t, ALLOC< std::size_t > > &nodeId2columns=Bijection< NodeId, std::size_t, ALLOC< std::size_t > >(), const allocator_type &alloc=allocator_type())
default constructor
virtual const std::string & getType() const final
returns the type of the apriori
static const std::string type
Definition: aprioriTypes.h:45
static bool isOfType(const std::string &t)
Definition: aprioriTypes.h:46
virtual void addAllApriori(const IdSet< ALLOC > &idset, std::vector< double, ALLOC< double > > &counts) final
adds the apriori to a counting vector corresponding to the idset
STL namespace.
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
AprioriNoAprioriType type
the type of the a priori
virtual bool isInformative() const final
indicates whether the apriori is potentially informative
virtual void setWeight(const double weight) final
sets the weight of the a priori (kind of effective sample size)
Apriori< ALLOC > & operator=(const Apriori< ALLOC > &from)
copy operator
allocator_type getAllocator() const
returns the allocator used by the internal apriori
virtual ~AprioriNoApriori()
destructor
virtual AprioriNoApriori< ALLOC > * clone() const
virtual copy constructor
ALLOC< NodeId > allocator_type
type for the allocators passed in arguments of methods
Size NodeId
Type for node ids.
Definition: graphElements.h:97
Apriori(const DatabaseTable< ALLOC > &database, const Bijection< NodeId, std::size_t, ALLOC< std::size_t > > &nodeId2columns=Bijection< NodeId, std::size_t, ALLOC< std::size_t > >(), const allocator_type &alloc=allocator_type())
default constructor
virtual void addConditioningApriori(const IdSet< ALLOC > &idset, std::vector< double, ALLOC< double > > &counts) final
adds the apriori to a counting vectordefined over the right hand side of the idset ...