[ff1121]: src / modules / bugs / functions / Sum.cc  Maximize  Restore  History

Download this file

42 lines (33 with data), 790 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
35
36
37
38
39
40
41
#include <config.h>
#include "Sum.h"
#include <util/logical.h>
using std::vector;
namespace jags {
namespace bugs {
Sum::Sum () : VectorFunction("sum", 0)
{
}
void Sum::evaluate(double *x, vector <double const *> const &args,
vector<unsigned int> const &lengths) const
{
double value = 0;
for (unsigned int j = 0; j < args.size(); ++j) {
for (unsigned int i = 0; i < lengths[j]; ++i) {
value += args[j][i];
}
}
*x = value;
}
bool Sum::checkParameterLength (vector<unsigned int> const &args) const
{
return true;
}
bool Sum::isDiscreteValued(vector<bool> const &mask) const
{
return allTrue(mask);
}
bool Sum::isScale(vector<bool> const &mask, vector<bool> const &fix) const
{
return true;
}
}}

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks