27auto build_iteration_Jv(
const std::vector<char>& vars,
const Eigen::Array<double, 3, 3>& Ar,
const Eigen::Array<double, 3, 3>& Aig,
const double R,
const double T,
const double rho,
const Array &z){
31 Eigen::ArrayXd& v = im.
v;
32 Eigen::ArrayXXd& J = im.
J;
34 auto dTrecipdT = -Trecip*Trecip;
44 auto alpha = [&](){
return A(0,0); };
45 auto dalphadTrecip = [&](){
return A(1,0)/Trecip; };
46 auto dalphadrho = [&](){
return A(0,1)/rho; };
47 auto d2alphadTrecip2 = [&](){
return A(2,0)/(Trecip*Trecip); };
48 auto d2alphadTrecipdrho = [&](){
return A(1,1)/(Trecip*rho); };
49 auto d2alphadrho2 = [&](){
return A(0,2)/(rho*rho); };
52 auto dadTrecip = [&](){
return R/(Trecip*Trecip)*(Trecip*dalphadTrecip()-alpha());};
53 auto d2adTrecip2 = [&](){
return R/(Trecip*Trecip*Trecip)*(Trecip*Trecip*d2alphadTrecip2()-2*Trecip*dalphadTrecip()+2*alpha());};
54 auto dadrho = [&](){
return R/Trecip*(dalphadrho());};
55 auto d2adrho2 = [&](){
return R/Trecip*(d2alphadrho2());};
56 auto d2adTrecipdrho = [&](){
return R/(Trecip*Trecip)*(Trecip*d2alphadTrecipdrho()-dalphadrho());};
58 for (
auto i = 0; i < vars.size(); ++i){
71 v(i) = rho*R*T*(1 + Ar(0,1));
72 J(i, 0) = rho*R*(1 + Ar(0,1) - Ar(1,1));
73 J(i, 1) = R*T*(1 + 2*Ar(0,1) + Ar(0,2));
76 v(i) = Trecip*Trecip*dadTrecip();
77 J(i, 0) = (Trecip*Trecip*d2adTrecip2() + 2*Trecip*dadTrecip())*dTrecipdT;
78 J(i, 1) = Trecip*Trecip*d2adTrecipdrho();
81 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 > &Ar, const Eigen::Array< double, 3, 3 > &Aig, 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...