22 using namespace PhysicsTools;
31 ProcMatrix(
const char *
name,
34 virtual ~ProcMatrix() {}
36 virtual void configure(ConfIterator iter,
unsigned int n);
37 virtual void eval(ValueIterator iter,
unsigned int n)
const;
38 virtual std::vector<double> deriv(ValueIterator iter,
39 unsigned int n)
const;
45 rows(calib->
rows), cols(calib->columns),
48 inline unsigned int getRows()
const {
return rows; }
49 inline unsigned int getCols()
const {
return cols; }
51 inline double operator () (
unsigned int row,
52 unsigned int col)
const
53 {
return coeffs[row * cols + col]; }
58 std::vector<double> coeffs;
66 ProcMatrix::ProcMatrix(
const char *
name,
74 void ProcMatrix::configure(ConfIterator iter,
unsigned int n)
79 for(
unsigned int col = 0; col <
matrix.getCols(); col++)
80 iter++(Variable::FLAG_NONE);
82 for(
unsigned int row = 0; row <
matrix.getRows(); row++)
83 iter << Variable::FLAG_NONE;
86 void ProcMatrix::eval(ValueIterator iter,
unsigned int n)
const
88 double *sums = (
double*)alloca(
matrix.getRows() *
sizeof(double));
89 for(
unsigned int row = 0; row <
matrix.getRows(); row++)
92 for(
unsigned int col = 0; col <
matrix.getCols(); col++) {
94 for(
unsigned int row = 0; row <
matrix.getRows(); row++)
95 sums[row] +=
matrix(row, col) * val;
98 for(
unsigned int row = 0; row <
matrix.getRows(); row++)
102 std::vector<double> ProcMatrix::deriv(ValueIterator iter,
103 unsigned int n)
const
105 std::vector<double>
result;
108 for(
unsigned int row = 0; row <
matrix.getRows(); row++)
109 for(
unsigned int col = 0; col <
matrix.getCols(); col++)
110 result.push_back(
matrix(row, col));
detail::ThreadSafeRegistry< ParameterSetID, ParameterSet, ProcessParameterSetIDCache > Registry
MVATrainerComputer * calib