33 ~ProcMultiply()
override {}
35 void configure(ConfIterator iter,
unsigned int n)
override;
36 void eval(ValueIterator iter,
unsigned int n)
const override;
37 std::vector<double> deriv(ValueIterator iter,
unsigned int n)
const override;
40 typedef std::vector<unsigned int>
Config;
43 std::vector<Config>
out;
53 void ProcMultiply::configure(ConfIterator iter,
unsigned int n) {
57 for (
unsigned int i = 0;
i <
in;
i++)
58 iter++(Variable::FLAG_NONE);
60 for (
unsigned int i = 0;
i <
out.size();
i++)
61 iter << Variable::FLAG_NONE;
64 void ProcMultiply::eval(ValueIterator iter,
unsigned int n)
const {
65 double *
values = (
double *)alloca(in *
sizeof(
double));
66 for (
double *
pos = values; iter; iter++,
pos++) {
68 throw cms::Exception(
"ProcMultiply") <<
"Special input variable encountered " 77 product *= values[*
var];
83 std::vector<double> ProcMultiply::deriv(ValueIterator iter,
unsigned int n)
const {
84 std::vector<double>
values;
85 std::vector<unsigned int>
offsets;
86 unsigned int size = 0;
88 offsets.push_back(size);
90 values.push_back(*iter++);
96 for (
unsigned int i = 0;
i <
config->size();
i++) {
98 for (
unsigned int j = 0;
j <
config->size();
j++)
100 product *= values[(*config)[
j]];
102 result[k * size + offsets[
i]] = product;