57 template < GUM_Numeric GUM_SCALAR >
59 GUM_SCALAR default_weight) :
66 template < GUM_Numeric GUM_SCALAR >
68 GUM_SCALAR causal_weight)
const {
69 if (external_weight == (GUM_SCALAR)0) {
76 template < GUM_Numeric GUM_SCALAR >
83 template < GUM_Numeric GUM_SCALAR >
91 template < GUM_Numeric GUM_SCALAR >
96 template < GUM_Numeric GUM_SCALAR >
104 if (i.
val(C) > 1)
return (GUM_SCALAR)0.0;
108 for (
Idx j = 1; j < this->
nbrDim(); j++) {
118 return (i.
val(C) == 1) ? fact : (GUM_SCALAR)1.0 - fact;
121 template < GUM_Numeric GUM_SCALAR >
124 s << MultiDimImplementation< GUM_SCALAR >::variable(0) <<
"=noisyAND(["
127 for (
Idx i = 1; i < MultiDimImplementation< GUM_SCALAR >::nbrDim(); i++)
137 template < GUM_Numeric GUM_SCALAR >
142 template < GUM_Numeric GUM_SCALAR >
148 template < GUM_Numeric GUM_SCALAR >
150 static const std::string str =
"MultiDimNoisyAND";
Set of pairs of elements with fast search for both elements.
Base class for discrete random variable.
Class for assigning/browsing values to tuples of discrete variables.
Idx val(Idx i) const
Returns the current value of the variable at position i.
Exception: at least one argument passed to a function is not what was expected.
static void checkWeightsAreProbabilities_(GUM_SCALAR external_weight, GUM_SCALAR causal_weight)
GUM_SCALAR _external_weight_
MultiDimICIModel(GUM_SCALAR external_weight, GUM_SCALAR default_weight=(GUM_SCALAR) 1.0)
GUM_SCALAR externalWeight() const
GUM_SCALAR _default_weight_
GUM_SCALAR causalWeight(const DiscreteVariable &v) const
const DiscreteVariable & variable(Idx i) const override
Idx nbrDim() const override
Noisy AND representation.
std::string toString() const override
Returns the real name of the multiDimArray.
GUM_SCALAR get(const Instantiation &i) const override
Returns the real name of the multiDimArray.
~MultiDimNoisyAND() override
Destructor.
void checkCausalWeight_(GUM_SCALAR external_weight, GUM_SCALAR causal_weight) const override
The leak and the causal weights are probabilities, and the leak cannot be null.
const std::string & name() const override
Returns the real name of the multiDimArray.
MultiDimNoisyAND(GUM_SCALAR external_weight, GUM_SCALAR default_weight=(GUM_SCALAR) 1.0)
Default constructor.
MultiDimContainer< GUM_SCALAR > * newFactory() const override
This method creates a clone of this object, withouth its content (including variable),...
Exception : operation not allowed.
#define GUM_ERROR(type, msg)
Size Idx
Type for indexes.
class for NoisyAND-net implementation as multiDim
gum is the global namespace for all aGrUM entities
std::ostream & operator<<(std::ostream &stream, const AVLTree< Val, Cmp > &tree)
display the content of a tree