aGrUM  0.16.0
aprioriK2_tpl.h
Go to the documentation of this file.
1 
28 #ifndef DOXYGEN_SHOULD_SKIP_THIS
29 
30 namespace gum {
31 
32  namespace learning {
33 
34 
36  template < template < typename > class ALLOC >
38  const DatabaseTable< ALLOC >& database,
39  const Bijection< NodeId, std::size_t, ALLOC< std::size_t > >&
40  nodeId2columns,
41  const typename AprioriK2< ALLOC >::allocator_type& alloc) :
42  AprioriSmoothing< ALLOC >(database, nodeId2columns, alloc) {
43  GUM_CONSTRUCTOR(AprioriK2);
44  }
45 
46 
48  template < template < typename > class ALLOC >
50  const AprioriK2< ALLOC >& from,
51  const typename AprioriK2< ALLOC >::allocator_type& alloc) :
52  AprioriSmoothing< ALLOC >(from, alloc) {
53  GUM_CONS_CPY(AprioriK2);
54  }
55 
56 
58  template < template < typename > class ALLOC >
59  INLINE AprioriK2< ALLOC >::AprioriK2(const AprioriK2< ALLOC >& from) :
60  AprioriK2< ALLOC >(from, from.getAllocator()) {}
61 
62 
64  template < template < typename > class ALLOC >
66  AprioriK2< ALLOC >&& from,
67  const typename AprioriK2< ALLOC >::allocator_type& alloc) :
68  AprioriSmoothing< ALLOC >(std::move(from), alloc) {
69  GUM_CONS_MOV(AprioriK2);
70  }
71 
72 
74  template < template < typename > class ALLOC >
75  INLINE AprioriK2< ALLOC >::AprioriK2(AprioriK2< ALLOC >&& from) :
76  AprioriK2< ALLOC >(std::move(from), from.getAllocator()) {}
77 
78 
80  template < template < typename > class ALLOC >
81  AprioriK2< ALLOC >* AprioriK2< ALLOC >::clone(
82  const typename AprioriK2< ALLOC >::allocator_type& alloc) const {
83  ALLOC< AprioriK2< ALLOC > > allocator(alloc);
84  AprioriK2< 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 AprioriK2< ALLOC >* AprioriK2< ALLOC >::clone() const {
99  return clone(this->getAllocator());
100  }
101 
102 
104  template < template < typename > class ALLOC >
106  GUM_DESTRUCTOR(AprioriK2);
107  }
108 
109 
111  template < template < typename > class ALLOC >
112  INLINE AprioriK2< ALLOC >& AprioriK2< ALLOC >::
113  operator=(const AprioriK2< ALLOC >& from) {
115  return *this;
116  }
117 
118 
120  template < template < typename > class ALLOC >
121  INLINE AprioriK2< ALLOC >& AprioriK2< ALLOC >::
122  operator=(AprioriK2< ALLOC >&& from) {
123  AprioriSmoothing< ALLOC >::operator=(std::move(from));
124  return *this;
125  }
126 
127 
129  template < template < typename > class ALLOC >
130  INLINE void AprioriK2< ALLOC >::setWeight(const double weight) {}
131 
132 
133  } /* namespace learning */
134 
135 } /* namespace gum */
136 
137 #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
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
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:58
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:98