10 #ifndef ROL_REGRESSIONERROR_H
11 #define ROL_REGRESSIONERROR_H
31 if (data.size() != x.size()) {
39 Real
value(
const std::vector<Real> &x, Real &tol ) {
42 const unsigned dim = x.size();
43 Real val = data[0] - x[0];
44 for (
unsigned i = 1; i <
dim; ++i) val -= data[i] * x[i];
48 void gradient( std::vector<Real> &g,
const std::vector<Real> &x, Real &tol ) {
51 const unsigned dim = g.size();
52 g[0] =
static_cast<Real
>(-1);
53 for (
unsigned i = 1; i <
dim; ++i) g[i] = -data[i];
56 void hessVec( std::vector<Real> &hv,
const std::vector<Real> &v,
const std::vector<Real> &x, Real &tol ) {
58 hv.assign(hv.size(),
static_cast<Real
>(0));
void gradient(std::vector< Real > &g, const std::vector< Real > &x, Real &tol)
Provides the interface to evaluate linear regression error.
void hessVec(std::vector< Real > &hv, const std::vector< Real > &v, const std::vector< Real > &x, Real &tol)
Real value(const std::vector< Real > &x, Real &tol)
Specializes the ROL::Objective interface for objective functions that operate on ROL::StdVector's.
const std::vector< Real > getParameter(void) const
void checkSize(const std::vector< Real > &x)