53 virtual bool read(std::istream& )
59 virtual bool write(std::ostream& )
const 72 Eigen::Vector3d::ConstMapType v(update);
87 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
91 virtual bool read(std::istream& )
96 virtual bool write(std::ostream& )
const 105 const double& a = params->
estimate()(0);
106 const double& b = params->
estimate()(1);
107 const double& lambda = params->
estimate()(2);
108 double fval = a * exp(-lambda * measurement()(0)) + b;
109 _error(0) = fval - measurement()(1);
113 int main(
int argc,
char** argv)
118 std::vector<int> gaugeList;
121 arg.
param(
"dump", dumpFilename,
"",
"dump the points into a file");
122 arg.
param(
"numPoints", numPoints, 50,
"number of points sampled from the curve");
123 arg.
param(
"i", maxIterations, 10,
"perform n iterations");
124 arg.
param(
"v", verbose,
false,
"verbose output of the optimization process");
132 Eigen::Vector2d* points =
new Eigen::Vector2d[numPoints];
133 for (
int i = 0; i < numPoints; ++i) {
135 double y = a * exp(-lambda * x) + b;
142 if (dumpFilename.size() > 0) {
143 ofstream fout(dumpFilename.c_str());
144 for (
int i = 0; i < numPoints; ++i)
145 fout << points[i].transpose() << endl;
155 MyLinearSolver* linearSolver =
new MyLinearSolver();
156 MyBlockSolver* solver_ptr =
new MyBlockSolver(linearSolver);
167 for (
int i = 0; i < numPoints; ++i) {
184 cout <<
"Target curve" << endl;
185 cout <<
"a * exp(-lambda * x) + b" << endl;
186 cout <<
"Iterative least squares solution" << endl;
187 cout <<
"a = " << params->
estimate()(0) << endl;
188 cout <<
"b = " << params->
estimate()(1) << endl;
189 cout <<
"lambda = " << params->
estimate()(2) << endl;
virtual bool read(std::istream &)
read the vertex from a stream, i.e., the internal state of the vertex
#define __PRETTY_FUNCTION__
Command line parsing of argc and argv.
measurement for a point on the curve
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
static double gaussRand(double mean, double sigma)
Implementation of the Levenberg Algorithm.
int optimize(int iterations, bool online=false)
virtual void setMeasurement(const Measurement &m)
linear solver using dense cholesky decomposition
int main(int argc, char **argv)
void setVertex(size_t i, Vertex *v)
virtual bool read(std::istream &)
read the vertex from a stream, i.e., the internal state of the vertex
virtual void setId(int id)
sets the id of the node in the graph be sure that the graph keeps consistent after changing the id ...
static double uniformRand(double lowerBndr, double upperBndr)
bool parseArgs(int argc, char **argv, bool exitOnError=true)
void setVerbose(bool verbose)
virtual bool write(std::ostream &) const
write the vertex to a stream
void setAlgorithm(OptimizationAlgorithm *algorithm)
EIGEN_STRONG_INLINE void setInformation(const InformationType &information)
virtual void oplusImpl(const double *update)
EIGEN_MAKE_ALIGNED_OPERATOR_NEW EdgePointOnCurve()
void param(const std::string &name, bool &p, bool defValue, const std::string &desc)
void setEstimate(const EstimateType &et)
set the estimate for the vertex also calls updateCache()
the params, a, b, and lambda for a * exp(-lambda * t) + b
virtual bool write(std::ostream &) const
write the vertex to a stream
const EstimateType & estimate() const
return the current estimate of the vertex
Implementation of a solver operating on the blocks of the Hessian.
virtual void setToOriginImpl()
sets the node to the origin (used in the multilevel stuff)
virtual bool initializeOptimization(HyperGraph::EdgeSet &eset)
virtual bool addEdge(HyperGraph::Edge *e)
virtual bool addVertex(HyperGraph::Vertex *v, Data *userData)