79 for (
Index i = 0; i <
nelem; i++) aoi[i] = value;
96 for (
Index i = 0; i < n; i++) x[i] =
start + i * step;
98 out2 <<
" Creating a linearly spaced ArrayOfIndex.\n";
99 out3 <<
" length : " << x.
nelem() <<
"\n";
100 out3 <<
" first value : " << x[0] <<
"\n";
103 out3 <<
" step size : " << x[1] - x[0] <<
"\n";
104 out3 <<
" last value : " << x[x.nelem() - 1] <<
"\n";
234 out(r,
c) = in(r,
c);
250 if (direction ==
"page") {
251 if (index >= t3.
npages()) {
253 os <<
"The index " << index
254 <<
" is outside the page range of the Matrix.";
255 throw runtime_error(os.str());
260 }
else if (direction ==
"row") {
261 if (index >= t3.
nrows()) {
263 os <<
"The index " << index <<
" is outside the row range of the Matrix.";
264 throw runtime_error(os.str());
269 }
else if (direction ==
"column") {
270 if (index >= t3.
ncols()) {
272 os <<
"The index " << index
273 <<
" is outside the column range of the Matrix.";
274 throw runtime_error(os.str());
281 os <<
"Keyword *direction* must be either *page* or *row* or *column*,"
282 <<
"but you gave: " << direction <<
".";
283 throw runtime_error(os.str());
295 if (
M.ncols() != X.
nrows()) {
297 os <<
"Matrix dimensions must be consistent!\n"
298 <<
"Matrix1.ncols() = " <<
M.ncols() <<
"\n"
299 <<
"Matrix2.nrows() = " << X.
nrows();
300 throw runtime_error(os.str());
321 const Index nv =
v.nelem();
336 if (v2.
nelem() != nv)
337 throw runtime_error(
"Vectors must be of the same size.");
355 throw runtime_error(
"Vectors must be of the same size.");
369 const Index nv =
v.nelem();
384 if (v2.
nelem() != nv)
385 throw runtime_error(
"Vectors must be of the same size.");
403 throw runtime_error(
"Vectors must be of the same size.");
449 else if (in > limit_high)
470 else if (op ==
"last")
471 out = in[in.
nelem() - 1];
472 else if (op ==
"max")
474 else if (op ==
"min")
476 else if (op ==
"mean")
480 os <<
"Your choice, *op* = \"" << op <<
"\", is not recognised.\n"
481 <<
"Valid options are: \"first\", \"last\", \"max\", \"min\" and \"mean\".";
482 throw runtime_error(os.str());
543 if (
M.ncols() != X.
nrows()) {
545 os <<
"Matrix dimensions must be consistent!\n"
546 <<
"Matrix1.ncols() = " <<
M.ncols() <<
"\n"
547 <<
"Matrix2.nrows() = " << X.
nrows();
548 throw runtime_error(os.str());
568 if (value != 1.0) X *= value;
577 for (
Index i = 0; i < n; ++i) {
589 for (
Index i = 0; i < n; ++i) {
620 const Index nv =
v.nelem();
654 x.
resize(npages, nrows, ncols);
657 out2 <<
" Tensor3 = " << value <<
"\n";
658 out3 <<
" npages : " << npages <<
"\n";
659 out3 <<
" nrows : " << nrows <<
"\n";
660 out3 <<
" ncols : " << ncols <<
"\n";
674 if (direction ==
"book") {
675 if (index >= t4.
nbooks()) {
677 os <<
"The index " << index
678 <<
" is outside the book range of the Tensor4.";
679 throw runtime_error(os.str());
684 }
else if (direction ==
"page") {
685 if (index >= t4.
npages()) {
687 os <<
"The index " << index
688 <<
" is outside the pages range of the Tensor4.";
689 throw runtime_error(os.str());
694 }
else if (direction ==
"row") {
695 if (index >= t4.
nrows()) {
697 os <<
"The index " << index
698 <<
" is outside the row range of the Tensor4.";
699 throw runtime_error(os.str());
704 }
else if (direction ==
"column") {
705 if (index >= t4.
ncols()) {
707 os <<
"The index " << index
708 <<
" is outside the column range of the Tensor4.";
709 throw runtime_error(os.str());
716 os <<
"Keyword *direction* must be either *page*, *book*, *row* or *column*,"
717 <<
"but you gave: " << direction <<
".";
718 throw runtime_error(os.str());
769 x.
resize(nbooks, npages, nrows, ncols);
772 out2 <<
" Tensor4 = " << value <<
"\n";
773 out3 <<
" nbooks : " << nbooks <<
"\n";
774 out3 <<
" npages : " << npages <<
"\n";
775 out3 <<
" nrows : " << nrows <<
"\n";
776 out3 <<
" ncols : " << ncols <<
"\n";
799 const Index& nshelves,
809 x.
resize(nshelves, nbooks, npages, nrows, ncols);
812 out2 <<
" Tensor5 = " << value <<
"\n";
813 out3 <<
" nshelves : " << nshelves <<
"\n";
814 out3 <<
" nbooks : " << nbooks <<
"\n";
815 out3 <<
" npages : " << npages <<
"\n";
816 out3 <<
" nrows : " << nrows <<
"\n";
817 out3 <<
" ncols : " << ncols <<
"\n";
845 const Index& nvitrines,
846 const Index& nshelves,
856 x.
resize(nvitrines, nshelves, nbooks, npages, nrows, ncols);
859 out2 <<
" Tensor6 = " << value <<
"\n";
860 out3 <<
" nvitrines : " << nvitrines <<
"\n";
861 out3 <<
" nshelves : " << nshelves <<
"\n";
862 out3 <<
" nbooks : " << nbooks <<
"\n";
863 out3 <<
" npages : " << npages <<
"\n";
864 out3 <<
" nrows : " << nrows <<
"\n";
865 out3 <<
" ncols : " << ncols <<
"\n";
894 const Index& nlibraries,
895 const Index& nvitrines,
896 const Index& nshelves,
906 x.
resize(nlibraries, nvitrines, nshelves, nbooks, npages, nrows, ncols);
909 out2 <<
" Tensor7 = " << value <<
"\n";
910 out3 <<
" nlibraries : " << nlibraries <<
"\n";
911 out3 <<
" nvitrines : " << nvitrines <<
"\n";
912 out3 <<
" nshelves : " << nshelves <<
"\n";
913 out3 <<
" nbooks : " << nbooks <<
"\n";
914 out3 <<
" npages : " << npages <<
"\n";
915 out3 <<
" nrows : " << nrows <<
"\n";
916 out3 <<
" ncols : " << ncols <<
"\n";
927 throw runtime_error(
"The vectors *x* and *y* must have the same length.");
930 for (
Index i=1; i<n; i++)
931 out += 0.5*(y[i-1]+y[i]) * (x[i]-x[i-1]);
1012 if (
b.nelem() == 1) {
1027 else if (
b.nelem() ==
a.nelem()) {
1038 throw runtime_error(
1039 "The vector *b* must have length 1 or match *a* in length.");
1048 if (
b.nelem() == 1) {
1063 else if (
b.nelem() ==
a.nelem()) {
1074 throw runtime_error(
1075 "The vector *b* must have length 1 or match *a* in length.");
1084 if (
b.nelem() == 1) {
1099 else if (
b.nelem() ==
a.nelem()) {
1110 throw runtime_error(
1111 "The vector *b* must have length 1 or match *a* in length.");
1120 if (
b.nelem() == 1) {
1135 else if (
b.nelem() ==
a.nelem()) {
1146 throw runtime_error(
1147 "The vector *b* must have length 1 or match *a* in length.");
1160 for (
Index i=0; i<
l; i++) {
1161 if (in[i] < limit_low)
1163 else if (in[i] > limit_high)
1164 out[i] = limit_high;
1180 for (
Index i = 0; i < nin; i++) {
1181 if (in[i] >= min_value && in[i] <= max_value) {
1193 for (
Index i = 0; i < nin; i++) {
1194 if (
c[i] >= min_value &&
c[i] <= max_value) {
1218 if (direction ==
"row") {
1219 if (index >= m.
nrows()) {
1221 os <<
"The index " << index <<
" is outside the row range of the Matrix.";
1222 throw runtime_error(os.str());
1227 }
else if (direction ==
"column") {
1228 if (index >= m.
ncols()) {
1230 os <<
"The index " << index
1231 <<
" is outside the column range of the Matrix.";
1232 throw runtime_error(os.str());
1239 os <<
"Keyword *direction* must be either *row* or *column*,"
1240 <<
"but you gave: " << direction <<
".";
1241 throw runtime_error(os.str());
1253 for (
Index i = 0; i < n; i++) out[i] =
v[n - 1 - i];
1257 for (
Index i = 0; i < n; i++) out[i] = in[n - 1 - i];
1295 os <<
"The input Vector must be either\n"
1296 <<
"strictly increasing or strictly decreasing,\n"
1297 <<
"but this is not the case.\n";
1298 os <<
"The vector contains:\n" << ig;
1299 throw runtime_error(os.str());
1308 for (
Index j = 0; j < p.
nelem(); j++) p[j] = dummy[si[j]];
1314 Index iig = 0, ip = 0;
1317 if (p[ip] < ig[iig]) {
1320 }
else if (p[ip] > ig[iig]) {
1321 x.push_back(ig[iig]);
1324 out3 <<
" Skipping point " << p[ip] <<
", which is already "
1325 <<
"in the original grid.\n";
1331 out2 <<
" " << sk <<
" points skipped.\n";
1335 if (ip == p.
nelem()) {
1337 while (iig < ig.
nelem()) {
1338 x.push_back(ig[iig]);
1341 }
else if (iig == ig.
nelem()) {
1343 while (ip < p.
nelem()) {
1359 for (
Index i = 0; i < x.
nelem(); ++i) og[i] = x[i];
1362 og[i] = x[x.
nelem() - 1 - i];
1376 out2 <<
" Creating a linearly spaced vector.\n";
1377 out3 <<
" length : " << x.
nelem() <<
"\n";
1378 out3 <<
" first value : " << x[0] <<
"\n";
1380 if (x.
nelem() > 1) {
1381 out3 <<
" step size : " << x[1] - x[0] <<
"\n";
1382 out3 <<
" last value : " << x[x.nelem() - 1] <<
"\n";
1398 out2 <<
" Creating a logarithmically spaced vector.\n";
1399 out3 <<
" length : " << x.
nelem() <<
"\n";
1400 out3 <<
" first value : " << x[0] <<
"\n";
1402 if (x.
nelem() > 1) {
1403 out3 <<
" step size : " << x[1] - x[0] <<
"\n";
1404 out3 <<
" last value : " << x[x.nelem() - 1] <<
"\n";
1416 if (
M.ncols() != x.
nelem()) {
1418 os <<
"Matrix and vector dimensions must be consistent!\n"
1419 <<
"Matrix.ncols() = " <<
M.ncols() <<
"\n"
1420 <<
"Vector.nelem() = " << x.
nelem();
1421 throw runtime_error(os.str());
1442 if (
M.ncols() != x.
nelem()) {
1444 os <<
"Sparse and vector dimensions must be consistent!\n"
1445 <<
"Sparse.ncols() = " <<
M.ncols() <<
"\n"
1446 <<
"Vector.nelem() = " << x.
nelem();
1447 throw runtime_error(os.str());
1469 if (n < 2)
throw runtime_error(
"The number of points must be > 1.");
1472 out2 <<
" Creating a linearly spaced vector.\n";
1473 out3 <<
" length : " << n <<
"\n";
1474 out3 <<
" first value : " << x[0] <<
"\n";
1476 if (x.
nelem() > 1) {
1477 out3 <<
" step size : " << x[1] - x[0] <<
"\n";
1478 out3 <<
" last value : " << x[x.nelem() - 1] <<
"\n";
1492 nlinspace(seconds, t0.Seconds(), t1.Seconds(), n);
1494 x = time_vector(seconds);
1497/* Workspace method: Doxygen documentation will be auto-generated */
1498void VectorNLogSpace(Vector& x,
1500 const Numeric& start,
1501 const Numeric& stop,
1502 const Verbosity& verbosity) {
1506 if (n < 2) throw runtime_error("The number of points must be > 1.
");
1507 if ((start <= 0) || (stop <= 0))
1508 throw runtime_error("Only positive numbers are allowed.
");
1510 nlogspace(x, start, stop, n);
1512 out2 << " Creating
a logarithmically spaced vector.\n
";
1513 out3 << " length :
" << n << "\n
";
1514 out3 << " first value :
" << x[0] << "\n
";
1517 out3 << " last value :
" << x[x.nelem() - 1] << "\n
";
1520/* Workspace method: Doxygen documentation will be auto-generated */
1521void VectorPower(Vector& out,
1523 const Numeric& value,
1525 const Index n = in.nelem();
1526 // Note that in and out can be the same vector
1528 // Out and in are the same.
1532 for (Index i=0; i<n; i++) {
1533 out[i] = pow( in[i], value );
1537/* Workspace method: Doxygen documentation will be auto-generated */
1538void VectorReshapeMatrix(Vector& v,
1540 const String& direction,
1542 const Index nrows = m.nrows();
1543 const Index ncols = m.ncols();
1545 v.resize(nrows * ncols);
1549 if (direction == "column
") {
1550 for (Index col = 0; col < ncols; col++) {
1551 for (Index row = 0; row < nrows; row++) {
1552 v[iv] = m(row, col);
1556 } else if (direction == "row
") {
1557 for (Index row = 0; row < nrows; row++) {
1558 for (Index col = 0; col < ncols; col++) {
1559 v[iv] = m(row, col);
1565 os << "Keyword *direction* must be either *row* or *column*,
"
1566 << "but you gave:
" << direction << ".
";
1567 throw runtime_error(os.str());
1571/* Workspace method: Doxygen documentation will be auto-generated */
1572void VectorSetConstant(Vector& x,
1574 const Numeric& value,
1575 const Verbosity& verbosity) {
1582 out2 << " Creating
a constant vector.\n
";
1583 out3 << " length :
" << n << "\n
";
1584 out3 << " value :
" << value << "\n
";
1587/* Workspace method: Doxygen documentation will be auto-generated */
1588void ArrayOfTimeSetConstant(ArrayOfTime& x,
1591 const Verbosity& verbosity) {
1598 out2 << " Creating
a constant vector.\n
";
1599 out3 << " length :
" << n << "\n
";
1600 out3 << " value :
" << value << "\n
";
1603/* Workspace method: Doxygen documentation will be auto-generated */
1604void Compare(const Numeric& var1,
1605 const Numeric& var2,
1606 const Numeric& maxabsdiff,
1607 const String& error_message,
1608 const String& var1name,
1609 const String& var2name,
1612 const Verbosity& verbosity) {
1613 Numeric maxdiff = var1 - var2;
1615 if (std::isnan(var1) || std::isnan(var2)) {
1616 if (std::isnan(var1) && std::isnan(var2)) {
1618 } else if (std::isnan(var1)) {
1620 os << "Nan found in
" << var1name << ", but there is no
"
1621 << "NaN at same position in
" << var2name << ".\nThis
"
1622 << "is not allowed.
";
1623 throw runtime_error(os.str());
1626 os << "Nan found in
" << var2name << ", but there is no
"
1627 << "NaN at same position in
" << var1name << ".\nThis
"
1628 << "is not allowed.
";
1629 throw runtime_error(os.str());
1633 if (abs(maxdiff) > maxabsdiff) {
1635 os << var1name << "-
" << var2name << " FAILED!\n
";
1636 if (error_message.length()) os << error_message << "\n
";
1637 os << "Max allowed deviation set to:
" << maxabsdiff << endl
1638 << "but the value deviates with:
" << maxdiff << endl;
1639 throw runtime_error(os.str());
1643 out2 << " " << var1name << "-
" << var2name
1644 << " OK (maximum difference =
" << maxdiff << ").\n
";
1647/* Workspace method: Doxygen documentation will be auto-generated */
1648void Compare(const Vector& var1,
1650 const Numeric& maxabsdiff,
1651 const String& error_message,
1652 const String& var1name,
1653 const String& var2name,
1656 const Verbosity& verbosity) {
1657 const Index n = var1.nelem();
1659 if (var2.nelem() != n) {
1661 os << var1name << " (
" << n << ") and
" << var2name << " (
" << var2.nelem()
1662 << ")
do not have the same size.
";
1663 throw runtime_error(os.str());
1666 Numeric maxdiff = 0.0;
1667 for (Index i = 0; i < n; i++) {
1668 Numeric diff = var1[i] - var2[i];
1670 if (std::isnan(var1[i]) || std::isnan(var2[i])) {
1671 if (std::isnan(var1[i]) && std::isnan(var2[i])) {
1673 } else if (std::isnan(var1[i])) {
1675 os << "Nan found in
" << var1name << ", but there is no
"
1676 << "NaN at same position in
" << var2name << ".\nThis
"
1677 << "is not allowed.
";
1678 throw runtime_error(os.str());
1681 os << "Nan found in
" << var2name << ", but there is no
"
1682 << "NaN at same position in
" << var1name << ".\nThis
"
1683 << "is not allowed.
";
1684 throw runtime_error(os.str());
1688 if (abs(diff) > abs(maxdiff)) {
1693 if (std::isnan(maxdiff) || abs(maxdiff) > maxabsdiff) {
1695 os << var1name << "-
" << var2name << " FAILED!\n
";
1696 if (error_message.length()) os << error_message << "\n
";
1697 os << "Max allowed deviation set to:
" << maxabsdiff << endl
1698 << "but the vectors deviate with:
" << maxdiff << endl;
1699 throw runtime_error(os.str());
1703 out2 << " " << var1name << "-
" << var2name
1704 << " OK (maximum difference =
" << maxdiff << ").\n
";
1707/* Workspace method: Doxygen documentation will be auto-generated */
1708void Compare(const Matrix& var1,
1710 const Numeric& maxabsdiff,
1711 const String& error_message,
1712 const String& var1name,
1713 const String& var2name,
1716 const Verbosity& verbosity) {
1717 const Index nrows = var1.nrows();
1718 const Index ncols = var1.ncols();
1720 if (var2.nrows() != nrows || var2.ncols() != ncols) {
1722 os << var1name << " (
" << nrows << ",
" << ncols << ") and
" << var2name
1723 << " (
" << var2.nrows() << ",
" << var2.ncols()
1724 << ")
do not have the same size.
";
1725 throw runtime_error(os.str());
1728 Numeric maxdiff = 0.0;
1730 for (Index r = 0; r < nrows; r++) {
1731 for (Index c = 0; c < ncols; c++) {
1732 Numeric diff = var1(r, c) - var2(r, c);
1734 if (std::isnan(var1(r, c)) || std::isnan(var2(r, c))) {
1735 if (std::isnan(var1(r, c)) && std::isnan(var2(r, c))) {
1737 } else if (std::isnan(var1(r, c))) {
1739 os << "Nan found in
" << var1name << ", but there is no
"
1740 << "NaN at same position in
" << var2name << ".\nThis
"
1741 << "is not allowed.
";
1742 throw runtime_error(os.str());
1745 os << "Nan found in
" << var2name << ", but there is no
"
1746 << "NaN at same position in
" << var1name << ".\nThis
"
1747 << "is not allowed.
";
1748 throw runtime_error(os.str());
1752 if (abs(diff) > abs(maxdiff)) {
1758 if (abs(maxdiff) > maxabsdiff) {
1760 os << var1name << "-
" << var2name << " FAILED!\n
";
1761 if (error_message.length()) os << error_message << "\n
";
1762 os << "Max allowed deviation set to :
" << maxabsdiff << endl
1763 << "but the matrices deviate with:
" << maxdiff << endl;
1764 throw runtime_error(os.str());
1768 out2 << " " << var1name << "-
" << var2name
1769 << " OK (maximum difference =
" << maxdiff << ").\n
";
1772/* Workspace method: Doxygen documentation will be auto-generated */
1773void Compare(const Tensor3& var1,
1774 const Tensor3& var2,
1775 const Numeric& maxabsdiff,
1776 const String& error_message,
1777 const String& var1name,
1778 const String& var2name,
1781 const Verbosity& verbosity) {
1782 const Index ncols = var1.ncols();
1783 const Index nrows = var1.nrows();
1784 const Index npages = var1.npages();
1786 if (var2.ncols() != ncols || var2.nrows() != nrows ||
1787 var2.npages() != npages) {
1789 os << var1name << " and
" << var2name << " do not have the same size.
";
1790 throw runtime_error(os.str());
1793 Numeric maxdiff = 0.0;
1795 for (Index c = 0; c < ncols; c++)
1796 for (Index r = 0; r < nrows; r++)
1797 for (Index p = 0; p < npages; p++) {
1798 Numeric diff = var1(p, r, c) - var2(p, r, c);
1800 if (std::isnan(var1(p, r, c)) || std::isnan(var2(p, r, c))) {
1801 if (std::isnan(var1(p, r, c)) && std::isnan(var2(p, r, c))) {
1803 } else if (std::isnan(var1(p, r, c))) {
1805 os << "Nan found in
" << var1name << ", but there is no
"
1806 << "NaN at same position in
" << var2name << ".\nThis
"
1807 << "is not allowed.
";
1808 throw runtime_error(os.str());
1811 os << "Nan found in
" << var2name << ", but there is no
"
1812 << "NaN at same position in
" << var1name << ".\nThis
"
1813 << "is not allowed.
";
1814 throw runtime_error(os.str());
1818 if (abs(diff) > abs(maxdiff)) {
1823 if (abs(maxdiff) > maxabsdiff) {
1825 os << var1name << "-
" << var2name << " FAILED!\n
";
1826 if (error_message.length()) os << error_message << "\n
";
1827 os << "Max allowed deviation set to :
" << maxabsdiff << endl
1828 << "but the tensors deviate with:
" << maxdiff << endl;
1829 throw runtime_error(os.str());
1833 out2 << " " << var1name << "-
" << var2name
1834 << " OK (maximum difference =
" << maxdiff << ").\n
";
1837/* Workspace method: Doxygen documentation will be auto-generated */
1838void Compare(const Tensor4& var1,
1839 const Tensor4& var2,
1840 const Numeric& maxabsdiff,
1841 const String& error_message,
1842 const String& var1name,
1843 const String& var2name,
1846 const Verbosity& verbosity) {
1847 const Index ncols = var1.ncols();
1848 const Index nrows = var1.nrows();
1849 const Index npages = var1.npages();
1850 const Index nbooks = var1.nbooks();
1852 if (var2.ncols() != ncols || var2.nrows() != nrows ||
1853 var2.npages() != npages || var2.nbooks() != nbooks) {
1855 os << var1name << " and
" << var2name << " do not have the same size.
";
1856 throw runtime_error(os.str());
1859 Numeric maxdiff = 0.0;
1861 for (Index c = 0; c < ncols; c++)
1862 for (Index r = 0; r < nrows; r++)
1863 for (Index p = 0; p < npages; p++)
1864 for (Index b = 0; b < nbooks; b++) {
1865 Numeric diff = var1(b, p, r, c) - var2(b, p, r, c);
1867 if (std::isnan(var1(b, p, r, c)) || std::isnan(var2(b, p, r, c))) {
1868 if (std::isnan(var1(b, p, r, c)) && std::isnan(var2(b, p, r, c))) {
1870 } else if (std::isnan(var1(b, p, r, c))) {
1872 os << "Nan found in
" << var1name << ", but there is no
"
1873 << "NaN at same position in
" << var2name << ".\nThis
"
1874 << "is not allowed.
";
1875 throw runtime_error(os.str());
1878 os << "Nan found in
" << var2name << ", but there is no
"
1879 << "NaN at same position in
" << var1name << ".\nThis
"
1880 << "is not allowed.
";
1881 throw runtime_error(os.str());
1885 if (abs(diff) > abs(maxdiff)) {
1890 if (abs(maxdiff) > maxabsdiff) {
1892 os << var1name << "-
" << var2name << " FAILED!\n
";
1893 if (error_message.length()) os << error_message << "\n
";
1894 os << "Max allowed deviation set to :
" << maxabsdiff << endl
1895 << "but the tensors deviate with:
" << maxdiff << endl;
1896 throw runtime_error(os.str());
1900 out2 << " " << var1name << "-
" << var2name
1901 << " OK (maximum difference =
" << maxdiff << ").\n
";
1904/* Workspace method: Doxygen documentation will be auto-generated */
1905void Compare(const Tensor5& var1,
1906 const Tensor5& var2,
1907 const Numeric& maxabsdiff,
1908 const String& error_message,
1909 const String& var1name,
1910 const String& var2name,
1913 const Verbosity& verbosity) {
1914 const Index ncols = var1.ncols();
1915 const Index nrows = var1.nrows();
1916 const Index npages = var1.npages();
1917 const Index nbooks = var1.nbooks();
1918 const Index nshelves = var1.nshelves();
1920 if (var2.ncols() != ncols || var2.nrows() != nrows ||
1921 var2.npages() != npages || var2.nbooks() != nbooks ||
1922 var2.nshelves() != nshelves) {
1924 os << var1name << " and
" << var2name << " do not have the same size.
";
1925 throw runtime_error(os.str());
1928 Numeric maxdiff = 0.0;
1930 for (Index c = 0; c < ncols; c++)
1931 for (Index r = 0; r < nrows; r++)
1932 for (Index p = 0; p < npages; p++)
1933 for (Index b = 0; b < nbooks; b++)
1934 for (Index s = 0; s < nshelves; s++) {
1935 Numeric diff = var1(s, b, p, r, c) - var2(s, b, p, r, c);
1937 if (std::isnan(var1(s, b, p, r, c)) ||
1938 std::isnan(var2(s, b, p, r, c))) {
1939 if (std::isnan(var1(s, b, p, r, c)) &&
1940 std::isnan(var2(s, b, p, r, c))) {
1942 } else if (std::isnan(var1(s, b, p, r, c))) {
1944 os << "Nan found in
" << var1name << ", but there is no
"
1945 << "NaN at same position in
" << var2name << ".\nThis
"
1946 << "is not allowed.
";
1947 throw runtime_error(os.str());
1950 os << "Nan found in
" << var2name << ", but there is no
"
1951 << "NaN at same position in
" << var1name << ".\nThis
"
1952 << "is not allowed.
";
1953 throw runtime_error(os.str());
1957 if (abs(diff) > abs(maxdiff)) {
1962 if (abs(maxdiff) > maxabsdiff) {
1964 os << var1name << "-
" << var2name << " FAILED!\n
";
1965 if (error_message.length()) os << error_message << "\n
";
1966 os << "Max allowed deviation set to :
" << maxabsdiff << endl
1967 << "but the tensors deviate with:
" << maxdiff << endl;
1968 throw runtime_error(os.str());
1972 out2 << " " << var1name << "-
" << var2name
1973 << " OK (maximum difference =
" << maxdiff << ").\n
";
1976/* Workspace method: Doxygen documentation will be auto-generated */
1977void Compare(const Tensor7& var1,
1978 const Tensor7& var2,
1979 const Numeric& maxabsdiff,
1980 const String& error_message,
1981 const String& var1name,
1982 const String& var2name,
1985 const Verbosity& verbosity) {
1986 const Index ncols = var1.ncols();
1987 const Index nrows = var1.nrows();
1988 const Index npages = var1.npages();
1989 const Index nbooks = var1.nbooks();
1990 const Index nshelves = var1.nshelves();
1991 const Index nvitrines = var1.nvitrines();
1992 const Index nlibraries = var1.nlibraries();
1994 if (var2.ncols() != ncols || var2.nrows() != nrows ||
1995 var2.npages() != npages || var2.nbooks() != nbooks ||
1996 var2.nshelves() != nshelves || var2.nvitrines() != nvitrines ||
1997 var2.nlibraries() != nlibraries) {
1999 os << var1name << " and
" << var2name << " do not have the same size.
";
2000 throw runtime_error(os.str());
2003 Numeric maxdiff = 0.0;
2005 for (Index c = 0; c < ncols; c++)
2006 for (Index r = 0; r < nrows; r++)
2007 for (Index p = 0; p < npages; p++)
2008 for (Index b = 0; b < nbooks; b++)
2009 for (Index s = 0; s < nshelves; s++)
2010 for (Index v = 0; v < nvitrines; v++)
2011 for (Index l = 0; l < nlibraries; l++) {
2013 var1(l, v, s, b, p, r, c) - var2(l, v, s, b, p, r, c);
2015 if (std::isnan(var1(l, v, s, b, p, r, c)) ||
2016 std::isnan(var2(l, v, s, b, p, r, c))) {
2017 if (std::isnan(var1(l, v, s, b, p, r, c)) &&
2018 std::isnan(var2(l, v, s, b, p, r, c))) {
2020 } else if (std::isnan(var1(l, v, s, b, p, r, c))) {
2022 os << "Nan found in
" << var1name << ", but there is no
"
2023 << "NaN at same position in
" << var2name << ".\nThis
"
2024 << "is not allowed.
";
2025 throw runtime_error(os.str());
2028 os << "Nan found in
" << var2name << ", but there is no
"
2029 << "NaN at same position in
" << var1name << ".\nThis
"
2030 << "is not allowed.
";
2031 throw runtime_error(os.str());
2035 if (abs(diff) > abs(maxdiff)) {
2040 if (abs(maxdiff) > maxabsdiff) {
2042 os << var1name << "-
" << var2name << " FAILED!\n
";
2043 if (error_message.length()) os << error_message << "\n
";
2044 os << "Max allowed deviation set to :
" << maxabsdiff << endl
2045 << "but the tensors deviate with:
" << maxdiff << endl;
2046 throw runtime_error(os.str());
2050 out2 << " " << var1name << "-
" << var2name
2051 << " OK (maximum difference =
" << maxdiff << ").\n
";
2054/* Workspace method: Doxygen documentation will be auto-generated */
2055void Compare(const ArrayOfVector& var1,
2056 const ArrayOfVector& var2,
2057 const Numeric& maxabsdiff,
2058 const String& error_message,
2059 const String& var1name,
2060 const String& var2name,
2063 const Verbosity& verbosity) {
2064 if (var1.nelem() != var2.nelem()) {
2066 os << "The two arrays
do not have the same size.
" << endl
2067 << var1name << " nelem:
" << var1.nelem() << endl
2068 << var2name << " nelem:
" << var2.nelem() << endl;
2069 throw runtime_error(os.str());
2072 bool failed = false;
2073 ostringstream fail_msg;
2074 for (Index i = 0; i < var1.nelem(); i++) {
2076 ostringstream vn1, vn2;
2077 vn1 << var1name << "[
" << i << "]
";
2078 vn2 << var2name << "[
" << i << "]
";
2088 } catch (const std::runtime_error& e) {
2092 << "Mismatch at array index:
" << i << endl;
2096 if (failed) throw runtime_error(fail_msg.str());
2099/* Workspace method: Doxygen documentation will be auto-generated */
2100void Compare(const ArrayOfMatrix& var1,
2101 const ArrayOfMatrix& var2,
2102 const Numeric& maxabsdiff,
2103 const String& error_message,
2104 const String& var1name,
2105 const String& var2name,
2108 const Verbosity& verbosity) {
2109 if (var1.nelem() != var2.nelem()) {
2111 os << "The two arrays
do not have the same size.
" << endl
2112 << var1name << " nelem:
" << var1.nelem() << endl
2113 << var2name << " nelem:
" << var2.nelem() << endl;
2114 throw runtime_error(os.str());
2117 bool failed = false;
2118 ostringstream fail_msg;
2119 for (Index i = 0; i < var1.nelem(); i++) {
2121 ostringstream vn1, vn2;
2122 vn1 << var1name << "[
" << i << "]
";
2123 vn2 << var2name << "[
" << i << "]
";
2133 } catch (const std::runtime_error& e) {
2137 << "Mismatch at array index:
" << i << endl;
2141 if (failed) throw runtime_error(fail_msg.str());
2144/* Workspace method: Doxygen documentation will be auto-generated */
2145void Compare(const ArrayOfTensor7& var1,
2146 const ArrayOfTensor7& var2,
2147 const Numeric& maxabsdiff,
2148 const String& error_message,
2149 const String& var1name,
2150 const String& var2name,
2153 const Verbosity& verbosity) {
2154 if (var1.nelem() != var2.nelem()) {
2156 os << "The two arrays
do not have the same size.
" << endl
2157 << var1name << " nelem:
" << var1.nelem() << endl
2158 << var2name << " nelem:
" << var2.nelem() << endl;
2159 throw runtime_error(os.str());
2162 bool failed = false;
2163 ostringstream fail_msg;
2164 for (Index i = 0; i < var1.nelem(); i++) {
2166 ostringstream vn1, vn2;
2167 vn1 << var1name << "[
" << i << "]
";
2168 vn2 << var2name << "[
" << i << "]
";
2178 } catch (const std::runtime_error& e) {
2182 << "Mismatch at array index:
" << i << endl;
2186 if (failed) throw runtime_error(fail_msg.str());
2189/* Workspace method: Doxygen documentation will be auto-generated */
2190void Compare(const GriddedField3& var1,
2191 const GriddedField3& var2,
2192 const Numeric& maxabsdiff,
2193 const String& error_message,
2194 const String& var1name,
2195 const String& var2name,
2198 const Verbosity& verbosity) {
2199 for (Index i = 0; i < var1.get_dim(); i++) {
2200 if (var1.get_grid_size(i) != var2.get_grid_size(i)) {
2202 os << var1name << " and
" << var2name << " grid
" << i
2203 << " do not have the same size:
" << var1.get_grid_size(i)
2204 << " !=
" << var2.get_grid_size(i);
2205 throw runtime_error(os.str());
2207 if (var1.get_grid_name(i) != var2.get_grid_name(i)) {
2209 os << var1name << " and
" << var2name << " grid
" << i
2210 << " do not have the same name:
" << var1.get_grid_name(i)
2211 << " !=
" << var2.get_grid_name(i);
2212 throw runtime_error(os.str());
2227/* Workspace method: Doxygen documentation will be auto-generated */
2228void Compare(const Sparse& var1,
2230 const Numeric& maxabsdiff,
2231 const String& error_message,
2232 const String& var1name,
2233 const String& var2name,
2236 const Verbosity& verbosity) {
2237 const Index nrows = var1.nrows();
2238 const Index ncols = var1.ncols();
2240 if (var2.nrows() != nrows || var2.ncols() != ncols) {
2242 os << var1name << " (
" << nrows << ",
" << ncols << ") and
" << var2name
2243 << " (
" << var2.nrows() << ",
" << var2.ncols()
2244 << ")
do not have the same size.
";
2245 throw runtime_error(os.str());
2248 Numeric maxdiff = 0.0;
2250 for (Index r = 0; r < nrows; r++) {
2251 for (Index c = 0; c < ncols; c++) {
2252 Numeric diff = var1(r, c) - var2(r, c);
2254 if (std::isnan(var1(r, c)) || std::isnan(var2(r, c))) {
2255 if (std::isnan(var1(r, c)) && std::isnan(var2(r, c))) {
2257 } else if (std::isnan(var1(r, c))) {
2259 os << "Nan found in
" << var1name << ", but there is no
"
2260 << "NaN at same position in
" << var2name << ".\nThis
"
2261 << "is not allowed.
";
2262 throw runtime_error(os.str());
2265 os << "Nan found in
" << var2name << ", but there is no
"
2266 << "NaN at same position in
" << var1name << ".\nThis
"
2267 << "is not allowed.
";
2268 throw runtime_error(os.str());
2272 if (abs(diff) > abs(maxdiff)) {
2278 if (abs(maxdiff) > maxabsdiff) {
2280 os << var1name << "-
" << var2name << " FAILED!\n
";
2281 if (error_message.length()) os << error_message << "\n
";
2282 os << "Max allowed deviation set to :
" << maxabsdiff << endl
2283 << "but the matrices deviate with:
" << maxdiff << endl;
2284 throw runtime_error(os.str());
2288 out2 << " " << var1name << "-
" << var2name
2289 << " OK (maximum difference =
" << maxdiff << ").\n
";
2292/* Workspace method: Doxygen documentation will be auto-generated */
2293void Compare(const SingleScatteringData& var1,
2294 const SingleScatteringData& var2,
2295 const Numeric& maxabsdiff,
2296 const String& error_message,
2297 const String& var1name,
2298 const String& var2name,
2301 const Verbosity& verbosity) {
2302 if (var1.ptype != var2.ptype) {
2303 std::ostringstream os;
2304 os << "The particle types don
't match: " << std::endl
2305 << var1name << " = " << PTypeToString(var1.ptype) << ", " << var2name
2306 << " = " << PTypeToString(var2.ptype) << std::endl;
2307 throw std::runtime_error(os.str());
2309 Compare(var1.f_grid,
2313 var1name + ".f_grid",
2314 var2name + ".f_grid",
2318 Compare(var1.T_grid,
2322 var1name + ".T_grid",
2323 var2name + ".T_grid",
2327 Compare(var1.za_grid,
2331 var1name + ".za_grid",
2332 var2name + ".za_grid",
2336 Compare(var1.aa_grid,
2340 var1name + ".aa_grid",
2341 var2name + ".aa_grid",
2345 Compare(var1.pha_mat_data,
2349 var1name + ".pha_mat_data",
2350 var2name + ".pha_mat_data",
2354 Compare(var1.ext_mat_data,
2358 var1name + ".ext_mat_data",
2359 var2name + ".ext_mat_data",
2363 Compare(var1.abs_vec_data,
2367 var1name + ".abs_vec_data",
2368 var2name + ".abs_vec_data",
2374inline void _cr_internal_(const Numeric& var1,
2375 const Numeric& var2,
2376 const Numeric& maxabsreldiff,
2377 const String& error_message,
2378 const String& var1name,
2379 const String& var2name,
2383 if (var1 not_eq 0. and var2 not_eq 0.) {
2384 const Numeric absreldiff = abs(var1 / var2 - 1);
2385 if (absreldiff > maxabsreldiff) {
2387 os << var1name << "-" << var2name << " FAILED!\n";
2388 if (error_message.length()) os << error_message << "\n";
2389 os << "Max allowed deviation set to: " << maxabsreldiff * 100.0 << "%"
2391 << "but the input deviate with: " << absreldiff * 100.0 << "%\n"
2392 << "If you compare non-scalar variables, the reported deviation is\n"
2393 << "the first one found violating the criterion. The maximum\n"
2394 << "difference can be higher.\n";
2395 throw runtime_error(os.str());
2400inline void _cr_internal_(const ConstVectorView var1,
2401 const ConstVectorView var2,
2402 const Numeric& maxabsreldiff,
2403 const String& error_message,
2404 const String& var1name,
2405 const String& var2name,
2408 const Verbosity& verbosity) {
2409 const Index n = var1.nelem();
2410 if (var2.nelem() not_eq n)
2411 throw std::runtime_error("Cannot compare variables of different size");
2412 for (Index i = 0; i < n; i++)
2413 _cr_internal_(var1[i],
2424inline void _cr_internal_(const ConstMatrixView var1,
2425 const ConstMatrixView var2,
2426 const Numeric& maxabsreldiff,
2427 const String& error_message,
2428 const String& var1name,
2429 const String& var2name,
2432 const Verbosity& verbosity) {
2433 const Index n = var1.nrows();
2434 if (var2.nrows() not_eq n)
2435 throw std::runtime_error("Cannot compare variables of different size");
2436 for (Index i = 0; i < n; i++)
2437 _cr_internal_(var1(i, joker),
2448inline void _cr_internal_(const ConstTensor3View var1,
2449 const ConstTensor3View var2,
2450 const Numeric& maxabsreldiff,
2451 const String& error_message,
2452 const String& var1name,
2453 const String& var2name,
2456 const Verbosity& verbosity) {
2457 const Index n = var1.npages();
2458 if (var2.npages() not_eq n)
2459 throw std::runtime_error("Cannot compare variables of different size");
2460 for (Index i = 0; i < n; i++)
2461 _cr_internal_(var1(i, joker, joker),
2462 var2(i, joker, joker),
2472inline void _cr_internal_(const ConstTensor4View var1,
2473 const ConstTensor4View var2,
2474 const Numeric& maxabsreldiff,
2475 const String& error_message,
2476 const String& var1name,
2477 const String& var2name,
2480 const Verbosity& verbosity) {
2481 const Index n = var1.nbooks();
2482 if (var2.nbooks() not_eq n)
2483 throw std::runtime_error("Cannot compare variables of different size");
2484 for (Index i = 0; i < n; i++)
2485 _cr_internal_(var1(i, joker, joker, joker),
2486 var2(i, joker, joker, joker),
2496inline void _cr_internal_(const ConstTensor5View var1,
2497 const ConstTensor5View var2,
2498 const Numeric& maxabsreldiff,
2499 const String& error_message,
2500 const String& var1name,
2501 const String& var2name,
2504 const Verbosity& verbosity) {
2505 const Index n = var1.nshelves();
2506 if (var2.nshelves() not_eq n)
2507 throw std::runtime_error("Cannot compare variables of different size");
2508 for (Index i = 0; i < n; i++)
2509 _cr_internal_(var1(i, joker, joker, joker, joker),
2510 var2(i, joker, joker, joker, joker),
2520inline void _cr_internal_(const ConstTensor6View var1,
2521 const ConstTensor6View var2,
2522 const Numeric& maxabsreldiff,
2523 const String& error_message,
2524 const String& var1name,
2525 const String& var2name,
2528 const Verbosity& verbosity) {
2529 const Index n = var1.nvitrines();
2530 if (var2.nvitrines() not_eq n)
2531 throw std::runtime_error("Cannot compare variables of different size");
2532 for (Index i = 0; i < n; i++)
2533 _cr_internal_(var1(i, joker, joker, joker, joker, joker),
2534 var2(i, joker, joker, joker, joker, joker),
2544inline void _cr_internal_(const ConstTensor7View var1,
2545 const ConstTensor7View var2,
2546 const Numeric& maxabsreldiff,
2547 const String& error_message,
2548 const String& var1name,
2549 const String& var2name,
2552 const Verbosity& verbosity) {
2553 const Index n = var1.nlibraries();
2554 if (var2.nlibraries() not_eq n)
2555 throw std::runtime_error("Cannot compare variables of different size");
2556 for (Index i = 0; i < n; i++)
2557 _cr_internal_(var1(i, joker, joker, joker, joker, joker, joker),
2558 var2(i, joker, joker, joker, joker, joker, joker),
2568inline void _cr_internal_(const PropagationMatrix& var1,
2569 const PropagationMatrix& var2,
2570 const Numeric& maxabsreldiff,
2571 const String& error_message,
2572 const String& var1name,
2573 const String& var2name,
2576 const Verbosity& verbosity) {
2577 _cr_internal_(var1.Data(),
2588inline void _cr_internal_(const StokesVector& var1,
2589 const StokesVector& var2,
2590 const Numeric& maxabsreldiff,
2591 const String& error_message,
2592 const String& var1name,
2593 const String& var2name,
2596 const Verbosity& verbosity) {
2597 _cr_internal_(var1.Data(),
2609inline void _cr_internal_(const Array<T>& var1,
2610 const Array<T>& var2,
2611 const Numeric& maxabsreldiff,
2612 const String& error_message,
2613 const String& var1name,
2614 const String& var2name,
2617 const Verbosity& verbosity) {
2618 const Index n = var1.nelem();
2619 if (var2.nelem() not_eq n)
2620 throw std::runtime_error("Cannot compare arrays of different length");
2621 for (Index i = 0; i < n; i++)
2622 _cr_internal_(var1[i],
2633/* Workspace method: Doxygen documentation will be auto-generated */
2634void CompareRelative(const Numeric& var1,
2635 const Numeric& var2,
2636 const Numeric& maxabsreldiff,
2637 const String& error_message,
2638 const String& var1name,
2639 const String& var2name,
2642 const Verbosity& verbosity) {
2653void CompareRelative(const Vector& var1,
2655 const Numeric& maxabsreldiff,
2656 const String& error_message,
2657 const String& var1name,
2658 const String& var2name,
2661 const Verbosity& verbosity) {
2672void CompareRelative(const Matrix& var1,
2674 const Numeric& maxabsreldiff,
2675 const String& error_message,
2676 const String& var1name,
2677 const String& var2name,
2680 const Verbosity& verbosity) {
2691void CompareRelative(const Tensor3& var1,
2692 const Tensor3& var2,
2693 const Numeric& maxabsreldiff,
2694 const String& error_message,
2695 const String& var1name,
2696 const String& var2name,
2699 const Verbosity& verbosity) {
2710void CompareRelative(const Tensor4& var1,
2711 const Tensor4& var2,
2712 const Numeric& maxabsreldiff,
2713 const String& error_message,
2714 const String& var1name,
2715 const String& var2name,
2718 const Verbosity& verbosity) {
2729void CompareRelative(const Tensor5& var1,
2730 const Tensor5& var2,
2731 const Numeric& maxabsreldiff,
2732 const String& error_message,
2733 const String& var1name,
2734 const String& var2name,
2737 const Verbosity& verbosity) {
2748void CompareRelative(const Tensor6& var1,
2749 const Tensor6& var2,
2750 const Numeric& maxabsreldiff,
2751 const String& error_message,
2752 const String& var1name,
2753 const String& var2name,
2756 const Verbosity& verbosity) {
2767void CompareRelative(const Tensor7& var1,
2768 const Tensor7& var2,
2769 const Numeric& maxabsreldiff,
2770 const String& error_message,
2771 const String& var1name,
2772 const String& var2name,
2775 const Verbosity& verbosity) {
2786void CompareRelative(const ArrayOfVector& var1,
2787 const ArrayOfVector& var2,
2788 const Numeric& maxabsreldiff,
2789 const String& error_message,
2790 const String& var1name,
2791 const String& var2name,
2794 const Verbosity& verbosity) {
2805void CompareRelative(const ArrayOfMatrix& var1,
2806 const ArrayOfMatrix& var2,
2807 const Numeric& maxabsreldiff,
2808 const String& error_message,
2809 const String& var1name,
2810 const String& var2name,
2813 const Verbosity& verbosity) {
2824void CompareRelative(const ArrayOfTensor3& var1,
2825 const ArrayOfTensor3& var2,
2826 const Numeric& maxabsreldiff,
2827 const String& error_message,
2828 const String& var1name,
2829 const String& var2name,
2832 const Verbosity& verbosity) {
2843void CompareRelative(const ArrayOfTensor4& var1,
2844 const ArrayOfTensor4& var2,
2845 const Numeric& maxabsreldiff,
2846 const String& error_message,
2847 const String& var1name,
2848 const String& var2name,
2851 const Verbosity& verbosity) {
2862void CompareRelative(const ArrayOfTensor5& var1,
2863 const ArrayOfTensor5& var2,
2864 const Numeric& maxabsreldiff,
2865 const String& error_message,
2866 const String& var1name,
2867 const String& var2name,
2870 const Verbosity& verbosity) {
2881void CompareRelative(const ArrayOfTensor6& var1,
2882 const ArrayOfTensor6& var2,
2883 const Numeric& maxabsreldiff,
2884 const String& error_message,
2885 const String& var1name,
2886 const String& var2name,
2889 const Verbosity& verbosity) {
2900void CompareRelative(const ArrayOfTensor7& var1,
2901 const ArrayOfTensor7& var2,
2902 const Numeric& maxabsreldiff,
2903 const String& error_message,
2904 const String& var1name,
2905 const String& var2name,
2908 const Verbosity& verbosity) {
2919void CompareRelative(const ArrayOfArrayOfVector& var1,
2920 const ArrayOfArrayOfVector& var2,
2921 const Numeric& maxabsreldiff,
2922 const String& error_message,
2923 const String& var1name,
2924 const String& var2name,
2927 const Verbosity& verbosity) {
2938void CompareRelative(const ArrayOfArrayOfMatrix& var1,
2939 const ArrayOfArrayOfMatrix& var2,
2940 const Numeric& maxabsreldiff,
2941 const String& error_message,
2942 const String& var1name,
2943 const String& var2name,
2946 const Verbosity& verbosity) {
2957void CompareRelative(const ArrayOfArrayOfTensor3& var1,
2958 const ArrayOfArrayOfTensor3& var2,
2959 const Numeric& maxabsreldiff,
2960 const String& error_message,
2961 const String& var1name,
2962 const String& var2name,
2965 const Verbosity& verbosity) {
2976void CompareRelative(const ArrayOfArrayOfTensor4& var1,
2977 const ArrayOfArrayOfTensor4& var2,
2978 const Numeric& maxabsreldiff,
2979 const String& error_message,
2980 const String& var1name,
2981 const String& var2name,
2984 const Verbosity& verbosity) {
2995void CompareRelative(const ArrayOfArrayOfTensor5& var1,
2996 const ArrayOfArrayOfTensor5& var2,
2997 const Numeric& maxabsreldiff,
2998 const String& error_message,
2999 const String& var1name,
3000 const String& var2name,
3003 const Verbosity& verbosity) {
3014void CompareRelative(const ArrayOfArrayOfTensor6& var1,
3015 const ArrayOfArrayOfTensor6& var2,
3016 const Numeric& maxabsreldiff,
3017 const String& error_message,
3018 const String& var1name,
3019 const String& var2name,
3022 const Verbosity& verbosity) {
3033void CompareRelative(const ArrayOfArrayOfTensor7& var1,
3034 const ArrayOfArrayOfTensor7& var2,
3035 const Numeric& maxabsreldiff,
3036 const String& error_message,
3037 const String& var1name,
3038 const String& var2name,
3041 const Verbosity& verbosity) {
3053void CompareRelative(const PropagationMatrix& var1,
3054 const PropagationMatrix& var2,
3055 const Numeric& maxabsreldiff,
3056 const String& error_message,
3057 const String& var1name,
3058 const String& var2name,
3061 const Verbosity& verbosity) {
3073void CompareRelative(const ArrayOfPropagationMatrix& var1,
3074 const ArrayOfPropagationMatrix& var2,
3075 const Numeric& maxabsreldiff,
3076 const String& error_message,
3077 const String& var1name,
3078 const String& var2name,
3081 const Verbosity& verbosity) {
3093void CompareRelative(const ArrayOfArrayOfPropagationMatrix& var1,
3094 const ArrayOfArrayOfPropagationMatrix& var2,
3095 const Numeric& maxabsreldiff,
3096 const String& error_message,
3097 const String& var1name,
3098 const String& var2name,
3101 const Verbosity& verbosity) {
3113void CompareRelative(const StokesVector& var1,
3114 const StokesVector& var2,
3115 const Numeric& maxabsreldiff,
3116 const String& error_message,
3117 const String& var1name,
3118 const String& var2name,
3121 const Verbosity& verbosity) {
3133void CompareRelative(const ArrayOfStokesVector& var1,
3134 const ArrayOfStokesVector& var2,
3135 const Numeric& maxabsreldiff,
3136 const String& error_message,
3137 const String& var1name,
3138 const String& var2name,
3141 const Verbosity& verbosity) {
3153void CompareRelative(const ArrayOfArrayOfStokesVector& var1,
3154 const ArrayOfArrayOfStokesVector& var2,
3155 const Numeric& maxabsreldiff,
3156 const String& error_message,
3157 const String& var1name,
3158 const String& var2name,
3161 const Verbosity& verbosity) {
3173/* Workspace method: Doxygen documentation will be auto-generated */
3174void CompareRelative(const EnergyLevelMap& var1,
3175 const EnergyLevelMap& var2,
3176 const Numeric& maxabsreldiff,
3177 const String& error_message,
3178 const String& var1name,
3179 const String& var2name,
3182 const Verbosity& verbosity) {
3183 _cr_internal_(var1.value,
3192 _cr_internal_(var1.vib_energy,
3203void PrintPhysicalConstants(const Verbosity& verbosity) {
3206 extern const Numeric AVOGADROS_NUMB;
3207 extern const Numeric BOHR_MAGNETON;
3208 extern const Numeric BOLTZMAN_CONST;
3209 extern const Numeric ELECTRON_CHARGE;
3210 extern const Numeric ELECTRON_MASS;
3211 extern const Numeric GAS_CONSTANT;
3212 extern const Numeric PLANCK_CONST;
3213 extern const Numeric SPEED_OF_LIGHT;
3214 extern const Numeric VACUUM_PERMITTIVITY;
3215 extern const Numeric DOPPLER_CONST;
3217 out0 << std::setprecision(15) << std::scientific;
3218 out0 << "---------------------------------------------------------\n"
3219 << "Numerical const in ARTS \tValue\n"
3220 << "Avogadro's constant: \t
" << AVOGADROS_NUMB << '\n'
3221 << "Bohr
's magneton: \t " << BOHR_MAGNETON << '\n
'
3222 << "Boltzmann's constant: \t
" << BOLTZMAN_CONST << '\n'
3223 << "Electron charge: \t
" << ELECTRON_CHARGE << '\n'
3224 << "Electron
mass: \t
" << ELECTRON_MASS << '\n'
3225 << "Ideal gas constant: \t
" << GAS_CONSTANT << '\n'
3226 << "Planck
's constant: \t " << PLANCK_CONST << '\n
'
3227 << "Speed of light: \t " << SPEED_OF_LIGHT << '\n
'
3228 << "Vacuum permittivity: \t " << VACUUM_PERMITTIVITY << '\n
'
3229 << "Doppler constant: \t " << DOPPLER_CONST << '\n
'
3230 << "---------------------------------------------------------\n";
This file contains the definition of Array.
void arts_exit(int status)
This is the exit function of ARTS.
The global header file for ARTS.
TimeStep mean(const ArrayOfTimeStep &dt)
Returns the mean time step.
Stuff related to time in ARTS.
Index nelem() const ARTS_NOEXCEPT
Number of elements.
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.
Implements rational numbers to work with other ARTS types.
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.
void Tensor3Add(Tensor3 &out, const Tensor3 &in, const Numeric &value, const Verbosity &)
WORKSPACE METHOD: Tensor3Add.
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 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 nlinspace(Vector &x, const Numeric start, const Numeric stop, const Index n)
nlinspace
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.
Index nelem(const Lines &l)
Number of lines.
constexpr Numeric l(const Index p0, const Index n, const Numeric x, const SortedVectorType &xi, const Index j, const std::pair< Numeric, Numeric > cycle={ -180, 180}) noexcept
Vector mass(const ConstVectorView &atmospheric_vmrs, const ArrayOfArrayOfSpeciesTag &atmospheric_species, const ArrayOfSpecies &lineshape_species, const SpeciesIsotopologueRatios &ir) ARTS_NOEXCEPT
Returns a mass vector for this model's main calculations.
constexpr Rational start(Rational Ju, Rational Jl, Polarization type) noexcept
Gives the lowest M for a polarization type of this transition.
Scattering database structure and functions.
Contains sorting routines.
void get_sorted_indexes(ArrayOfIndex &sorted, const T &data)
get_sorted_indexes
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.