ReFRACtor
nlls_problem.cc
Go to the documentation of this file.
1 #include "nlls_problem.h"
2 #include "fp_exception.h"
3 
4 
5 using namespace FullPhysics;
6 using namespace blitz;
7 
8 
9 
10 #ifdef HAVE_LUA
11 #include "register_lua.h"
14 #endif
15 
16 
17 
18 void NLLSProblem::residual_jacobian(Array<double, 1>& r, Array<double, 2>& j)
19 {
20  r.reference(residual());
21  j.reference(jacobian());
22 }
23 
25 {
26  return sum(residual()*residual())/2.0;
27 }
28 
29 blitz::Array<double, 1> NLLSProblem::gradient()
30 {
31  firstIndex i1; secondIndex i2;
32  Array<double, 1> ret(sum(jacobian()(i2,i1) * residual()(i2), i2));
33  return ret;
34 }
The base class for all problem classes that implement a cost function.
Definition: cost_func.h:20
virtual double cost()
Read comments on CostFunc::cost()
Definition: nlls_problem.cc:24
blitz::Array< T, 2 > jacobian(const blitz::Array< AutoDerivative< T >, 1 > &Ad)
Utility function to extract the Jacobian as a separate matrix from an array of AutoDerivative.
#define REGISTER_LUA_DERIVED_CLASS(X, Y)
Definition: register_lua.h:136
Apply value function to a blitz array.
The base class for the Non-Linear Least Squares problem.
Definition: nlls_problem.h:54
virtual blitz::Array< double, 1 > gradient()
Read comments on CostFuncDiff::gradient()
Definition: nlls_problem.cc:29
Contains classes to abstract away details in various Spurr Radiative Transfer software.
Definition: doxygen_python.h:1
#define REGISTER_LUA_END()
Definition: register_lua.h:134
virtual void residual_jacobian(blitz::Array< double, 1 > &r, blitz::Array< double, 2 > &j)
The residual function and its Jacobian together.
Definition: nlls_problem.cc:18

Copyright © 2017, California Institute of Technology.
ALL RIGHTS RESERVED.
U.S. Government Sponsorship acknowledged.
Generated Fri Aug 24 2018 15:44:10