14 const Array<double, 1>& Rad,
15 const Array<double, 1>& Rad_uncer,
16 const Array<double, 1> X_apriori,
17 const Array<double, 2> Apriori_cov)
18 : fm(Fm), statev(Sv),
rad(Rad.copy()), x_a(X_apriori.copy())
20 if(Rad.rows() != Rad_uncer.rows())
21 throw Exception(
"Rad and Rad_uncer need to be the same size");
22 if(X_apriori.rows() != Apriori_cov.rows() ||
23 Apriori_cov.rows() != Apriori_cov.cols())
24 throw Exception(
"Apriori_cov needs to be square, and the same size a X_apriori");
25 se_sqrt_inv.resize(Rad_uncer.shape());
26 se_sqrt_inv = 1 / Rad_uncer;
34 assert_parameter_set_correctly();
35 firstIndex i1; secondIndex i2;
36 Array<double, 1> res(
rad.rows() + sa_sqrt_inv.rows());
37 Range r1(0,
rad.rows() - 1);
38 Range r2(
rad.rows(), res.rows() - 1);
39 statev->update_state(X);
40 res(r1) = (fm->radiance_all(
true).spectral_range().data() -
rad) *
42 res(r2) = sum(sa_sqrt_inv(i1, i2) * (X(i2) - x_a(i2)));
49 assert_parameter_set_correctly();
50 firstIndex i1; secondIndex i2; thirdIndex i3;
51 Array<double, 2> res(
rad.rows() + sa_sqrt_inv.rows(),
53 Range r1(0,
rad.rows() - 1);
54 Range r2(
rad.rows(), res.rows() - 1);
55 statev->update_state(X);
57 res(r1, Range::all()) = fmrad.
jacobian()(i1, i2) * se_sqrt_inv(i1);
58 res(r2, Range::all()) = sa_sqrt_inv;
FmNLLSProblem(const boost::shared_ptr< ForwardModel > &Fm, const boost::shared_ptr< StateVector > &Sv, const blitz::Array< double, 1 > &Rad, const blitz::Array< double, 1 > &Rad_uncer, const blitz::Array< double, 1 > X_apriori, const blitz::Array< double, 2 > Apriori_cov)
Constructor.
This is the base of the exception hierarchy for Full Physics code.
blitz::Array< double, 2 > cholesky_decomposition(const blitz::Array< double, 2 > &A)
This calculates the Cholesky Decompostion of A so that A = L L^T.
const blitz::Array< T, D+1 > jacobian() const
Apply value function to a blitz array.
blitz::Array< double, 2 > generalized_inverse(const blitz::Array< double, 2 > &A, double Rcond=std::numeric_limits< double >::epsilon())
This returns the generalized inverse of the given matrix.
virtual blitz::Array< double, 2 > jacobian()
The Jacobian matrix function.
Contains classes to abstract away details in various Spurr Radiative Transfer software.
const Unit rad("rad", 1.0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0)
virtual blitz::Array< double, 1 > residual()
The residual vector function.