26auto build_iteration_Jv(
const std::vector<char>& vars,
const Eigen::Array<double, 3, 3>& A,
const double R,
const double T,
const double rho,
const Array &z){
29 Eigen::Array2d& v = im.
v;
30 Eigen::Array22d& J = im.
J;
32 auto dTrecipdT = -Trecip*Trecip;
42 auto alpha = [&](){
return A(0,0); };
43 auto dalphadTrecip = [&](){
return A(1,0)/Trecip; };
44 auto dalphadrho = [&](){
return A(0,1)/rho; };
45 auto d2alphadTrecip2 = [&](){
return A(2,0)/(Trecip*Trecip); };
46 auto d2alphadTrecipdrho = [&](){
return A(1,1)/(Trecip*rho); };
47 auto d2alphadrho2 = [&](){
return A(0,2)/(rho*rho); };
50 auto a = [&](){
return alpha()*R*T; };
51 auto dadTrecip = [&](){
return R/(Trecip*Trecip)*(Trecip*dalphadTrecip()-alpha());};
52 auto d2adTrecip2 = [&](){
return R/(Trecip*Trecip*Trecip)*(Trecip*Trecip*d2alphadTrecip2()-2*Trecip*dalphadTrecip()+2*alpha());};
53 auto dadrho = [&](){
return R/Trecip*(dalphadrho());};
54 auto d2adrho2 = [&](){
return R/Trecip*(d2alphadrho2());};
55 auto d2adTrecipdrho = [&](){
return R/(Trecip*Trecip)*(Trecip*d2alphadTrecipdrho()-dalphadrho());};
57 for (
auto i = 0; i < vars.size(); ++i){
70 v(i) = rho*rho*dadrho();
71 J(i, 0) = rho*rho*d2adTrecipdrho()*dTrecipdT;
72 J(i, 1) = rho*rho*d2adrho2() + 2*rho*dadrho();
75 v(i) = Trecip*Trecip*dadTrecip();
76 J(i, 0) = (Trecip*Trecip*d2adTrecip2() + 2*Trecip*dadTrecip())*dTrecipdT;
77 J(i, 1) = Trecip*Trecip*d2adTrecipdrho();
80 v(i) = a() + Trecip*dadTrecip() + rho*dadrho();
81 J(i, 0) = (Trecip*d2adTrecip2() + rho*d2adTrecipdrho() + 2*dadTrecip())*dTrecipdT;
82 J(i, 1) = Trecip*d2adTrecipdrho() + rho*d2adrho2() + 2*dadrho();
85 v(i) = a() + Trecip*dadTrecip();
86 J(i, 0) = (Trecip*d2adTrecip2() + 2*dadTrecip())*dTrecipdT;
87 J(i, 1) = Trecip*d2adTrecipdrho() + dadrho();
90 throw std::invalid_argument(
"bad var: " + std::to_string(vars[i]));
auto build_iteration_Jv(const std::vector< char > &vars, const Eigen::Array< double, 3, 3 > &A, const double R, const double T, const double rho, const Array &z)
A convenience function for calculation of Jacobian terms of the form and where is one of the therm...