14 const Index grid_dimensions,
15 const Sparse& covmat_block,
16 const Sparse& covmat_inv_block) {
19 Range range(start, extent);
21 for (
Index j = 0; j < grid_dimensions; ++j) {
25 if (!covmat_block.
empty()) {
26 if ((n_gps == extent) && (n_gps == covmat_block.
ncols())) {
27 std::shared_ptr<Sparse> mat = make_shared<Sparse>(covmat_block);
29 Block(range, range, std::make_pair(rq_index, rq_index), mat));
32 os <<
"The matrix in covmat_block was expected to have dimensions [" 33 << n_gps <<
", " << n_gps <<
"] but found to have dimensions [" 34 << covmat_block.
nrows() <<
", " << covmat_block.
ncols() <<
"].";
35 throw runtime_error(os.
str());
38 if (!covmat_inv_block.
empty()) {
39 if ((n_gps == covmat_inv_block.
nrows()) &&
40 (n_gps == covmat_inv_block.
ncols())) {
41 std::shared_ptr<Sparse> mat = make_shared<Sparse>(covmat_inv_block);
43 Block(range, range, std::make_pair(rq_index, rq_index), mat));
46 os <<
"The matrix in covmat_inv_block was expected to have dimensions [" 47 << n_gps <<
", " << n_gps <<
"] but found to have dimensions [" 48 << covmat_block.
nrows() <<
", " << covmat_block.
ncols() <<
"].";
49 throw runtime_error(os.
str());
57 Index i = jacobian_quantities.size() - 1;
60 Range range(start, extent);
61 std::shared_ptr<Matrix> mat = make_shared<Matrix>(1, 1);
62 mat->operator()(0, 0) = var;
64 mat = make_shared<Matrix>(1, 1);
65 mat->operator()(0, 0) = 1.0 / var;
67 Block(range, range, std::make_pair(i, i), mat));
78 if (p_grid[
i] < 0.01) {
79 throw runtime_error(
"Pressures below 0.01 Pa are not accedpted.");
84 z_grid[
i] = 16e3 * (5.0 - log10(p_grid[
i]));
92 if (z_grid[
i] > 120e3) {
93 throw runtime_error(
"Altitudes above 120 km are not accepted.");
98 p_grid[
i] =
pow(10.0, 5.0 - z_grid[
i] / 16e3);
106 template <
typename MatrixType>
113 matrix.insert_elements(
114 row_indices.
nelem(), row_indices, column_indices, elements);
124 assert(row_indices.
nelem() == column_indices.
nelem());
125 assert(column_indices.
nelem() == elements.
nelem());
130 matrix(row_indices[
i], column_indices[i]) = elements[
i];
134 template <
typename MatrixType>
141 "Cannot pass empty vector of variances to covmat_blockSetDiagonal");
148 Vector elements(n), elements_inv(n);
151 elements[
i] = vars[
i];
152 elements_inv[
i] = 1.0 / vars[
i];
168 template <
typename MatrixType>
178 Vector elements, elements_inv;
180 if (n != sigma.
nelem()) {
181 throw runtime_error(
"Size of grid incompatible with given variances.");
184 elements =
Vector(row_indices.size());
185 for (
size_t i = 0;
i < row_indices.size(); ++
i) {
186 Numeric dz =
abs(grid[row_indices[
i]] - grid[column_indices[
i]]);
188 sigma[row_indices[
i]] * sigma[column_indices[
i]] * exp(-dz / lc);
196 elements =
Vector(3 * n - 2);
206 column_indices.push_back(
i - 1);
207 row_indices.push_back(
i);
208 elements[
i * 3 - 1] = c1;
209 elements[
i * 3 - 1] /= (sigma[
i] * sigma[
i - 1]);
213 column_indices.push_back(
i);
214 row_indices.push_back(
i);
215 if (
i == 0 ||
i == n - 1) {
216 elements[
i * 3] = c2;
218 elements[
i * 3] = c2 * (1.0 + alpha *
alpha);
220 elements[
i * 3] /= (sigma[
i] * sigma[
i]);
224 column_indices.push_back(
i + 1);
225 row_indices.push_back(
i);
226 elements[
i * 3 + 1] = c1;
227 elements[
i * 3 + 1] /= (sigma[
i] * sigma[
i + 1]);
231 insert_elements(block_inv, n, n, row_indices, column_indices, elements);
250 template <
typename MatrixType>
262 Vector sigma1_copy(sigma1), lc1_copy(lc1);
264 assert((sigma1.
nelem() == m) || (sigma1.
nelem() == 1));
265 if (sigma1.
nelem() == 1) {
271 assert((lc1.
nelem() == m) || (lc1.
nelem() == 1));
272 if (lc1.
nelem() == 1) {
279 Vector sigma2_copy(sigma2), lc2_copy(lc2);
281 assert((sigma2.
nelem() ==
n) || (sigma2.
nelem() == 1));
282 if (sigma2.
nelem() == 1) {
289 if (lc2.
nelem() == 1) {
296 cls_view_1(lc1_copy);
298 cls_view_2(lc2_copy);
302 grid_view_2 = grid_view_1;
303 sigma_view_2 = sigma_view_1;
304 cls_view_2 = cls_view_1;
309 Numeric d =
abs(grid_view_1[i] - grid_view_2[j]);
310 Numeric cl = 0.5 * (cls_view_1[
i] + cls_view_2[j]);
311 return 1.0 - (1.0 - exp(-1.0)) * (d / cl);
315 Numeric d =
abs(grid_view_1[i] - grid_view_2[j]);
316 Numeric cl = 0.5 * (cls_view_1[
i] + cls_view_2[j]);
321 Numeric d =
abs(grid_view_1[i] - grid_view_2[j]);
322 Numeric cl = 0.5 * (cls_view_1[
i] + cls_view_2[j]);
331 row_indices.reserve(n * m);
332 column_indices.reserve(n * m);
334 std::function<Numeric(Index, Index)> f;
336 if (fname ==
"exp") {
338 }
else if (fname ==
"lin") {
340 }
else if (fname ==
"gau") {
344 os << fname <<
" is not a known function name. Supported names" 345 <<
"are: exp, lin, gau.";
346 std::runtime_error(os.
str());
349 for (
Index i = 0; i < m; ++
i) {
350 for (
Index j = 0; j <
n; ++j) {
353 row_indices.push_back(i);
354 column_indices.push_back(j);
359 Vector elements(row_indices.size());
360 for (
size_t i = 0; i < row_indices.size(); ++
i) {
361 Index ii = row_indices[
i];
362 Index jj = column_indices[
i];
363 elements[
i] = sigma_view_1[ii] * sigma_view_2[jj] * f(ii, jj);
396 template <
typename MatrixType>
402 Index m = block.nrows();
406 if ((ii < 0) && (jj < 0)) {
412 throw std::runtime_error(
413 "The block must be on or above the diagonal, " 414 " i.e. *i* <= *j*.");
419 if ((ii >= ndiagblocks)) {
420 if (ii > ndiagblocks) {
422 throw std::runtime_error(
423 "Off-diagonal block can only be added to rows that already " 424 "have a block on the diagonal.");
426 throw std::runtime_error(
427 "Diagonal block must be added row-by-row starting in the " 428 " upper left of the matrix.");
434 throw std::runtime_error(
"Block already present in covariance matrix.");
439 throw std::runtime_error(
"Diagonal blocks must be square.");
442 Range range(start, m);
443 std::shared_ptr<MatrixType> mat = std::make_shared<MatrixType>(block);
449 throw std::runtime_error(
450 "Trying to add an off-diagonal block that" 451 " lacks corresponding diagonal block in the " 458 throw std::runtime_error(
459 "Trying to add an off-diagonal block that" 460 " lacks corresponding diagonal block in the " 466 throw std::runtime_error(
467 "The off-diagonal block is inconsistent " 468 "with the corresponding diagonal blocks.");
471 std::shared_ptr<MatrixType> mat = std::make_shared<MatrixType>(block);
473 Block(row_range, column_range, std::make_pair(ii, jj), mat));
489 template <
typename MatrixType>
496 if ((ii < 0) && (jj < 0)) {
501 Index m = inv_block.nrows();
502 Index n = inv_block.ncols();
507 throw std::runtime_error(
508 "Cannot add inverse block to the covariance " 509 " without corresponding non-inverse block.");
512 if ((m != inv_block.nrows()) || (n != inv_block.ncols())) {
513 throw std::runtime_error(
514 "Dimensions of block are inconsistent with " 515 " non-inverse block.");
521 std::shared_ptr<MatrixType> mat = std::make_shared<MatrixType>(inv_block);
523 Block(row_range, column_range, std::make_pair(ii, jj), mat));
538 template <
typename MatrixType>
540 Index m = block.nrows();
544 throw std::runtime_error(
"Covariance matrix must be sqare!");
548 IndexPair indices = std::make_pair(0, 0);
550 std::shared_ptr<MatrixType> mat_ptr = std::make_shared<MatrixType>(block);
560 template <
typename MatrixType>
579 template <
typename MatrixType>
598 template <
typename MatrixType>
606 if ((ii < 0) && (jj < 0)) {
609 if ((ii >= jq.
nelem()) || (jj >= jq.
nelem())) {
611 "*covmat_sx* already contains more or as many diagonal" 612 " blocks as there are retrieval quantities.");
614 }
else if ((ii >= jq.
nelem()) || (jj >= jq.
nelem())) {
616 "The block indices must either be both -1 (default) or\n" 617 "non-negative and smaller than the number of retrieval \n" 619 }
else if (ii > jj) {
621 "Only blocks above the diagonal can be set, hence" 622 "*i* must be less than or equal to *j*.");
625 Index m = block.nrows();
629 if (jq[ii].HasAffine()) {
630 jq_m = jq[ii].TransformationMatrix().ncols();
633 if (jq[jj].HasAffine()) {
634 jq_n = jq[jj].TransformationMatrix().ncols();
637 if ((m != jq_m) || (n != jq_n)) {
639 os <<
"The covariance block for retrieval quantities " << ii <<
" and " 640 << jj <<
" was expected to have dimensions [" << jq_m <<
", " << jq_n
641 <<
"] but found to have dimensions " 642 <<
"[" << m <<
", " << n <<
"].";
644 throw runtime_error(os.
str());
650 Index row_start = ji[ii][0];
651 Index row_extent = ji[ii][1] - ji[ii][0] + 1;
652 Range row_range(row_start, row_extent);
654 Index col_start = ji[jj][0];
655 Index col_extent = ji[jj][1] - ji[jj][0] + 1;
656 Range col_range(col_start, col_extent);
658 std::shared_ptr<MatrixType> mat = make_shared<MatrixType>(block);
660 Block(row_range, col_range, std::make_pair(ii, jj), mat));
677 template <
typename MatrixType>
685 if ((ii < 0) && (jj < 0)) {
688 }
else if ((ii >= jq.
nelem()) || (jj >= jq.
nelem())) {
690 "The block indices must either be both -1 (default) or\n" 691 "non-negative and smaller than the number of retrieval \n" 693 }
else if (ii > jj) {
695 "Only blocks above the diagonal can be set, hence" 696 "*i* must be less than or equal to *j*.");
699 Index m = block_inv.nrows();
700 Index n = block_inv.ncols();
703 if (jq[ii].HasAffine()) {
704 jq_m = jq[ii].TransformationMatrix().ncols();
708 if (jq[jj].HasAffine()) {
709 jq_n = jq[jj].TransformationMatrix().ncols();
712 if (!((m == jq_m) && (n == jq_n))) {
714 os <<
"The dimensions of the covariance block ( " << m;
715 os <<
" x " << n <<
" )" 716 <<
" with the dimensionality of ";
717 os <<
" retrieval quantity " << ii <<
" and " << jj <<
", respectively.";
719 throw runtime_error(os.
str());
724 "To add the inverse of a block the non-inverse" 725 " block must be added first.");
731 Index row_start = ji[ii][0];
732 Index row_extent = ji[ii][1] - ji[ii][0] + 1;
733 Range row_range(row_start, row_extent);
735 Index col_start = ji[jj][0];
736 Index col_extent = ji[jj][1] - ji[jj][0] + 1;
737 Range col_range(col_start, col_extent);
739 std::shared_ptr<MatrixType> mat = make_shared<MatrixType>(block_inv);
741 Block(row_range, col_range, std::make_pair(ii, jj), mat));
763 x_norm[
i] =
sqrt(x_norm[
i]);
775 const Index& atmosphere_dim,
776 const Sparse& covmat_block,
777 const Sparse& covmat_inv_block,
782 const Vector& rq_lat_grid,
783 const Vector& rq_lon_grid,
786 const Index& for_species_tag,
803 jacobian_quantities.back(),
804 jacobian_quantities.
nelem() - 1,
814 const Sparse& covmat_block,
815 const Sparse& covmat_inv_block,
820 ws, jacobian_quantities, jacobian_agenda, f_grid, df, verbosity);
822 jacobian_quantities.back(),
823 jacobian_quantities.
nelem() - 1,
834 const Sparse& covmat_block,
835 const Sparse& covmat_inv_block,
839 ws, jacobian_quantities, jacobian_agenda, f_grid, df, verbosity);
841 jacobian_quantities.back(),
842 jacobian_quantities.
nelem() - 1,
853 const String& catalog_parameter,
870 const Sparse& covmat_block,
871 const Sparse& covmat_inv_block,
882 jacobian_quantities.back(),
883 jacobian_quantities.
nelem() - 1,
893 const Index& atmosphere_dim,
894 const Sparse& covmat_block,
895 const Sparse& covmat_inv_block,
900 const Vector& rq_lat_grid,
901 const Vector& rq_lon_grid,
919 jacobian_quantities.back(),
920 jacobian_quantities.
nelem() - 1,
930 const Sparse& covmat_block,
931 const Sparse& covmat_inv_block,
933 const Vector& sensor_time,
934 const Index& poly_order,
948 jacobian_quantities.back(),
949 jacobian_quantities.
nelem() - 1,
959 const Sparse& covmat_block,
960 const Sparse& covmat_inv_block,
962 const Matrix& sensor_response_dlos_grid,
964 const Index& poly_order,
965 const Index& no_pol_variation,
966 const Index& no_los_variation,
967 const Index& no_mblock_variation,
969 size_t jq_start = jacobian_quantities.size();
973 sensor_response_pol_grid,
974 sensor_response_dlos_grid,
981 for (
Index i = 0;
i <= poly_order; ++
i) {
983 jacobian_quantities[jq_start +
i],
995 const Index& atmosphere_dim,
996 const Sparse& covmat_block,
997 const Sparse& covmat_inv_block,
1002 const Vector& rq_lat_grid,
1003 const Vector& rq_lon_grid,
1008 jacobian_quantities,
1021 jacobian_quantities.back(),
1022 jacobian_quantities.
nelem() - 1,
1032 const Sparse& covmat_block,
1033 const Sparse& covmat_inv_block,
1035 const Matrix& sensor_response_dlos_grid,
1036 const Matrix& sensor_pos,
1037 const Vector& period_lengths,
1038 const Index& no_pol_variation,
1039 const Index& no_los_variation,
1040 const Index& no_mblock_variation,
1042 size_t jq_start = jacobian_quantities.size();
1044 jacobian_quantities,
1046 sensor_response_pol_grid,
1047 sensor_response_dlos_grid,
1052 no_mblock_variation,
1056 jacobian_quantities[jq_start +
i],
1068 const Index& atmosphere_dim,
1069 const Sparse& covmat_block,
1070 const Sparse& covmat_inv_block,
1075 const Vector& rq_lat_grid,
1076 const Vector& rq_lon_grid,
1080 jacobian_quantities,
1092 jacobian_quantities.back(),
1093 jacobian_quantities.
nelem() - 1,
1103 const Index& atmosphere_dim,
1104 const Sparse& covmat_block,
1105 const Sparse& covmat_inv_block,
1110 const Vector& rq_lat_grid,
1111 const Vector& rq_lon_grid,
1116 jacobian_quantities,
1129 jacobian_quantities.back(),
1130 jacobian_quantities.
nelem() - 1,
1140 const Index& atmosphere_dim,
1141 const Sparse& covmat_block,
1142 const Sparse& covmat_inv_block,
1147 const Vector& rq_lat_grid,
1148 const Vector& rq_lon_grid,
1152 jacobian_quantities,
1164 jacobian_quantities.back(),
1165 jacobian_quantities.
nelem() - 1,
1175 const Sparse& covmat_block,
1176 const Sparse& covmat_inv_block,
1177 const Index& atmosphere_dim,
1180 const Vector& rq_lat_grid,
1181 const Vector& rq_lon_grid,
1185 jacobian_quantities,
1196 jacobian_quantities.back(),
1197 jacobian_quantities.
nelem() - 1,
1207 Index& retrieval_checked,
1212 ws, jacobian_do, jacobian_agenda, jacobian_quantities, verbosity);
1219 os <<
"*covmat_sx* does not contain a diagonal block for each retrieval" 1220 " quantity in the Jacobian.\n";
1221 os <<
" Fails test (!covmat_sx.has_diagonal_blocks(ji_t)) for ji_t " << ji_t
1223 throw runtime_error(os.str());
1226 throw runtime_error(
1227 "The blocks in *covmat_sx* are not consistent with the retrieval" 1228 " quantities in the Jacobian.");
1230 retrieval_checked =
true;
1237 Sparse& covmat_inv_block,
1240 const Index& initialize_jacobian,
1242 if (initialize_jacobian == 1) {
1243 jacobianInit(jacobian_quantities, jacobian_agenda, verbosity);
1247 covmat_inv_block =
Sparse();
1260 retrieval_eo.
resize(n_so);
1262 retrieval_eo[
i] =
sqrt(covmat_so(
i,
i));
1265 retrieval_ss.
resize(n_ss);
1267 retrieval_ss[
i] =
sqrt(covmat_ss(
i,
i));
std::pair< Index, Index > IndexPair
void retrievalAddPolyfit(Workspace &ws, CovarianceMatrix &covmat_sx, ArrayOfRetrievalQuantity &jacobian_quantities, Agenda &jacobian_agenda, const Sparse &covmat_block, const Sparse &covmat_inv_block, const ArrayOfIndex &sensor_response_pol_grid, const Matrix &sensor_response_dlos_grid, const Matrix &sensor_pos, const Index &poly_order, const Index &no_pol_variation, const Index &no_los_variation, const Index &no_mblock_variation, const Verbosity &verbosity)
WORKSPACE METHOD: retrievalAddPolyfit.
INDEX Index
The type to use for all integer numbers and indices.
void covmatDiagonal(MatrixType &block, MatrixType &block_inv, const Vector &vars, const Verbosity &)
void jacobianAddAbsSpecies(Workspace &, ArrayOfRetrievalQuantity &jq, Agenda &jacobian_agenda, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Vector &rq_p_grid, const Vector &rq_lat_grid, const Vector &rq_lon_grid, const String &species, const String &mode, const Index &for_species_tag, const Verbosity &verbosity)
WORKSPACE METHOD: jacobianAddAbsSpecies.
void covmat_seAddBlock(CovarianceMatrix &covmat_se, const MatrixType &block, const Index &i, const Index &j, const Verbosity &)
void jacobianClose(Workspace &ws, Index &jacobian_do, Agenda &jacobian_agenda, const ArrayOfRetrievalQuantity &jacobian_quantities, const Verbosity &verbosity)
WORKSPACE METHOD: jacobianClose.
void var(VectorView var, const Vector &y, const ArrayOfVector &ys, const Index start=0, const Index end=-1)
Compute the variance of the ranged ys.
const ArrayOfVector & Grids() const
Returns the grids of the retrieval.
Range get_column_range() const
void covmat1DMarkov(MatrixType &block, MatrixType &block_inv, const Vector &grid, const Vector &sigma, const Numeric &lc, const Numeric &, const Verbosity &)
void retrievalAddMagField(Workspace &ws, CovarianceMatrix &covmat_sx, ArrayOfRetrievalQuantity &jacobian_quantities, Agenda &jacobian_agenda, const Index &atmosphere_dim, const Sparse &covmat_block, const Sparse &covmat_inv_block, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Vector &rq_p_grid, const Vector &rq_lat_grid, const Vector &rq_lon_grid, const String &component, const Numeric &dB, const Verbosity &verbosity)
WORKSPACE METHOD: retrievalAddMagField.
void covmat_seAddInverseBlock(CovarianceMatrix &covmat_se, const MatrixType &inv_block, const Index &i, const Index &j, const Verbosity &)
bool has_block(Index i, Index j)
Check if the block with indices (i, j) is contained in the covariance matrix.
void jacobianAddPointingZa(Workspace &ws, ArrayOfRetrievalQuantity &jacobian_quantities, Agenda &jacobian_agenda, const Matrix &sensor_pos, const Vector &sensor_time, const Index &poly_order, const String &calcmode, const Numeric &dza, const Verbosity &)
WORKSPACE METHOD: jacobianAddPointingZa.
Index nelem() const
Number of elements.
invlib::Matrix< ArtsCovarianceMatrixWrapper > CovarianceMatrix
invlib wrapper type for ARTS the ARTS covariance class.
void jacobianAddFreqShift(Workspace &ws, ArrayOfRetrievalQuantity &jacobian_quantities, Agenda &jacobian_agenda, const Vector &f_grid, const Numeric &df, const Verbosity &)
WORKSPACE METHOD: jacobianAddFreqShift.
void retrievalAddTemperature(Workspace &ws, CovarianceMatrix &covmat_sx, ArrayOfRetrievalQuantity &jacobian_quantities, Agenda &jacobian_agenda, const Index &atmosphere_dim, const Sparse &covmat_block, const Sparse &covmat_inv_block, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Vector &rq_p_grid, const Vector &rq_lat_grid, const Vector &rq_lon_grid, const String &hse, const Verbosity &verbosity)
WORKSPACE METHOD: retrievalAddTemperature.
void covmat_sxSet(CovarianceMatrix &covmat, const MatrixType &block, const Verbosity &)
void retrievalAddSpecialSpecies(Workspace &ws, CovarianceMatrix &covmat_sx, ArrayOfRetrievalQuantity &jacobian_quantities, Agenda &jacobian_agenda, const Index &atmosphere_dim, const Sparse &covmat_block, const Sparse &covmat_inv_block, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Vector &rq_p_grid, const Vector &rq_lat_grid, const Vector &rq_lon_grid, const String &species, const Verbosity &verbosity)
WORKSPACE METHOD: retrievalAddSpecialSpecies.
void retrievalDefInit(CovarianceMatrix &covmat_se, CovarianceMatrix &covmat_sx, Sparse &covmat_block, Sparse &covmat_inv_block, ArrayOfRetrievalQuantity &jacobian_quantities, Agenda &jacobian_agenda, const Index &initialize_jacobian, const Verbosity &verbosity)
WORKSPACE METHOD: retrievalDefInit.
Routines for setting up the jacobian.
void jacobianAddMagField(Workspace &, ArrayOfRetrievalQuantity &jq, Agenda &jacobian_agenda, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Vector &rq_p_grid, const Vector &rq_lat_grid, const Vector &rq_lon_grid, const String &component, const Numeric &dB, const Verbosity &verbosity)
WORKSPACE METHOD: jacobianAddMagField.
void jacobianAddFreqStretch(Workspace &ws, ArrayOfRetrievalQuantity &jacobian_quantities, Agenda &jacobian_agenda, const Vector &f_grid, const Numeric &df, const Verbosity &)
WORKSPACE METHOD: jacobianAddFreqStretch.
Eigen::Matrix< Numeric, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > MatrixType
bool empty() const
Returns true if variable size is zero.
Index ncols() const
Returns the number of columns.
invlib::Vector< ArtsVector > Vector
invlib wrapper type for ARTS vectors.
void PFromZSimple(Vector &p_grid, const Vector &z_grid, const Verbosity &)
WORKSPACE METHOD: PFromZSimple.
void add_scalar_variance(CovarianceMatrix &covmat, ArrayOfRetrievalQuantity &jacobian_quantities, Numeric var)
void jacobianAddBasicCatalogParameter(Workspace &, ArrayOfRetrievalQuantity &jq, Agenda &jacobian_agenda, const QuantumIdentifier &catalog_identity, const String &catalog_parameter, const Verbosity &verbosity)
WORKSPACE METHOD: jacobianAddBasicCatalogParameter.
void retrievalAddSinefit(Workspace &ws, CovarianceMatrix &covmat_sx, ArrayOfRetrievalQuantity &jacobian_quantities, Agenda &jacobian_agenda, const Sparse &covmat_block, const Sparse &covmat_inv_block, const ArrayOfIndex &sensor_response_pol_grid, const Matrix &sensor_response_dlos_grid, const Matrix &sensor_pos, const Vector &period_lengths, const Index &no_pol_variation, const Index &no_los_variation, const Index &no_mblock_variation, const Verbosity &verbosity)
WORKSPACE METHOD: retrievalAddSinefit.
bool empty() const
Returns true if variable size is zero.
void jacobianAddScatSpecies(Workspace &, ArrayOfRetrievalQuantity &jq, Agenda &jacobian_agenda, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Vector &rq_p_grid, const Vector &rq_lat_grid, const Vector &rq_lon_grid, const String &species, const String &quantity, const Verbosity &verbosity)
WORKSPACE METHOD: jacobianAddScatSpecies.
void jacobianAddTemperature(Workspace &, ArrayOfRetrievalQuantity &jq, Agenda &jacobian_agenda, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Vector &rq_p_grid, const Vector &rq_lat_grid, const Vector &rq_lon_grid, const String &hse, const Verbosity &verbosity)
WORKSPACE METHOD: jacobianAddTemperature.
Index nelem() const
Returns the number of elements.
void jacobianAddWind(Workspace &, ArrayOfRetrievalQuantity &jq, Agenda &jacobian_agenda, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Vector &rq_p_grid, const Vector &rq_lat_grid, const Vector &rq_lon_grid, const String &component, const Numeric &dfrequency, const Verbosity &verbosity)
WORKSPACE METHOD: jacobianAddWind.
void retrievalAddWind(Workspace &ws, CovarianceMatrix &covmat_sx, ArrayOfRetrievalQuantity &jacobian_quantities, Agenda &jacobian_agenda, const Index &atmosphere_dim, const Sparse &covmat_block, const Sparse &covmat_inv_block, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Vector &rq_p_grid, const Vector &rq_lat_grid, const Vector &rq_lon_grid, const String &component, const Numeric &dfrequency, const Verbosity &verbosity)
WORKSPACE METHOD: retrievalAddWind.
void insert_elements(MatrixType &matrix, Index, Index, const ArrayOfIndex &row_indices, const ArrayOfIndex &column_indices, const Vector &elements)
void jacobianAddSurfaceQuantity(Workspace &, ArrayOfRetrievalQuantity &jq, Agenda &jacobian_agenda, const Index &atmosphere_dim, const Vector &lat_grid, const Vector &lon_grid, const Vector &rq_lat_grid, const Vector &rq_lon_grid, const String &quantity, const Verbosity &verbosity)
WORKSPACE METHOD: jacobianAddSurfaceQuantity.
Deals with internal derivatives, Jacobian definition, and OEM calculations.
void retrievalAddCatalogParameters(Workspace &ws, CovarianceMatrix &covmat_sx, ArrayOfRetrievalQuantity &jacobian_quantities, Agenda &jacobian_agenda, const Sparse &covmat_block, const Sparse &covmat_inv_block, const ArrayOfQuantumIdentifier &catalog_identities, const ArrayOfString &catalog_parameters, const Verbosity &verbosity)
WORKSPACE METHOD: retrievalAddCatalogParameters.
bool is_consistent(const ArrayOfArrayOfIndex &jis) const
Checks that the dimensions of the blocks in the covariance matrix are consistent with ranges occupied...
void jac_ranges_indices(ArrayOfArrayOfIndex &jis, bool &any_affine, const ArrayOfRetrievalQuantity &jqs, const bool &before_affine)
Determines the index range inside x and the Jacobian for each retrieval quantity. ...
void retrievalAddPointingZa(Workspace &ws, CovarianceMatrix &covmat_sx, ArrayOfRetrievalQuantity &jacobian_quantities, Agenda &jacobian_agenda, const Sparse &covmat_block, const Sparse &covmat_inv_block, const Matrix &sensor_pos, const Vector &sensor_time, const Index &poly_order, const String &calcmode, const Numeric &dza, const Verbosity &verbosity)
WORKSPACE METHOD: retrievalAddPointingZa.
Header files of CovarianceMatrix class.
void retrievalAddFreqStretch(Workspace &ws, CovarianceMatrix &covmat_sx, ArrayOfRetrievalQuantity &jacobian_quantities, Agenda &jacobian_agenda, const Vector &f_grid, const Sparse &covmat_block, const Sparse &covmat_inv_block, const Numeric &df, const Verbosity &verbosity)
WORKSPACE METHOD: retrievalAddFreqStretch.
void retrievalErrorsExtract(Vector &retrieval_eo, Vector &retrieval_ss, const Matrix &covmat_so, const Matrix &covmat_ss, const Verbosity &)
WORKSPACE METHOD: retrievalErrorsExtract.
_CS_string_type str() const
void ZFromPSimple(Vector &z_grid, const Vector &p_grid, const Verbosity &)
WORKSPACE METHOD: ZFromPSimple.
void covmat1D(MatrixType &block, const Vector &grid1, const Vector &grid2, const Vector &sigma1, const Vector &sigma2, const Vector &lc1, const Vector &lc2, const Numeric &co, const String &fname, const Verbosity &)
constexpr Index get_extent() const
Returns the extent of the range.
void jacobianAddPolyfit(Workspace &ws, ArrayOfRetrievalQuantity &jq, Agenda &jacobian_agenda, const ArrayOfIndex &sensor_response_pol_grid, const Matrix &sensor_response_dlos_grid, const Matrix &sensor_pos, const Index &poly_order, const Index &no_pol_variation, const Index &no_los_variation, const Index &no_mblock_variation, const Verbosity &)
WORKSPACE METHOD: jacobianAddPolyfit.
Index nrows() const
Returns the number of rows.
Class to identify and match lines by their quantum numbers.
void retrievalAddSurfaceQuantity(Workspace &ws, CovarianceMatrix &covmat_sx, ArrayOfRetrievalQuantity &jacobian_quantities, Agenda &jacobian_agenda, const Sparse &covmat_block, const Sparse &covmat_inv_block, const Index &atmosphere_dim, const Vector &lat_grid, const Vector &lon_grid, const Vector &rq_lat_grid, const Vector &rq_lon_grid, const String &quantity, const Verbosity &verbosity)
WORKSPACE METHOD: retrievalAddSurfaceQuantity.
NUMERIC Numeric
The type to use for all floating point numbers.
Range get_row_range() const
void covmat_sxAddInverseBlock(CovarianceMatrix &covmat_sx, const ArrayOfRetrievalQuantity &jq, const MatrixType &block_inv, const Index &i, const Index &j, const Verbosity &)
Vector diagonal() const
Diagonal elements as vector.
Numeric pow(const Rational base, Numeric exp)
Power of.
basic_ostringstream< char, string_char_traits< char >, alloc > ostringstream
void retrievalAddFreqShift(Workspace &ws, CovarianceMatrix &covmat_sx, ArrayOfRetrievalQuantity &jacobian_quantities, Agenda &jacobian_agenda, const Sparse &covmat_block, const Sparse &covmat_inv_block, const Vector &f_grid, const Numeric &df, const Verbosity &verbosity)
WORKSPACE METHOD: retrievalAddFreqShift.
void retrievalAddAbsSpecies(Workspace &ws, CovarianceMatrix &covmat_sx, ArrayOfRetrievalQuantity &jacobian_quantities, Agenda &jacobian_agenda, const Index &atmosphere_dim, const Sparse &covmat_block, const Sparse &covmat_inv_block, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Vector &rq_p_grid, const Vector &rq_lat_grid, const Vector &rq_lon_grid, const String &species, const String &mode, const Index &for_species_tag, const Verbosity &verbosity)
WORKSPACE METHOD: retrievalAddAbsSpecies.
This can be used to make arrays out of anything.
void setCovarianceMatrix(CovarianceMatrix &covmat, const MatrixType &block)
void jacobianAddBasicCatalogParameters(Workspace &ws, ArrayOfRetrievalQuantity &jq, Agenda &jacobian_agenda, const ArrayOfQuantumIdentifier &catalog_identities, const ArrayOfString &catalog_parameters, const Verbosity &verbosity)
WORKSPACE METHOD: jacobianAddBasicCatalogParameters.
void resize(Index n)
Resize function.
void retrievalAddCatalogParameter(Workspace &ws, CovarianceMatrix &covmat_sx, ArrayOfRetrievalQuantity &jacobian_quantities, Agenda &jacobian_agenda, const QuantumIdentifier &catalog_identity, const String &catalog_parameter, const Numeric &var, const Verbosity &verbosity)
WORKSPACE METHOD: retrievalAddCatalogParameter.
void check_and_add_block(CovarianceMatrix &covmat, const RetrievalQuantity &jq, const Index rq_index, const Index grid_dimensions, const Sparse &covmat_block, const Sparse &covmat_inv_block)
A constant view of a Vector.
void retrievalDefClose(Workspace &ws, Index &jacobian_do, Agenda &jacobian_agenda, Index &retrieval_checked, const CovarianceMatrix &covmat_sx, const ArrayOfRetrievalQuantity &jacobian_quantities, const Verbosity &verbosity)
WORKSPACE METHOD: retrievalDefClose.
constexpr Rational start(Rational Ju, Rational Jl, Polarization type) noexcept
Gives the lowest M for a polarization type of this transition.
const Block * get_block(Index i=-1, Index j=-1)
Return a pointer to the block with indices (i,j).
void covmat_sxExtractSqrtDiagonal(Vector &x_norm, const CovarianceMatrix &covmat_sx, const Verbosity &)
WORKSPACE METHOD: covmat_sxExtractSqrtDiagonal.
void add_correlation_inverse(Block c)
Add block inverse to covariance matrix.
Index ndiagblocks() const
! The number of diagonal blocks in the matrix excluding inverses.
void add_correlation(Block c)
Add block to covariance matrix.
void covmat_sxAddBlock(CovarianceMatrix &covmat_sx, const ArrayOfRetrievalQuantity &jq, const MatrixType &block, const Index &i, const Index &j, const Verbosity &)
void jacobianAddSinefit(Workspace &ws, ArrayOfRetrievalQuantity &jq, Agenda &jacobian_agenda, const ArrayOfIndex &sensor_response_pol_grid, const Matrix &sensor_response_dlos_grid, const Matrix &sensor_pos, const Vector &period_lengths, const Index &no_pol_variation, const Index &no_los_variation, const Index &no_mblock_variation, const Verbosity &)
WORKSPACE METHOD: jacobianAddSinefit.
void retrievalAddScatSpecies(Workspace &ws, CovarianceMatrix &covmat_sx, ArrayOfRetrievalQuantity &jacobian_quantities, Agenda &jacobian_agenda, const Index &atmosphere_dim, const Sparse &covmat_block, const Sparse &covmat_inv_block, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Vector &rq_p_grid, const Vector &rq_lat_grid, const Vector &rq_lon_grid, const String &species, const String &quantity, const Verbosity &verbosity)
WORKSPACE METHOD: retrievalAddScatSpecies.
void covmat_seSet(CovarianceMatrix &covmat, const MatrixType &block, const Verbosity &)
bool has_diagonal_blocks(const ArrayOfArrayOfIndex &jis) const
Checks that the covariance matrix contains one diagonal block per retrieval quantity.
void jacobianAddSpecialSpecies(Workspace &, ArrayOfRetrievalQuantity &jq, Agenda &jacobian_agenda, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Vector &rq_p_grid, const Vector &rq_lat_grid, const Vector &rq_lon_grid, const String &species, const Verbosity &verbosity)
WORKSPACE METHOD: jacobianAddSpecialSpecies.
Index nrows() const
Returns the number of rows.
void jacobianInit(ArrayOfRetrievalQuantity &jacobian_quantities, Agenda &jacobian_agenda, const Verbosity &)
WORKSPACE METHOD: jacobianInit.
Numeric sqrt(const Rational r)
Square root.
void resize(Index r, Index c)
Resize function.