aGrUM  0.14.2
aprioriK2_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 AprioriK2< ALLOC >::allocator_type& alloc) :
39  AprioriSmoothing< ALLOC >(database, nodeId2columns, alloc) {
40  GUM_CONSTRUCTOR(AprioriK2);
41  }
42 
43 
45  template < template < typename > class ALLOC >
47  const AprioriK2< ALLOC >& from,
48  const typename AprioriK2< ALLOC >::allocator_type& alloc) :
49  AprioriSmoothing< ALLOC >(from, alloc) {
50  GUM_CONS_CPY(AprioriK2);
51  }
52 
53 
55  template < template < typename > class ALLOC >
56  INLINE AprioriK2< ALLOC >::AprioriK2(const AprioriK2< ALLOC >& from) :
57  AprioriK2< ALLOC >(from, from.getAllocator()) {}
58 
59 
61  template < template < typename > class ALLOC >
63  AprioriK2< ALLOC >&& from,
64  const typename AprioriK2< ALLOC >::allocator_type& alloc) :
65  AprioriSmoothing< ALLOC >(std::move(from), alloc) {
66  GUM_CONS_MOV(AprioriK2);
67  }
68 
69 
71  template < template < typename > class ALLOC >
72  INLINE AprioriK2< ALLOC >::AprioriK2(AprioriK2< ALLOC >&& from) :
73  AprioriK2< ALLOC >(std::move(from), from.getAllocator()) {}
74 
75 
77  template < template < typename > class ALLOC >
78  AprioriK2< ALLOC >* AprioriK2< ALLOC >::clone(
79  const typename AprioriK2< ALLOC >::allocator_type& alloc) const {
80  ALLOC< AprioriK2< ALLOC > > allocator(alloc);
81  AprioriK2< ALLOC >* apriori = allocator.allocate(1);
82  try {
83  allocator.construct(apriori, *this, alloc);
84  } catch (...) {
85  allocator.deallocate(apriori, 1);
86  throw;
87  }
88 
89  return apriori;
90  }
91 
92 
94  template < template < typename > class ALLOC >
95  INLINE AprioriK2< ALLOC >* AprioriK2< ALLOC >::clone() const {
96  return clone(this->getAllocator());
97  }
98 
99 
101  template < template < typename > class ALLOC >
103  GUM_DESTRUCTOR(AprioriK2);
104  }
105 
106 
108  template < template < typename > class ALLOC >
109  INLINE AprioriK2< ALLOC >& AprioriK2< ALLOC >::
110  operator=(const AprioriK2< ALLOC >& from) {
112  return *this;
113  }
114 
115 
117  template < template < typename > class ALLOC >
118  INLINE AprioriK2< ALLOC >& AprioriK2< ALLOC >::
119  operator=(AprioriK2< ALLOC >&& from) {
120  AprioriSmoothing< ALLOC >::operator=(std::move(from));
121  return *this;
122  }
123 
124 
126  template < template < typename > class ALLOC >
127  INLINE void AprioriK2< ALLOC >::setWeight(const double weight) {}
128 
129 
130  } /* namespace learning */
131 
132 } /* namespace gum */
133 
134 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
STL namespace.
virtual void setWeight(const double weight) final
dummy set weight function: in K2, weights are always equal to 1
AprioriK2(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
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
virtual AprioriK2< ALLOC > * clone() const
virtual copy constructor
virtual ~AprioriK2()
destructor
AprioriK2< ALLOC > & operator=(const AprioriK2< ALLOC > &from)
copy operator
double weight() const
returns the weight assigned to the apriori
ALLOC< NodeId > allocator_type
type for the allocators passed in arguments of methods
Definition: aprioriK2.h:55
allocator_type getAllocator() const
returns the allocator used by the internal apriori
AprioriSmoothing< ALLOC > & operator=(const AprioriSmoothing< ALLOC > &from)
copy operator
AprioriSmoothing(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
Size NodeId
Type for node ids.
Definition: graphElements.h:97