25 #ifndef GUM_POTENTIAL_H 26 #define GUM_POTENTIAL_H 56 template <
typename GUM_SCALAR >
192 GUM_SCALAR
sum()
const;
196 GUM_SCALAR
max()
const;
198 GUM_SCALAR
min()
const;
221 reorganize(
const std::vector< const DiscreteVariable* >& vars)
const;
262 const std::vector< std::string >& mapSrc)
const;
273 fillWith(
const std::vector< GUM_SCALAR >& v)
const;
430 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS Potential< GUM_SCALAR > operator+(const Potential< GUM_SCALAR > &p2) const
the function to be used to add two Potentials
aGrUM's Potential is a multi-dimensional array with tensor operators.
Potential< GUM_SCALAR > extract(const Instantiation &inst) const
create a new Potential extracted from *this given a partial instantiation
MultiDimImplementation< GUM_SCALAR > * _content
The true container.
Potential< GUM_SCALAR > operator/(const Potential< GUM_SCALAR > &p2) const
the function to be used to divide two Potentials
virtual const std::string toString() const
Default implementation of MultiDimContainer::set().
Potential< GUM_SCALAR > isNonZeroMap() const
create a boolean-like potential using the predicate isNonZero
GUM_SCALAR min() const
min of all elements in the Potential
const Potential< GUM_SCALAR > & normalize() const
normalisation of this do nothing if sum is 0
Potential< GUM_SCALAR > & operator-=(const Potential< GUM_SCALAR > &r)
the function to be used to add two Potentials
GUM_SCALAR minNonZero() const
min of all non zero elements in the Potential
GUM_SCALAR _empty_value
value of the MultiDimDecorator if no dimension.
const Potential< GUM_SCALAR > & scale(GUM_SCALAR v) const
create a new potential multiplied by v from *this
Potential< GUM_SCALAR > & operator/=(const Potential< GUM_SCALAR > &r)
the function to be used to add two Potentials
Base class for discrete random variable.
Potential< GUM_SCALAR > & operator*=(const Potential< GUM_SCALAR > &r)
the function to be used to add two Potentials
GUM_SCALAR KL(const Potential< GUM_SCALAR > &p) const
compute KL divergence between this and p Checks the compatibility and then compute KL divergence ...
Potential< GUM_SCALAR > margProdOut(const Set< const DiscreteVariable * > &del_vars) const
Projection using multiplication as operation (and implementation-optimized operations) ...
gum is the global namespace for all aGrUM entities
Abstract base class for all multi dimensionnal containers.
Set< Instantiation > argmin() const
set of instantiation corresponding to the min in the Potential
Headers of gum::MultiDimImplementation.
virtual bool empty() const final
Returns true if no var is in *this.
Set< const DiscreteVariable *> _complementVars(const Set< const DiscreteVariable * > &del_vars) const
virtual const MultiDimImplementation< GUM_SCALAR > * content() const final
Returns the implementation for this object (may be *this).
Set< Instantiation > findAll(GUM_SCALAR v) const
set of instantiation corresponding to the parameter v in the Potential
Representation of a setA Set is a structure that contains arbitrary elements.
GUM_SCALAR product() const
product of all elements in the Potential
Potential< GUM_SCALAR > margProdIn(const Set< const DiscreteVariable * > &kept_vars) const
Projection using multiplication as operation (and implementation-optimized operations) ...
const Potential< GUM_SCALAR > & sq() const
apply $x^2$ on every element of the container
virtual void apply(std::function< GUM_SCALAR(GUM_SCALAR) > f) const final
Apply a function on every element of the container.
bool operator==(const Potential< GUM_SCALAR > &r) const
the function to be used to add two Potentials
Idx draw() const
get a value at random from a 1-D distribution
const Potential< GUM_SCALAR > & fillWith(const Potential< GUM_SCALAR > &src) const
copy a Potential data using name of variables and labels (not necessarily the same variables in the s...
Potential< GUM_SCALAR > margSumIn(const Set< const DiscreteVariable * > &kept_vars) const
Projection using sum as operation (and implementation-optimized operations)
Set< Instantiation > argmax() const
set of instantiation corresponding to the max in the Potential
Potential< GUM_SCALAR > & operator=(const Potential< GUM_SCALAR > &src)
Default constructor.
GUM_SCALAR max() const
max of all elements in the Potential
Headers for MultiDimDecorator.
Potential< GUM_SCALAR > reorganize(const std::vector< const DiscreteVariable * > &vars) const
create a new Potential with another order
Implementation of the Potential class.
Potential< GUM_SCALAR > operator-(const Potential< GUM_SCALAR > &p2) const
the function to be used to subtract two Potentials
const Potential< GUM_SCALAR > & abs() const
Apply abs on every element of the container.
Potential< GUM_SCALAR > margMaxIn(const Set< const DiscreteVariable * > &kept_vars) const
Projection using max as operation (and implementation-optimized operations)
GUM_SCALAR entropy() const
entropy of the Potential
Potential< GUM_SCALAR > margSumOut(const Set< const DiscreteVariable * > &del_vars) const
Projection using sum as operation (and implementation-optimized operations)
Potential< GUM_SCALAR > & operator+=(const Potential< GUM_SCALAR > &r)
the function to be used to add two Potentials
Class for assigning/browsing values to tuples of discrete variables.
void normalizeAsCPT() const
normalisation of this as a CPT
Decorator design pattern in order to separate implementations from multidimensional matrix concepts...
GUM_SCALAR sum() const
sum of all elements in the Potential
virtual const std::string toString() const
the function to be used to add two Potentials
<agrum/multidim/multiDimImplementation.h>
Potential< GUM_SCALAR > margMaxOut(const Set< const DiscreteVariable * > &del_vars) const
Projection using max as operation (and implementation-optimized operations)
Size Idx
Type for indexes.
GUM_SCALAR maxNonOne() const
max of all non one elements in the Potential
Potential< GUM_SCALAR > margMinOut(const Set< const DiscreteVariable * > &del_vars) const
Projection using min as operation (and implementation-optimized operations)
Potential< GUM_SCALAR > operator*(const Potential< GUM_SCALAR > &p2) const
the function to be used to multiply two Potentials
const Potential< GUM_SCALAR > & translate(GUM_SCALAR v) const
create a new potential added with v from *this
bool operator!=(const Potential< GUM_SCALAR > &r) const
the function to be used to add two Potentials
virtual Potential< GUM_SCALAR > * newFactory() const
Default implementation of MultiDimContainer::set().
Potential()
Default constructor.
Potential< GUM_SCALAR > putFirst(const DiscreteVariable *var) const
create a new Potential with a certain variable in first
Potential< GUM_SCALAR > margMinIn(const Set< const DiscreteVariable * > &kept_vars) const
Projection using min as operation (and implementation-optimized operations)