[082b02]: src / modules / bugs / functions / IfElse.h Maximize Restore History

Download this file

IfElse.h    35 lines (29 with data), 747 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#ifndef IF_ELSE_H_
#define IF_ELSE_H_
#include <function/ScalarFunction.h>
namespace jags {
namespace bugs {
/**
* The ifelse function returns either a or b depending on whether the
* value of x is zero or not
*
* @short Conditional selection
* <pre>
* y <- ifelse(x,a,b)
* y = a if x != 0
* y = b if x == 0
* </pre>
*/
class IfElse : public ScalarFunction
{
public:
IfElse ();
double evaluate(std::vector<double const *> const &args) const;
bool isDiscreteValued(std::vector<bool> const &mask) const;
bool isScale(std::vector<bool> const &mask,
std::vector<bool> const &fixed) const;
bool isLinear(std::vector<bool> const &mask,
std::vector<bool> const &fixed) const;
};
}}
#endif /* IF_ELSE_H_ */