18 { Array<double, 1> v(1);
26 { Array<double, 1> v(1);
34 { Array<double, 2> v(1,1);
40 .def(luabind::constructor<>())
43 ((a2) &InitialGuessValue::apriori))
46 .def(
"apriori_covariance_subset",
48 .property(
"apriori_double",
49 &initial_guess_value_apriori_double_get,
50 &initial_guess_value_apriori_double_set)
51 .property(
"initial_guess",
53 ((a2) &InitialGuessValue::initial_guess))
54 .property(
"initial_guess_double",
55 &initial_guess_value_initial_guess_double_get,
56 &initial_guess_value_initial_guess_double_set)
57 .property(
"apriori_covariance",
59 ((b2) &InitialGuessValue::apriori_covariance))
60 .property(
"apriori_covariance_double",
61 &initial_guess_value_apriori_cov_double_get,
62 &initial_guess_value_apriori_cov_double_set)
71 (
const blitz::Array<bool, 1>& Flag,
72 const blitz::Array<double, 1>& V)
74 if(Flag.rows() != V.rows()) {
75 std::stringstream err_msg;
76 err_msg <<
"Flag and apriori need to be same size. " 77 << Flag.rows() <<
" != " << V.rows();
80 apriori_.resize(count(Flag));
82 for(
int i = 0; i < V.rows(); ++i)
84 apriori_(ind++) = V(i);
92 (
const blitz::Array<bool, 1>& Flag,
93 const blitz::Array<double, 1>& V)
95 if(Flag.rows() != V.rows()) {
96 std::stringstream err_msg;
97 err_msg <<
"Flag and initial guess need to be same size. " 98 << Flag.rows() <<
" != " << V.rows();
101 initial_guess_.resize(count(Flag));
103 for(
int i = 0; i < V.rows(); ++i)
105 initial_guess_(ind++) = V(i);
113 (
const blitz::Array<bool, 1>& Flag,
114 const blitz::Array<double, 2>& V)
116 if(Flag.rows() != V.rows() ||
117 Flag.rows() != V.cols()) {
118 std::stringstream err_msg;
119 err_msg <<
"Flag and covariance need to be same size. " 120 << Flag.rows() <<
" != " <<
"[ " << V.rows() <<
", " << V.cols() <<
" ]";
124 apriori_covariance_.resize(count(Flag), count(Flag));
126 for(
int i = 0; i < V.rows(); ++i)
129 for(
int j = 0; j < V.cols(); ++j)
131 apriori_covariance_(ind1, ind2++) = V(i, j);
139 if(number_element() == 0)
141 if(initial_guess().rows() != number_element()) {
143 e <<
"initial_guess() in InitialGuessValue has " << initial_guess().rows()
144 <<
" elements, but apriori has " << number_element();
147 v(Range(index, index + number_element() - 1)) = initial_guess();
153 if(number_element() == 0)
155 v(Range(index, index + number_element() - 1)) = apriori();
161 if(number_element() == 0)
163 if(apriori_covariance().rows() != number_element() ||
164 apriori_covariance().cols() != number_element()) {
166 e <<
"apriori_covariance() in InitialGuessValue has " 167 << apriori_covariance().rows() <<
" x " << apriori_covariance().cols()
168 <<
" elements, but apriori has " << number_element();
171 Range r(index, index + number_element() - 1);
172 m(r, r) = apriori_covariance();
177 Os <<
"InitialGuessValue:\n";
179 Os <<
"Apriori:\n" << apriori() <<
"\n" 180 <<
"Initial guess:\n" << initial_guess() <<
"\n" 181 <<
"Covariance:\n" << apriori_covariance() <<
"\n";
This is a filtering stream that adds a pad to the front of every line written out.
virtual void build_initial_value(blitz::Array< double, 1 > &v, int index) const
Called when we need this class to do its part in setting up the initial state vector.
This is the base of the exception hierarchy for Full Physics code.
#define REGISTER_LUA_DERIVED_CLASS(X, Y)
void apriori_covariance_subset(const blitz::Array< bool, 1 > &Flag, const blitz::Array< double, 2 > &V)
Subset a value to include only those elements where Flag is true.
Apply value function to a blitz array.
virtual void print(std::ostream &Os) const
Class that builds a portion of the state vector.
virtual void build_apriori(blitz::Array< double, 1 > &v, int index) const
Called when we need this class to do its part in setting up the apriori state vector.
This is a simple implementation of InitialGuessBuilder that just has variables used to give the aprio...
const Unit m("m", 1.0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
const blitz::Array< double, 2 > & apriori_covariance() const
Apriori covariance value.
Contains classes to abstract away details in various Spurr Radiative Transfer software.
#define REGISTER_LUA_END()
virtual void build_apriori_covariance(blitz::Array< double, 2 > &m, int index) const
Called when we need this class to do its part in setting up the covariance matrix for the a priori st...
void apriori_subset(const blitz::Array< bool, 1 > &Flag, const blitz::Array< double, 1 > &V)
Subset a value to include only those elements where Flag is true.
void initial_guess_subset(const blitz::Array< bool, 1 > &Flag, const blitz::Array< double, 1 > &V)
Subset a value to include only those elements where Flag is true.
const blitz::Array< double, 1 > & apriori() const
Apriori value.
const blitz::Array< double, 1 > & initial_guess() const
First guess value.