aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
PRMFormAttribute.h
Go to the documentation of this file.
1/****************************************************************************
2 * This file is part of the aGrUM/pyAgrum library. *
3 * *
4 * Copyright (c) 2005-2025 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-2025 *
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
48
49#ifndef GUM_FORM_ATTRIBUTE_H
50#define GUM_FORM_ATTRIBUTE_H
51
52
54
55namespace gum {
56 namespace prm {
57
67 template < typename GUM_SCALAR >
68 class PRMFormAttribute: public PRMAttribute< GUM_SCALAR > {
69 public:
71 const std::string& name,
72 const PRMType& type,
75
76 virtual ~PRMFormAttribute();
77
80
84
87 const PRMAttribute< GUM_SCALAR >& source);
88
91
93 virtual PRMType& type();
94
96 virtual const PRMType& type() const;
97
99 virtual const Tensor< GUM_SCALAR >& cpf() const;
100
102 virtual void addParent(const PRMClassElement< GUM_SCALAR >& elt);
103
105 virtual void addChild(const PRMClassElement< GUM_SCALAR >& elt);
106
109
112 virtual void becomeCastDescendant(PRMType& subtype);
113
115 virtual const MultiDimImplementation< std::string >& formulas() const;
116
118 virtual void swap(const PRMType& old_type, const PRMType& new_type);
119
120 protected:
121 virtual PRMType* type_();
122 virtual void type_(PRMType* t);
123
124 private:
125 PRMFormAttribute(const PRMFormAttribute& source);
127
130
132 mutable Tensor< GUM_SCALAR >* _cpf_;
133
136
139
140 void _fillCpf_() const;
141 };
142
143
144#ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
145 extern template class PRMFormAttribute< double >;
146#endif
147
148
149 } /* namespace prm */
150} // namespace gum
151
153
154#endif /* GUM_ATTRIBUTE_H */
Headers of gum::prm::Class<GUM_SCALAR>.
Inline implementation of gum::PRMFormAttribute.
Set of pairs of elements with fast search for both elements.
Definition bijection.h:1594
Multidimensional matrix stored as an array in memory.
PRMAttribute(const std::string &name)
Destructor.
Abstract class representing an element of PRM class.
ClassElementType
Returns true if obj_ptr is of type PRMReferenceSlot.
A PRMClass is an object of a PRM representing a fragment of a Bayesian network which can be instantia...
Definition PRMClass.h:75
<agrum/PRM/elements/formAttribute.h>
virtual void swap(const PRMType &old_type, const PRMType &new_type)
Swap old_type with new_type in the PRMClassElement cpt.
virtual MultiDimImplementation< std::string > & formulas()
virtual void addChild(const PRMClassElement< GUM_SCALAR > &elt)
See gum::prm::PRMAttribute.
const PRMClass< GUM_SCALAR > * _class_
A pointe toward the class of this attribute.
virtual PRMAttribute< GUM_SCALAR > * getCastDescendant() const
See gum::prm::PRMAttribute.
virtual PRMClassElement< GUM_SCALAR >::ClassElementType elt_type() const
See gum::prm::PRMAttribute.
Tensor< GUM_SCALAR > * _cpf_
A pointer on the Tensor of this attribute.
MultiDimImplementation< std::string > * _formulas_
A pointer on the Tensor of this attribute.
virtual void setAsCastDescendant(PRMAttribute< GUM_SCALAR > *attr)
See gum::prm::PRMAttribute.
virtual void becomeCastDescendant(PRMType &subtype)
Change this attribute to be a cast descendant of a an attribute with type subtype.
PRMType * _type_
The random variable type of this attribute.
virtual void copyCpf(const Bijection< const DiscreteVariable *, const DiscreteVariable * > &bif, const PRMAttribute< GUM_SCALAR > &source)
See gum::prm::PRMAttribute.
virtual PRMType & type()
See gum::prm::PRMAttribute.
virtual PRMAttribute< GUM_SCALAR > * copy(Bijection< const DiscreteVariable *, const DiscreteVariable * > bij) const
See gum::prm::PRMAttribute.
PRMFormAttribute & operator=(const PRMFormAttribute &source)
virtual void addParent(const PRMClassElement< GUM_SCALAR > &elt)
See gum::prm::PRMAttribute.
virtual PRMAttribute< GUM_SCALAR > * newFactory(const PRMClass< GUM_SCALAR > &c) const
See gum::prm::PRMAttribute.
PRMFormAttribute(const PRMClass< GUM_SCALAR > &c, const std::string &name, const PRMType &type, MultiDimImplementation< std::string > *impl=new MultiDimArray< std::string >())
virtual const Tensor< GUM_SCALAR > & cpf() const
See gum::prm::PRMAttribute.
const std::string & name() const
Returns the name of this object.
This is a decoration of the DiscreteVariable class.
Definition PRMType.h:78
namespace for all probabilistic relational models entities
Definition agrum.h:68
gum is the global namespace for all aGrUM entities
Definition agrum.h:46