1

I was trying to setup some default constructors, but keep running into the error:

newton.h:29:38: error: type ‘Newton’ is not a direct base of ‘Newton’

I can't grasp what I am doing wrong, I am using g++ with std=c++0x (c++11 compiler setting).

Newton.h:

#ifndef Newton_h
#define Newton_h

#include <armadillo>
#include "qr.h"

using namespace std;
using namespace arma;

class Newton {
 public:

  class Lambda {
  public:
    virtual double walkLambda(Newton newt) {};
  };

  class linearL : public Lambda {
  public:
    double walkLambda(Newton newt);
  };

  Newton(function<vec(vec)> f,
     vec xStart, vec dx,
     const double eps, function<mat(vec)> dfdx = 0, Lambda lambda = linearL());

  Newton(function<vec(vec)> f,
     vec xStart, vec dx,
     const double eps, Lambda lambda) : Newton(f, xStart, dx, eps, 0, lambda) {} // Line 29!

  vec getRoots();
  int getCalls();

 protected:
  int _n, _calls;
  vec _x, _dx, _y, _fx, _fy, _df;
  mat _j;
  function<vec(vec)> _f;
};
#endif

Thank you for your time. Best.

4

0 回答 0