aGrUM 3.1.1
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-2026 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-2026 *
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
55#include <string_view>
56
57namespace gum {
58 namespace prm {
59
69 template < GUM_Numeric GUM_SCALAR >
70 class PRMFormAttribute: public PRMAttribute< GUM_SCALAR > {
71 public:
73 std::string_view name,
74 const PRMType& type,
77
78 ~PRMFormAttribute() override;
79
82
86
89 const PRMAttribute< GUM_SCALAR >& source) override;
90
93
95 PRMType& type() override;
96
98 const PRMType& type() const override;
99
101 const Tensor< GUM_SCALAR >& cpf() const override;
102
104 void addParent(const PRMClassElement< GUM_SCALAR >& elt) override;
105
107 void addChild(const PRMClassElement< GUM_SCALAR >& elt) override;
108
111
114 void becomeCastDescendant(PRMType& subtype) override;
115
117 virtual const MultiDimImplementation< std::string >& formulas() const;
118
120 void swap(const PRMType& old_type, const PRMType& new_type) override;
121
122 protected:
123 PRMType* type_() override;
124 void type_(PRMType* t) override;
125
126 private:
127 PRMFormAttribute(const PRMFormAttribute& source);
129
132
134 mutable Tensor< GUM_SCALAR >* _cpf_;
135
138
141
142 void _fillCpf_() const;
143 };
144
145
146#ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
147 extern template class PRMFormAttribute< double >;
148#endif
149
150
151 } /* namespace prm */
152} // namespace gum
153
155
156#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:1640
Multidimensional matrix stored as an array in memory.
PRMAttribute(std::string_view 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:77
<agrum/PRM/elements/formAttribute.h>
PRMAttribute< GUM_SCALAR > * newFactory(const PRMClass< GUM_SCALAR > &c) const override
See gum::prm::PRMAttribute.
void copyCpf(const Bijection< const DiscreteVariable *, const DiscreteVariable * > &bif, const PRMAttribute< GUM_SCALAR > &source) override
See gum::prm::PRMAttribute.
virtual MultiDimImplementation< std::string > & formulas()
void addParent(const PRMClassElement< GUM_SCALAR > &elt) override
See gum::prm::PRMAttribute.
const PRMClass< GUM_SCALAR > * _class_
A pointe toward the class of this attribute.
PRMClassElement< GUM_SCALAR >::ClassElementType elt_type() const override
See gum::prm::PRMAttribute.
PRMType & type() override
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.
PRMFormAttribute(const PRMClass< GUM_SCALAR > &c, std::string_view name, const PRMType &type, MultiDimImplementation< std::string > *impl=new MultiDimArray< std::string >())
PRMAttribute< GUM_SCALAR > * copy(Bijection< const DiscreteVariable *, const DiscreteVariable * > bij) const override
See gum::prm::PRMAttribute.
PRMAttribute< GUM_SCALAR > * getCastDescendant() const override
See gum::prm::PRMAttribute.
PRMType * _type_
The random variable type of this attribute.
void becomeCastDescendant(PRMType &subtype) override
Change this attribute to be a cast descendant of a an attribute with type subtype.
const Tensor< GUM_SCALAR > & cpf() const override
See gum::prm::PRMAttribute.
void addChild(const PRMClassElement< GUM_SCALAR > &elt) override
See gum::prm::PRMAttribute.
PRMFormAttribute & operator=(const PRMFormAttribute &source)
void setAsCastDescendant(PRMAttribute< GUM_SCALAR > *attr) override
See gum::prm::PRMAttribute.
void swap(const PRMType &old_type, const PRMType &new_type) override
Swap old_type with new_type in the PRMClassElement cpt.
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