83 for (
Index i = 0; i < nelem; i++) aoi[i] = value;
95 Index n = (
Index)floor((stop - start) / step) + 1;
100 for (
Index i = 0; i < n; i++) x[i] = start + i * step;
102 out2 <<
" Creating a linearly spaced ArrayOfIndex.\n";
103 out3 <<
" length : " << x.
nelem() <<
"\n";
104 out3 <<
" first value : " << x[0] <<
"\n";
107 out3 <<
" step size : " << x[1] - x[0] <<
"\n";
108 out3 <<
" last value : " << x[x.nelem() - 1] <<
"\n";
210 (si_row>0 && fwhm_row>0),
211 "One of the GINs *si_row* and *fwhm_row* shall be >0, but just one.");
213 (si_col>0 && fwhm_col>0),
214 "One of the GINs *si_col* and *fwhm_col* shall be >0, but just one.");
218 Y.resize(nrow, ncol);
223 for (
Index r=0; r<nrow; ++r)
224 row_term[r] =
pow((x_row[r] - x0_row) / si4row, 2.0);
227 col_term[
c] =
pow((x_col[
c] - x0_col) / si4col, 2.0);
229 for (
Index r=0; r<nrow; ++r) {
231 Y(r,
c) =
fac * exp(-0.5 * (row_term[r] + col_term[
c]));
278 out(r,
c) = in(r,
c);
294 if (direction ==
"page") {
295 if (index >= t3.
npages()) {
297 os <<
"The index " << index
298 <<
" is outside the page range of the Matrix.";
299 throw runtime_error(os.str());
304 }
else if (direction ==
"row") {
305 if (index >= t3.
nrows()) {
307 os <<
"The index " << index <<
" is outside the row range of the Matrix.";
308 throw runtime_error(os.str());
313 }
else if (direction ==
"column") {
314 if (index >= t3.
ncols()) {
316 os <<
"The index " << index
317 <<
" is outside the column range of the Matrix.";
318 throw runtime_error(os.str());
325 os <<
"Keyword *direction* must be either *page* or *row* or *column*,"
326 <<
"but you gave: " << direction <<
".";
327 throw runtime_error(os.str());
339 if (
M.ncols() != X.
nrows()) {
341 os <<
"Matrix dimensions must be consistent!\n"
342 <<
"Matrix1.ncols() = " <<
M.ncols() <<
"\n"
343 <<
"Matrix2.nrows() = " << X.
nrows();
344 throw runtime_error(os.str());
365 const Index nv =
v.nelem();
380 if (v2.
nelem() != nv)
381 throw runtime_error(
"Vectors must be of the same size.");
399 throw runtime_error(
"Vectors must be of the same size.");
413 const Index nv =
v.nelem();
428 if (v2.
nelem() != nv)
429 throw runtime_error(
"Vectors must be of the same size.");
447 throw runtime_error(
"Vectors must be of the same size.");
477 m.
resize(npages * nrows, ncols);
480 for (
Index p=0; p<npages; ++p) {
481 for (
Index r=0; r<nrows; ++r) {
513 else if (in > limit_high)
534 else if (op ==
"last")
535 out = in[in.
nelem() - 1];
536 else if (op ==
"max")
538 else if (op ==
"min")
540 else if (op ==
"mean")
544 os <<
"Your choice, *op* = \"" << op <<
"\", is not recognised.\n"
545 <<
"Valid options are: \"first\", \"last\", \"max\", \"min\" and \"mean\".";
546 throw runtime_error(os.str());
607 if (
M.ncols() != X.
nrows()) {
609 os <<
"Matrix dimensions must be consistent!\n"
610 <<
"Matrix1.ncols() = " <<
M.ncols() <<
"\n"
611 <<
"Matrix2.nrows() = " << X.
nrows();
612 throw runtime_error(os.str());
632 if (value != 1.0) X *= value;
641 for (
Index i = 0; i < n; ++i) {
653 for (
Index i = 0; i < n; ++i) {
684 const Index nv =
v.nelem();
718 x.
resize(npages, nrows, ncols);
721 out2 <<
" Tensor3 = " << value <<
"\n";
722 out3 <<
" npages : " << npages <<
"\n";
723 out3 <<
" nrows : " << nrows <<
"\n";
724 out3 <<
" ncols : " << ncols <<
"\n";
738 if (direction ==
"book") {
739 if (index >= t4.
nbooks()) {
741 os <<
"The index " << index
742 <<
" is outside the book range of the Tensor4.";
743 throw runtime_error(os.str());
748 }
else if (direction ==
"page") {
749 if (index >= t4.
npages()) {
751 os <<
"The index " << index
752 <<
" is outside the pages range of the Tensor4.";
753 throw runtime_error(os.str());
758 }
else if (direction ==
"row") {
759 if (index >= t4.
nrows()) {
761 os <<
"The index " << index
762 <<
" is outside the row range of the Tensor4.";
763 throw runtime_error(os.str());
768 }
else if (direction ==
"column") {
769 if (index >= t4.
ncols()) {
771 os <<
"The index " << index
772 <<
" is outside the column range of the Tensor4.";
773 throw runtime_error(os.str());
780 os <<
"Keyword *direction* must be either *page*, *book*, *row* or *column*,"
781 <<
"but you gave: " << direction <<
".";
782 throw runtime_error(os.str());
833 x.
resize(nbooks, npages, nrows, ncols);
836 out2 <<
" Tensor4 = " << value <<
"\n";
837 out3 <<
" nbooks : " << nbooks <<
"\n";
838 out3 <<
" npages : " << npages <<
"\n";
839 out3 <<
" nrows : " << nrows <<
"\n";
840 out3 <<
" ncols : " << ncols <<
"\n";
863 const Index& nshelves,
873 x.
resize(nshelves, nbooks, npages, nrows, ncols);
876 out2 <<
" Tensor5 = " << value <<
"\n";
877 out3 <<
" nshelves : " << nshelves <<
"\n";
878 out3 <<
" nbooks : " << nbooks <<
"\n";
879 out3 <<
" npages : " << npages <<
"\n";
880 out3 <<
" nrows : " << nrows <<
"\n";
881 out3 <<
" ncols : " << ncols <<
"\n";
909 const Index& nvitrines,
910 const Index& nshelves,
920 x.
resize(nvitrines, nshelves, nbooks, npages, nrows, ncols);
923 out2 <<
" Tensor6 = " << value <<
"\n";
924 out3 <<
" nvitrines : " << nvitrines <<
"\n";
925 out3 <<
" nshelves : " << nshelves <<
"\n";
926 out3 <<
" nbooks : " << nbooks <<
"\n";
927 out3 <<
" npages : " << npages <<
"\n";
928 out3 <<
" nrows : " << nrows <<
"\n";
929 out3 <<
" ncols : " << ncols <<
"\n";
958 const Index& nlibraries,
959 const Index& nvitrines,
960 const Index& nshelves,
970 x.
resize(nlibraries, nvitrines, nshelves, nbooks, npages, nrows, ncols);
973 out2 <<
" Tensor7 = " << value <<
"\n";
974 out3 <<
" nlibraries : " << nlibraries <<
"\n";
975 out3 <<
" nvitrines : " << nvitrines <<
"\n";
976 out3 <<
" nshelves : " << nshelves <<
"\n";
977 out3 <<
" nbooks : " << nbooks <<
"\n";
978 out3 <<
" npages : " << npages <<
"\n";
979 out3 <<
" nrows : " << nrows <<
"\n";
980 out3 <<
" ncols : " << ncols <<
"\n";
991 throw runtime_error(
"The vectors *x* and *y* must have the same length.");
994 for (
Index i=1; i<n; i++)
995 out += 0.5*(y[i-1]+y[i]) * (x[i]-x[i-1]);
1076 if (
b.nelem() == 1) {
1091 else if (
b.nelem() ==
a.nelem()) {
1102 throw runtime_error(
1103 "The vector *b* must have length 1 or match *a* in length.");
1112 if (
b.nelem() == 1) {
1127 else if (
b.nelem() ==
a.nelem()) {
1138 throw runtime_error(
1139 "The vector *b* must have length 1 or match *a* in length.");
1148 if (
b.nelem() == 1) {
1163 else if (
b.nelem() ==
a.nelem()) {
1174 throw runtime_error(
1175 "The vector *b* must have length 1 or match *a* in length.");
1184 if (
b.nelem() == 1) {
1199 else if (
b.nelem() ==
a.nelem()) {
1210 throw runtime_error(
1211 "The vector *b* must have length 1 or match *a* in length.");
1221 if (out.
nelem() != l)
1224 for (
Index i=0; i<l; i++) {
1225 if (in[i] < limit_low)
1227 else if (in[i] > limit_high)
1228 out[i] = limit_high;
1244 for (
Index i = 0; i < nin; i++) {
1245 if (in[i] >= min_value && in[i] <= max_value) {
1257 for (
Index i = 0; i < nin; i++) {
1258 if (
c[i] >= min_value &&
c[i] <= max_value) {
1282 if (direction ==
"row") {
1283 if (index >= m.
nrows()) {
1285 os <<
"The index " << index <<
" is outside the row range of the Matrix.";
1286 throw runtime_error(os.str());
1291 }
else if (direction ==
"column") {
1292 if (index >= m.
ncols()) {
1294 os <<
"The index " << index
1295 <<
" is outside the column range of the Matrix.";
1296 throw runtime_error(os.str());
1303 os <<
"Keyword *direction* must be either *row* or *column*,"
1304 <<
"but you gave: " << direction <<
".";
1305 throw runtime_error(os.str());
1317 for (
Index i = 0; i < n; i++) out[i] =
v[n - 1 - i];
1321 for (
Index i = 0; i < n; i++) out[i] = in[n - 1 - i];
1335 "One of the GINs *si* and *fwhm* shall be >0, but just one.");
1346 for (
Index i=0; i<n; ++i) {
1347 y[i] =
fac * exp(-0.5 *
pow((x[i] - x0) / si2use, 2.0));
1385 os <<
"The input Vector must be either\n"
1386 <<
"strictly increasing or strictly decreasing,\n"
1387 <<
"but this is not the case.\n";
1388 os <<
"The vector contains:\n" << ig;
1389 throw runtime_error(os.str());
1398 for (
Index j = 0; j < p.
nelem(); j++) p[j] = dummy[si[j]];
1404 Index iig = 0, ip = 0;
1407 if (p[ip] < ig[iig]) {
1410 }
else if (p[ip] > ig[iig]) {
1411 x.push_back(ig[iig]);
1414 out3 <<
" Skipping point " << p[ip] <<
", which is already "
1415 <<
"in the original grid.\n";
1421 out2 <<
" " << sk <<
" points skipped.\n";
1425 if (ip == p.
nelem()) {
1427 while (iig < ig.
nelem()) {
1428 x.push_back(ig[iig]);
1431 }
else if (iig == ig.
nelem()) {
1433 while (ip < p.
nelem()) {
1449 for (
Index i = 0; i < x.
nelem(); ++i) og[i] = x[i];
1452 og[i] = x[x.
nelem() - 1 - i];
1466 out2 <<
" Creating a linearly spaced vector.\n";
1467 out3 <<
" length : " << x.
nelem() <<
"\n";
1468 out3 <<
" first value : " << x[0] <<
"\n";
1470 if (x.
nelem() > 1) {
1471 out3 <<
" step size : " << x[1] - x[0] <<
"\n";
1472 out3 <<
" last value : " << x[x.nelem() - 1] <<
"\n";
1485 linspace(x, log(start), log(stop), step);
1488 out2 <<
" Creating a logarithmically spaced vector.\n";
1489 out3 <<
" length : " << x.
nelem() <<
"\n";
1490 out3 <<
" first value : " << x[0] <<
"\n";
1492 if (x.
nelem() > 1) {
1493 out3 <<
" step size : " << x[1] - x[0] <<
"\n";
1494 out3 <<
" last value : " << x[x.nelem() - 1] <<
"\n";
1506 if (
M.ncols() != x.
nelem()) {
1508 os <<
"Matrix and vector dimensions must be consistent!\n"
1509 <<
"Matrix.ncols() = " <<
M.ncols() <<
"\n"
1510 <<
"Vector.nelem() = " << x.
nelem();
1511 throw runtime_error(os.str());
1532 if (
M.ncols() != x.
nelem()) {
1534 os <<
"Sparse and vector dimensions must be consistent!\n"
1535 <<
"Sparse.ncols() = " <<
M.ncols() <<
"\n"
1536 <<
"Vector.nelem() = " << x.
nelem();
1537 throw runtime_error(os.str());
1559 if (n < 2)
throw runtime_error(
"The number of points must be > 1.");
1562 out2 <<
" Creating a linearly spaced vector.\n";
1563 out3 <<
" length : " << n <<
"\n";
1564 out3 <<
" first value : " << x[0] <<
"\n";
1566 if (x.
nelem() > 1) {
1567 out3 <<
" step size : " << x[1] - x[0] <<
"\n";
1568 out3 <<
" last value : " << x[x.nelem() - 1] <<
"\n";
1587 Time t0(start), t1(stop);
1590 nlinspace(seconds, t0.Seconds(), t1.Seconds(), n);
1592 x = time_vector(seconds);
1595/* Workspace method: Doxygen documentation will be auto-generated */
1596void VectorNLogSpace(Vector& x,
1598 const Numeric& start,
1599 const Numeric& stop,
1600 const Verbosity& verbosity) {
1604 if (n < 2) throw runtime_error("The number of points must be > 1.
");
1605 if ((start <= 0) || (stop <= 0))
1606 throw runtime_error("Only positive numbers are allowed.
");
1608 nlogspace(x, start, stop, n);
1610 out2 << " Creating
a logarithmically spaced vector.\n
";
1611 out3 << " length :
" << n << "\n
";
1612 out3 << " first value :
" << x[0] << "\n
";
1615 out3 << " last value :
" << x[x.nelem() - 1] << "\n
";
1618/* Workspace method: Doxygen documentation will be auto-generated */
1619void VectorPower(Vector& out,
1621 const Numeric& value,
1623 const Index n = in.nelem();
1624 // Note that in and out can be the same vector
1626 // Out and in are the same.
1630 for (Index i=0; i<n; i++) {
1631 out[i] = pow( in[i], value );
1635/* Workspace method: Doxygen documentation will be auto-generated */
1636void VectorReshapeMatrix(Vector& v,
1638 const String& direction,
1640 const Index nrows = m.nrows();
1641 const Index ncols = m.ncols();
1643 v.resize(nrows * ncols);
1647 if (direction == "column
") {
1648 for (Index col = 0; col < ncols; col++) {
1649 for (Index row = 0; row < nrows; row++) {
1650 v[iv] = m(row, col);
1654 } else if (direction == "row
") {
1655 for (Index row = 0; row < nrows; row++) {
1656 for (Index col = 0; col < ncols; col++) {
1657 v[iv] = m(row, col);
1663 os << "Keyword *direction* must be either *row* or *column*,
"
1664 << "but you gave:
" << direction << ".
";
1665 throw runtime_error(os.str());
1669/* Workspace method: Doxygen documentation will be auto-generated */
1670void VectorSetConstant(Vector& x,
1672 const Numeric& value,
1673 const Verbosity& verbosity) {
1680 out2 << " Creating
a constant vector.\n
";
1681 out3 << " length :
" << n << "\n
";
1682 out3 << " value :
" << value << "\n
";
1685/* Workspace method: Doxygen documentation will be auto-generated */
1686void ArrayOfTimeSetConstant(ArrayOfTime& x,
1689 const Verbosity& verbosity) {
1696 out2 << " Creating
a constant vector.\n
";
1697 out3 << " length :
" << n << "\n
";
1698 out3 << " value :
" << value << "\n
";
1701/* Workspace method: Doxygen documentation will be auto-generated */
1702void Compare(const Numeric& var1,
1703 const Numeric& var2,
1704 const Numeric& maxabsdiff,
1705 const String& error_message,
1706 const String& var1name,
1707 const String& var2name,
1710 const Verbosity& verbosity) {
1711 Numeric maxdiff = var1 - var2;
1713 if (std::isnan(var1) || std::isnan(var2)) {
1714 if (std::isnan(var1) && std::isnan(var2)) {
1716 } else if (std::isnan(var1)) {
1718 os << "Nan found in
" << var1name << ", but there is no
"
1719 << "NaN at same position in
" << var2name << ".\nThis
"
1720 << "is not allowed.
";
1721 throw runtime_error(os.str());
1724 os << "Nan found in
" << var2name << ", but there is no
"
1725 << "NaN at same position in
" << var1name << ".\nThis
"
1726 << "is not allowed.
";
1727 throw runtime_error(os.str());
1731 if (abs(maxdiff) > maxabsdiff) {
1733 os << var1name << "-
" << var2name << " FAILED!\n
";
1734 if (error_message.length()) os << error_message << "\n
";
1735 os << "Max allowed deviation set to:
" << maxabsdiff << endl
1736 << "but the value deviates with:
" << maxdiff << endl;
1737 throw runtime_error(os.str());
1741 out2 << " " << var1name << "-
" << var2name
1742 << " OK (maximum difference =
" << maxdiff << ").\n
";
1745/* Workspace method: Doxygen documentation will be auto-generated */
1746void Compare(const Vector& var1,
1748 const Numeric& maxabsdiff,
1749 const String& error_message,
1750 const String& var1name,
1751 const String& var2name,
1754 const Verbosity& verbosity) {
1755 const Index n = var1.nelem();
1757 if (var2.nelem() != n) {
1759 os << var1name << " (
" << n << ") and
" << var2name << " (
" << var2.nelem()
1760 << ")
do not have the same size.
";
1761 throw runtime_error(os.str());
1764 Numeric maxdiff = 0.0;
1765 for (Index i = 0; i < n; i++) {
1766 Numeric diff = var1[i] - var2[i];
1768 if (std::isnan(var1[i]) || std::isnan(var2[i])) {
1769 if (std::isnan(var1[i]) && std::isnan(var2[i])) {
1771 } else if (std::isnan(var1[i])) {
1773 os << "Nan found in
" << var1name << ", but there is no
"
1774 << "NaN at same position in
" << var2name << ".\nThis
"
1775 << "is not allowed.
";
1776 throw runtime_error(os.str());
1779 os << "Nan found in
" << var2name << ", but there is no
"
1780 << "NaN at same position in
" << var1name << ".\nThis
"
1781 << "is not allowed.
";
1782 throw runtime_error(os.str());
1786 if (abs(diff) > abs(maxdiff)) {
1791 if (std::isnan(maxdiff) || abs(maxdiff) > maxabsdiff) {
1793 os << var1name << "-
" << var2name << " FAILED!\n
";
1794 if (error_message.length()) os << error_message << "\n
";
1795 os << "Max allowed deviation set to:
" << maxabsdiff << endl
1796 << "but the vectors deviate with:
" << maxdiff << endl;
1797 throw runtime_error(os.str());
1801 out2 << " " << var1name << "-
" << var2name
1802 << " OK (maximum difference =
" << maxdiff << ").\n
";
1805/* Workspace method: Doxygen documentation will be auto-generated */
1806void Compare(const Matrix& var1,
1808 const Numeric& maxabsdiff,
1809 const String& error_message,
1810 const String& var1name,
1811 const String& var2name,
1814 const Verbosity& verbosity) {
1815 const Index nrows = var1.nrows();
1816 const Index ncols = var1.ncols();
1818 if (var2.nrows() != nrows || var2.ncols() != ncols) {
1820 os << var1name << " (
" << nrows << ",
" << ncols << ") and
" << var2name
1821 << " (
" << var2.nrows() << ",
" << var2.ncols()
1822 << ")
do not have the same size.
";
1823 throw runtime_error(os.str());
1826 Numeric maxdiff = 0.0;
1828 for (Index r = 0; r < nrows; r++) {
1829 for (Index c = 0; c < ncols; c++) {
1830 Numeric diff = var1(r, c) - var2(r, c);
1832 if (std::isnan(var1(r, c)) || std::isnan(var2(r, c))) {
1833 if (std::isnan(var1(r, c)) && std::isnan(var2(r, c))) {
1835 } else if (std::isnan(var1(r, c))) {
1837 os << "Nan found in
" << var1name << ", but there is no
"
1838 << "NaN at same position in
" << var2name << ".\nThis
"
1839 << "is not allowed.
";
1840 throw runtime_error(os.str());
1843 os << "Nan found in
" << var2name << ", but there is no
"
1844 << "NaN at same position in
" << var1name << ".\nThis
"
1845 << "is not allowed.
";
1846 throw runtime_error(os.str());
1850 if (abs(diff) > abs(maxdiff)) {
1856 if (abs(maxdiff) > maxabsdiff) {
1858 os << var1name << "-
" << var2name << " FAILED!\n
";
1859 if (error_message.length()) os << error_message << "\n
";
1860 os << "Max allowed deviation set to :
" << maxabsdiff << endl
1861 << "but the matrices deviate with:
" << maxdiff << endl;
1862 throw runtime_error(os.str());
1866 out2 << " " << var1name << "-
" << var2name
1867 << " OK (maximum difference =
" << maxdiff << ").\n
";
1870/* Workspace method: Doxygen documentation will be auto-generated */
1871void Compare(const Tensor3& var1,
1872 const Tensor3& var2,
1873 const Numeric& maxabsdiff,
1874 const String& error_message,
1875 const String& var1name,
1876 const String& var2name,
1879 const Verbosity& verbosity) {
1880 const Index ncols = var1.ncols();
1881 const Index nrows = var1.nrows();
1882 const Index npages = var1.npages();
1884 if (var2.ncols() != ncols || var2.nrows() != nrows ||
1885 var2.npages() != npages) {
1887 os << var1name << " and
" << var2name << " do not have the same size.
";
1888 throw runtime_error(os.str());
1891 Numeric maxdiff = 0.0;
1893 for (Index c = 0; c < ncols; c++)
1894 for (Index r = 0; r < nrows; r++)
1895 for (Index p = 0; p < npages; p++) {
1896 Numeric diff = var1(p, r, c) - var2(p, r, c);
1898 if (std::isnan(var1(p, r, c)) || std::isnan(var2(p, r, c))) {
1899 if (std::isnan(var1(p, r, c)) && std::isnan(var2(p, r, c))) {
1901 } else if (std::isnan(var1(p, r, c))) {
1903 os << "Nan found in
" << var1name << ", but there is no
"
1904 << "NaN at same position in
" << var2name << ".\nThis
"
1905 << "is not allowed.
";
1906 throw runtime_error(os.str());
1909 os << "Nan found in
" << var2name << ", but there is no
"
1910 << "NaN at same position in
" << var1name << ".\nThis
"
1911 << "is not allowed.
";
1912 throw runtime_error(os.str());
1916 if (abs(diff) > abs(maxdiff)) {
1921 if (abs(maxdiff) > maxabsdiff) {
1923 os << var1name << "-
" << var2name << " FAILED!\n
";
1924 if (error_message.length()) os << error_message << "\n
";
1925 os << "Max allowed deviation set to :
" << maxabsdiff << endl
1926 << "but the tensors deviate with:
" << maxdiff << endl;
1927 throw runtime_error(os.str());
1931 out2 << " " << var1name << "-
" << var2name
1932 << " OK (maximum difference =
" << maxdiff << ").\n
";
1935/* Workspace method: Doxygen documentation will be auto-generated */
1936void Compare(const Tensor4& var1,
1937 const Tensor4& var2,
1938 const Numeric& maxabsdiff,
1939 const String& error_message,
1940 const String& var1name,
1941 const String& var2name,
1944 const Verbosity& verbosity) {
1945 const Index ncols = var1.ncols();
1946 const Index nrows = var1.nrows();
1947 const Index npages = var1.npages();
1948 const Index nbooks = var1.nbooks();
1950 if (var2.ncols() != ncols || var2.nrows() != nrows ||
1951 var2.npages() != npages || var2.nbooks() != nbooks) {
1953 os << var1name << " and
" << var2name << " do not have the same size.
";
1954 throw runtime_error(os.str());
1957 Numeric maxdiff = 0.0;
1959 for (Index c = 0; c < ncols; c++)
1960 for (Index r = 0; r < nrows; r++)
1961 for (Index p = 0; p < npages; p++)
1962 for (Index b = 0; b < nbooks; b++) {
1963 Numeric diff = var1(b, p, r, c) - var2(b, p, r, c);
1965 if (std::isnan(var1(b, p, r, c)) || std::isnan(var2(b, p, r, c))) {
1966 if (std::isnan(var1(b, p, r, c)) && std::isnan(var2(b, p, r, c))) {
1968 } else if (std::isnan(var1(b, p, r, c))) {
1970 os << "Nan found in
" << var1name << ", but there is no
"
1971 << "NaN at same position in
" << var2name << ".\nThis
"
1972 << "is not allowed.
";
1973 throw runtime_error(os.str());
1976 os << "Nan found in
" << var2name << ", but there is no
"
1977 << "NaN at same position in
" << var1name << ".\nThis
"
1978 << "is not allowed.
";
1979 throw runtime_error(os.str());
1983 if (abs(diff) > abs(maxdiff)) {
1988 if (abs(maxdiff) > maxabsdiff) {
1990 os << var1name << "-
" << var2name << " FAILED!\n
";
1991 if (error_message.length()) os << error_message << "\n
";
1992 os << "Max allowed deviation set to :
" << maxabsdiff << endl
1993 << "but the tensors deviate with:
" << maxdiff << endl;
1994 throw runtime_error(os.str());
1998 out2 << " " << var1name << "-
" << var2name
1999 << " OK (maximum difference =
" << maxdiff << ").\n
";
2002/* Workspace method: Doxygen documentation will be auto-generated */
2003void Compare(const Tensor5& var1,
2004 const Tensor5& var2,
2005 const Numeric& maxabsdiff,
2006 const String& error_message,
2007 const String& var1name,
2008 const String& var2name,
2011 const Verbosity& verbosity) {
2012 const Index ncols = var1.ncols();
2013 const Index nrows = var1.nrows();
2014 const Index npages = var1.npages();
2015 const Index nbooks = var1.nbooks();
2016 const Index nshelves = var1.nshelves();
2018 if (var2.ncols() != ncols || var2.nrows() != nrows ||
2019 var2.npages() != npages || var2.nbooks() != nbooks ||
2020 var2.nshelves() != nshelves) {
2022 os << var1name << " and
" << var2name << " do not have the same size.
";
2023 throw runtime_error(os.str());
2026 Numeric maxdiff = 0.0;
2028 for (Index c = 0; c < ncols; c++)
2029 for (Index r = 0; r < nrows; r++)
2030 for (Index p = 0; p < npages; p++)
2031 for (Index b = 0; b < nbooks; b++)
2032 for (Index s = 0; s < nshelves; s++) {
2033 Numeric diff = var1(s, b, p, r, c) - var2(s, b, p, r, c);
2035 if (std::isnan(var1(s, b, p, r, c)) ||
2036 std::isnan(var2(s, b, p, r, c))) {
2037 if (std::isnan(var1(s, b, p, r, c)) &&
2038 std::isnan(var2(s, b, p, r, c))) {
2040 } else if (std::isnan(var1(s, b, p, r, c))) {
2042 os << "Nan found in
" << var1name << ", but there is no
"
2043 << "NaN at same position in
" << var2name << ".\nThis
"
2044 << "is not allowed.
";
2045 throw runtime_error(os.str());
2048 os << "Nan found in
" << var2name << ", but there is no
"
2049 << "NaN at same position in
" << var1name << ".\nThis
"
2050 << "is not allowed.
";
2051 throw runtime_error(os.str());
2055 if (abs(diff) > abs(maxdiff)) {
2060 if (abs(maxdiff) > maxabsdiff) {
2062 os << var1name << "-
" << var2name << " FAILED!\n
";
2063 if (error_message.length()) os << error_message << "\n
";
2064 os << "Max allowed deviation set to :
" << maxabsdiff << endl
2065 << "but the tensors deviate with:
" << maxdiff << endl;
2066 throw runtime_error(os.str());
2070 out2 << " " << var1name << "-
" << var2name
2071 << " OK (maximum difference =
" << maxdiff << ").\n
";
2074/* Workspace method: Doxygen documentation will be auto-generated */
2075void Compare(const Tensor7& var1,
2076 const Tensor7& var2,
2077 const Numeric& maxabsdiff,
2078 const String& error_message,
2079 const String& var1name,
2080 const String& var2name,
2083 const Verbosity& verbosity) {
2084 const Index ncols = var1.ncols();
2085 const Index nrows = var1.nrows();
2086 const Index npages = var1.npages();
2087 const Index nbooks = var1.nbooks();
2088 const Index nshelves = var1.nshelves();
2089 const Index nvitrines = var1.nvitrines();
2090 const Index nlibraries = var1.nlibraries();
2092 if (var2.ncols() != ncols || var2.nrows() != nrows ||
2093 var2.npages() != npages || var2.nbooks() != nbooks ||
2094 var2.nshelves() != nshelves || var2.nvitrines() != nvitrines ||
2095 var2.nlibraries() != nlibraries) {
2097 os << var1name << " and
" << var2name << " do not have the same size.
";
2098 throw runtime_error(os.str());
2101 Numeric maxdiff = 0.0;
2103 for (Index c = 0; c < ncols; c++)
2104 for (Index r = 0; r < nrows; r++)
2105 for (Index p = 0; p < npages; p++)
2106 for (Index b = 0; b < nbooks; b++)
2107 for (Index s = 0; s < nshelves; s++)
2108 for (Index v = 0; v < nvitrines; v++)
2109 for (Index l = 0; l < nlibraries; l++) {
2111 var1(l, v, s, b, p, r, c) - var2(l, v, s, b, p, r, c);
2113 if (std::isnan(var1(l, v, s, b, p, r, c)) ||
2114 std::isnan(var2(l, v, s, b, p, r, c))) {
2115 if (std::isnan(var1(l, v, s, b, p, r, c)) &&
2116 std::isnan(var2(l, v, s, b, p, r, c))) {
2118 } else if (std::isnan(var1(l, v, s, b, p, r, c))) {
2120 os << "Nan found in
" << var1name << ", but there is no
"
2121 << "NaN at same position in
" << var2name << ".\nThis
"
2122 << "is not allowed.
";
2123 throw runtime_error(os.str());
2126 os << "Nan found in
" << var2name << ", but there is no
"
2127 << "NaN at same position in
" << var1name << ".\nThis
"
2128 << "is not allowed.
";
2129 throw runtime_error(os.str());
2133 if (abs(diff) > abs(maxdiff)) {
2138 if (abs(maxdiff) > maxabsdiff) {
2140 os << var1name << "-
" << var2name << " FAILED!\n
";
2141 if (error_message.length()) os << error_message << "\n
";
2142 os << "Max allowed deviation set to :
" << maxabsdiff << endl
2143 << "but the tensors deviate with:
" << maxdiff << endl;
2144 throw runtime_error(os.str());
2148 out2 << " " << var1name << "-
" << var2name
2149 << " OK (maximum difference =
" << maxdiff << ").\n
";
2152/* Workspace method: Doxygen documentation will be auto-generated */
2153void Compare(const ArrayOfVector& var1,
2154 const ArrayOfVector& var2,
2155 const Numeric& maxabsdiff,
2156 const String& error_message,
2157 const String& var1name,
2158 const String& var2name,
2161 const Verbosity& verbosity) {
2162 if (var1.nelem() != var2.nelem()) {
2164 os << "The two arrays
do not have the same size.
" << endl
2165 << var1name << " nelem:
" << var1.nelem() << endl
2166 << var2name << " nelem:
" << var2.nelem() << endl;
2167 throw runtime_error(os.str());
2170 bool failed = false;
2171 ostringstream fail_msg;
2172 for (Index i = 0; i < var1.nelem(); i++) {
2174 ostringstream vn1, vn2;
2175 vn1 << var1name << "[
" << i << "]
";
2176 vn2 << var2name << "[
" << i << "]
";
2186 } catch (const std::runtime_error& e) {
2190 << "Mismatch at array index:
" << i << endl;
2194 if (failed) throw runtime_error(fail_msg.str());
2197/* Workspace method: Doxygen documentation will be auto-generated */
2198void Compare(const ArrayOfMatrix& var1,
2199 const ArrayOfMatrix& var2,
2200 const Numeric& maxabsdiff,
2201 const String& error_message,
2202 const String& var1name,
2203 const String& var2name,
2206 const Verbosity& verbosity) {
2207 if (var1.nelem() != var2.nelem()) {
2209 os << "The two arrays
do not have the same size.
" << endl
2210 << var1name << " nelem:
" << var1.nelem() << endl
2211 << var2name << " nelem:
" << var2.nelem() << endl;
2212 throw runtime_error(os.str());
2215 bool failed = false;
2216 ostringstream fail_msg;
2217 for (Index i = 0; i < var1.nelem(); i++) {
2219 ostringstream vn1, vn2;
2220 vn1 << var1name << "[
" << i << "]
";
2221 vn2 << var2name << "[
" << i << "]
";
2231 } catch (const std::runtime_error& e) {
2235 << "Mismatch at array index:
" << i << endl;
2239 if (failed) throw runtime_error(fail_msg.str());
2242/* Workspace method: Doxygen documentation will be auto-generated */
2243void Compare(const ArrayOfTensor7& var1,
2244 const ArrayOfTensor7& var2,
2245 const Numeric& maxabsdiff,
2246 const String& error_message,
2247 const String& var1name,
2248 const String& var2name,
2251 const Verbosity& verbosity) {
2252 if (var1.nelem() != var2.nelem()) {
2254 os << "The two arrays
do not have the same size.
" << endl
2255 << var1name << " nelem:
" << var1.nelem() << endl
2256 << var2name << " nelem:
" << var2.nelem() << endl;
2257 throw runtime_error(os.str());
2260 bool failed = false;
2261 ostringstream fail_msg;
2262 for (Index i = 0; i < var1.nelem(); i++) {
2264 ostringstream vn1, vn2;
2265 vn1 << var1name << "[
" << i << "]
";
2266 vn2 << var2name << "[
" << i << "]
";
2276 } catch (const std::runtime_error& e) {
2280 << "Mismatch at array index:
" << i << endl;
2284 if (failed) throw runtime_error(fail_msg.str());
2287/* Workspace method: Doxygen documentation will be auto-generated */
2288void Compare(const GriddedField3& var1,
2289 const GriddedField3& var2,
2290 const Numeric& maxabsdiff,
2291 const String& error_message,
2292 const String& var1name,
2293 const String& var2name,
2296 const Verbosity& verbosity) {
2297 for (Index i = 0; i < var1.get_dim(); i++) {
2298 if (var1.get_grid_size(i) != var2.get_grid_size(i)) {
2300 os << var1name << " and
" << var2name << " grid
" << i
2301 << " do not have the same size:
" << var1.get_grid_size(i)
2302 << " !=
" << var2.get_grid_size(i);
2303 throw runtime_error(os.str());
2305 if (var1.get_grid_name(i) != var2.get_grid_name(i)) {
2307 os << var1name << " and
" << var2name << " grid
" << i
2308 << " do not have the same name:
" << var1.get_grid_name(i)
2309 << " !=
" << var2.get_grid_name(i);
2310 throw runtime_error(os.str());
2325/* Workspace method: Doxygen documentation will be auto-generated */
2326void Compare(const Sparse& var1,
2328 const Numeric& maxabsdiff,
2329 const String& error_message,
2330 const String& var1name,
2331 const String& var2name,
2334 const Verbosity& verbosity) {
2335 const Index nrows = var1.nrows();
2336 const Index ncols = var1.ncols();
2338 if (var2.nrows() != nrows || var2.ncols() != ncols) {
2340 os << var1name << " (
" << nrows << ",
" << ncols << ") and
" << var2name
2341 << " (
" << var2.nrows() << ",
" << var2.ncols()
2342 << ")
do not have the same size.
";
2343 throw runtime_error(os.str());
2346 Numeric maxdiff = 0.0;
2348 for (Index r = 0; r < nrows; r++) {
2349 for (Index c = 0; c < ncols; c++) {
2350 Numeric diff = var1(r, c) - var2(r, c);
2352 if (std::isnan(var1(r, c)) || std::isnan(var2(r, c))) {
2353 if (std::isnan(var1(r, c)) && std::isnan(var2(r, c))) {
2355 } else if (std::isnan(var1(r, c))) {
2357 os << "Nan found in
" << var1name << ", but there is no
"
2358 << "NaN at same position in
" << var2name << ".\nThis
"
2359 << "is not allowed.
";
2360 throw runtime_error(os.str());
2363 os << "Nan found in
" << var2name << ", but there is no
"
2364 << "NaN at same position in
" << var1name << ".\nThis
"
2365 << "is not allowed.
";
2366 throw runtime_error(os.str());
2370 if (abs(diff) > abs(maxdiff)) {
2376 if (abs(maxdiff) > maxabsdiff) {
2378 os << var1name << "-
" << var2name << " FAILED!\n
";
2379 if (error_message.length()) os << error_message << "\n
";
2380 os << "Max allowed deviation set to :
" << maxabsdiff << endl
2381 << "but the matrices deviate with:
" << maxdiff << endl;
2382 throw runtime_error(os.str());
2386 out2 << " " << var1name << "-
" << var2name
2387 << " OK (maximum difference =
" << maxdiff << ").\n
";
2390/* Workspace method: Doxygen documentation will be auto-generated */
2391void Compare(const SingleScatteringData& var1,
2392 const SingleScatteringData& var2,
2393 const Numeric& maxabsdiff,
2394 const String& error_message,
2395 const String& var1name,
2396 const String& var2name,
2399 const Verbosity& verbosity) {
2400 if (var1.ptype != var2.ptype) {
2401 std::ostringstream os;
2402 os << "The particle types don
't match: " << std::endl
2403 << var1name << " = " << PTypeToString(var1.ptype) << ", " << var2name
2404 << " = " << PTypeToString(var2.ptype) << std::endl;
2405 throw std::runtime_error(os.str());
2407 Compare(var1.f_grid,
2411 var1name + ".f_grid",
2412 var2name + ".f_grid",
2416 Compare(var1.T_grid,
2420 var1name + ".T_grid",
2421 var2name + ".T_grid",
2425 Compare(var1.za_grid,
2429 var1name + ".za_grid",
2430 var2name + ".za_grid",
2434 Compare(var1.aa_grid,
2438 var1name + ".aa_grid",
2439 var2name + ".aa_grid",
2443 Compare(var1.pha_mat_data,
2447 var1name + ".pha_mat_data",
2448 var2name + ".pha_mat_data",
2452 Compare(var1.ext_mat_data,
2456 var1name + ".ext_mat_data",
2457 var2name + ".ext_mat_data",
2461 Compare(var1.abs_vec_data,
2465 var1name + ".abs_vec_data",
2466 var2name + ".abs_vec_data",
2472inline void _cr_internal_(const Numeric& var1,
2473 const Numeric& var2,
2474 const Numeric& maxabsreldiff,
2475 const String& error_message,
2476 const String& var1name,
2477 const String& var2name,
2481 if (var1 not_eq 0. and var2 not_eq 0.) {
2482 const Numeric absreldiff = abs(var1 / var2 - 1);
2483 if (absreldiff > maxabsreldiff) {
2485 os << var1name << "-" << var2name << " FAILED!\n";
2486 if (error_message.length()) os << error_message << "\n";
2487 os << "Max allowed deviation set to: " << maxabsreldiff * 100.0 << "%"
2489 << "but the input deviate with: " << absreldiff * 100.0 << "%\n"
2490 << "If you compare non-scalar variables, the reported deviation is\n"
2491 << "the first one found violating the criterion. The maximum\n"
2492 << "difference can be higher.\n";
2493 throw runtime_error(os.str());
2498inline void _cr_internal_(const ConstVectorView var1,
2499 const ConstVectorView var2,
2500 const Numeric& maxabsreldiff,
2501 const String& error_message,
2502 const String& var1name,
2503 const String& var2name,
2506 const Verbosity& verbosity) {
2507 const Index n = var1.nelem();
2508 if (var2.nelem() not_eq n)
2509 throw std::runtime_error("Cannot compare variables of different size");
2510 for (Index i = 0; i < n; i++)
2511 _cr_internal_(var1[i],
2522inline void _cr_internal_(const ConstMatrixView var1,
2523 const ConstMatrixView var2,
2524 const Numeric& maxabsreldiff,
2525 const String& error_message,
2526 const String& var1name,
2527 const String& var2name,
2530 const Verbosity& verbosity) {
2531 const Index n = var1.nrows();
2532 if (var2.nrows() not_eq n)
2533 throw std::runtime_error("Cannot compare variables of different size");
2534 for (Index i = 0; i < n; i++)
2535 _cr_internal_(var1(i, joker),
2546inline void _cr_internal_(const ConstTensor3View var1,
2547 const ConstTensor3View var2,
2548 const Numeric& maxabsreldiff,
2549 const String& error_message,
2550 const String& var1name,
2551 const String& var2name,
2554 const Verbosity& verbosity) {
2555 const Index n = var1.npages();
2556 if (var2.npages() not_eq n)
2557 throw std::runtime_error("Cannot compare variables of different size");
2558 for (Index i = 0; i < n; i++)
2559 _cr_internal_(var1(i, joker, joker),
2560 var2(i, joker, joker),
2570inline void _cr_internal_(const ConstTensor4View var1,
2571 const ConstTensor4View var2,
2572 const Numeric& maxabsreldiff,
2573 const String& error_message,
2574 const String& var1name,
2575 const String& var2name,
2578 const Verbosity& verbosity) {
2579 const Index n = var1.nbooks();
2580 if (var2.nbooks() not_eq n)
2581 throw std::runtime_error("Cannot compare variables of different size");
2582 for (Index i = 0; i < n; i++)
2583 _cr_internal_(var1(i, joker, joker, joker),
2584 var2(i, joker, joker, joker),
2594inline void _cr_internal_(const ConstTensor5View var1,
2595 const ConstTensor5View var2,
2596 const Numeric& maxabsreldiff,
2597 const String& error_message,
2598 const String& var1name,
2599 const String& var2name,
2602 const Verbosity& verbosity) {
2603 const Index n = var1.nshelves();
2604 if (var2.nshelves() not_eq n)
2605 throw std::runtime_error("Cannot compare variables of different size");
2606 for (Index i = 0; i < n; i++)
2607 _cr_internal_(var1(i, joker, joker, joker, joker),
2608 var2(i, joker, joker, joker, joker),
2618inline void _cr_internal_(const ConstTensor6View var1,
2619 const ConstTensor6View var2,
2620 const Numeric& maxabsreldiff,
2621 const String& error_message,
2622 const String& var1name,
2623 const String& var2name,
2626 const Verbosity& verbosity) {
2627 const Index n = var1.nvitrines();
2628 if (var2.nvitrines() not_eq n)
2629 throw std::runtime_error("Cannot compare variables of different size");
2630 for (Index i = 0; i < n; i++)
2631 _cr_internal_(var1(i, joker, joker, joker, joker, joker),
2632 var2(i, joker, joker, joker, joker, joker),
2642inline void _cr_internal_(const ConstTensor7View var1,
2643 const ConstTensor7View var2,
2644 const Numeric& maxabsreldiff,
2645 const String& error_message,
2646 const String& var1name,
2647 const String& var2name,
2650 const Verbosity& verbosity) {
2651 const Index n = var1.nlibraries();
2652 if (var2.nlibraries() not_eq n)
2653 throw std::runtime_error("Cannot compare variables of different size");
2654 for (Index i = 0; i < n; i++)
2655 _cr_internal_(var1(i, joker, joker, joker, joker, joker, joker),
2656 var2(i, joker, joker, joker, joker, joker, joker),
2666inline void _cr_internal_(const PropagationMatrix& var1,
2667 const PropagationMatrix& var2,
2668 const Numeric& maxabsreldiff,
2669 const String& error_message,
2670 const String& var1name,
2671 const String& var2name,
2674 const Verbosity& verbosity) {
2675 _cr_internal_(var1.Data(),
2686inline void _cr_internal_(const StokesVector& var1,
2687 const StokesVector& var2,
2688 const Numeric& maxabsreldiff,
2689 const String& error_message,
2690 const String& var1name,
2691 const String& var2name,
2694 const Verbosity& verbosity) {
2695 _cr_internal_(var1.Data(),
2707inline void _cr_internal_(const Array<T>& var1,
2708 const Array<T>& var2,
2709 const Numeric& maxabsreldiff,
2710 const String& error_message,
2711 const String& var1name,
2712 const String& var2name,
2715 const Verbosity& verbosity) {
2716 const Index n = var1.nelem();
2717 if (var2.nelem() not_eq n)
2718 throw std::runtime_error("Cannot compare arrays of different length");
2719 for (Index i = 0; i < n; i++)
2720 _cr_internal_(var1[i],
2731/* Workspace method: Doxygen documentation will be auto-generated */
2732void CompareRelative(const Numeric& var1,
2733 const Numeric& var2,
2734 const Numeric& maxabsreldiff,
2735 const String& error_message,
2736 const String& var1name,
2737 const String& var2name,
2740 const Verbosity& verbosity) {
2751void CompareRelative(const Vector& var1,
2753 const Numeric& maxabsreldiff,
2754 const String& error_message,
2755 const String& var1name,
2756 const String& var2name,
2759 const Verbosity& verbosity) {
2770void CompareRelative(const Matrix& var1,
2772 const Numeric& maxabsreldiff,
2773 const String& error_message,
2774 const String& var1name,
2775 const String& var2name,
2778 const Verbosity& verbosity) {
2789void CompareRelative(const Tensor3& var1,
2790 const Tensor3& var2,
2791 const Numeric& maxabsreldiff,
2792 const String& error_message,
2793 const String& var1name,
2794 const String& var2name,
2797 const Verbosity& verbosity) {
2808void CompareRelative(const Tensor4& var1,
2809 const Tensor4& var2,
2810 const Numeric& maxabsreldiff,
2811 const String& error_message,
2812 const String& var1name,
2813 const String& var2name,
2816 const Verbosity& verbosity) {
2827void CompareRelative(const Tensor5& var1,
2828 const Tensor5& var2,
2829 const Numeric& maxabsreldiff,
2830 const String& error_message,
2831 const String& var1name,
2832 const String& var2name,
2835 const Verbosity& verbosity) {
2846void CompareRelative(const Tensor6& var1,
2847 const Tensor6& var2,
2848 const Numeric& maxabsreldiff,
2849 const String& error_message,
2850 const String& var1name,
2851 const String& var2name,
2854 const Verbosity& verbosity) {
2865void CompareRelative(const Tensor7& var1,
2866 const Tensor7& var2,
2867 const Numeric& maxabsreldiff,
2868 const String& error_message,
2869 const String& var1name,
2870 const String& var2name,
2873 const Verbosity& verbosity) {
2884void CompareRelative(const ArrayOfVector& var1,
2885 const ArrayOfVector& var2,
2886 const Numeric& maxabsreldiff,
2887 const String& error_message,
2888 const String& var1name,
2889 const String& var2name,
2892 const Verbosity& verbosity) {
2903void CompareRelative(const ArrayOfMatrix& var1,
2904 const ArrayOfMatrix& var2,
2905 const Numeric& maxabsreldiff,
2906 const String& error_message,
2907 const String& var1name,
2908 const String& var2name,
2911 const Verbosity& verbosity) {
2922void CompareRelative(const ArrayOfTensor3& var1,
2923 const ArrayOfTensor3& var2,
2924 const Numeric& maxabsreldiff,
2925 const String& error_message,
2926 const String& var1name,
2927 const String& var2name,
2930 const Verbosity& verbosity) {
2941void CompareRelative(const ArrayOfTensor4& var1,
2942 const ArrayOfTensor4& var2,
2943 const Numeric& maxabsreldiff,
2944 const String& error_message,
2945 const String& var1name,
2946 const String& var2name,
2949 const Verbosity& verbosity) {
2960void CompareRelative(const ArrayOfTensor5& var1,
2961 const ArrayOfTensor5& var2,
2962 const Numeric& maxabsreldiff,
2963 const String& error_message,
2964 const String& var1name,
2965 const String& var2name,
2968 const Verbosity& verbosity) {
2979void CompareRelative(const ArrayOfTensor6& var1,
2980 const ArrayOfTensor6& var2,
2981 const Numeric& maxabsreldiff,
2982 const String& error_message,
2983 const String& var1name,
2984 const String& var2name,
2987 const Verbosity& verbosity) {
2998void CompareRelative(const ArrayOfTensor7& var1,
2999 const ArrayOfTensor7& var2,
3000 const Numeric& maxabsreldiff,
3001 const String& error_message,
3002 const String& var1name,
3003 const String& var2name,
3006 const Verbosity& verbosity) {
3017void CompareRelative(const ArrayOfArrayOfVector& var1,
3018 const ArrayOfArrayOfVector& var2,
3019 const Numeric& maxabsreldiff,
3020 const String& error_message,
3021 const String& var1name,
3022 const String& var2name,
3025 const Verbosity& verbosity) {
3036void CompareRelative(const ArrayOfArrayOfMatrix& var1,
3037 const ArrayOfArrayOfMatrix& var2,
3038 const Numeric& maxabsreldiff,
3039 const String& error_message,
3040 const String& var1name,
3041 const String& var2name,
3044 const Verbosity& verbosity) {
3055void CompareRelative(const ArrayOfArrayOfTensor3& var1,
3056 const ArrayOfArrayOfTensor3& var2,
3057 const Numeric& maxabsreldiff,
3058 const String& error_message,
3059 const String& var1name,
3060 const String& var2name,
3063 const Verbosity& verbosity) {
3074void CompareRelative(const ArrayOfArrayOfTensor4& var1,
3075 const ArrayOfArrayOfTensor4& var2,
3076 const Numeric& maxabsreldiff,
3077 const String& error_message,
3078 const String& var1name,
3079 const String& var2name,
3082 const Verbosity& verbosity) {
3093void CompareRelative(const ArrayOfArrayOfTensor5& var1,
3094 const ArrayOfArrayOfTensor5& var2,
3095 const Numeric& maxabsreldiff,
3096 const String& error_message,
3097 const String& var1name,
3098 const String& var2name,
3101 const Verbosity& verbosity) {
3112void CompareRelative(const ArrayOfArrayOfTensor6& var1,
3113 const ArrayOfArrayOfTensor6& var2,
3114 const Numeric& maxabsreldiff,
3115 const String& error_message,
3116 const String& var1name,
3117 const String& var2name,
3120 const Verbosity& verbosity) {
3131void CompareRelative(const ArrayOfArrayOfTensor7& var1,
3132 const ArrayOfArrayOfTensor7& var2,
3133 const Numeric& maxabsreldiff,
3134 const String& error_message,
3135 const String& var1name,
3136 const String& var2name,
3139 const Verbosity& verbosity) {
3151void CompareRelative(const PropagationMatrix& var1,
3152 const PropagationMatrix& var2,
3153 const Numeric& maxabsreldiff,
3154 const String& error_message,
3155 const String& var1name,
3156 const String& var2name,
3159 const Verbosity& verbosity) {
3171void CompareRelative(const ArrayOfPropagationMatrix& var1,
3172 const ArrayOfPropagationMatrix& var2,
3173 const Numeric& maxabsreldiff,
3174 const String& error_message,
3175 const String& var1name,
3176 const String& var2name,
3179 const Verbosity& verbosity) {
3191void CompareRelative(const ArrayOfArrayOfPropagationMatrix& var1,
3192 const ArrayOfArrayOfPropagationMatrix& var2,
3193 const Numeric& maxabsreldiff,
3194 const String& error_message,
3195 const String& var1name,
3196 const String& var2name,
3199 const Verbosity& verbosity) {
3211void CompareRelative(const StokesVector& var1,
3212 const StokesVector& var2,
3213 const Numeric& maxabsreldiff,
3214 const String& error_message,
3215 const String& var1name,
3216 const String& var2name,
3219 const Verbosity& verbosity) {
3231void CompareRelative(const ArrayOfStokesVector& var1,
3232 const ArrayOfStokesVector& var2,
3233 const Numeric& maxabsreldiff,
3234 const String& error_message,
3235 const String& var1name,
3236 const String& var2name,
3239 const Verbosity& verbosity) {
3251void CompareRelative(const ArrayOfArrayOfStokesVector& var1,
3252 const ArrayOfArrayOfStokesVector& var2,
3253 const Numeric& maxabsreldiff,
3254 const String& error_message,
3255 const String& var1name,
3256 const String& var2name,
3259 const Verbosity& verbosity) {
3271/* Workspace method: Doxygen documentation will be auto-generated */
3272void CompareRelative(const EnergyLevelMap& var1,
3273 const EnergyLevelMap& var2,
3274 const Numeric& maxabsreldiff,
3275 const String& error_message,
3276 const String& var1name,
3277 const String& var2name,
3280 const Verbosity& verbosity) {
3281 _cr_internal_(var1.value,
3290 _cr_internal_(var1.vib_energy,
3301void PrintPhysicalConstants(const Verbosity& verbosity) {
3304 out0 << std::setprecision(15) << std::scientific;
3305 out0 << "---------------------------------------------------------\n"
3306 << "Numerical const in ARTS \tValue\n"
3307 << "Avogadro's constant: \t
" << Constant::avogadro_constant << '\n'
3308 << "Bohr
's magneton: \t " << Constant::bohr_magneton << '\n
'
3309 << "Boltzmann's constant: \t
" << Constant::boltzmann_constant << '\n'
3310 << "Elemental charge: \t
" << Constant::elementary_charge << '\n'
3311 << "Electron mass: \t
" << Constant::electron_mass << '\n'
3312 << "Ideal gas constant: \t
" << Constant::ideal_gas_constant << '\n'
3313 << "Planck
's constant: \t " << Constant::planck_constant << '\n
'
3314 << "Speed of light: \t " << Constant::speed_of_light << '\n
'
3315 << "Vacuum permittivity: \t " << Constant::vacuum_permittivity << '\n
'
3316 << "Doppler constant: \t " << std::sqrt(Constant::doppler_broadening_const_squared) << '\n
'
3317 << "---------------------------------------------------------\n";
This file contains the definition of Array.
base max(const Array< base > &x)
Max function.
base min(const Array< base > &x)
Min function.
void arts_exit(int status)
This is the exit function of ARTS.
The global header file for ARTS.
Constants of physical expressions as constexpr.
TimeStep mean(const ArrayOfTimeStep &dt)
Returns the mean time step.
Stuff related to time in ARTS.
Index nelem() const ARTS_NOEXCEPT
Index nrows() const noexcept
Index ncols() const noexcept
Index npages() const
Returns the number of pages.
Index nrows() const
Returns the number of rows.
Index ncols() const
Returns the number of columns.
Index ncols() const noexcept
Index nrows() const noexcept
Index nbooks() const noexcept
Index npages() const noexcept
Index nrows() const noexcept
Index ncols() const noexcept
Index npages() const noexcept
Index nbooks() const noexcept
Index nshelves() const noexcept
Index nbooks() const noexcept
Index nvitrines() const noexcept
Index ncols() const noexcept
Index npages() const noexcept
Index nshelves() const noexcept
Index nrows() const noexcept
Index ncols() const noexcept
Index npages() const noexcept
Index nrows() const noexcept
Index nlibraries() const noexcept
Index nvitrines() const noexcept
Index nshelves() const noexcept
Index nbooks() const noexcept
Index nelem() const noexcept
Returns the number of elements.
void resize(Index r, Index c)
Resize function.
void resize(Index p, Index r, Index c)
Resize function.
void resize(Index b, Index p, Index r, Index c)
Resize function.
void resize(Index s, Index b, Index p, Index r, Index c)
Resize function.
void resize(Index v, Index s, Index b, Index p, Index r, Index c)
Resize function.
void resize(Index l, Index v, Index s, Index b, Index p, Index r, Index c)
Resize function.
void resize(Index n)
Resize function.
void mult(MatrixView C, ConstMatrixView A, const Block &B)
#define ARTS_ASSERT(condition,...)
#define ARTS_USER_ERROR_IF(condition,...)
Class to map energy levels.
The declarations of all the exception classes.
Implementation of gridded fields.
void id_mat(MatrixView I)
Identity Matrix.
Linear algebra functions.
bool is_increasing(ConstVectorView x)
Checks if a vector is sorted and strictly increasing.
bool is_decreasing(ConstVectorView x)
Checks if a vector is sorted in reversed order and is strictly decreasing.
Header file for logic.cc.
std::vector< T > linspace(T s, T e, typename std::vector< T >::size_type count) noexcept
void VectorLinSpace(Vector &x, const Numeric &start, const Numeric &stop, const Numeric &step, const Verbosity &verbosity)
WORKSPACE METHOD: VectorLinSpace.
void IndexStepUp(Index &xout, const Index &xin, const Verbosity &)
WORKSPACE METHOD: IndexStepUp.
void VectorDivide(Vector &out, const Vector &in, const Numeric &value, const Verbosity &)
WORKSPACE METHOD: VectorDivide.
void Tensor4Multiply(Tensor4 &out, const Tensor4 &in, const Numeric &value, const Verbosity &)
WORKSPACE METHOD: Tensor4Multiply.
void MatrixSubtract(Matrix &out, const Matrix &in, const Numeric &value, const Verbosity &)
WORKSPACE METHOD: MatrixSubtract.
void VectorCrop(Vector &out, const Vector &in, const Numeric &min_value, const Numeric &max_value, const Verbosity &)
WORKSPACE METHOD: VectorCrop.
void Matrix1ColFromVector(Matrix &m, const Vector &v, const Verbosity &)
WORKSPACE METHOD: Matrix1ColFromVector.
void Tensor7SetConstant(Tensor7 &x, const Index &nlibraries, const Index &nvitrines, const Index &nshelves, const Index &nbooks, const Index &npages, const Index &nrows, const Index &ncols, const Numeric &value, const Verbosity &verbosity)
WORKSPACE METHOD: Tensor7SetConstant.
void ArrayOfIndexSetConstant(ArrayOfIndex &aoi, const Index &nelem, const Index &value, const Verbosity &)
WORKSPACE METHOD: ArrayOfIndexSetConstant.
void IndexSubtract(Index &out, const Index &in, const Index &value, const Verbosity &)
WORKSPACE METHOD: IndexSubtract.
void Tensor3Multiply(Tensor3 &out, const Tensor3 &in, const Numeric &value, const Verbosity &)
WORKSPACE METHOD: Tensor3Multiply.
void VectorFlip(Vector &out, const Vector &in, const Verbosity &)
WORKSPACE METHOD: VectorFlip.
void IndexDivide(Index &out, const Index &in, const Index &value, const Verbosity &)
WORKSPACE METHOD: IndexDivide.
void Matrix2RowFromVectors(Matrix &m, const Vector &v1, const Vector &v2, const Verbosity &)
WORKSPACE METHOD: Matrix2RowFromVectors.
void NumericClip(Numeric &out, const Numeric &in, const Numeric &limit_low, const Numeric &limit_high, const Verbosity &)
WORKSPACE METHOD: NumericClip.
void Tensor5SetConstant(Tensor5 &x, const Index &nshelves, const Index &nbooks, const Index &npages, const Index &nrows, const Index &ncols, const Numeric &value, const Verbosity &verbosity)
WORKSPACE METHOD: Tensor5SetConstant.
void ArrayOfTimeNLinSpace(ArrayOfTime &x, const Index &n, const String &start, const String &stop, const Verbosity &)
WORKSPACE METHOD: ArrayOfTimeNLinSpace.
void Trapz(Numeric &out, const Vector &x, const Vector &y, const Verbosity &)
WORKSPACE METHOD: Trapz.
void DiagonalMatrix(Matrix &X, const Vector &diag, const Verbosity &)
WORKSPACE METHOD: DiagonalMatrix.
void Tensor3ExtractFromTensor4(Tensor3 &t3, const Tensor4 &t4, const Index &index, const String &direction, const Verbosity &)
WORKSPACE METHOD: Tensor3ExtractFromTensor4.
void MatrixMultiply(Matrix &out, const Matrix &in, const Numeric &value, const Verbosity &)
WORKSPACE METHOD: MatrixMultiply.
void SparseSparseMultiply(Sparse &Y, const Sparse &M, const Sparse &X, const Verbosity &)
WORKSPACE METHOD: SparseSparseMultiply.
void MatrixSetConstant(Matrix &x, const Index &nrows, const Index &ncols, const Numeric &value, const Verbosity &)
WORKSPACE METHOD: MatrixSetConstant.
void VectorMultiply(Vector &out, const Vector &in, const Numeric &value, const Verbosity &)
WORKSPACE METHOD: VectorMultiply.
void Tensor6SetConstant(Tensor6 &x, const Index &nvitrines, const Index &nshelves, const Index &nbooks, const Index &npages, const Index &nrows, const Index &ncols, const Numeric &value, const Verbosity &verbosity)
WORKSPACE METHOD: Tensor6SetConstant.
void IndexAdd(Index &out, const Index &in, const Index &value, const Verbosity &)
WORKSPACE METHOD: IndexAdd.
void VectorSubtractElementwise(Vector &c, const Vector &a, const Vector &b, const Verbosity &)
WORKSPACE METHOD: VectorSubtractElementwise.
void VectorExtractFromMatrix(Vector &v, const Matrix &m, const Index &index, const String &direction, const Verbosity &)
WORKSPACE METHOD: VectorExtractFromMatrix.
constexpr Numeric NAT_LOG_2
void MatrixReshapeTensor3(Matrix &m, const Tensor3 &t, const Verbosity &)
WORKSPACE METHOD: MatrixReshapeTensor3.
void Tensor3Add(Tensor3 &out, const Tensor3 &in, const Numeric &value, const Verbosity &)
WORKSPACE METHOD: Tensor3Add.
void VectorGaussian(Vector &y, const Vector &x, const Numeric &x0, const Numeric &si, const Numeric &fwhm, const Verbosity &)
WORKSPACE METHOD: VectorGaussian.
void VectorAddElementwise(Vector &c, const Vector &a, const Vector &b, const Verbosity &)
WORKSPACE METHOD: VectorAddElementwise.
void RationalDivide(Rational &out, const Rational &in, const Rational &value, const Verbosity &)
WORKSPACE METHOD: RationalDivide.
void Matrix1RowFromVector(Matrix &m, const Vector &v, const Verbosity &)
WORKSPACE METHOD: Matrix1RowFromVector.
void Tensor3FromVector(Tensor3 &m, const Vector &v, const Verbosity &)
WORKSPACE METHOD: Tensor3FromVector.
void Tensor6Multiply(Tensor6 &out, const Tensor6 &in, const Numeric &value, const Verbosity &)
WORKSPACE METHOD: Tensor6Multiply.
void NumericMultiply(Numeric &out, const Numeric &in, const Numeric &value, const Verbosity &)
WORKSPACE METHOD: NumericMultiply.
void NumericSubtract(Numeric &out, const Numeric &in, const Numeric &value, const Verbosity &)
WORKSPACE METHOD: NumericSubtract.
void RationalSubtract(Rational &out, const Rational &in, const Rational &value, const Verbosity &)
WORKSPACE METHOD: RationalSubtract.
void VectorSubtract(Vector &out, const Vector &in, const Numeric &value, const Verbosity &)
WORKSPACE METHOD: VectorSubtract.
void VectorDivideElementwise(Vector &c, const Vector &a, const Vector &b, const Verbosity &)
WORKSPACE METHOD: VectorDivideElementwise.
void IndexMultiply(Index &out, const Index &in, const Index &value, const Verbosity &)
WORKSPACE METHOD: IndexMultiply.
void Matrix2ColFromVectors(Matrix &m, const Vector &v1, const Vector &v2, const Verbosity &)
WORKSPACE METHOD: Matrix2ColFromVectors.
void NumericDivide(Numeric &out, const Numeric &in, const Numeric &value, const Verbosity &)
WORKSPACE METHOD: NumericDivide.
void ArrayOfIndexLinSpace(ArrayOfIndex &x, const Index &start, const Index &stop, const Index &step, const Verbosity &verbosity)
WORKSPACE METHOD: ArrayOfIndexLinSpace.
void MatrixDivide(Matrix &out, const Matrix &in, const Numeric &value, const Verbosity &)
WORKSPACE METHOD: MatrixDivide.
void VectorMultiplyElementwise(Vector &c, const Vector &a, const Vector &b, const Verbosity &)
WORKSPACE METHOD: VectorMultiplyElementwise.
void VectorSparseMultiply(Vector &y, const Sparse &M, const Vector &x, const Verbosity &)
WORKSPACE METHOD: VectorSparseMultiply.
void VectorNLinSpace(Vector &x, const Index &n, const Numeric &start, const Numeric &stop, const Verbosity &verbosity)
WORKSPACE METHOD: VectorNLinSpace.
void VectorNLinSpaceVector(Vector &x, const Index &n, const Vector &y, const Verbosity &verbosity)
WORKSPACE METHOD: VectorNLinSpaceVector.
void Tensor4SetConstant(Tensor4 &x, const Index &nbooks, const Index &npages, const Index &nrows, const Index &ncols, const Numeric &value, const Verbosity &verbosity)
WORKSPACE METHOD: Tensor4SetConstant.
void Tensor5Multiply(Tensor5 &out, const Tensor5 &in, const Numeric &value, const Verbosity &)
WORKSPACE METHOD: Tensor5Multiply.
void Tensor4Add(Tensor4 &out, const Tensor4 &in, const Numeric &value, const Verbosity &)
WORKSPACE METHOD: Tensor4Add.
void VectorLogSpace(Vector &x, const Numeric &start, const Numeric &stop, const Numeric &step, const Verbosity &verbosity)
WORKSPACE METHOD: VectorLogSpace.
void Matrix3RowFromVectors(Matrix &m, const Vector &v1, const Vector &v2, const Vector &v3, const Verbosity &)
WORKSPACE METHOD: Matrix3RowFromVectors.
void Tensor7Multiply(Tensor7 &out, const Tensor7 &in, const Numeric &value, const Verbosity &)
WORKSPACE METHOD: Tensor7Multiply.
void VectorMatrixMultiply(Vector &y, const Matrix &M, const Vector &x, const Verbosity &)
WORKSPACE METHOD: VectorMatrixMultiply.
void IndexStepDown(Index &xout, const Index &xin, const Verbosity &)
WORKSPACE METHOD: IndexStepDown.
void VectorInsertGridPoints(Vector &og, const Vector &ingrid, const Vector &points, const Verbosity &verbosity)
WORKSPACE METHOD: VectorInsertGridPoints.
void FlagOff(Index &x, const Verbosity &)
WORKSPACE METHOD: FlagOff.
void VectorAdd(Vector &out, const Vector &in, const Numeric &value, const Verbosity &)
WORKSPACE METHOD: VectorAdd.
void RationalAdd(Rational &out, const Rational &in, const Rational &value, const Verbosity &)
WORKSPACE METHOD: RationalAdd.
void Matrix3ColFromVectors(Matrix &m, const Vector &v1, const Vector &v2, const Vector &v3, const Verbosity &)
WORKSPACE METHOD: Matrix3ColFromVectors.
void MatrixIdentity(Matrix &out, const Index &n, const Numeric &value, const Verbosity &)
WORKSPACE METHOD: MatrixIdentity.
void VectorClip(Vector &out, const Vector &in, const Numeric &limit_low, const Numeric &limit_high, const Verbosity &)
WORKSPACE METHOD: VectorClip.
void Tensor3SetConstant(Tensor3 &x, const Index &npages, const Index &nrows, const Index &ncols, const Numeric &value, const Verbosity &verbosity)
WORKSPACE METHOD: Tensor3SetConstant.
void SparseIdentity(Sparse &X, const Index &n, const Numeric &value, const Verbosity &)
WORKSPACE METHOD: SparseIdentity.
void MatrixMatrixMultiply(Matrix &Y, const Matrix &M, const Matrix &X, const Verbosity &)
WORKSPACE METHOD: MatrixMatrixMultiply.
void MatrixExtractFromTensor3(Matrix &m, const Tensor3 &t3, const Index &index, const String &direction, const Verbosity &)
WORKSPACE METHOD: MatrixExtractFromTensor3.
void FlagOn(Index &x, const Verbosity &)
WORKSPACE METHOD: FlagOn.
void MatrixCopySparse(Matrix &out, const Sparse &in, const Verbosity &)
WORKSPACE METHOD: MatrixCopySparse.
void MatrixAdd(Matrix &out, const Matrix &in, const Numeric &value, const Verbosity &)
WORKSPACE METHOD: MatrixAdd.
void NumericFromVector(Numeric &out, const Vector &in, const String &op, const Verbosity &)
WORKSPACE METHOD: NumericFromVector.
void RationalMultiply(Rational &out, const Rational &in, const Rational &value, const Verbosity &)
WORKSPACE METHOD: RationalMultiply.
void NumericAdd(Numeric &out, const Numeric &in, const Numeric &value, const Verbosity &)
WORKSPACE METHOD: NumericAdd.
void MatrixGaussian(Matrix &Y, const Vector &x_row, const Numeric &x0_row, const Numeric &si_row, const Numeric &fwhm_row, const Vector &x_col, const Numeric &x0_col, const Numeric &si_col, const Numeric &fwhm_col, const Verbosity &)
WORKSPACE METHOD: MatrixGaussian.
void nlinspace(Vector &x, const Numeric start, const Numeric stop, const Index n)
nlinspace
Numeric fac(const Index n)
fac
Numeric last(ConstVectorView x)
last
Header file for sparse matrices.
void transform(VectorView y, double(&my_func)(double), ConstVectorView x)
A generic transform function for vectors, which can be used to implement mathematical functions opera...
Implementation of Matrix, Vector, and such stuff.
NUMERIC Numeric
The type to use for all floating point numbers.
INDEX Index
The type to use for all integer numbers and indices.
Declarations having to do with the four output streams.
This file contains the definition of String, the ARTS string class.
constexpr Numeric pi
The following mathematical constants are generated in python Decimal package by the code:
constexpr Numeric ln_2
Natural logarithm of 2.
Scattering database structure and functions.
Numeric pow(const Rational base, Numeric exp)
Power of.
Numeric sqrt(const Rational r)
Square root.
Contains sorting routines.
void get_sorted_indexes(ArrayOfIndex &sorted, const T &data)
get_sorted_indexes
Implements rational numbers to work with other ARTS types.
void resize(Index r, Index c)
Resize function.
Index nrows() const
Returns the number of rows.
Index ncols() const
Returns the number of columns.
void insert_elements(Index nnz, const ArrayOfIndex &rowind, const ArrayOfIndex &colind, ConstVectorView data)
Insert vector of elements with given row and column indices.
Class to handle time in ARTS.