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,
70 matrix(&calib->matrix)
74 void ProcMatrix::configure(ConfIterator iter,
unsigned int n)
76 if (n != matrix.getCols())
79 for(
unsigned int col = 0; col < matrix.getCols(); col++)
82 for(
unsigned int row = 0; row < matrix.getRows(); row++)
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;
106 result.reserve(matrix.getRows() * matrix.getCols());
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