17namespace CurveFitting {
36 for (
size_t i = 0; i < fun.
nParams(); ++i) {
37 m_index[i] =
static_cast<int>(np);
60 for (
size_t iY = 9; iY <
m_J.
size1() - 1; iY += 10)
63 throw std::runtime_error(
"Try to add number to column of Jacobian matrix "
64 "which does not exist.");
68 void set(
size_t iY,
size_t iP,
double value)
override {
74 double get(
size_t iY,
size_t iP)
override {
101 if (iActiveP < m_J->size2()) {
103 m_J->mutator().data()[iActiveP *
m_J->size1()] +=
value;
104 m_J->mutator().data()[(iActiveP + 1) *
m_J->size1() - 1] +=
value;
105 for (
size_t iY = 9; iY <
m_J->size1() - 1; iY += 10)
106 m_J->mutator().data()[iActiveP *
m_J->size1() + iY] +=
value;
108 throw std::runtime_error(
"Try to add number to column of Jacobian matrix "
109 "which does not exist.");
113 void set(
size_t iY,
size_t iP,
double value)
override {
131 m_J->mutator().data()[j *
m_J->size1() + iY] =
value;
134 double get(
size_t iY,
size_t iP)
override {
137 return m_J->inspector().data()[j *
m_J->size1() + iY];
double value
The value of the point.
This is an interface to a fitting function - a semi-abstarct class.
virtual size_t nParams() const =0
Total number of parameters.
bool isActive(size_t i) const
Check if an active parameter i is actually active.
Represents the Jacobian in IFitFunction::functionDeriv.
Two implementations of Jacobian.
map_type & getJ()
Get the map to the jacobian.
void zero() override
overwrite base method
EigenJacobian(const API::IFunction &fun, const size_t ny)
Constructor.
double get(size_t iY, size_t iP) override
overwrite base method
std::vector< int > m_index
Maps declared indeces to active. For fixed (tied) parameters holds -1.
void addNumberToColumn(const double &value, const size_t &iActiveP) override
overwrite base method
EigenMatrix m_J
The internal jacobian matrix.
void set(size_t iY, size_t iP, double value) override
overwrite base method
A wrapper around Eigen::Matrix.
void set(size_t i, size_t j, double value)
Set an element.
double get(size_t i, size_t j) const
Get an element.
size_t size1() const
First size of the matrix.
map_type & mutator()
Get the map to Eigen matrix.
void zero()
Set all elements to zero.
size_t size2() const
Second size of the matrix.
void resize(const size_t nx, const size_t ny)
Resize the matrix.
The implementation of Jacobian.
T * m_J
The internal jacobian matrix.
double get(size_t iY, size_t iP) override
overwrite base method
void set(size_t iY, size_t iP, double value) override
overwrite base method
void addNumberToColumn(const double &value, const size_t &iActiveP) override
overwrite base method
void setJ(T *J)
Set the pointer to the jacobian.
void zero() override
overwrite base method
std::vector< int > m_index
Maps declared indices to active. For fixed (tied) parameters holds -1.
Eigen::Map< Eigen::MatrixXd, 0, dynamic_stride > map_type
Helper class which provides the Collimation Length for SANS instruments.