diff --git a/CMakeLists.txt b/CMakeLists.txt index 9421ea94e2..9629116847 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -111,8 +111,6 @@ endif () set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) -add_compile_definitions(MDSPAN_USE_PAREN_OPERATOR=1) - enable_testing () list (APPEND CMAKE_MODULE_PATH "${ARTS_SOURCE_DIR}/cmake/modules") diff --git a/src/core/absorption/cia.cc b/src/core/absorption/cia.cc index ea45ff3159..191c70eb29 100644 --- a/src/core/absorption/cia.cc +++ b/src/core/absorption/cia.cc @@ -187,7 +187,7 @@ void cia_interpolation(VectorView result, if (T_order == 0) { // No temperature interpolation in this case, just a frequency interpolation. result_active = - reinterp(cia_data.data(joker, 0), interpweights(f_lag), f_lag); + reinterp(cia_data.data[joker, 0], interpweights(f_lag), f_lag); } else { // Temperature and frequency interpolation. const auto Tnew = matpack::matpack_constant_data{temperature}; @@ -495,7 +495,7 @@ void CIARecord::AppendDataset(const Vector& freq, dataset.grid<1>() = temp_t; dataset.gridname<1>() = "Temperature"; - for (Index t = 0; t < temp.nelem(); t++) dataset.data(joker, t) = cia[t]; + for (Index t = 0; t < temp.nelem(); t++) dataset.data[joker, t] = cia[t]; mdata.push_back(dataset); } diff --git a/src/core/absorption/xsec_fit.cc b/src/core/absorption/xsec_fit.cc index a27d6f7858..fb57e03a59 100644 --- a/src/core/absorption/xsec_fit.cc +++ b/src/core/absorption/xsec_fit.cc @@ -184,7 +184,7 @@ void XsecRecord::CalcXsec(VectorView xsec, const Numeric pressure, const Numeric temperature) const { for (Index i = 0; i < xsec.nelem(); i++) { - const ConstVectorView coeffs = mfitcoeffs[dataset].data(i, joker); + const ConstVectorView coeffs = mfitcoeffs[dataset].data[i, joker]; xsec[i] = coeffs[P00] + coeffs[P10] * temperature + coeffs[P01] * pressure + coeffs[P20] * temperature * temperature; } diff --git a/src/core/atm/atm.cpp b/src/core/atm/atm.cpp index df9db18e73..4dfca1780c 100644 --- a/src/core/atm/atm.cpp +++ b/src/core/atm/atm.cpp @@ -613,7 +613,7 @@ Vector vec_interp(const GriddedField3 &v, const Index n = alt.size(); - if (d1 and d2 and d3) return Vector(n, v.data(0, 0, 0)); + if (d1 and d2 and d3) return Vector(n, v.data[0, 0, 0]); if (d1 and d2) return tvec_interp<0, 0, 1>( v.data, v.grid<0>(), v.grid<1>(), v.grid<2>(), alt, lat, lon); @@ -928,7 +928,7 @@ std::array, 8> flat_weight_(const GriddedField3 &gf3, for (Index j = 0; j < la.size(); j++) { for (Index k = 0; k < lo.size(); k++, ++m) { out[m] = {{(al.pos + i) * NN + (la.pos + j) * N + lo.pos + k}, - x(i, j, k)}; + x[i, j, k]}; } } } @@ -1227,7 +1227,7 @@ AtmField Atm::atm_from_profile(const std::span &atm, for (auto &key : atm.front().keys()) { for (Size i = 0; i < atm.size(); i++) { // Add from ending - gf3.data(N - 1 - i, 0, 0) = atm[i][key]; + gf3.data[N - 1 - i, 0, 0] = atm[i][key]; } gf3.data_name = std::format("{}", key); @@ -1238,7 +1238,7 @@ AtmField Atm::atm_from_profile(const std::span &atm, for (auto &key : atm.front().keys()) { for (Size i = 0; i < atm.size(); i++) { // Add from beginning - gf3.data(i, 0, 0) = atm[i][key]; + gf3.data[i, 0, 0] = atm[i][key]; } gf3.data_name = std::format("{}", key); @@ -1385,7 +1385,7 @@ Longitude must be within -180 to 180 degrees. for (Index j = 0; j < nlat; j++) { for (Index k = 0; k < nlon; k++) { try { - gf3(i, j, k) = atm_data.at(alt[i], lat[j], lon[k]); + gf3[i, j, k] = atm_data.at(alt[i], lat[j], lon[k]); } catch (std::exception &e) { #pragma omp critical if (error.empty()) error = e.what(); diff --git a/src/core/check_input.cc b/src/core/check_input.cc index a97e17c8e4..ada6e060d6 100644 --- a/src/core/check_input.cc +++ b/src/core/check_input.cc @@ -1463,7 +1463,7 @@ void chk_atm_field(const String& x_name, for (Index ip = 0; ip < npages; ip++) { for (Index ir = 0; ir < nrows; ir++) { for (Index ic = 0; ic < ncols; ic++) { - ARTS_USER_ERROR_IF(std::isnan(x(ip, ir, ic)), + ARTS_USER_ERROR_IF(std::isnan(x[ip, ir, ic]), "The variable *", x_name, "* contains one or ", @@ -1481,7 +1481,7 @@ void chk_atm_field(const String& x_name, for (Index ir = 0; ir < nrows; ir++) { ARTS_USER_ERROR_IF( !is_same_within_epsilon( - x(ip, ir, ic), x(ip, ir, 0), 4 * DBL_EPSILON), + x[ip, ir, ic], x[ip, ir, 0], 4 * DBL_EPSILON), "The variable *", x_name, "* covers 360 ", @@ -1489,10 +1489,10 @@ void chk_atm_field(const String& x_name, "seems to deviate between first and last longitude ", "point. The field must be \"cyclic\".\n", "Difference: ", - x(ip, ir, ic) - x(ip, ir, 0), + x[ip, ir, ic] - x[ip, ir, 0], "\n", "Epsilon : ", - 4 * DBL_EPSILON * std::max(x(ip, ir, ic), x(ip, ir, 0))) + 4 * DBL_EPSILON * std::max(x[ip, ir, ic], x[ip, ir, 0])) } } } @@ -1505,7 +1505,7 @@ void chk_atm_field(const String& x_name, for (Index ic = 1; ic < ncols; ic++) { ARTS_USER_ERROR_IF( !is_same_within_epsilon( - x(ip, 0, ic), x(ip, 0, ic - 1), 2 * DBL_EPSILON), + x[ip, 0, ic], x[ip, 0, ic - 1], 2 * DBL_EPSILON), "The variable *", x_name, "* covers the South\n", @@ -1527,7 +1527,7 @@ void chk_atm_field(const String& x_name, for (Index ic = 1; ic < ncols; ic++) { ARTS_USER_ERROR_IF( !is_same_within_epsilon( - x(ip, ir, ic), x(ip, ir, ic - 1), 2 * DBL_EPSILON), + x[ip, ir, ic], x[ip, ir, ic - 1], 2 * DBL_EPSILON), "The variable *", x_name, "* covers the North\n", @@ -1616,7 +1616,7 @@ void chk_atm_field(const String& x_name, for (Index ip = 0; ip < npages; ip++) { for (Index ir = 0; ir < nrows; ir++) { for (Index ic = 0; ic < ncols; ic++) { - ARTS_USER_ERROR_IF(std::isnan(x(ib, ip, ir, ic)), + ARTS_USER_ERROR_IF(std::isnan(x[ib, ip, ir, ic]), "The variable *", x_name, "* contains one or ", @@ -1637,7 +1637,7 @@ void chk_atm_field(const String& x_name, for (Index ir = 0; ir < nrows; ir++) { ARTS_USER_ERROR_IF( !is_same_within_epsilon( - x(is, ip, ir, ic), x(is, ip, ir, 0), 2 * DBL_EPSILON), + x[is, ip, ir, ic], x[is, ip, ir, 0], 2 * DBL_EPSILON), "The variable *", x_name, "* covers 360 ", @@ -1658,7 +1658,7 @@ void chk_atm_field(const String& x_name, for (Index ic = 1; ic < ncols; ic++) { ARTS_USER_ERROR_IF( !is_same_within_epsilon( - x(is, ip, 0, ic), x(is, ip, 0, ic - 1), 2 * DBL_EPSILON), + x[is, ip, 0, ic], x[is, ip, 0, ic - 1], 2 * DBL_EPSILON), "The variable *", x_name, "* covers the South ", @@ -1679,7 +1679,7 @@ void chk_atm_field(const String& x_name, for (Index ic = 1; ic < ncols; ic++) { ARTS_USER_ERROR_IF( !is_same_within_epsilon( - x(is, ip, ir, ic), x(is, ip, ir, ic - 1), 2 * DBL_EPSILON), + x[is, ip, ir, ic], x[is, ip, ir, ic - 1], 2 * DBL_EPSILON), "The variable *", x_name, "* covers the North ", @@ -1785,9 +1785,9 @@ void chk_atm_vecfield_lat90(const String& x1_name, Numeric vec1, vec2; for (Index ip = 0; ip < npages; ip++) { for (Index ic = 1; ic < ncols; ic++) { - vec1 = x1(ip, 0, ic) * x1(ip, 0, ic) + x2(ip, 0, ic) * x2(ip, 0, ic); - vec2 = x1(ip, 0, ic - 1) * x1(ip, 0, ic - 1) + - x2(ip, 0, ic - 1) * x2(ip, 0, ic - 1); + vec1 = x1[ip, 0, ic] * x1[ip, 0, ic] + x2[ip, 0, ic] * x2[ip, 0, ic]; + vec2 = x1[ip, 0, ic - 1] * x1[ip, 0, ic - 1] + + x2[ip, 0, ic - 1] * x2[ip, 0, ic - 1]; ARTS_USER_ERROR_IF( fabs(vec1 / vec2 - 1.) > th, "The variables *", @@ -1821,9 +1821,9 @@ void chk_atm_vecfield_lat90(const String& x1_name, for (Index ip = 0; ip < npages; ip++) { for (Index ic = 1; ic < ncols; ic++) { vec1 = - x1(ip, ir, ic) * x1(ip, ir, ic) + x2(ip, ir, ic) * x2(ip, ir, ic); - vec2 = x1(ip, ir, ic - 1) * x1(ip, ir, ic - 1) + - x2(ip, ir, ic - 1) * x2(ip, ir, ic - 1); + x1[ip, ir, ic] * x1[ip, ir, ic] + x2[ip, ir, ic] * x2[ip, ir, ic]; + vec2 = x1[ip, ir, ic - 1] * x1[ip, ir, ic - 1] + + x2[ip, ir, ic - 1] * x2[ip, ir, ic - 1]; ARTS_USER_ERROR_IF( fabs(vec1 / vec2 - 1.) > th, "The variables *", @@ -1898,7 +1898,7 @@ void chk_atm_surface(const String& x_name, const Index ic = ncols - 1; for (Index ir = 0; ir < nrows; ir++) { ARTS_USER_ERROR_IF( - !is_same_within_epsilon(x(ir, ic), x(ir, 0), 2 * DBL_EPSILON), + !is_same_within_epsilon(x[ir, ic], x[ir, 0], 2 * DBL_EPSILON), "The variable *", x_name, "* covers 360 ", @@ -1912,7 +1912,7 @@ void chk_atm_surface(const String& x_name, if (lat_grid[0] == -90) { for (Index ic = 1; ic < ncols; ic++) { ARTS_USER_ERROR_IF( - !is_same_within_epsilon(x(0, ic), x(0, ic - 1), 2 * DBL_EPSILON), + !is_same_within_epsilon(x[0, ic], x[0, ic - 1], 2 * DBL_EPSILON), "The variable *", x_name, "* covers the South ", @@ -1926,7 +1926,7 @@ void chk_atm_surface(const String& x_name, const Index ir = nrows - 1; for (Index ic = 1; ic < ncols; ic++) { ARTS_USER_ERROR_IF( - !is_same_within_epsilon(x(ir, ic), x(ir, ic - 1), 2 * DBL_EPSILON), + !is_same_within_epsilon(x[ir, ic], x[ir, ic - 1], 2 * DBL_EPSILON), "The variable *", x_name, "* covers the North ", @@ -1983,7 +1983,7 @@ void chk_sensor_pos(const String& name, ConstMatrixView sensor_pos) { ARTS_USER_ERROR_IF( sensor_pos.nrows() == 0, "*", name, "*must have at least one row."); for (Index i = 0; i < sensor_pos.nrows(); i++) { - ARTS_USER_ERROR_IF(sensor_pos(i, 1) < -90 || sensor_pos(i, 1) > 90, + ARTS_USER_ERROR_IF((sensor_pos[i, 1] < -90 || sensor_pos[i, 1] > 90), "Unvalid latitude in *", name, "*.\n", @@ -1993,8 +1993,8 @@ void chk_sensor_pos(const String& name, ConstMatrixView sensor_pos) { "(", i, ",1) is ", - sensor_pos(i, 1)); - ARTS_USER_ERROR_IF(sensor_pos(i, 2) < -180 || sensor_pos(i, 1) >= 180, + sensor_pos[i, 1]); + ARTS_USER_ERROR_IF((sensor_pos[i, 2] < -180 || sensor_pos[i, 1] >= 180), "Unvalid longitude in *", name, "*.\n", @@ -2004,7 +2004,7 @@ void chk_sensor_pos(const String& name, ConstMatrixView sensor_pos) { "(", i, ",2) is ", - sensor_pos(i, 2)); + sensor_pos[i, 2]); } } @@ -2014,7 +2014,7 @@ void chk_sensor_los(const String& name, ConstMatrixView sensor_los) { ARTS_USER_ERROR_IF( sensor_los.nrows() == 0, "*", name, "* must have at least one row."); for (Index i = 0; i < sensor_los.nrows(); i++) { - ARTS_USER_ERROR_IF(sensor_los(i, 0) < 0 || sensor_los(i, 0) > 180, + ARTS_USER_ERROR_IF((sensor_los[i, 0] < 0 || sensor_los[i, 0] > 180), "Unvalid zenith angle in *", name, "*.\n", @@ -2024,8 +2024,8 @@ void chk_sensor_los(const String& name, ConstMatrixView sensor_los) { "(", i, ",0) is ", - sensor_los(i, 0)); - ARTS_USER_ERROR_IF(sensor_los(i, 1) < -180 || sensor_los(i, 1) > 180, + sensor_los[i, 0]); + ARTS_USER_ERROR_IF((sensor_los[i, 1] < -180 || sensor_los[i, 1] > 180), "Unvalid azimuth angle in *", name, "*.\n", @@ -2035,7 +2035,7 @@ void chk_sensor_los(const String& name, ConstMatrixView sensor_los) { "(", i, ",1) is ", - sensor_los(i, 1)); + sensor_los[i, 1]); } } @@ -2153,10 +2153,10 @@ void chk_met_mm_backend(const Matrix& mmb) { ARTS_USER_ERROR_IF(mmb.ncols() != 4, "*met_mm_backend* must have 4 columns."); for (Index ch = 0; ch < mmb.nrows(); ch++) { - Numeric lo = mmb(ch, 0); - Numeric offset1 = mmb(ch, 1); - Numeric offset2 = mmb(ch, 2); - Numeric bandwidth = mmb(ch, 3); + Numeric lo = mmb[ch, 0]; + Numeric offset1 = mmb[ch, 1]; + Numeric offset2 = mmb[ch, 2]; + Numeric bandwidth = mmb[ch, 3]; // Negative LO ARTS_USER_ERROR_IF(lo < 0., @@ -2166,7 +2166,7 @@ void chk_met_mm_backend(const Matrix& mmb) { ch, " in *met_mm_backend*.\n", "Center frequency is negative: ", - mmb(ch, 0), + mmb[ch, 0], " Hz") // Negative offsets diff --git a/src/core/cloudbox.cc b/src/core/cloudbox.cc index 974c3ec719..0f147614b9 100644 --- a/src/core/cloudbox.cc +++ b/src/core/cloudbox.cc @@ -94,7 +94,7 @@ void chk_pnd_field_raw_only_in_cloudbox( for (p_i = 0; p_i < pnd_field_raw[n].data.npages(); p_i++) { for (lat_i = 0; lat_i < pnd_field_raw[n].data.nrows(); lat_i++) { for (lon_i = 0; lon_i < pnd_field_raw[n].data.ncols(); lon_i++) { - v = pnd_field_raw[n].data(p_i, lat_i, lon_i); + v = pnd_field_raw[n].data[p_i, lat_i, lon_i]; if (v != 0) { // Verify pressure is between cloudbox limits p = pnd_field_raw[n].grid<0>()[p_i]; @@ -499,8 +499,8 @@ void chk_scat_species_field(bool& empty_flag, for (Index j = 0; j < scat_species_field.npages(); j++) { for (Index k = 0; k < scat_species_field.nrows(); k++) { for (Index l = 0; l < scat_species_field.ncols(); l++) { - if (scat_species_field(j, k, l) != 0.0 && - !std::isnan(scat_species_field(j, k, l))) + if (scat_species_field[j, k, l] != 0.0 && + !std::isnan(scat_species_field[j, k, l])) empty_flag = true; // if ( scat_species_field(j,k,l) != 0.0 ) empty_flag = true; } diff --git a/src/core/covariance_matrix.cc b/src/core/covariance_matrix.cc index 110f719b11..b8d505a9f3 100644 --- a/src/core/covariance_matrix.cc +++ b/src/core/covariance_matrix.cc @@ -105,10 +105,10 @@ std::array BlockMatrix::shape() const { void mult(MatrixView C, ConstMatrixView A, const Block &B) { ARTS_ASSERT(B.not_null()); - MatrixView CView(C(joker, B.get_column_range())); - MatrixView CTView(C(joker, B.get_row_range())); - ConstMatrixView AView(A(joker, B.get_row_range())); - ConstMatrixView ATView(A(joker, B.get_column_range())); + MatrixView CView(C[joker, B.get_column_range()]); + MatrixView CTView(C[joker, B.get_row_range()]); + ConstMatrixView AView(A[joker, B.get_row_range()]); + ConstMatrixView ATView(A[joker, B.get_column_range()]); Index i, j; std::tie(i, j) = B.get_indices(); @@ -135,10 +135,10 @@ void mult(MatrixView C, ConstMatrixView A, const Block &B) { void mult(MatrixView C, const Block &A, ConstMatrixView B) { ARTS_ASSERT(A.not_null()); - MatrixView CView(C(A.get_row_range(), joker)); - MatrixView CTView(C(A.get_column_range(), joker)); - ConstMatrixView BView(B(A.get_column_range(), joker)); - ConstMatrixView BTView(B(A.get_row_range(), joker)); + MatrixView CView(C[A.get_row_range(), joker]); + MatrixView CTView(C[A.get_column_range(), joker]); + ConstMatrixView BView(B[A.get_column_range(), joker]); + ConstMatrixView BTView(B[A.get_row_range(), joker]); if (A.is_dense()) { mult(CView, A.get_dense(), BView); @@ -185,8 +185,8 @@ void mult(VectorView w, const Block &A, ConstVectorView v) { } MatrixView operator+=(MatrixView A, const Block &B) { - MatrixView Aview(A(B.get_row_range(), B.get_column_range())); - MatrixView ATview(A(B.get_column_range(), B.get_row_range())); + MatrixView Aview(A[B.get_row_range(), B.get_column_range()]); + MatrixView ATview(A[B.get_column_range(), B.get_row_range()]); if (B.is_dense()) { Aview += B.get_dense(); } else { @@ -215,7 +215,7 @@ CovarianceMatrix::operator Matrix() const { A = 0.0; for (const Block &c : correlations_) { - MatrixView Aview = A(c.get_row_range(), c.get_column_range()); + MatrixView Aview = A[c.get_row_range(), c.get_column_range()]; if (c.is_dense()) { Aview = c.get_dense(); } else { @@ -225,7 +225,7 @@ CovarianceMatrix::operator Matrix() const { Index ci, cj; std::tie(ci, cj) = c.get_indices(); if (ci != cj) { - MatrixView ATview = A(c.get_column_range(), c.get_row_range()); + MatrixView ATview = A[c.get_column_range(), c.get_row_range()]; if (c.is_dense()) { ATview = transpose(c.get_dense()); } else { @@ -242,7 +242,7 @@ Matrix CovarianceMatrix::get_inverse() const { A = 0.0; for (const Block &c : inverses_) { - MatrixView Aview = A(c.get_row_range(), c.get_column_range()); + MatrixView Aview = A[c.get_row_range(), c.get_column_range()]; if (c.is_dense()) { Aview = c.get_dense(); } else { @@ -252,7 +252,7 @@ Matrix CovarianceMatrix::get_inverse() const { Index ci, cj; std::tie(ci, cj) = c.get_indices(); if (ci != cj) { - MatrixView ATview = A(c.get_column_range(), c.get_row_range()); + MatrixView ATview = A[c.get_column_range(), c.get_row_range()]; if (c.is_dense()) { ATview = transpose(c.get_dense()); } else { @@ -536,7 +536,7 @@ void CovarianceMatrix::invert_correlation_block( std::tie(ci, cj) = blocks[i]->get_indices(); Range row_range(block_start_cont[ci], block_extent_cont[ci]); Range column_range(block_start_cont[cj], block_extent_cont[cj]); - MatrixView A_view = A(row_range, column_range); + MatrixView A_view = A[row_range, column_range]; if (blocks[i]->is_dense()) { A_view = blocks[i]->get_dense(); @@ -547,7 +547,7 @@ void CovarianceMatrix::invert_correlation_block( for (Index i = 0; i < n; ++i) { for (Index j = i + 1; j < n; ++j) { - A(j, i) = A(i, j); + A[j, i] = A[i, j]; } } inv(A, A); @@ -575,7 +575,7 @@ void CovarianceMatrix::invert_correlation_block( Range column_range_A(block_start_cont[bj], block_extent_cont[bj]); Range row_range(block_start[bi], block_extent[bi]); Range column_range(block_start[bj], block_extent[bj]); - MatrixView A_view = A(row_range_A, column_range_A); + MatrixView A_view = A[row_range_A, column_range_A]; inverses.push_back(Block(row_range, column_range, std::make_pair(bi, bj), diff --git a/src/core/disort-cpp/disort-test-1.cpp b/src/core/disort-cpp/disort-test-1.cpp index 3f24d29e57..de945f94d9 100644 --- a/src/core/disort-cpp/disort-test-1.cpp +++ b/src/core/disort-cpp/disort-test-1.cpp @@ -7,7 +7,7 @@ void test_1a() { const Vector omega_arr{0.2}; const Index NQuad = 16; Matrix Leg_coeffs_all(1, 17, 0); - Leg_coeffs_all(0, 0) = 1; + Leg_coeffs_all[0, 0] = 1; const Numeric mu0 = 0.1; const Numeric I0 = Constant::pi / mu0; @@ -185,7 +185,7 @@ void test_1b() { const Vector omega_arr{1 - 1e-6}; const Index NQuad = 16; Matrix Leg_coeffs_all(1, 17, 0); - Leg_coeffs_all(0, 0) = 1; + Leg_coeffs_all[0, 0] = 1; const Numeric mu0 = 0.1; const Numeric I0 = Constant::pi / mu0; const Numeric phi0 = 0; @@ -360,7 +360,7 @@ void test_1c() { const Vector omega_arr{0.99}; const Index NQuad{16}; Matrix Leg_coeffs_all(1, 17, 0); - Leg_coeffs_all(0, 0) = 1; + Leg_coeffs_all[0, 0] = 1; const Numeric mu0 = 0.1; const Numeric I0 = Constant::pi / mu0; const Numeric phi0 = 0; @@ -537,7 +537,7 @@ void test_1d() { const Vector omega_arr{0.2}; const Index NQuad{16}; Matrix Leg_coeffs_all(1, 17, 0); - Leg_coeffs_all(0, 0) = 1; + Leg_coeffs_all[0, 0] = 1; const Numeric mu0 = 0.1; const Numeric I0 = Constant::pi / mu0; const Numeric phi0 = 0; @@ -714,7 +714,7 @@ void test_1e() { const Vector omega_arr{1 - 1e-6}; const Index NQuad{16}; Matrix Leg_coeffs_all(1, 17, 0); - Leg_coeffs_all(0, 0) = 1; + Leg_coeffs_all[0, 0] = 1; const Numeric mu0 = 0.1; const Numeric I0 = Constant::pi / mu0; const Numeric phi0 = 0; @@ -891,7 +891,7 @@ void test_1f() { const Vector omega_arr{0.99}; const Index NQuad{16}; Matrix Leg_coeffs_all(1, 17, 0); - Leg_coeffs_all(0, 0) = 1; + Leg_coeffs_all[0, 0] = 1; const Numeric mu0 = 0.1; const Numeric I0 = Constant::pi / mu0; const Numeric phi0 = 0; diff --git a/src/core/disort-cpp/disort-test-11.cpp b/src/core/disort-cpp/disort-test-11.cpp index bd9be17f17..1a574b3aef 100644 --- a/src/core/disort-cpp/disort-test-11.cpp +++ b/src/core/disort-cpp/disort-test-11.cpp @@ -31,7 +31,7 @@ void test_11a_1layer() try { disort::BDRF{[](auto c, auto&, auto&) { c = 1; }}}; const Matrix s_poly_coeffs{ Vector{172311.79936609, -102511.4417051}.reshape(tau_arr.nelem(), 2)}; - const Vector f_arr{Leg_coeffs_all(joker, NQuad)}; + const Vector f_arr{Leg_coeffs_all[joker, NQuad]}; // Optional (unused) const Index NLeg = NQuad; @@ -232,7 +232,7 @@ void test_11a_multilayer() try { disort::BDRF{[](auto c, auto&, auto&) { c = 1; }}}; Matrix s_poly_coeffs(tau_arr.size(), 2); for (auto&& v : s_poly_coeffs) v = {172311.79936609, -102511.4417051}; - const Vector f_arr{Leg_coeffs_all(joker, NQuad)}; + const Vector f_arr{Leg_coeffs_all[joker, NQuad]}; // Optional (unused) const Index NLeg = NQuad; diff --git a/src/core/disort-cpp/disort-test-2.cpp b/src/core/disort-cpp/disort-test-2.cpp index a2b9578017..e140dde244 100644 --- a/src/core/disort-cpp/disort-test-2.cpp +++ b/src/core/disort-cpp/disort-test-2.cpp @@ -5,8 +5,8 @@ void test_2a() { const Vector omega_arr{0.5}; const Index NQuad = 16; Matrix Leg_coeffs_all(1, 17, 0); - Leg_coeffs_all(0, 0) = 1; - Leg_coeffs_all(0, 2) = 0.1; + Leg_coeffs_all[0, 0] = 1; + Leg_coeffs_all[0, 2] = 0.1; const Numeric mu0 = 0.080442; const Numeric I0 = Constant::pi; @@ -185,8 +185,8 @@ void test_2b() { const Vector omega_arr{1 - 1e-6}; const Index NQuad = 16; Matrix Leg_coeffs_all(1, 17, 0); - Leg_coeffs_all(0, 0) = 1; - Leg_coeffs_all(0, 2) = 0.1; + Leg_coeffs_all[0, 0] = 1; + Leg_coeffs_all[0, 2] = 0.1; const Numeric mu0 = 0.080442; const Numeric I0 = Constant::pi; @@ -365,8 +365,8 @@ void test_2c() { const Vector omega_arr{0.5}; const Index NQuad = 16; Matrix Leg_coeffs_all(1, 17, 0); - Leg_coeffs_all(0, 0) = 1; - Leg_coeffs_all(0, 2) = 0.1; + Leg_coeffs_all[0, 0] = 1; + Leg_coeffs_all[0, 2] = 0.1; const Numeric mu0 = 0.080442; const Numeric I0 = Constant::pi; @@ -545,8 +545,8 @@ void test_2d() { const Vector omega_arr{1 - 1e-6}; const Index NQuad = 16; Matrix Leg_coeffs_all(1, 17, 0); - Leg_coeffs_all(0, 0) = 1; - Leg_coeffs_all(0, 2) = 0.1; + Leg_coeffs_all[0, 0] = 1; + Leg_coeffs_all[0, 2] = 0.1; const Numeric mu0 = 0.080442; const Numeric I0 = Constant::pi; diff --git a/src/core/disort-cpp/disort-test-3.cpp b/src/core/disort-cpp/disort-test-3.cpp index d7cc304d1d..73439181c9 100644 --- a/src/core/disort-cpp/disort-test-3.cpp +++ b/src/core/disort-cpp/disort-test-3.cpp @@ -6,7 +6,7 @@ void test_3a() try { const Index NQuad = 16; Matrix Leg_coeffs_all(1, 32, 1); for (Index i = 1; i < 32; i++) { - Leg_coeffs_all(0, i) = std::pow(0.75, i); + Leg_coeffs_all[0, i] = std::pow(0.75, i); } const Numeric mu0 = 1; @@ -18,7 +18,7 @@ void test_3a() try { const Index NFourier = NQuad; const Matrix b_pos(NQuad, NQuad / 2, 0); const Matrix b_neg(NQuad, NQuad / 2, 0); - const Vector f_arr{Leg_coeffs_all(0, NQuad)}; + const Vector f_arr{Leg_coeffs_all[0, NQuad]}; const std::vector BDRF_Fourier_modes{}; const Matrix s_poly_coeffs(1, 0); @@ -191,7 +191,7 @@ void test_3b() try { const Index NQuad = 16; Matrix Leg_coeffs_all(1, 32, 1); for (Index i = 1; i < 32; i++) { - Leg_coeffs_all(0, i) = std::pow(0.75, i); + Leg_coeffs_all[0, i] = std::pow(0.75, i); } const Numeric mu0 = 1; @@ -203,7 +203,7 @@ void test_3b() try { const Index NFourier = NQuad; const Matrix b_pos(NQuad, NQuad / 2, 0); const Matrix b_neg(NQuad, NQuad / 2, 0); - const Vector f_arr{Leg_coeffs_all(0, NQuad)}; + const Vector f_arr{Leg_coeffs_all[0, NQuad]}; const std::vector BDRF_Fourier_modes{}; const Matrix s_poly_coeffs(1, 0); diff --git a/src/core/disort-cpp/disort-test-4.cpp b/src/core/disort-cpp/disort-test-4.cpp index 4c94268450..2d4548425d 100644 --- a/src/core/disort-cpp/disort-test-4.cpp +++ b/src/core/disort-cpp/disort-test-4.cpp @@ -19,7 +19,7 @@ void test_4a() try { const Index NQuad = 32; Matrix Leg_coeffs_all(1, Leg_coeffs_ALL.nelem(), 1); for (Index i = 1; i < Leg_coeffs_ALL.nelem(); i++) { - Leg_coeffs_all(0, i) = + Leg_coeffs_all[0, i] = Leg_coeffs_ALL[i] / (static_cast(2 * i + 1)); } @@ -32,7 +32,7 @@ void test_4a() try { const Index NFourier = NQuad; const Matrix b_pos(NQuad, NQuad / 2, 0); const Matrix b_neg(NQuad, NQuad / 2, 0); - const Vector f_arr{Leg_coeffs_all(0, NQuad)}; + const Vector f_arr{Leg_coeffs_all[0, NQuad]}; const std::vector BDRF_Fourier_modes{}; const Matrix s_poly_coeffs(1, 0); @@ -301,7 +301,7 @@ void test_4b() try { const Index NQuad = 32; Matrix Leg_coeffs_all(1, Leg_coeffs_ALL.nelem(), 1); for (Index i = 1; i < Leg_coeffs_ALL.nelem(); i++) { - Leg_coeffs_all(0, i) = + Leg_coeffs_all[0, i] = Leg_coeffs_ALL[i] / (static_cast(2 * i + 1)); } @@ -314,7 +314,7 @@ void test_4b() try { const Index NFourier = NQuad; const Matrix b_pos(NQuad, NQuad / 2, 0); const Matrix b_neg(NQuad, NQuad / 2, 0); - const Vector f_arr{Leg_coeffs_all(0, NQuad)}; + const Vector f_arr{Leg_coeffs_all[0, NQuad]}; const std::vector BDRF_Fourier_modes{}; const Matrix s_poly_coeffs(1, 0); @@ -583,7 +583,7 @@ void test_4c() try { const Index NQuad = 32; Matrix Leg_coeffs_all(1, Leg_coeffs_ALL.nelem(), 1); for (Index i = 1; i < Leg_coeffs_ALL.nelem(); i++) { - Leg_coeffs_all(0, i) = + Leg_coeffs_all[0, i] = Leg_coeffs_ALL[i] / (static_cast(2 * i + 1)); } @@ -596,7 +596,7 @@ void test_4c() try { const Index NFourier = NQuad; const Matrix b_pos(NQuad, NQuad / 2, 0); const Matrix b_neg(NQuad, NQuad / 2, 0); - const Vector f_arr{Leg_coeffs_all(0, NQuad)}; + const Vector f_arr{Leg_coeffs_all[0, NQuad]}; const std::vector BDRF_Fourier_modes{}; const Matrix s_poly_coeffs(1, 0); diff --git a/src/core/disort-cpp/disort-test-5.cpp b/src/core/disort-cpp/disort-test-5.cpp index 2eb008de69..313b5d8bc5 100644 --- a/src/core/disort-cpp/disort-test-5.cpp +++ b/src/core/disort-cpp/disort-test-5.cpp @@ -44,7 +44,7 @@ void test_5a() try { const Index NQuad = 48; Matrix Leg_coeffs_all(1, Leg_coeffs_ALL.nelem(), 1); for (Index i = 1; i < Leg_coeffs_ALL.nelem(); i++) { - Leg_coeffs_all(0, i) = + Leg_coeffs_all[0, i] = Leg_coeffs_ALL[i] / (static_cast(2 * i + 1)); } @@ -57,7 +57,7 @@ void test_5a() try { const Index NFourier = NQuad; const Matrix b_pos(NQuad, NQuad / 2, 0); const Matrix b_neg(NQuad, NQuad / 2, 0); - const Vector f_arr{Leg_coeffs_all(0, NQuad)}; + const Vector f_arr{Leg_coeffs_all[0, NQuad]}; const std::vector BDRF_Fourier_modes{}; const Matrix s_poly_coeffs(1, 0); @@ -422,7 +422,7 @@ void test_5b() try { const Index NQuad = 48; Matrix Leg_coeffs_all(1, Leg_coeffs_ALL.nelem(), 1); for (Index i = 1; i < Leg_coeffs_ALL.nelem(); i++) { - Leg_coeffs_all(0, i) = + Leg_coeffs_all[0, i] = Leg_coeffs_ALL[i] / (static_cast(2 * i + 1)); } @@ -435,7 +435,7 @@ void test_5b() try { const Index NFourier = NQuad; const Matrix b_pos(NQuad, NQuad / 2, 0); const Matrix b_neg(NQuad, NQuad / 2, 0); - const Vector f_arr{Leg_coeffs_all(0, NQuad)}; + const Vector f_arr{Leg_coeffs_all[0, NQuad]}; const std::vector BDRF_Fourier_modes{}; const Matrix s_poly_coeffs(1, 0); @@ -800,7 +800,7 @@ void test_5BDRF() try { const Index NQuad = 48; Matrix Leg_coeffs_all(1, Leg_coeffs_ALL.nelem(), 1); for (Index i = 1; i < Leg_coeffs_ALL.nelem(); i++) { - Leg_coeffs_all(0, i) = + Leg_coeffs_all[0, i] = Leg_coeffs_ALL[i] / (static_cast(2 * i + 1)); } @@ -815,7 +815,7 @@ void test_5BDRF() try { const Index NFourier = NQuad; const Matrix b_pos(NQuad, NQuad / 2, 0); const Matrix b_neg(NQuad, NQuad / 2, 0); - const Vector f_arr{Leg_coeffs_all(0, NQuad)}; + const Vector f_arr{Leg_coeffs_all[0, NQuad]}; const Matrix s_poly_coeffs(1, 0); const disort::main_data dis(NQuad, diff --git a/src/core/disort-cpp/disort-test-8.cpp b/src/core/disort-cpp/disort-test-8.cpp index 82fc56b8cd..223dc5c24c 100644 --- a/src/core/disort-cpp/disort-test-8.cpp +++ b/src/core/disort-cpp/disort-test-8.cpp @@ -7,7 +7,7 @@ void test_8a() try { const Vector omega_arr{0.5, 0.3}; const Index NQuad = 8; Matrix Leg_coeffs_all(2, 9, 0); - Leg_coeffs_all(joker, 0) = 1; + Leg_coeffs_all[joker, 0] = 1; const Numeric mu0 = 0; const Numeric I0 = 0; @@ -139,7 +139,7 @@ void test_8b() try { const Vector omega_arr{0.8, 0.95}; const Index NQuad = 8; Matrix Leg_coeffs_all(2, 9, 0); - Leg_coeffs_all(joker, 0) = 1; + Leg_coeffs_all[joker, 0] = 1; const Numeric mu0 = 0; const Numeric I0 = 0; @@ -275,7 +275,7 @@ void test_8c() try { const Vector omega_arr{0.8, 0.95}; const Index NQuad = 8; Matrix Leg_coeffs_all(2, 9, 0); - Leg_coeffs_all(joker, 0) = 1; + Leg_coeffs_all[joker, 0] = 1; const Numeric mu0 = 0; const Numeric I0 = 0; diff --git a/src/core/disort-cpp/disort-test-9.cpp b/src/core/disort-cpp/disort-test-9.cpp index ed4298df4a..edd77f20cc 100644 --- a/src/core/disort-cpp/disort-test-9.cpp +++ b/src/core/disort-cpp/disort-test-9.cpp @@ -5,7 +5,7 @@ void test_9a() try { const Vector omega_arr{0.65, 0.7, 0.75, 0.8, 0.85, 0.9}; const Index NQuad = 8; Matrix Leg_coeffs_all(6, 9, 0); - Leg_coeffs_all(joker, 0) = 1; + Leg_coeffs_all[joker, 0] = 1; const Numeric mu0 = 0; const Numeric I0 = 0; diff --git a/src/core/disort-cpp/disort-test.h b/src/core/disort-cpp/disort-test.h index e4c9be013d..74bd9a88e8 100644 --- a/src/core/disort-cpp/disort-test.h +++ b/src/core/disort-cpp/disort-test.h @@ -44,7 +44,7 @@ inline Tensor3 compute_u(const disort::main_data& dis, } else { dis.u(u_data, taus[j], phis[i]); } - u(i, j, joker) = u_data.intensities; + u[i, j, joker] = u_data.intensities; } } return u; diff --git a/src/core/disort-cpp/disort.cpp b/src/core/disort-cpp/disort.cpp index 9bd98b33cb..bb7d08c8cf 100644 --- a/src/core/disort-cpp/disort.cpp +++ b/src/core/disort-cpp/disort.cpp @@ -178,16 +178,16 @@ void main_data::solve_for_coefs() { for (Index l = 0; l < ln; l++) { const Numeric scl = std::exp(-mu0 * scaled_tau_arr_with_0[l + 1]); for (Index j = 0; j < NQuad; j++) { - RHS_middle(j, l) += - (B_collect_m(l + 1, j) - B_collect_m(l, j)) * scl; + RHS_middle[j, l] += + (B_collect_m[l + 1, j] - B_collect_m[l, j]) * scl; } } } for (Index i = 0; i < N; i++) { - RHS[i] += b_neg_m[i] - B_collect_m(0, N + i); + RHS[i] += b_neg_m[i] - B_collect_m[0, N + i]; RHS[n - N + i] += - b_pos_m[i] + (BDRF_RHS_contribution[i] - B_collect_m(ln, i)) * + b_pos_m[i] + (BDRF_RHS_contribution[i] - B_collect_m[ln, i]) * std::exp(-scaled_tau_arr_with_0.back() / mu0); } } else { @@ -200,7 +200,7 @@ void main_data::solve_for_coefs() { { for (Index i = 0; i < N; i++) { E_Lm1L[i] = - std::exp(K_collect_m(ln, i) * (scaled_tau_arr_with_0[NLayers] - + std::exp(K_collect_m[ln, i] * (scaled_tau_arr_with_0[NLayers] - scaled_tau_arr_with_0[NLayers - 1])); } @@ -212,46 +212,46 @@ void main_data::solve_for_coefs() { for (Index i = 0; i < N; i++) { for (Index j = 0; j < N; j++) { - LHSB(i, j) = G_collect_m(0, i + N, j); - LHSB(i, N + j) = - G_collect_m(0, i + N, j + N) * - std::exp(K_collect_m(0, j) * scaled_tau_arr_with_0[1]); - LHSB(n - N + i, n - 2 * N + j) = - (G_collect_m(ln, i, j) - BDRF_LHS(i, j)) * E_Lm1L[j]; - LHSB(n - N + i, n - N + j) = - G_collect_m(ln, i, j + N) - BDRF_LHS(i, j + N); + LHSB[i, j] = G_collect_m[0, i + N, j]; + LHSB[i, N + j] = + G_collect_m[0, i + N, j + N] * + std::exp(K_collect_m[0, j] * scaled_tau_arr_with_0[1]); + LHSB[n - N + i, n - 2 * N + j] = + (G_collect_m[ln, i, j] - BDRF_LHS[i, j]) * E_Lm1L[j]; + LHSB[n - N + i, n - N + j] = + G_collect_m[ln, i, j + N] - BDRF_LHS[i, j + N]; } } for (Index l = 0; l < ln; l++) { for (Index i = 0; i < N; i++) { E_lm1l[i] = - std::exp(K_collect_m(l, i + N) * (scaled_tau_arr_with_0[l] - + std::exp(K_collect_m[l, i + N] * (scaled_tau_arr_with_0[l] - scaled_tau_arr_with_0[l + 1])); E_llp1[i] = std::exp( - K_collect_m(l + 1, i + N) * + K_collect_m[l + 1, i + N] * (scaled_tau_arr_with_0[l + 1] - scaled_tau_arr_with_0[l + 2])); } for (Index i = 0; i < N; i++) { for (Index j = 0; j < N; j++) { - LHSB(N + l * NQuad + i, l * NQuad + j) = - G_collect_m(l, i, j) * E_lm1l[j]; - LHSB(2 * N + l * NQuad + i, l * NQuad + j) = - G_collect_m(l, N + i, j) * E_lm1l[j]; - LHSB(N + l * NQuad + i, l * NQuad + 2 * NQuad - N + j) = - -G_collect_m(l + 1, i, N + j) * E_llp1[j]; - LHSB(2 * N + l * NQuad + i, l * NQuad + 2 * NQuad - N + j) = - -1 * G_collect_m(l + 1, N + i, N + j) * E_llp1[j]; + LHSB[N + l * NQuad + i, l * NQuad + j] = + G_collect_m[l, i, j] * E_lm1l[j]; + LHSB[2 * N + l * NQuad + i, l * NQuad + j] = + G_collect_m[l, N + i, j] * E_lm1l[j]; + LHSB[N + l * NQuad + i, l * NQuad + 2 * NQuad - N + j] = + -G_collect_m[l + 1, i, N + j] * E_llp1[j]; + LHSB[2 * N + l * NQuad + i, l * NQuad + 2 * NQuad - N + j] = + -1 * G_collect_m[l + 1, N + i, N + j] * E_llp1[j]; } } for (Index i = 0; i < NQuad; i++) { for (Index j = 0; j < N; j++) { - LHSB(N + l * NQuad + i, l * NQuad + N + j) = - G_collect_m(l, i, N + j); - LHSB(N + l * NQuad + i, l * NQuad + 2 * N + j) = - -G_collect_m(l + 1, i, j); + LHSB[N + l * NQuad + i, l * NQuad + N + j] = + G_collect_m[l, i, N + j]; + LHSB[N + l * NQuad + i, l * NQuad + 2 * N + j] = + -G_collect_m[l + 1, i, j]; } } } @@ -293,9 +293,9 @@ void main_data::diagonalize() { for (Index i = m; i < NLeg; i++) { for (Index j = 0; j < N; j++) { - asso_leg_term_pos(i - m, j) = Legendre::assoc_legendre(i, m, mu_arr[j]); - asso_leg_term_neg(i - m, j) = - asso_leg_term_pos(i - m, j) * ((i - m) % 2 ? -1.0 : 1.0); + asso_leg_term_pos[i - m, j] = Legendre::assoc_legendre(i, m, mu_arr[j]); + asso_leg_term_neg[i - m, j] = + asso_leg_term_pos[i - m, j] * ((i - m) % 2 ? -1.0 : 1.0); } asso_leg_term_mu0[i - m] = Legendre::assoc_legendre(i, m, -mu0); } @@ -311,7 +311,7 @@ void main_data::diagonalize() { for (Index i = 0; i < NLeg - m; i++) { weighted_asso_Leg_coeffs_l[i] = - weighted_scaled_Leg_coeffs(l, i + m) * fac[i]; + weighted_scaled_Leg_coeffs[l, i + m] * fac[i]; } const Numeric scaled_omega_l = scaled_omega_arr[l]; @@ -351,7 +351,7 @@ void main_data::diagonalize() { mult(GmG, apb, G.slice(0, N)); for (Index j = 0; j < NQuad; j++) { - GmG(joker, j) /= K[j]; + GmG[joker, j] /= K[j]; } G.slice(N, N) = G.slice(0, N); G.slice(0, N) -= GmG; @@ -382,8 +382,8 @@ void main_data::diagonalize() { } } else { for (Index i = 0; i < N; i++) { - G(i + N, i) = 1; - G(i, i + N) = 1; + G[i + N, i] = 1; + G[i, i + N] = 1; K[i] = -inv_mu_arr[i]; K[i + N] = inv_mu_arr[i]; } @@ -425,7 +425,7 @@ void main_data::set_ims_factors() { } } else { for (Index j = 0; j < NLayers; j++) { - sum3 += Leg_coeffs_all(j, i) * omega_arr[j] * tau_arr[j]; + sum3 += Leg_coeffs_all[j, i] * omega_arr[j] * tau_arr[j]; } } } @@ -460,8 +460,8 @@ void main_data::set_scales() { for (Index i = 0; i < NLayers; i++) { for (Index j = 0; j < NLeg; j++) { - weighted_scaled_Leg_coeffs(i, j) = static_cast(2 * j + 1) * - (Leg_coeffs_all(i, j) - f_arr[i]) / + weighted_scaled_Leg_coeffs[i, j] = static_cast(2 * j + 1) * + (Leg_coeffs_all[i, j] - f_arr[i]) / (1 - f_arr[i]); } } @@ -474,8 +474,8 @@ void main_data::set_scales() { void main_data::set_weighted_Leg_coeffs_all() { for (Index j = 0; j < NLayers; j++) { for (Index i = 0; i < NLeg_all; i++) { - weighted_Leg_coeffs_all(joker, i) = - static_cast(2 * i + 1) * Leg_coeffs_all(j, i); + weighted_Leg_coeffs_all[joker, i] = + static_cast(2 * i + 1) * Leg_coeffs_all[j, i]; } } } @@ -788,10 +788,10 @@ void main_data::u(u_data& data, const Numeric tau, const Numeric phi) const { data.exponent.resize(NFourier, NQuad); for (Index i = 0; i < NFourier; i++) { for (Index j = 0; j < N; j++) { - data.exponent(i, j) = - std::exp(K_collect(i, l, j) * (scaled_tau - scaled_tau_arr_lm1)); - data.exponent(i, j + N) = - std::exp(K_collect(i, l, j + N) * (scaled_tau - scaled_tau_arr_l)); + data.exponent[i, j] = + std::exp(K_collect[i, l, j] * (scaled_tau - scaled_tau_arr_lm1)); + data.exponent[i, j + N] = + std::exp(K_collect[i, l, j + N] * (scaled_tau - scaled_tau_arr_l)); } } @@ -800,12 +800,12 @@ void main_data::u(u_data& data, const Numeric tau, const Numeric phi) const { matpack::einsum_optpath<"mi", "mij", "mj">(), "On Failure, the einsum has been changed to not use optimal path"); einsum<"mi", "mij", "mj">( - data.um, GC_collect(joker, l, joker, joker), data.exponent); + data.um, GC_collect[joker, l, joker, joker], data.exponent); if (has_beam_source) { for (Index m = 0; m < NFourier; m++) { for (Index i = 0; i < NQuad; i++) { - data.um(m, i) += std::exp(-scaled_tau / mu0) * B_collect(m, l, i); + data.um[m, i] += std::exp(-scaled_tau / mu0) * B_collect[m, l, i]; } } } @@ -850,9 +850,9 @@ void main_data::u0(u0_data& data, const Numeric tau) const { data.exponent.resize(NQuad); for (Index j = 0; j < N; j++) { data.exponent[j] = - std::exp(K_collect(0, l, j) * (scaled_tau - scaled_tau_arr_lm1)); + std::exp(K_collect[0, l, j] * (scaled_tau - scaled_tau_arr_lm1)); data.exponent[j + N] = - std::exp(K_collect(0, l, j + N) * (scaled_tau - scaled_tau_arr_l)); + std::exp(K_collect[0, l, j + N] * (scaled_tau - scaled_tau_arr_l)); } data.u0.resize(NQuad); @@ -869,10 +869,10 @@ void main_data::u0(u0_data& data, const Numeric tau) const { data.u0 = 0.0; } - mult(data.u0, GC_collect(0, l, joker, joker), data.exponent, 1.0, 1.0); + mult(data.u0, GC_collect[0, l, joker, joker], data.exponent, 1.0, 1.0); if (has_beam_source) { - const auto tmp = B_collect(0, l, joker); + const auto tmp = B_collect[0, l, joker]; std::transform(tmp.elem_begin(), tmp.elem_end(), data.u0.elem_begin(), @@ -930,7 +930,7 @@ void main_data::TMS(tms_data& data, Legendre::legendre_sum(weighted_Leg_coeffs_all[j], data.nu[i]); const Numeric p_trun = Legendre::legendre_sum(weighted_scaled_Leg_coeffs[j], data.nu[i]); - data.mathscr_B(j, i) = (scaled_omega_arr[j] * I0) / (4 * Constant::pi) * + data.mathscr_B[j, i] = (scaled_omega_arr[j] * I0) / (4 * Constant::pi) * (mu0 / (mu0 + mu_arr[i])) * (p_true / (1.0 - f_arr[j]) - p_trun); } @@ -957,8 +957,8 @@ void main_data::TMS(tms_data& data, if (l > i) { // neg for (Index j = 0; j < N; j++) { - data.contribution_from_other_layers_neg(j, i) = - (data.mathscr_B(i, j + N) * + data.contribution_from_other_layers_neg[j, i] = + (data.mathscr_B[i, j + N] * (std::exp((scaled_tau_arr_with_0[i] - scaled_tau) / mu_arr[j] - scaled_tau_arr_with_0[i] / mu0) - std::exp((scaled_tau_arr_with_0[i] - scaled_tau) / mu_arr[j] - @@ -967,8 +967,8 @@ void main_data::TMS(tms_data& data, } else if (l < i) { // pos for (Index j = 0; j < N; j++) { - data.contribution_from_other_layers_pos(j, i) = - (data.mathscr_B(i, j) * + data.contribution_from_other_layers_pos[j, i] = + (data.mathscr_B[i, j] * (std::exp((scaled_tau - scaled_tau_arr_with_0[i]) / mu_arr[j] - scaled_tau_arr_with_0[i] / mu0) - std::exp((scaled_tau - scaled_tau_arr_with_0[i]) / mu_arr[j] - @@ -1051,20 +1051,20 @@ Numeric main_data::flux_up(flux_data& data, const Numeric tau) const { if (has_beam_source) { for (Index i = 0; i < N; i++) { - data.u0_pos[i] += B_collect(0, l, i) * std::exp(-scaled_tau / mu0); + data.u0_pos[i] += B_collect[0, l, i] * std::exp(-scaled_tau / mu0); } } data.exponent.resize(NQuad); for (Index i = 0; i < N; i++) { data.exponent[i] = - std::exp(K_collect(0, l, i) * (scaled_tau - scaled_tau_arr_lm1)); + std::exp(K_collect[0, l, i] * (scaled_tau - scaled_tau_arr_lm1)); data.exponent[i + N] = - std::exp(K_collect(0, l, i + N) * (scaled_tau - scaled_tau_arr_l)); + std::exp(K_collect[0, l, i + N] * (scaled_tau - scaled_tau_arr_l)); } mult(data.u0_pos, - GC_collect(0, l, Range(0, N), joker), + GC_collect[0, l, Range(0, N), joker], data.exponent, 1.0, 1.0); @@ -1110,20 +1110,20 @@ std::pair main_data::flux_down(flux_data& data, has_beam_source ? I0 * mu0 * std::exp(-scaled_tau / mu0) : 0; if (has_beam_source) { for (Index i = 0; i < N; i++) { - data.u0_neg[i] += B_collect(0, l, i + N) * std::exp(-scaled_tau / mu0); + data.u0_neg[i] += B_collect[0, l, i + N] * std::exp(-scaled_tau / mu0); } } data.exponent.resize(NQuad); for (Index i = 0; i < N; i++) { data.exponent[i] = - std::exp(K_collect(0, l, i) * (scaled_tau - scaled_tau_arr_lm1)); + std::exp(K_collect[0, l, i] * (scaled_tau - scaled_tau_arr_lm1)); data.exponent[i + N] = - std::exp(K_collect(0, l, i + N) * (scaled_tau - scaled_tau_arr_l)); + std::exp(K_collect[0, l, i + N] * (scaled_tau - scaled_tau_arr_l)); } mult(data.u0_neg, - GC_collect(0, l, Range(N, N), joker), + GC_collect[0, l, Range(N, N), joker], data.exponent, 1.0, 1.0); @@ -1164,16 +1164,16 @@ void main_data::gridded_flux(ExhaustiveVectorView flux_up, has_beam_source ? I0 * mu0 * std::exp(-scaled_tau_arr_l / mu0) : 0; if (has_beam_source) { for (Index i = 0; i < NQuad; i++) { - u0[i] += B_collect(0, l, i) * std::exp(-scaled_tau_arr_l / mu0); + u0[i] += B_collect[0, l, i] * std::exp(-scaled_tau_arr_l / mu0); } } for (Index i = 0; i < N; i++) { - exponent[i] = std::exp(K_collect(0, l, i) * + exponent[i] = std::exp(K_collect[0, l, i] * (scaled_tau_arr_l - scaled_tau_arr_lm1)); } - mult(u0, GC_collect(0, l, joker, joker), exponent, 1.0, 1.0); + mult(u0, GC_collect[0, l, joker, joker], exponent, 1.0, 1.0); flux_up[l] = Constant::two_pi * I0_orig * einsum( @@ -1196,7 +1196,7 @@ void main_data::gridded_u(ExhaustiveTensor3View out, const Vector& phi) const { Matrix cp(Nphi, NFourier); for (Index p = 0; p < phi.size(); p++) { for (Index m = 0; m < NFourier; m++) { - cp(p, m) = I0_orig * std::cos(static_cast(m) * (phi0 - phi[p])); + cp[p, m] = I0_orig * std::cos(static_cast(m) * (phi0 - phi[p])); } } @@ -1206,7 +1206,7 @@ void main_data::gridded_u(ExhaustiveTensor3View out, const Vector& phi) const { for (Index i = 0; i < NFourier; i++) { for (Index j = 0; j < N; j++) { - exponent(i, j) = std::exp(K_collect(i, l, j) * + exponent[i, j] = std::exp(K_collect[i, l, j] * (scaled_tau_arr_l - scaled_tau_arr_lm1)); } } @@ -1214,12 +1214,12 @@ void main_data::gridded_u(ExhaustiveTensor3View out, const Vector& phi) const { static_assert( matpack::einsum_optpath<"mi", "mij", "mj">(), "On Failure, the einsum has been changed to not use optimal path"); - einsum<"mi", "mij", "mj">(um, GC_collect(joker, l, joker, joker), exponent); + einsum<"mi", "mij", "mj">(um, GC_collect[joker, l, joker, joker], exponent); if (has_beam_source) { for (Index m = 0; m < NFourier; m++) { for (Index i = 0; i < NQuad; i++) { - um(m, i) += std::exp(-scaled_tau_arr_l / mu0) * B_collect(m, l, i); + um[m, i] += std::exp(-scaled_tau_arr_l / mu0) * B_collect[m, l, i]; } } } @@ -1286,18 +1286,18 @@ void main_data::ungridded_flux(ExhaustiveVectorView flux_up, has_beam_source ? I0 * mu0 * std::exp(-scaled_tau / mu0) : 0; if (has_beam_source) { for (Index i = 0; i < NQuad; i++) { - u0[i] += B_collect(0, l, i) * std::exp(-scaled_tau / mu0); + u0[i] += B_collect[0, l, i] * std::exp(-scaled_tau / mu0); } } for (Index i = 0; i < N; i++) { exponent[i] = - std::exp(K_collect(0, l, i) * (scaled_tau - scaled_tau_arr_lm1)); + std::exp(K_collect[0, l, i] * (scaled_tau - scaled_tau_arr_lm1)); exponent[i + N] = - std::exp(K_collect(0, l, i + N) * (scaled_tau - scaled_tau_arr_l)); + std::exp(K_collect[0, l, i + N] * (scaled_tau - scaled_tau_arr_l)); } - mult(u0, GC_collect(0, l, joker, joker), exponent, 1.0, 1.0); + mult(u0, GC_collect[0, l, joker, joker], exponent, 1.0, 1.0); flux_up[il] = Constant::two_pi * I0_orig * einsum( @@ -1329,7 +1329,7 @@ void main_data::ungridded_u(ExhaustiveTensor3View out, Matrix cp(Nphi, NFourier); for (Index p = 0; p < phi.size(); p++) { for (Index m = 0; m < NFourier; m++) { - cp(p, m) = I0_orig * std::cos(static_cast(m) * (phi0 - phi[p])); + cp[p, m] = I0_orig * std::cos(static_cast(m) * (phi0 - phi[p])); } } @@ -1344,22 +1344,22 @@ void main_data::ungridded_u(ExhaustiveTensor3View out, for (Index i = 0; i < NFourier; i++) { for (Index j = 0; j < N; j++) { - exponent(i, j) = - std::exp(K_collect(i, l, j) * (scaled_tau - scaled_tau_arr_lm1)); - exponent(i, j + N) = - std::exp(K_collect(i, l, j + N) * (scaled_tau - scaled_tau_arr_l)); + exponent[i, j] = + std::exp(K_collect[i, l, j] * (scaled_tau - scaled_tau_arr_lm1)); + exponent[i, j + N] = + std::exp(K_collect[i, l, j + N] * (scaled_tau - scaled_tau_arr_l)); } } static_assert( matpack::einsum_optpath<"mi", "mij", "mj">(), "On Failure, the einsum has been changed to not use optimal path"); - einsum<"mi", "mij", "mj">(um, GC_collect(joker, l, joker, joker), exponent); + einsum<"mi", "mij", "mj">(um, GC_collect[joker, l, joker, joker], exponent); if (has_beam_source) { for (Index m = 0; m < NFourier; m++) { for (Index i = 0; i < NQuad; i++) { - um(m, i) += std::exp(-scaled_tau / mu0) * B_collect(m, l, i); + um[m, i] += std::exp(-scaled_tau / mu0) * B_collect[m, l, i]; } } } @@ -1471,7 +1471,7 @@ disort::main_data& DisortSettings::set(disort::main_data& dis, Index iv) const i < bidirectional_reflectance_distribution_functions.ncols(); i++) { dis.brdf_modes()[i] = - bidirectional_reflectance_distribution_functions(iv, i); + bidirectional_reflectance_distribution_functions[iv, i]; } dis.solar_zenith() = cosd(solar_zenith_angle[iv]); diff --git a/src/core/disort-cpp/test-old-impl.cpp b/src/core/disort-cpp/test-old-impl.cpp index 3c4ab1e015..fd9ff08a97 100644 --- a/src/core/disort-cpp/test-old-impl.cpp +++ b/src/core/disort-cpp/test-old-impl.cpp @@ -233,7 +233,7 @@ void test_flat() try { disort::BDRF{[](auto c, auto&, auto&) { c = 1; }}}; Matrix s_poly_coeffs(tau_arr.size(), 2); for (auto&& v : s_poly_coeffs) v = {172311.79936609, -102511.4417051}; - const Vector f_arr{Leg_coeffs_all(joker, NQuad_)}; + const Vector f_arr{Leg_coeffs_all[joker, NQuad_]}; // Optional (unused) const Index NLeg = NQuad_; @@ -265,7 +265,7 @@ void test_flat() try { for (Index i = 0; i < NLayers_; i++) { for (Index j = 0; j < NP; j++) { dis.u(data_u, tau_arr[i], phi[j]); - u1(i, j, joker) = data_u.intensities; + u1[i, j, joker] = data_u.intensities; } } } diff --git a/src/core/fwd/fwd_spectral_radiance.cpp b/src/core/fwd/fwd_spectral_radiance.cpp index dabae6673c..21daff0842 100644 --- a/src/core/fwd/fwd_spectral_radiance.cpp +++ b/src/core/fwd/fwd_spectral_radiance.cpp @@ -22,7 +22,7 @@ Stokvec spectral_radiance::B( for (const auto& p : pos) { if (p.w == 0.0) continue; - out += p.w * planck(f, atm(p.i, p.j, p.k)->temperature); + out += p.w * planck(f, atm[p.i, p.j, p.k]->temperature); } return {out, 0.0, 0.0, 0.0}; @@ -37,12 +37,12 @@ Stokvec spectral_radiance::Iback( if (pp.point.los_type == PathPositionType::space) { for (const auto& p : pos) { if (p.w == 0.0) continue; - out += p.w * spectral_radiance_space(p.j, p.k)(f, pp.point.los); + out += p.w * spectral_radiance_space[p.j, p.k](f, pp.point.los); } } else if (pp.point.los_type == PathPositionType::surface) { for (const auto& p : pos) { if (p.w == 0.0) continue; - out += p.w * spectral_radiance_surface(p.j, p.k)(f, pp.point.los); + out += p.w * spectral_radiance_surface[p.j, p.k](f, pp.point.los); } } @@ -58,7 +58,7 @@ std::pair spectral_radiance::PM( for (const auto& p : pos) { if (p.w == 0.0) continue; - const auto [propmat, stokvec] = pm(p.i, p.j, p.k)(f, pp.point.los); + const auto [propmat, stokvec] = pm[p.i, p.j, p.k](f, pp.point.los); out.first += p.w * propmat; out.second += p.w * stokvec; } @@ -115,7 +115,7 @@ spectral_radiance::spectral_radiance( if (arts_omp_in_parallel() or arts_omp_get_max_threads() == 1) { for (Index j = 0; j < lat.size(); j++) { for (Index k = 0; k < lon.size(); k++) { - spectral_radiance_surface(j, j) = [surf = surf.at(lat[j], lon[k])]( + spectral_radiance_surface[j, j] = [surf = surf.at(lat[j], lon[k])]( Numeric f, Vector2) -> Stokvec { return planck(f, surf.temperature); }; @@ -125,10 +125,10 @@ spectral_radiance::spectral_radiance( for (Index i = 0; i < alt.size(); i++) { for (Index j = 0; j < lat.size(); j++) { for (Index k = 0; k < lon.size(); k++) { - atm(i, j, k) = + atm[i, j, k] = std::make_shared(atm_.at(alt[i], lat[j], lon[k])); - pm(i, j, k) = propmat( - atm(i, j, k), lines, cia, xsec, predef, ciaextrap, ciarobust); + pm[i, j, k] = propmat( + atm[i, j, k], lines, cia, xsec, predef, ciaextrap, ciarobust); } } } @@ -139,7 +139,7 @@ spectral_radiance::spectral_radiance( for (Index j = 0; j < lat.size(); j++) { for (Index k = 0; k < lon.size(); k++) { try { - spectral_radiance_surface(j, j) = [surf = surf.at(lat[j], lon[k])]( + spectral_radiance_surface[j, j] = [surf = surf.at(lat[j], lon[k])]( Numeric f, Vector2) -> Stokvec { return planck(f, surf.temperature); }; @@ -155,10 +155,10 @@ spectral_radiance::spectral_radiance( for (Index j = 0; j < lat.size(); j++) { for (Index k = 0; k < lon.size(); k++) { try { - atm(i, j, k) = + atm[i, j, k] = std::make_shared(atm_.at(alt[i], lat[j], lon[k])); - pm(i, j, k) = propmat( - atm(i, j, k), lines, cia, xsec, predef, ciaextrap, ciarobust); + pm[i, j, k] = propmat( + atm[i, j, k], lines, cia, xsec, predef, ciaextrap, ciarobust); } catch (const std::exception& e) { #pragma omp critical errors += e.what(); @@ -201,7 +201,7 @@ Stokvec spectral_radiance::operator()(const Numeric f, const Stokvec Ji = inv(Ki) * Ni + B(f, pos); const Muelmat Ti = T * exp(avg(Ki, K), pp.distance); - if (Ti(0, 0) < cutoff_transmission) { + if (Ti[0, 0] < cutoff_transmission) { return I += Ti * avg(Ji, J); } diff --git a/src/core/gas_abs_lookup.cc b/src/core/gas_abs_lookup.cc index 17d47a15b4..8e47795175 100644 --- a/src/core/gas_abs_lookup.cc +++ b/src/core/gas_abs_lookup.cc @@ -328,12 +328,12 @@ void GasAbsLookup::Adapt(const ArrayOfArrayOfSpeciesTag& current_species, new_table.vmrs_ref.resize(n_current_species, n_p_grid); for (Index i = 0; i < n_current_species; ++i) { if (i_current_species[i] >= 0) { - new_table.vmrs_ref(i, Range(joker)) = - vmrs_ref(i_current_species[i], Range(joker)); + new_table.vmrs_ref[i] = + vmrs_ref[i_current_species[i], Range(joker)]; } else { // Here we handle the case of the trivial species, for which we set // the reference VMR to NAN. - new_table.vmrs_ref(i, Range(joker)) = NAN; + new_table.vmrs_ref[i] = NAN; } } @@ -378,15 +378,15 @@ void GasAbsLookup::Adapt(const ArrayOfArrayOfSpeciesTag& current_species, // Do frequencies: for (Index i_f = 0; i_f < n_current_f_grid; ++i_f) { if (i_current_species[i_s] >= 0) { - new_table.xsec(Range(joker), Range(sp, n_v), i_f, Range(joker)) = - xsec(Range(joker), + new_table.xsec[Range(joker), Range(sp, n_v), i_f, Range(joker)] = + xsec[Range(joker), Range(original_spec_pos_in_xsec[i_current_species[i_s]], n_v), i_current_f_grid[i_f], - Range(joker)); + Range(joker)]; } else { // Here we handle the case of the trivial species, which we simply // set to NAN: - new_table.xsec(Range(joker), Range(sp, n_v), i_f, Range(joker)) = NAN; + new_table.xsec[Range(joker), Range(sp, n_v), i_f, Range(joker)] = NAN; } // cout << "result: " << xsec( Range(joker), @@ -891,7 +891,7 @@ void GasAbsLookup::Extract(Matrix& sga, // const Numeric effective_vmr_ref = interp(pitw, // vmrs_ref(h2o_index, Range(joker)), // pgp); - const Numeric effective_vmr_ref = vmrs_ref(h2o_index, this_p_grid_index); + const Numeric effective_vmr_ref = vmrs_ref[h2o_index, this_p_grid_index]; // Fractional VMR: const Numeric VMR_frac = abs_vmrs[h2o_index] / effective_vmr_ref; @@ -951,8 +951,8 @@ void GasAbsLookup::Extract(Matrix& sga, // For interpolation result. // Fixed pressure level and species. // Free dimension is T, H2O, and frequency. - Tensor3View res(xsec_pre_interpolated( - pi, si, Range(joker), Range(joker), Range(joker))); + Tensor3View res(xsec_pre_interpolated[ + pi, si, Range(joker), Range(joker), Range(joker)]); // Ignore species such as Zeeman and free_electrons which are not // stored in the lookup table. For those the result is set to 0. @@ -983,10 +983,10 @@ void GasAbsLookup::Extract(Matrix& sga, // Get the right view on xsec. ConstTensor3View this_xsec = - xsec(Range(joker), // Temperature range + xsec[Range(joker), // Temperature range Range(fpi, this_h2o_extent), // VMR profile range Range(joker), // Frequency range - this_p_grid_index); // Pressure index + this_p_grid_index]; // Pressure index // Do interpolation. reinterp(res, // result @@ -1028,12 +1028,11 @@ void GasAbsLookup::Extract(Matrix& sga, // Temperature (always 1) // H2O (always 1) // Frequency - xsec_pre_interpolated( - pi, Range(joker), Range(joker), Range(joker), Range(joker)) *= pitw[pi]; + xsec_pre_interpolated[pi] *= pitw[pi]; // Add up in sga. // Dimensions of sga are (species, frequency) - sga += xsec_pre_interpolated(pi, Range(joker), 0, 0, Range(joker)); + sga += xsec_pre_interpolated[pi, Range(joker), 0, 0, Range(joker)]; } // Watch out, this is not yet the final result, we @@ -1043,9 +1042,9 @@ void GasAbsLookup::Extract(Matrix& sga, for (Index si = 0; si < n_species; ++si) { if (select_species != SpeciesEnum::Bath and species[si].Species() != select_species) { - sga(si, Range(joker)) = 0.; + sga[si] = 0.; } else { - sga(si, Range(joker)) *= (n * abs_vmrs[si]); + sga[si] *= (n * abs_vmrs[si]); } } diff --git a/src/core/interpolation.cc b/src/core/interpolation.cc index ebc5394235..2db1a8a131 100644 --- a/src/core/interpolation.cc +++ b/src/core/interpolation.cc @@ -1005,7 +1005,7 @@ Numeric interp(ConstVectorView itw, Index iti = 0; for (Index r = 0; r < 2; ++r) for (Index c = 0; c < 2; ++c) { - tia += a(tr.idx + r, tc.idx + c) * itw[iti]; + tia += a[tr.idx + r, tc.idx + c] * itw[iti]; ++iti; } @@ -1049,7 +1049,7 @@ Numeric interp(ConstVectorView itw, for (Index p = 0; p < 2; ++p) for (Index r = 0; r < 2; ++r) for (Index c = 0; c < 2; ++c) { - tia += a(tp.idx + p, tr.idx + r, tc.idx + c) * itw[iti]; + tia += a[tp.idx + p, tr.idx + r, tc.idx + c] * itw[iti]; ++iti; } @@ -1096,7 +1096,7 @@ Numeric interp(ConstVectorView itw, for (Index p = 0; p < 2; ++p) for (Index r = 0; r < 2; ++r) for (Index c = 0; c < 2; ++c) { - tia += a(tb.idx + b, tp.idx + p, tr.idx + r, tc.idx + c) * + tia += a[tb.idx + b, tp.idx + p, tr.idx + r, tc.idx + c] * itw[iti]; ++iti; } @@ -1147,11 +1147,11 @@ Numeric interp(ConstVectorView itw, for (Index p = 0; p < 2; ++p) for (Index r = 0; r < 2; ++r) for (Index c = 0; c < 2; ++c) { - tia += a(ts.idx + s, + tia += a[ts.idx + s, tb.idx + b, tp.idx + p, tr.idx + r, - tc.idx + c) * + tc.idx + c] * itw[iti]; ++iti; } @@ -1205,12 +1205,12 @@ Numeric interp(ConstVectorView itw, for (Index p = 0; p < 2; ++p) for (Index r = 0; r < 2; ++r) for (Index c = 0; c < 2; ++c) { - tia += a(tv.idx + v, + tia += a[tv.idx + v, ts.idx + s, tb.idx + b, tp.idx + p, tr.idx + r, - tc.idx + c) * + tc.idx + c] * itw[iti]; ++iti; } @@ -1279,7 +1279,7 @@ void interpweights(MatrixView itw, const ArrayOfGridPos& cgp) { // COMMAND! LOOPIT(c) { - itw(i, iti) = *c; + itw[i, iti] = *c; ++iti; } } @@ -1332,7 +1332,7 @@ void interpweights(MatrixView itw, LOOPIT(r) LOOPIT(c) { - itw(i, iti) = (*r) * (*c); + itw[i, iti] = (*r) * (*c); ++iti; } } @@ -1382,7 +1382,7 @@ void interpweights(MatrixView itw, LOOPIT(p) LOOPIT(r) LOOPIT(c) { - itw(i, iti) = (*p) * (*r) * (*c); + itw[i, iti] = (*p) * (*r) * (*c); ++iti; } } @@ -1437,7 +1437,7 @@ void interpweights(MatrixView itw, LOOPIT(p) LOOPIT(r) LOOPIT(c) { - itw(i, iti) = (*b) * (*p) * (*r) * (*c); + itw[i, iti] = (*b) * (*p) * (*r) * (*c); ++iti; } } @@ -1497,7 +1497,7 @@ void interpweights(MatrixView itw, LOOPIT(p) LOOPIT(r) LOOPIT(c) { - itw(i, iti) = (*s) * (*b) * (*p) * (*r) * (*c); + itw[i, iti] = (*s) * (*b) * (*p) * (*r) * (*c); ++iti; } } @@ -1562,7 +1562,7 @@ void interpweights(MatrixView itw, LOOPIT(p) LOOPIT(r) LOOPIT(c) { - itw(i, iti) = (*v) * (*s) * (*b) * (*p) * (*r) * (*c); + itw[i, iti] = (*v) * (*s) * (*b) * (*p) * (*r) * (*c); ++iti; } } @@ -1598,7 +1598,7 @@ void interp(VectorView ia, // weights (last dimension) must always be approximately one. We // only check the first element. ARTS_ASSERT( - is_same_within_epsilon(sum(itw(0, Range(joker))), 1, sum_check_epsilon)); + is_same_within_epsilon(sum(itw[0]), 1, sum_check_epsilon)); // We have to loop all the points in the sequence: for (Index i = 0; i < n; ++i) { @@ -1613,7 +1613,7 @@ void interp(VectorView ia, Index iti = 0; for (Index c = 0; c < 2; ++c) { ARTS_ASSERT(tc.idx + c < a.nelem()); // Temporary !? - tia += a(tc.idx + c) * itw(i, iti); + tia += a[tc.idx + c] * itw[i, iti]; ++iti; } } @@ -1656,7 +1656,7 @@ void interp(VectorView ia, // weights (last dimension) must always be approximately one. We // only check the first element. ARTS_ASSERT( - is_same_within_epsilon(sum(itw(0, Range(joker))), 1, sum_check_epsilon)); + is_same_within_epsilon(sum(itw[0]), 1, sum_check_epsilon)); // We have to loop all the points in the sequence: for (Index i = 0; i < n; ++i) { @@ -1672,7 +1672,7 @@ void interp(VectorView ia, Index iti = 0; for (Index r = 0; r < 2; ++r) for (Index c = 0; c < 2; ++c) { - tia += a(tr.idx + r, tc.idx + c) * itw(i, iti); + tia += a[tr.idx + r, tc.idx + c] * itw[i, iti]; ++iti; } } @@ -1718,7 +1718,7 @@ void interp(VectorView ia, // weights (last dimension) must always be approximately one. We // only check the first element. ARTS_ASSERT( - is_same_within_epsilon(sum(itw(0, Range(joker))), 1, sum_check_epsilon)); + is_same_within_epsilon(sum(itw[0]), 1, sum_check_epsilon)); // We have to loop all the points in the sequence: for (Index i = 0; i < n; ++i) { @@ -1736,7 +1736,7 @@ void interp(VectorView ia, for (Index p = 0; p < 2; ++p) for (Index r = 0; r < 2; ++r) for (Index c = 0; c < 2; ++c) { - tia += a(tp.idx + p, tr.idx + r, tc.idx + c) * itw(i, iti); + tia += a[tp.idx + p, tr.idx + r, tc.idx + c] * itw[i, iti]; ++iti; } } @@ -1785,7 +1785,7 @@ void interp(VectorView ia, // weights (last dimension) must always be approximately one. We // only check the first element. ARTS_ASSERT( - is_same_within_epsilon(sum(itw(0, Range(joker))), 1, sum_check_epsilon)); + is_same_within_epsilon(sum(itw[0]), 1, sum_check_epsilon)); // We have to loop all the points in the sequence: for (Index i = 0; i < n; ++i) { @@ -1805,8 +1805,8 @@ void interp(VectorView ia, for (Index p = 0; p < 2; ++p) for (Index r = 0; r < 2; ++r) for (Index c = 0; c < 2; ++c) { - tia += a(tb.idx + b, tp.idx + p, tr.idx + r, tc.idx + c) * - itw(i, iti); + tia += a[tb.idx + b, tp.idx + p, tr.idx + r, tc.idx + c] * + itw[i, iti]; ++iti; } } @@ -1858,7 +1858,7 @@ void interp(VectorView ia, // weights (last dimension) must always be approximately one. We // only check the first element. ARTS_ASSERT( - is_same_within_epsilon(sum(itw(0, Range(joker))), 1, sum_check_epsilon)); + is_same_within_epsilon(sum(itw[0]), 1, sum_check_epsilon)); // We have to loop all the points in the sequence: for (Index i = 0; i < n; ++i) { @@ -1880,12 +1880,12 @@ void interp(VectorView ia, for (Index p = 0; p < 2; ++p) for (Index r = 0; r < 2; ++r) for (Index c = 0; c < 2; ++c) { - tia += a(ts.idx + s, + tia += a[ts.idx + s, tb.idx + b, tp.idx + p, tr.idx + r, - tc.idx + c) * - itw(i, iti); + tc.idx + c] * + itw[i, iti]; ++iti; } } @@ -1940,7 +1940,7 @@ void interp(VectorView ia, // weights (last dimension) must always be approximately one. We // only check the first element. ARTS_ASSERT( - is_same_within_epsilon(sum(itw(0, Range(joker))), 1, sum_check_epsilon)); + is_same_within_epsilon(sum(itw[0]), 1, sum_check_epsilon)); // We have to loop all the points in the sequence: for (Index i = 0; i < n; ++i) { @@ -1964,13 +1964,13 @@ void interp(VectorView ia, for (Index p = 0; p < 2; ++p) for (Index r = 0; r < 2; ++r) for (Index c = 0; c < 2; ++c) { - tia += a(tv.idx + v, + tia += a[tv.idx + v, ts.idx + s, tb.idx + b, tp.idx + p, tr.idx + r, - tc.idx + c) * - itw(i, iti); + tc.idx + c] * + itw[i, iti]; ++iti; } } @@ -2030,7 +2030,7 @@ void interpweights(Tensor3View itw, LOOPIT(r) LOOPIT(c) { - itw(ir, ic, iti) = (*r) * (*c); + itw[ir, ic, iti] = (*r) * (*c); ++iti; } } @@ -2083,7 +2083,7 @@ void interpweights(Tensor4View itw, LOOPIT(p) LOOPIT(r) LOOPIT(c) { - itw(ip, ir, ic, iti) = (*p) * (*r) * (*c); + itw[ip, ir, ic, iti] = (*p) * (*r) * (*c); ++iti; } } @@ -2143,7 +2143,7 @@ void interpweights(Tensor5View itw, LOOPIT(p) LOOPIT(r) LOOPIT(c) { - itw(ib, ip, ir, ic, iti) = (*b) * (*p) * (*r) * (*c); + itw[ib, ip, ir, ic, iti] = (*b) * (*p) * (*r) * (*c); ++iti; } } @@ -2210,7 +2210,7 @@ void interpweights(Tensor6View itw, LOOPIT(p) LOOPIT(r) LOOPIT(c) { - itw(is, ib, ip, ir, ic, iti) = + itw[is, ib, ip, ir, ic, iti] = (*s) * (*b) * (*p) * (*r) * (*c); ++iti; } @@ -2285,7 +2285,7 @@ void interpweights(Tensor7View itw, LOOPIT(p) LOOPIT(r) LOOPIT(c) { - itw(iv, is, ib, ip, ir, ic, iti) = + itw[iv, is, ib, ip, ir, ic, iti] = (*v) * (*s) * (*b) * (*p) * (*r) * (*c); ++iti; } @@ -2334,7 +2334,7 @@ void interp(MatrixView ia, // weights (last dimension) must always be approximately one. We // only check the first element. ARTS_ASSERT(is_same_within_epsilon( - sum(itw(0, 0, Range(joker))), 1, sum_check_epsilon)); + sum(itw[0, 0, Range(joker)]), 1, sum_check_epsilon)); // We have to loop all the points in the new grid: for (Index ir = 0; ir < nr; ++ir) { @@ -2347,7 +2347,7 @@ void interp(MatrixView ia, // Get handle to current element of output tensor and initialize // it to zero: - Numeric& tia = ia(ir, ic); + Numeric& tia = ia[ir, ic]; tia = 0; Index iti = 0; @@ -2355,7 +2355,7 @@ void interp(MatrixView ia, for (Index c = 0; c < 2; ++c) { ARTS_ASSERT(tr.idx + r < a.nrows()); // Temporary !? ARTS_ASSERT(tc.idx + c < a.ncols()); // Temporary !? - tia += a(tr.idx + r, tc.idx + c) * itw(ir, ic, iti); + tia += a[tr.idx + r, tc.idx + c] * itw[ir, ic, iti]; ++iti; } } @@ -2401,7 +2401,7 @@ void interp(Tensor3View ia, // weights (last dimension) must always be approximately one. We // only check the first element. ARTS_ASSERT(is_same_within_epsilon( - sum(itw(0, 0, 0, Range(joker))), 1, sum_check_epsilon)); + sum(itw[0, 0, 0, Range(joker)]), 1, sum_check_epsilon)); // We have to loop all the points in the new grid: for (Index ip = 0; ip < np; ++ip) { @@ -2414,7 +2414,7 @@ void interp(Tensor3View ia, // Get handle to current element of output tensor and // initialize it to zero: - Numeric& tia = ia(ip, ir, ic); + Numeric& tia = ia[ip, ir, ic]; tia = 0; Index iti = 0; @@ -2424,8 +2424,8 @@ void interp(Tensor3View ia, ARTS_ASSERT(tp.idx + p < a.npages()); // Temporary !? ARTS_ASSERT(tr.idx + r < a.nrows()); // Temporary !? ARTS_ASSERT(tc.idx + c < a.ncols()); // Temporary !? - tia += a(tp.idx + p, tr.idx + r, tc.idx + c) * - itw(ip, ir, ic, iti); + tia += a[tp.idx + p, tr.idx + r, tc.idx + c] * + itw[ip, ir, ic, iti]; ++iti; } } @@ -2475,7 +2475,7 @@ void interp(Tensor4View ia, // weights (last dimension) must always be approximately one. We // only check the first element. ARTS_ASSERT(is_same_within_epsilon( - sum(itw(0, 0, 0, 0, Range(joker))), 1, sum_check_epsilon)); + sum(itw[0, 0, 0, 0, Range(joker)]), 1, sum_check_epsilon)); // We have to loop all the points in the new grid: for (Index ib = 0; ib < nb; ++ib) { @@ -2490,7 +2490,7 @@ void interp(Tensor4View ia, // Get handle to current element of output tensor and // initialize it to zero: - Numeric& tia = ia(ib, ip, ir, ic); + Numeric& tia = ia[ib, ip, ir, ic]; tia = 0; Index iti = 0; @@ -2498,8 +2498,8 @@ void interp(Tensor4View ia, for (Index p = 0; p < 2; ++p) for (Index r = 0; r < 2; ++r) for (Index c = 0; c < 2; ++c) { - tia += a(tb.idx + b, tp.idx + p, tr.idx + r, tc.idx + c) * - itw(ib, ip, ir, ic, iti); + tia += a[tb.idx + b, tp.idx + p, tr.idx + r, tc.idx + c] * + itw[ib, ip, ir, ic, iti]; ++iti; } } @@ -2553,7 +2553,7 @@ void interp(Tensor5View ia, // weights (last dimension) must always be approximately one. We // only check the first element. ARTS_ASSERT(is_same_within_epsilon( - sum(itw(0, 0, 0, 0, 0, Range(joker))), 1, sum_check_epsilon)); + sum(itw[0, 0, 0, 0, 0, Range(joker)]), 1, sum_check_epsilon)); // We have to loop all the points in the new grid: for (Index is = 0; is < ns; ++is) { @@ -2570,7 +2570,7 @@ void interp(Tensor5View ia, // Get handle to current element of output tensor and // initialize it to zero: - Numeric& tia = ia(is, ib, ip, ir, ic); + Numeric& tia = ia[is, ib, ip, ir, ic]; tia = 0; Index iti = 0; @@ -2579,12 +2579,12 @@ void interp(Tensor5View ia, for (Index p = 0; p < 2; ++p) for (Index r = 0; r < 2; ++r) for (Index c = 0; c < 2; ++c) { - tia += a(ts.idx + s, + tia += a[ts.idx + s, tb.idx + b, tp.idx + p, tr.idx + r, - tc.idx + c) * - itw(is, ib, ip, ir, ic, iti); + tc.idx + c] * + itw[is, ib, ip, ir, ic, iti]; ++iti; } } @@ -2642,7 +2642,7 @@ void interp(Tensor6View ia, // weights (last dimension) must always be approximately one. We // only check the first element. ARTS_ASSERT(is_same_within_epsilon( - sum(itw(0, 0, 0, 0, 0, 0, Range(joker))), 1, sum_check_epsilon)); + sum(itw[0, 0, 0, 0, 0, 0, Range(joker)]), 1, sum_check_epsilon)); // We have to loop all the points in the new grid: for (Index iv = 0; iv < nv; ++iv) { @@ -2661,7 +2661,7 @@ void interp(Tensor6View ia, // Get handle to current element of output tensor and // initialize it to zero: - Numeric& tia = ia(iv, is, ib, ip, ir, ic); + Numeric& tia = ia[iv, is, ib, ip, ir, ic]; tia = 0; Index iti = 0; @@ -2671,13 +2671,13 @@ void interp(Tensor6View ia, for (Index p = 0; p < 2; ++p) for (Index r = 0; r < 2; ++r) for (Index c = 0; c < 2; ++c) { - tia += a(tv.idx + v, + tia += a[tv.idx + v, ts.idx + s, tb.idx + b, tp.idx + p, tr.idx + r, - tc.idx + c) * - itw(iv, is, ib, ip, ir, ic, iti); + tc.idx + c] * + itw[iv, is, ib, ip, ir, ic, iti]; ++iti; } } diff --git a/src/core/jacobian/jacobian.cc b/src/core/jacobian/jacobian.cc index 848da89fea..ee639bb796 100644 --- a/src/core/jacobian/jacobian.cc +++ b/src/core/jacobian/jacobian.cc @@ -299,7 +299,7 @@ void ErrorTarget::update_y(Vector& y, Matrix& dy, const Vector& x) const { szx) set_y(y.slice(type.y_start, type.y_size), - dy(Range(type.y_start, type.y_size), Range(x_start, x_size)), + dy[Range(type.y_start, type.y_size), Range(x_start, x_size)], x.slice(x_start, x_size)); } diff --git a/src/core/lbl/lbl_lineshape_voigt_ecs.cpp b/src/core/lbl/lbl_lineshape_voigt_ecs.cpp index 684fa8caa1..0d4acc0dce 100644 --- a/src/core/lbl/lbl_lineshape_voigt_ecs.cpp +++ b/src/core/lbl/lbl_lineshape_voigt_ecs.cpp @@ -115,7 +115,7 @@ void ComputeData::core_calc_eqv() { // Do the matrix forward multiplication for (Index i = 0; i < n; i++) { for (Index j = 0; j < n; j++) { - eqv_str[i] += dip[j] * V(j, i); + eqv_str[i] += dip[j] * V[j, i]; } } @@ -124,7 +124,7 @@ void ComputeData::core_calc_eqv() { for (Index i = 0; i < n; i++) { Complex z(0, 0); for (Index j = 0; j < n; j++) { - z += pop[j] * dip[j] * V(i, j); + z += pop[j] * dip[j] * V[i, j]; } eqv_str[i] *= z; } @@ -256,9 +256,9 @@ void ComputeData::adapt_multi(const QuantumIdentifier& bnd_qid, Wimag = 0.0; for (Size k = 0; k < n; k++) { - Wimag(k, k) = bnd.lines[sort[k]].ls.single_models[i].G0( + Wimag[k, k] = bnd.lines[sort[k]].ls.single_models[i].G0( bnd.lines[sort[k]].ls.T0, atm.temperature, atm.pressure); - Ws[i](k, k) = bnd.lines[sort[k]].ls.single_models[i].D0( + Ws[i][k, k] = bnd.lines[sort[k]].ls.single_models[i].D0( bnd.lines[sort[k]].ls.T0, atm.temperature, atm.pressure); } @@ -276,7 +276,7 @@ void ComputeData::adapt_multi(const QuantumIdentifier& bnd_qid, } for (Size i = 0; i < n; i++) { - Ws(joker, i, i) += bnd.lines[sort[i]].f0; + Ws[joker, i, i] += bnd.lines[sort[i]].f0; } } @@ -384,7 +384,7 @@ void ComputeData::adapt_single(const QuantumIdentifier& bnd_qid, Wimag = 0.0; for (Size k = 0; k < n; k++) { - Wimag(k, k) = bnd.lines[sort[k]].ls.single_models[i].G0( + Wimag[k, k] = bnd.lines[sort[k]].ls.single_models[i].G0( bnd.lines[sort[k]].ls.T0, atm.temperature, atm.pressure); } @@ -400,7 +400,7 @@ void ComputeData::adapt_single(const QuantumIdentifier& bnd_qid, for (Size ir = 0; ir < n; ir++) { for (Size ic = 0; ic < n; ic++) { - imag_val(Ws[0](ir, ic)) += this_vmr * Wimag(ir, ic); + imag_val(Ws[0][ir, ic]) += this_vmr * Wimag[ir, ic]; } } @@ -410,7 +410,7 @@ void ComputeData::adapt_single(const QuantumIdentifier& bnd_qid, if (vmr != 1.0) Ws[0] /= vmr; for (Size i = 0; i < n; i++) { - real_val(Ws[0](i, i)) = + real_val(Ws[0][i, i]) = bnd.lines[sort[i]].f0 + bnd.lines[sort[i]].ls.D0(atm); } } diff --git a/src/core/lbl/lbl_lineshape_voigt_ecs_hartmann.cpp b/src/core/lbl/lbl_lineshape_voigt_ecs_hartmann.cpp index 794cb30ade..317ab9cdb9 100644 --- a/src/core/lbl/lbl_lineshape_voigt_ecs_hartmann.cpp +++ b/src/core/lbl/lbl_lineshape_voigt_ecs_hartmann.cpp @@ -142,8 +142,8 @@ void relaxation_matrix_offdiagonal(ExhaustiveMatrixView& W, sum *= scl; // Add to W and rescale to upwards element by the populations - W(j, i) = sum; - W(i, j) = sum * std::exp((erot(Jf_p) - erot(Jf)) / kelvin2joule(T)); + W[j, i] = sum; + W[i, j] = sum * std::exp((erot(Jf_p) - erot(Jf)) / kelvin2joule(T)); } } arts_wigner_thread_free(); @@ -153,7 +153,7 @@ void relaxation_matrix_offdiagonal(ExhaustiveMatrixView& W, // Undocumented negative absolute sign for (Size i = 0; i < n; i++) for (Size j = 0; j < n; j++) - if (j not_eq i and W(i, j) > 0) W(i, j) *= -1; + if (j not_eq i and W[i, j] > 0) W[i, j] *= -1; // Sum rule correction for (Size i = 0; i < n; i++) { @@ -162,9 +162,9 @@ void relaxation_matrix_offdiagonal(ExhaustiveMatrixView& W, for (Size j = 0; j < n; j++) { if (j > i) { - sumlw += std::abs(dipr[j]) * W(j, i); // Undocumented abs-sign + sumlw += std::abs(dipr[j]) * W[j, i]; // Undocumented abs-sign } else { - sumup += std::abs(dipr[j]) * W(j, i); // Undocumented abs-sign + sumup += std::abs(dipr[j]) * W[j, i]; // Undocumented abs-sign } } @@ -174,11 +174,11 @@ void relaxation_matrix_offdiagonal(ExhaustiveMatrixView& W, const Rational Jj = bnd.lines[sorting[j]].qn.val[QuantumNumberType::J].low(); if (sumlw == 0) { - W(j, i) = 0.0; - W(i, j) = 0.0; + W[j, i] = 0.0; + W[i, j] = 0.0; } else { - W(j, i) *= -sumup / sumlw; - W(i, j) = W(j, i) * std::exp((erot(Ji) - erot(Jj)) / + W[j, i] *= -sumup / sumlw; + W[i, j] = W[j, i] * std::exp((erot(Ji) - erot(Jj)) / kelvin2joule(T)); // This gives LTE } } diff --git a/src/core/lbl/lbl_lineshape_voigt_ecs_makarov.cpp b/src/core/lbl/lbl_lineshape_voigt_ecs_makarov.cpp index a9d3b23ff5..51571cf142 100644 --- a/src/core/lbl/lbl_lineshape_voigt_ecs_makarov.cpp +++ b/src/core/lbl/lbl_lineshape_voigt_ecs_makarov.cpp @@ -180,8 +180,8 @@ void relaxation_matrix_offdiagonal(ExhaustiveMatrixView& W, sum *= scl * Om[Ni.toIndex()]; // Add to W and rescale to upwards element by the populations - W(i, j) = sum; - W(j, i) = + W[i, j] = sum; + W[j, i] = sum * std::exp((bnd.lines[sorting[j]].e0 - bnd.lines[sorting[i]].e0) / kelvin2joule(atm.temperature)); } @@ -197,20 +197,20 @@ void relaxation_matrix_offdiagonal(ExhaustiveMatrixView& W, for (Size j = 0; j < n; j++) { if (j > i) { - sumlw += dipr[j] * W(j, i); + sumlw += dipr[j] * W[j, i]; } else { - sumup += dipr[j] * W(j, i); + sumup += dipr[j] * W[j, i]; } } for (Size j = i + 1; j < n; j++) { if (sumlw == 0) { - W(j, i) = 0.0; - W(i, j) = 0.0; + W[j, i] = 0.0; + W[i, j] = 0.0; } else { - W(j, i) *= -sumup / sumlw; - W(i, j) = - W(j, i) * + W[j, i] *= -sumup / sumlw; + W[i, j] = + W[j, i] * std::exp((bnd.lines[sorting[i]].e0 - bnd.lines[sorting[j]].e0) / kelvin2joule(atm.temperature)); } diff --git a/src/core/legendre/legendre.cpp b/src/core/legendre/legendre.cpp index 034c178999..831762193a 100644 --- a/src/core/legendre/legendre.cpp +++ b/src/core/legendre/legendre.cpp @@ -39,33 +39,33 @@ std::pair schmidt(const Numeric theta, const Index nmax) { Matrix P(N, N, 0); Matrix dP(N, N, 0); Matrix S(N, N, 0); - S(0, 0) = 1.0; - P(0, 0) = 1.0; + S[0, 0] = 1.0; + P[0, 0] = 1.0; for (Index n = 1; n < N; ++n) { for (Index m = 0; m < n + 1; ++m) { if (n == m) { - P(n, n) = st * P(n - 1, m - 1); - dP(n, n) = st * dP(n - 1, m - 1) + ct * P(n - 1, n - 1); + P[n, n] = st * P[n - 1, m - 1]; + dP[n, n] = st * dP[n - 1, m - 1] + ct * P[n - 1, n - 1]; } else { if (n == 1) { - P(n, m) = ct * P(n - 1, m); - dP(n, m) = st * dP(n - 1, m) - st * P(n - 1, m); + P[n, m] = ct * P[n - 1, m]; + dP[n, m] = st * dP[n - 1, m] - st * P[n - 1, m]; } else { const Numeric Knm = static_cast((n - 1 + m) * (n - 1 - m)) / static_cast((2 * n - 1) * (2 * n - 3)); - P(n, m) = ct * P(n - 1, m) - Knm * P(n - 2, m); - dP(n, m) = ct * dP(n - 1, m) - st * P(n - 1, m) - Knm * dP(n - 2, m); + P[n, m] = ct * P[n - 1, m] - Knm * P[n - 2, m]; + dP[n, m] = ct * dP[n - 1, m] - st * P[n - 1, m] - Knm * dP[n - 2, m]; } } // compute Schmidt normalization if (m == 0) - S(n, 0) = S(n - 1, 0) * (2. * n - 1) / n; + S[n, 0] = S[n - 1, 0] * (2. * n - 1) / n; else - S(n, m) = - S(n, m - 1) * std::sqrt((n - m + 1) * (int(m == 1) + 1.) / (n + m)); + S[n, m] = + S[n, m - 1] * std::sqrt((n - m + 1) * (int(m == 1) + 1.) / (n + m)); } } @@ -110,9 +110,9 @@ Vector3 schmidt_fieldcalc(const Matrix& g, ratn *= r_ratio; for (Index m = 0; m < n + 1; ++m) { B[0] += - (g(n, m) * cosm[m] + h(n, m) * sinm[m]) * P(n, m) * (n + 1) * ratn; - B[1] -= (g(n, m) * cosm[m] + h(n, m) * sinm[m]) * dP(n, m) * ratn; - B[2] += (g(n, m) * sinm[m] - h(n, m) * cosm[m]) * P(n, m) * m * ratn; + (g[n, m] * cosm[m] + h[n, m] * sinm[m]) * P[n, m] * (n + 1) * ratn; + B[1] -= (g[n, m] * cosm[m] + h[n, m] * sinm[m]) * dP[n, m] * ratn; + B[2] += (g[n, m] * sinm[m] - h[n, m] * cosm[m]) * P[n, m] * m * ratn; } } diff --git a/src/core/lookup/lookup_map.cpp b/src/core/lookup/lookup_map.cpp index 4fcc96dd24..1a44b69444 100644 --- a/src/core/lookup/lookup_map.cpp +++ b/src/core/lookup/lookup_map.cpp @@ -106,7 +106,7 @@ table::table(const SpeciesEnum& species, const Numeric inv_nd = 1.0 / atm_point.number_density(species); for (Index ifreq = 0; ifreq < f_grid->size(); ++ifreq) { - xsec(it, iw, ip, ifreq) = pm[ifreq].A() * inv_nd; + xsec[it, iw, ip, ifreq] = pm[ifreq].A() * inv_nd; } } catch (std::runtime_error& e) { #pragma omp critical @@ -218,7 +218,7 @@ void table::absorption(ExhaustiveVectorView absorption, } else if (do_t()) { const ArrayOfLagrangeInterpolation tlag{temperature_lagrange( atm_point.temperature, plag[0], t_interp_order, extpolfac)}; - xsec_local = reinterp(xsec(joker, 0, joker, joker), tlag, plag, flag) + xsec_local = reinterp(xsec[joker, 0, joker, joker], tlag, plag, flag) .reshape(frequency_grid.size()); } else { xsec_local = diff --git a/src/core/matpack/gridded_data.h b/src/core/matpack/gridded_data.h index b95ddabf79..82f9e0cb59 100644 --- a/src/core/matpack/gridded_data.h +++ b/src/core/matpack/gridded_data.h @@ -76,13 +76,13 @@ struct gridded_data { } template - [[nodiscard]] decltype(auto) operator()(Access&&... access) const { - return data(std::forward(access)...); + [[nodiscard]] decltype(auto) operator[](Access&&... access) const { + return data[std::forward(access)...]; } template - [[nodiscard]] decltype(auto) operator()(Access&&... access) { - return data(std::forward(access)...); + [[nodiscard]] decltype(auto) operator[](Access&&... access) { + return data[std::forward(access)...]; } template diff --git a/src/core/matpack/interp.h b/src/core/matpack/interp.h index 3ab7533cfb..ea6a696715 100644 --- a/src/core/matpack/interp.h +++ b/src/core/matpack/interp.h @@ -1227,12 +1227,6 @@ struct select_derivative { }; } // namespace internal -//! Conceptually, the type is assignable -template -concept matpack_assignable = matpack::any_matpack_type and requires(T &a) { - std::apply(a, std::array()>{}) = U{}; -}; - /** Precompute the interpolation weights * * For use with the interp method when re-usability is required @@ -1245,7 +1239,7 @@ concept matpack_assignable = matpack::any_matpack_type and requires(T &a) { template constexpr void interpweights( matpack::ranked_matpack_type auto &&out, const lags &...lag) - requires(N > 0 and matpack_assignable) + requires(N > 0) { ARTS_USER_ERROR_IF(std::array{lag.size()...} != out.shape(), "{:B,} vs {:B,}", @@ -1270,8 +1264,7 @@ constexpr void interpweights( template constexpr void dinterpweights( matpack::ranked_matpack_type auto &&out, const lags &...lag) - requires(N > 0 and matpack_assignable and dlx >= 0 and - dlx < N) + requires(N > 0 and dlx >= 0 and dlx < N) { ARTS_USER_ERROR_IF(std::array{lag.size()...} != out.shape(), "{:B,} vs {:B,}", @@ -1371,7 +1364,7 @@ constexpr auto interpweights(const list_lags &...lags) ++pos) { std::apply( [&](auto &&...ind) { - interpweights(std::apply(out, + interpweights(std::apply([&out](auto... ind) { return out[ind...]; }, std::tuple_cat(std::array{ind...}, matpack::jokers())), lags[ind]...); @@ -1414,10 +1407,11 @@ constexpr auto dinterpweights(const list_lags &...lags) ++pos) { std::apply( [&](auto &&...ind) { - dinterpweights(std::apply(out, - std::tuple_cat(std::array{ind...}, - matpack::jokers())), - lags[ind]...); + dinterpweights( + std::apply( + [&out](auto... ind) { return out[ind...]; }, + std::tuple_cat(std::array{ind...}, matpack::jokers())), + lags[ind]...); }, pos.pos); } @@ -1480,11 +1474,12 @@ constexpr void reinterp( ++pos) { std::apply( [&](auto... ind) { - out(ind...) = interp(field, - std::apply(iw_field, - std::tuple_cat(std::array{ind...}, - matpack::jokers())), - list_lag[ind]...); + out[ind...] = interp( + field, + std::apply( + [&iw_field](auto... ind) { return iw_field[ind...]; }, + std::tuple_cat(std::array{ind...}, matpack::jokers())), + list_lag[ind]...); }, pos.pos); } diff --git a/src/core/matpack/lin_alg.cc b/src/core/matpack/lin_alg.cc index 4d11e11260..8b5fbb3da0 100644 --- a/src/core/matpack/lin_alg.cc +++ b/src/core/matpack/lin_alg.cc @@ -403,7 +403,7 @@ void diagonalize(ComplexMatrixView P, &info); for (Index i = 0; i < n; i++) - for (Index j = 0; j < i; j++) std::swap(P(j, i), P(i, j)); + for (Index j = 0; j < i; j++) std::swap(P[j, i], P[i, j]); } //! General exponential of a Matrix @@ -475,9 +475,9 @@ void matrix_exp(MatrixView F, ConstMatrixView A, const Index& q) { ludcmp(X, indx, D); for (Index i = 0; i < n; i++) { - N_col_vec = N(joker, i); // extract column vectors of N + N_col_vec = N[joker, i]; // extract column vectors of N lubacksub(F_col_vec, X, N_col_vec, indx); - F(joker, i) = F_col_vec; // construct F matrix from column vectors + F[joker, i] = F_col_vec; // construct F matrix from column vectors } /* The square of F gives the result. */ @@ -514,7 +514,7 @@ Numeric norm_inf(ConstMatrixView A) { for (Index j = 0; j < A.nrows(); j++) { Numeric row_sum = 0; //Calculate the row sum for all rows - for (Index i = 0; i < A.ncols(); i++) row_sum += abs(A(i, j)); + for (Index i = 0; i < A.ncols(); i++) row_sum += abs(A[i, j]); //Pick out the row with the highest row sum if (norm_inf < row_sum) norm_inf = row_sum; } @@ -530,7 +530,7 @@ void id_mat(MatrixView I) { ARTS_ASSERT(n == I.nrows()); I = 0; - for (Index i = 0; i < n; i++) I(i, i) = 1.; + for (Index i = 0; i < n; i++) I[i, i] = 1.; } /*! @@ -546,11 +546,11 @@ Numeric det(ConstMatrixView A) { ARTS_ASSERT(dim == A.ncols()); if (dim == 3) - return A(0, 0) * A(1, 1) * A(2, 2) + A(0, 1) * A(1, 2) * A(2, 0) + - A(0, 2) * A(1, 0) * A(2, 1) - A(0, 2) * A(1, 1) * A(2, 0) - - A(0, 1) * A(1, 0) * A(2, 2) - A(0, 0) * A(1, 2) * A(2, 1); - if (dim == 2) return A(0, 0) * A(1, 1) - A(0, 1) * A(1, 0); - if (dim == 1) return A(0, 0); + return A[0, 0] * A[1, 1] * A[2, 2] + A[0, 1] * A[1, 2] * A[2, 0] + + A[0, 2] * A[1, 0] * A[2, 1] - A[0, 2] * A[1, 1] * A[2, 0] - + A[0, 1] * A[1, 0] * A[2, 2] - A[0, 0] * A[1, 2] * A[2, 1]; + if (dim == 2) return A[0, 0] * A[1, 1] - A[0, 1] * A[1, 0]; + if (dim == 1) return A[0, 0]; Numeric ret_val = 0.; @@ -559,14 +559,14 @@ Numeric det(ConstMatrixView A) { for (Index I = 1; I < dim; I++) for (Index J = 0; J < dim; J++) { if (J < j) - temp(I - 1, J) = A(I, J); + temp[I - 1, J] = A[I, J]; else if (J > j) - temp(I - 1, J - 1) = A(I, J); + temp[I - 1, J - 1] = A[I, J]; } Numeric tempNum = det(temp); - ret_val += ((j % 2 == 0) ? -1. : 1.) * tempNum * A(0, j); + ret_val += ((j % 2 == 0) ? -1. : 1.) * tempNum * A[0, j]; } return ret_val; } diff --git a/src/core/matpack/logic.cc b/src/core/matpack/logic.cc index 21a7d0abc5..dafb2de92e 100644 --- a/src/core/matpack/logic.cc +++ b/src/core/matpack/logic.cc @@ -282,7 +282,7 @@ bool is_singular(ConstMatrixView A) { for (Index i = 0; i < A.nrows(); i++) { Numeric big = 0.; for (Index j = 0; j < A.nrows(); j++) { - if ((temp = fabs(A(i, j))) > big) big = temp; + if ((temp = fabs(A[i, j])) > big) big = temp; } // Due to numerical precision the values can deviate from 0.0 if (big < precision) { @@ -308,7 +308,7 @@ bool is_diagonal(ConstMatrixView A) { for (Index i = 1; i < A.ncols(); i++) { for (Index j = 0; j < i; j++) { - if (fabs(A(i, j)) > precision || fabs(A(j, i)) > precision) return false; + if (fabs(A[i, j]) > precision || fabs(A[j, i]) > precision) return false; } } return true; diff --git a/src/core/matpack/math_funcs.cc b/src/core/matpack/math_funcs.cc index 40661fc8aa..3f979e7177 100644 --- a/src/core/matpack/math_funcs.cc +++ b/src/core/matpack/math_funcs.cc @@ -342,7 +342,7 @@ Numeric AngIntegrate_trapezoid(ConstMatrixView Integrand, res1[i] = 0.0; for (Index j = 0; j < m - 1; ++j) { - res1[i] += 0.5 * DEG2RAD * (Integrand(i, j) + Integrand(i, j + 1)) * + res1[i] += 0.5 * DEG2RAD * (Integrand[i, j] + Integrand[i, j + 1]) * (aa_grid[j + 1] - aa_grid[j]) * sin(za_grid[i] * DEG2RAD); } } @@ -390,11 +390,11 @@ Numeric AngIntegrate_trapezoid_opti(ConstMatrixView Integrand, Numeric temp = 0.0; for (Index i = 0; i < n; ++i) { - temp = Integrand(i, 0); + temp = Integrand[i, 0]; for (Index j = 1; j < m - 1; j++) { - temp += Integrand(i, j) * 2; + temp += Integrand[i, j] * 2; } - temp += Integrand(i, m - 1); + temp += Integrand[i, m - 1]; temp *= 0.5 * DEG2RAD * stepsize_aa * sin(za_grid[i] * DEG2RAD); res1[i] = temp; } @@ -630,10 +630,10 @@ void mgd_with_derivatives(VectorView psd, const Numeric eterm = exp(-la * x[ix]); psd[ix] = n0 * eterm; if (do_n0_jac) { - jac_data(0, ix) = eterm; + jac_data[0, ix] = eterm; } if (do_la_jac) { - jac_data(2, ix) = -x[ix] * psd[ix]; + jac_data[2, ix] = -x[ix] * psd[ix]; } } } else { @@ -647,13 +647,13 @@ void mgd_with_derivatives(VectorView psd, const Numeric xterm = pow(x[ix], mu); psd[ix] = n0 * xterm * eterm; if (do_n0_jac) { - jac_data(0, ix) = xterm * eterm; + jac_data[0, ix] = xterm * eterm; } if (do_mu_jac) { - jac_data(1, ix) = log(x[ix]) * psd[ix]; + jac_data[1, ix] = log(x[ix]) * psd[ix]; } if (do_la_jac) { - jac_data(2, ix) = -x[ix] * psd[ix]; + jac_data[2, ix] = -x[ix] * psd[ix]; } psd[ix] = n0 * pow(x[ix], mu) * exp(-la * x[ix]); } @@ -674,16 +674,16 @@ void mgd_with_derivatives(VectorView psd, const Numeric xterm = pow(x[ix], mu); psd[ix] = n0 * xterm * eterm; if (do_n0_jac) { - jac_data(0, ix) = xterm * eterm; + jac_data[0, ix] = xterm * eterm; } if (do_mu_jac) { - jac_data(1, ix) = log(x[ix]) * psd[ix]; + jac_data[1, ix] = log(x[ix]) * psd[ix]; } if (do_la_jac) { - jac_data(2, ix) = -pterm * psd[ix]; + jac_data[2, ix] = -pterm * psd[ix]; } if (do_ga_jac) { - jac_data(3, ix) = -la * pterm * log(x[ix]) * psd[ix]; + jac_data[3, ix] = -la * pterm * log(x[ix]) * psd[ix]; } } } @@ -704,7 +704,7 @@ void delanoe_shape_with_derivative(VectorView psd, for (Index i = 0; i < x.size(); ++i) { Numeric xi = x[i]; psd[i] = beta * f_c * pow(xi, alpha) * exp(-pow(f_d * xi, beta)); - jac_data(0, i) = + jac_data[0, i] = psd[i] * (alpha / xi - beta * f_d * pow(f_d * xi, beta - 1.0)); } } @@ -791,7 +791,7 @@ void flat(VectorView x, ConstMatrixView X) { for (Index c = 0; c < X.ncols(); c++) { for (Index r = 0; r < X.nrows(); r++) { - x[i] = X(r, c); + x[i] = X[r, c]; i += 1; } } @@ -818,7 +818,7 @@ void flat(VectorView x, ConstTensor3View X) { for (Index c = 0; c < X.ncols(); c++) { for (Index r = 0; r < X.nrows(); r++) { for (Index p = 0; p < X.npages(); p++) { - x[i] = X(p, r, c); + x[i] = X[p, r, c]; i += 1; } } @@ -846,7 +846,7 @@ void reshape(Tensor3View X, ConstVectorView x) { for (Index c = 0; c < X.ncols(); c++) { for (Index r = 0; r < X.nrows(); r++) { for (Index p = 0; p < X.npages(); p++) { - X(p, r, c) = x[i]; + X[p, r, c] = x[i]; i += 1; } } @@ -873,7 +873,7 @@ void reshape(MatrixView X, ConstVectorView x) { for (Index c = 0; c < X.ncols(); c++) { for (Index r = 0; r < X.nrows(); r++) { - X(r, c) = x[i]; + X[r, c] = x[i]; i += 1; } } diff --git a/src/core/matpack/matpack_band_matrix.cc b/src/core/matpack/matpack_band_matrix.cc index 0d1b84e4f3..24a22a5739 100644 --- a/src/core/matpack/matpack_band_matrix.cc +++ b/src/core/matpack/matpack_band_matrix.cc @@ -33,7 +33,7 @@ band_matrix::band_matrix(const Matrix& ab) for (Index j = 0; j < N; ++j) { if (i == j) continue; - if (ab(i, j) != 0) { + if (ab[i, j] != 0) { if (j > i) KU = std::max(j - i, KU); else if (j < i) @@ -47,17 +47,17 @@ band_matrix::band_matrix(const Matrix& ab) for (Index j = 0; j < N; j++) { const Index maxi = end_row(j); for (Index i = start_row(j); i < maxi; i++) { - this->operator()(i, j) = ab(i, j); + this->operator[](i, j) = ab[i, j]; } } } -Numeric& band_matrix::operator()(Index i, Index j) { +Numeric& band_matrix::operator[](Index i, Index j) { ARTS_ASSERT( i >= start_row(j), "Out of lower bound. limit: {} vs {}", start_row(j), i) ARTS_ASSERT( i < end_row(j), "Out of upper bound. limit: {} vs {}", end_row(j), i) - return AB(j, KU + KL + i - j); + return AB[j, KU + KL + i - j]; } int band_matrix::solve(Vector& bx) { diff --git a/src/core/matpack/matpack_band_matrix.h b/src/core/matpack/matpack_band_matrix.h index 55ea09c35a..abdbc3fe94 100644 --- a/src/core/matpack/matpack_band_matrix.h +++ b/src/core/matpack/matpack_band_matrix.h @@ -29,7 +29,7 @@ class band_matrix { band_matrix(const Matrix& ab); - Numeric& operator()(Index i, Index j); + Numeric& operator[](Index i, Index j); //! Solves the system of equations A * x = b destructively int solve(Vector& bx); diff --git a/src/core/matpack/matpack_concepts.h b/src/core/matpack/matpack_concepts.h index e4290e612b..1f33721850 100644 --- a/src/core/matpack/matpack_concepts.h +++ b/src/core/matpack/matpack_concepts.h @@ -1,15 +1,14 @@ #pragma once -#include +#include +#include #include #include +#include #include #include -#include -#include - namespace stdx = std::experimental; using Complex = std::complex; @@ -28,17 +27,19 @@ struct matpack_strided_access; //! The basic view type template -class matpack_view; +struct matpack_view; //! The basic data type template class matpack_data; //! The constexpr view type -template struct matpack_constant_view; +template +struct matpack_constant_view; //! The constexpr data type -template struct matpack_constant_data; +template +struct matpack_constant_data; //! Helper bool template @@ -76,7 +77,7 @@ concept arithmetic_subtraction_with = requires(T a, U b) { template concept arithmetic_multiplication_with = requires(T a, U b) { - { a * b } -> std::convertible_to; + { a* b } -> std::convertible_to; }; template @@ -160,7 +161,7 @@ concept has_nlibraries = requires(T a) { //! Eigen uses cols() for column index [exclude ncols and nelem] template concept has_cols = requires(T a) { - { a.cols() } -> integral; + { a.cols() } -> integral; } and not has_ncols and not has_nelem; //! Eigen uses rows() for column index [exclude nrows] @@ -191,80 +192,94 @@ concept has_NumIndices = requires(T) { //! if it is a vector or (if false) if it is a matrix template concept has_IsVectorAtCompileTime = requires(T) { - { std::remove_cvref_t::IsVectorAtCompileTime } -> std::convertible_to; + { + std::remove_cvref_t::IsVectorAtCompileTime + } -> std::convertible_to; }; //! Checks if the type has any accepted types of columns -template concept column_keeper = has_ncols or has_nelem or has_size or has_cols; +template +concept column_keeper = + has_ncols or has_nelem or has_size or has_cols; //! Get a column size from x -template +template constexpr auto column_size(const U& x) { if constexpr (has_cols) { - // Special Eigen::Matrix workaround for vectors + // Special Eigen::Matrix workaround for vectors if constexpr (has_IsVectorAtCompileTime) { if constexpr (U::IsVectorAtCompileTime) { return std::max(x.rows(), x.cols()); } } return x.cols(); - } - else if constexpr (has_size) return x.size(); - else if constexpr (has_nelem) return x.nelem(); - else return x.ncols(); + } else if constexpr (has_size) + return x.size(); + else if constexpr (has_nelem) + return x.nelem(); + else + return x.ncols(); } //! Checks if the type has any accepted types of rows as well as previous sizes -template concept row_keeper = column_keeper and (has_nrows or has_rows); +template +concept row_keeper = column_keeper and (has_nrows or has_rows); //! Get a row size from x -template +template constexpr auto row_size(const U& x) { - if constexpr (has_rows) return x.rows(); - else return x.nrows(); + if constexpr (has_rows) + return x.rows(); + else + return x.nrows(); } //! Checks if the type has any accepted types of pages as well as previous sizes -template concept page_keeper = row_keeper and (has_npages); +template +concept page_keeper = row_keeper and (has_npages); //! Get a page size from x -template +template constexpr auto page_size(const U& x) { return x.npages(); } //! Checks if the type has any accepted types of books as well as previous sizes -template concept book_keeper = page_keeper and (has_nbooks); +template +concept book_keeper = page_keeper and (has_nbooks); //! Get a book size from x -template +template constexpr auto book_size(const U&& x) { return x.nbooks(); } //! Checks if the type has any accepted types of shelves as well as previous sizes -template concept shelf_keeper = book_keeper and (has_nshelves); +template +concept shelf_keeper = book_keeper and (has_nshelves); //! Get a shelf size from x -template +template constexpr auto shelf_size(const U& x) { return x.nshelves(); } //! Checks if the type has any accepted types of vitrines as well as previous sizes -template concept vitrine_keeper = shelf_keeper and (has_nvitrines); +template +concept vitrine_keeper = shelf_keeper and (has_nvitrines); //! Get a vitrine size from x -template +template constexpr auto vitrine_size(const U& x) { return x.nvitrines(); } //! Checks if the type has any accepted types of libraries as well as previous sizes -template concept library_keeper = vitrine_keeper and (has_nlibraries); +template +concept library_keeper = vitrine_keeper and (has_nlibraries); //! Get a library size from x -template +template constexpr auto library_size(const U& x) { return x.nlibraries(); } @@ -276,35 +291,52 @@ constexpr Index mdsize(const std::array& shape) { } //! A rankable multidimensional array -template concept rankable = has_rank or has_NumIndices or has_IsVectorAtCompileTime or has_size or has_nelem; +template +concept rankable = has_rank or has_NumIndices or + has_IsVectorAtCompileTime or has_size or has_nelem; //! Get the rank of the multidimensional array at compile time template constexpr auto rank() { - if constexpr (has_NumIndices) return std::remove_cvref_t::NumIndices; - else if constexpr (has_IsVectorAtCompileTime) return 2 - std::remove_cvref_t::IsVectorAtCompileTime; - else if constexpr (has_rank) return std::remove_cvref_t::rank(); - else if constexpr (has_size) return 1; - else if constexpr (has_nelem) return 1; - else return -1; + if constexpr (has_NumIndices) + return std::remove_cvref_t::NumIndices; + else if constexpr (has_IsVectorAtCompileTime) + return 2 - std::remove_cvref_t::IsVectorAtCompileTime; + else if constexpr (has_rank) + return std::remove_cvref_t::rank(); + else if constexpr (has_size) + return 1; + else if constexpr (has_nelem) + return 1; + else + return -1; } //! Gets the dimension size of some extent -template ()> constexpr Index dimsize(const T& v, integral auto ind) { +template ()> +constexpr Index dimsize(const T& v, integral auto ind) { if constexpr (has_extent) { return v.extent(ind); } else if constexpr (has_dimension) { return v.dimension(ind); } else { switch (dim - ind - 1) { - case 0: if constexpr (dim > 0) return column_size(v); - case 1: if constexpr (dim > 1) return row_size(v); - case 2: if constexpr (dim > 2) return page_size(v); - case 3: if constexpr (dim > 3) return book_size(v); - case 4: if constexpr (dim > 4) return shelf_size(v); - case 5: if constexpr (dim > 5) return vitrine_size(v); - case 6: if constexpr (dim > 6) return library_size(v); - default: {} + case 0: + if constexpr (dim > 0) return column_size(v); + case 1: + if constexpr (dim > 1) return row_size(v); + case 2: + if constexpr (dim > 2) return page_size(v); + case 3: + if constexpr (dim > 3) return book_size(v); + case 4: + if constexpr (dim > 4) return shelf_size(v); + case 5: + if constexpr (dim > 5) return vitrine_size(v); + case 6: + if constexpr (dim > 6) return library_size(v); + default: { + } } return 0; } @@ -318,10 +350,11 @@ concept has_dimsize = requires(T a) { //! Ensure that T is of the type std::array template -concept integral_array = - requires(T a) { {a[0] } -> integral; } and - std::same_as, N>, - std::remove_cvref_t>; +concept integral_array = + requires(T a) { + { a[0] } -> integral; + } and std::same_as, N>, + std::remove_cvref_t>; //! Checks if the type has a shape template @@ -336,14 +369,14 @@ constexpr std::array mdshape(const T& v) { return v.shape(); } else { std::array out; - for (Index i=0; i(dimsize(v, i)); + for (Index i = 0; i < dim; i++) out[i] = static_cast(dimsize(v, i)); return out; } } -constexpr std::array mdshape(const Index&) {return {};} -constexpr std::array mdshape(const Numeric&) {return {};} -constexpr std::array mdshape(const Complex&) {return {};} +constexpr std::array mdshape(const Index&) { return {}; } +constexpr std::array mdshape(const Numeric&) { return {}; } +constexpr std::array mdshape(const Complex&) { return {}; } //! Test that the object can have a shape template @@ -353,9 +386,7 @@ concept has_mdshape = rankable and requires(T a) { //! Test if the object can be accessed by an Index template -concept has_index_access = requires(T a) { - a[Index{}]; -}; +concept has_index_access = requires(T a) { a[Index{}]; }; //! Thest if the object can be iterated over template @@ -370,10 +401,23 @@ concept is_iterable = requires(T a) { template ()> constexpr auto mdvalue(const T& v, const std::array& pos) { if constexpr (dim == 1) { - if constexpr (has_index_access) return v[pos[0]]; - else if constexpr (is_iterable) return *(std::begin(v)+pos[0]); - else {/**/} - } else return std::apply([&v](auto... inds){return v(inds...);}, pos); + if constexpr (has_index_access) + return v[pos[0]]; + else if constexpr (is_iterable) + return *(std::begin(v) + pos[0]); + else { /**/ + } + } else { + return std::apply( + [&v](auto... inds) { + if constexpr (requires { v(inds...); }) { + return v(inds...); + } else { + return v[inds...]; + } + }, + pos); + } } //! The type is arithmetic or complex (for interface reasons, this cannot be @@ -385,10 +429,8 @@ concept math_type = arithmetic or complex_type; //! specific type template concept mdvalue_type_compatible = requires(U a) { - { - mdvalue(a, mdshape(a)) - } -> std::convertible_to; - }; + { mdvalue(a, mdshape(a)) } -> std::convertible_to; +}; //! The underlying value type of the type T template @@ -397,107 +439,119 @@ using matpack_value_type = typename std::remove_cvref_t::value_type; //! Helper struct to test that all the types that define it has the same value type template class same_value_type { -/** Test the types that they are the same + /** Test the types that they are the same * * @return true if all of first, second, rest..., have the same matpack_value_type * @return false otherwise */ -static constexpr bool same() { - using L = matpack_value_type; - using R = matpack_value_type; - if constexpr (sizeof...(rest) == 0) return std::same_as; - else return std::same_as and same_value_type::value; -} + static constexpr bool same() { + using L = matpack_value_type; + using R = matpack_value_type; + if constexpr (sizeof...(rest) == 0) + return std::same_as; + else + return std::same_as and same_value_type::value; + } -public: + public: static constexpr bool value = same(); }; //! Helper bool for ::value on same_value_type template -inline constexpr bool same_value_type_v = same_value_type::value; - +inline constexpr bool same_value_type_v = + same_value_type::value; //! Test that the type U is exactly matpack_view (w/o qualifiers) for any constant, strided template -concept ranked_matpack_view = std::same_as, matpack_view> or - std::same_as, matpack_view> or - std::same_as, matpack_view> or - std::same_as, matpack_view>; +concept ranked_matpack_view = + std::same_as, matpack_view> or + std::same_as, matpack_view> or + std::same_as, matpack_view> or + std::same_as, matpack_view>; //! Test that the type U is exactly matpack_view (w/o qualifiers) for any constant, strided template -concept strict_rank_matpack_view = ranked_matpack_view, N>; +concept strict_rank_matpack_view = + ranked_matpack_view, N>; //! Test that the type U is any matpack_view<...> (w/o qualifiers) template -concept any_matpack_view = rankable and ranked_matpack_view, rank()>; - +concept any_matpack_view = + rankable and ranked_matpack_view, rank()>; //! Test that the type U is exactly matpack_data (w/o qualifiers) template -concept ranked_matpack_data = std::same_as, matpack_data>; +concept ranked_matpack_data = + std::same_as, matpack_data>; //! Test that the type U is exactly matpack_data (w/o qualifiers) template -concept strict_rank_matpack_data = ranked_matpack_data, N>; +concept strict_rank_matpack_data = + ranked_matpack_data, N>; //! Test that the type U is any matpack_data<...> (w/o qualifiers) template -concept any_matpack_data = rankable and ranked_matpack_data, rank()>; - +concept any_matpack_data = + rankable and ranked_matpack_data, rank()>; /** Test that the type U is a matpack_constant_view of a given rank and type (w/o qualifiers) using magic function */ template concept ranked_matpack_constant_view = - std::remove_cvref_t::template magic_test_of_matpack_constant_view(); + std::remove_cvref_t::template magic_test_of_matpack_constant_view(); /** Test that the type U is a matpack_constant_view of a given rank (w/o qualifiers) */ template -concept strict_rank_matpack_constant_view = ranked_matpack_constant_view, N>; +concept strict_rank_matpack_constant_view = + ranked_matpack_constant_view, N>; /** Test that the type U is a matpack_constant_view (w/o qualifiers) */ template -concept any_matpack_constant_view = ranked_matpack_constant_view, rank()>; - +concept any_matpack_constant_view = + ranked_matpack_constant_view, rank()>; /** Test that the type U is a matpack_constant_data of a given rank and type (w/o qualifiers) using magic function */ template concept ranked_matpack_constant_data = - std::remove_cvref_t::template magic_test_of_matpack_constant_data(); + std::remove_cvref_t::template magic_test_of_matpack_constant_data(); /** Test that the type U is a matpack_constant_data of a given rank (w/o qualifiers) */ template -concept strict_rank_matpack_constant_data = ranked_matpack_constant_data, N>; +concept strict_rank_matpack_constant_data = + ranked_matpack_constant_data, N>; /** Test that the type U is a matpack_constant_data (w/o qualifiers) */ template -concept any_matpack_constant_data = ranked_matpack_constant_data, rank()>; - +concept any_matpack_constant_data = + ranked_matpack_constant_data, rank()>; //! Test that the type U is exactly matpack_data or matpack_view or their constant friends (w/o qualifiers) template -concept ranked_matpack_type = ranked_matpack_data or - ranked_matpack_view or - ranked_matpack_constant_data or - ranked_matpack_constant_view; +concept ranked_matpack_type = + ranked_matpack_data or ranked_matpack_view or + ranked_matpack_constant_data or + ranked_matpack_constant_view; //! Test that the type U is strictly ranked matpack_data or matpack_view (w/o qualifiers) -template -concept strict_rank_matpack_type = ranked_matpack_type, N>; +template +concept strict_rank_matpack_type = + ranked_matpack_type, N>; //! Test that the type is any matpack_view or matpack_data template -concept any_matpack_type = ranked_matpack_type, rank()>; - +concept any_matpack_type = + ranked_matpack_type, rank()>; //! Test if the type can be converted to a ranked matpack_data template -concept matpack_convertible = not any_matpack_type and has_mdshape and mdvalue_type_compatible and rank() == N; - +concept matpack_convertible = not any_matpack_type and has_mdshape and + mdvalue_type_compatible and rank() == N; //! Helper to rank a mdspan -template using ranking = stdx::dextents; +template +using ranking = stdx::dextents; //! Helper to define a strided layout mdspan using strided = stdx::layout_stride; diff --git a/src/core/matpack/matpack_constexpr.h b/src/core/matpack/matpack_constexpr.h index 27f3ea5c29..b0cf9424a5 100644 --- a/src/core/matpack/matpack_constexpr.h +++ b/src/core/matpack/matpack_constexpr.h @@ -51,44 +51,50 @@ struct matpack_constant_view { using inner_view = typename inner_type::type; template - [[nodiscard]] constexpr T &operator()(index... i) - requires(not constant and sizeof...(index) == N) + [[nodiscard]] constexpr T &operator[](index... i) + requires(not constant and sizeof...(index) == N and N != 1) { ARTS_ASSERT((std::cmp_less(static_cast(i), alldim) && ...), "{:B,} vs {:B,}", std::array{static_cast(i)...}, shape()) - return view(i...); + return view[i...]; } template - [[nodiscard]] constexpr const T &operator()(index... i) const - requires(sizeof...(index) == N) + [[nodiscard]] constexpr const T &operator[](index... i) const + requires(sizeof...(index) == N and N != 1) { ARTS_ASSERT((std::cmp_less(static_cast(i), alldim) && ...), "{:B,} vs {:B,}", std::array{static_cast(i)...}, shape()) - return view(i...); + return view[i...]; } template - [[nodiscard]] constexpr inner_view operator()(Index i, Jokers... v) + [[nodiscard]] constexpr inner_view operator[](Index i, Jokers... v) requires(not constant and sizeof...(Jokers) == N - 1 and N > 1 and (std::same_as, Joker> and ...)) { ARTS_ASSERT(i < view.extent(0), "{} vs {}", i, extent(0)) - return stdx::submdspan(view, i, v...); + if constexpr ((integral and ...)) + return view[i, v...]; + else + return stdx::submdspan(view, i, v...); } template - [[nodiscard]] constexpr inner_view operator()(Index i, + [[nodiscard]] constexpr inner_view operator[](Index i, Jokers... v) const requires(sizeof...(Jokers) == N - 1 and N > 1 and (std::same_as, Joker> and ...)) { ARTS_ASSERT(i < extent(0), "{} vs {}", i, extent(0)) - return stdx::submdspan(view, i, v...); + if constexpr ((integral and ...)) + return view[i, v...]; + else + return stdx::submdspan(view, i, v...); } [[nodiscard]] constexpr auto operator[](Index i) @@ -267,34 +273,34 @@ struct matpack_constant_data { [[nodiscard]] constexpr auto view() const { return const_view_type{data}; } template - [[nodiscard]] constexpr T &operator()(index... i) - requires(sizeof...(index) == N) + [[nodiscard]] constexpr T &operator[](index... i) + requires(sizeof...(index) == N and N != 1) { - return view()(i...); + return view()[i...]; } template - [[nodiscard]] constexpr T operator()(index... i) const - requires(sizeof...(index) == N) + [[nodiscard]] constexpr T operator[](index... i) const + requires(sizeof...(index) == N and N != 1) { - return view()(i...); + return view()[i...]; } template - [[nodiscard]] constexpr inner_view operator()(Index i, Jokers... v) + [[nodiscard]] constexpr inner_view operator[](Index i, Jokers... v) requires(sizeof...(Jokers) == N - 1 and N > 1 and (std::same_as, Joker> and ...)) { - return view()(i, v...); + return view()[i, v...]; } template - [[nodiscard]] constexpr inner_view operator()(Index i, + [[nodiscard]] constexpr inner_view operator[](Index i, Jokers... v) const requires(sizeof...(Jokers) == N - 1 and N > 1 and (std::same_as, Joker> and ...)) { - return view()(i, v...); + return view()[i, v...]; } [[nodiscard]] constexpr auto operator[](Index i) diff --git a/src/core/matpack/matpack_data.h b/src/core/matpack/matpack_data.h index 0fd3522a33..dc38888b04 100644 --- a/src/core/matpack/matpack_data.h +++ b/src/core/matpack/matpack_data.h @@ -77,7 +77,7 @@ class matpack_data { //! Allow all matpack views to view private information about this class template - friend class matpack_view; + friend struct matpack_view; public: constexpr operator view_type&() { return view; } @@ -317,7 +317,7 @@ class matpack_data { constexpr matpack_data reshape(const std::array& sz) && { using other_view_type = typename matpack_data::view_type; - assert (size() == mdsize(sz)) ; + assert(size() == mdsize(sz)); matpack_data out; out.data = std::move(data); @@ -337,7 +337,7 @@ class matpack_data { template constexpr matpack_view reshape_as( const std::array& sz) { - assert (size() == mdsize(sz)); + assert(size() == mdsize(sz)); return matpack_view{data.data(), sz}; } @@ -352,7 +352,7 @@ class matpack_data { template constexpr matpack_view reshape_as( const std::array& sz) const { - assert (size() == mdsize(sz)); + assert(size() == mdsize(sz)); return matpack_view{const_cast(data.data()), sz}; } @@ -419,21 +419,29 @@ class matpack_data { } template - constexpr auto operator()(access&&... ind) - -> decltype(view(std::forward(ind)...)) { - return view(std::forward(ind)...); + [[nodiscard]] + constexpr auto operator[](access&&... ind) + -> decltype(view[std::forward(ind)...]) + requires(sizeof...(access) == N and N > 1) + { + return view[std::forward(ind)...]; } template - constexpr auto operator()(access&&... ind) const - -> decltype(view(std::forward(ind)...)) const { - return view(std::forward(ind)...); + [[nodiscard]] + constexpr auto operator[](access&&... ind) const + -> decltype(view[std::forward(ind)...]) const + requires(sizeof...(access) == N and N > 1) + { + return view[std::forward(ind)...]; } template + [[nodiscard]] constexpr auto operator[](access&& ind) -> decltype(view[std::forward(ind)]) { return view[std::forward(ind)]; } template + [[nodiscard]] constexpr auto operator[](access&& ind) const -> decltype(view[std::forward(ind)]) const { return view[std::forward(ind)]; @@ -532,7 +540,7 @@ class matpack_data { if constexpr (N == 1) return data[std::get<0>(std::tuple{inds...})]; else - return view(inds...); + return view[inds...]; } //! Access the data elements regardless of the matpack data rank template @@ -543,7 +551,7 @@ class matpack_data { if constexpr (N == 1) return data[std::get<0>(std::tuple{inds...})]; else - return view(inds...); + return view[inds...]; } //! Iterate over this object element-wise --- return the first of these iterators @@ -785,8 +793,7 @@ class matpack_data { template std::string describe(const matpack_data& m) { using namespace matpack; - return std::format( - "matpack_data of rank {} of shape {:B,}", N, m.shape()); + return std::format("matpack_data of rank {} of shape {:B,}", N, m.shape()); } } // namespace matpack diff --git a/src/core/matpack/matpack_iter.h b/src/core/matpack/matpack_iter.h index d9a365f1d4..06ef5a9234 100644 --- a/src/core/matpack/matpack_iter.h +++ b/src/core/matpack/matpack_iter.h @@ -33,13 +33,12 @@ template //! Helper to return smaller span type when accessed by a index template [[nodiscard]] constexpr decltype(auto) sub(mdspan_type &v, Index i) { - using namespace stdx; return std::apply( [&v](auto &&...slices) { - if constexpr (requires { v(slices...); }) { - return v(slices...); + if constexpr (requires { v[slices...]; }) { + return v[slices...]; } else { - return submdspan(v, slices...); + return stdx::submdspan(v, slices...); } }, tup(i)); @@ -48,13 +47,12 @@ template //! Helper to return smaller span type when accessed by a index template [[nodiscard]] constexpr decltype(auto) sub(mdspan_type &v, const stdx::strided_slice& i) { - using namespace stdx; return std::apply( [&v](auto &&...slices) { - if constexpr (requires { v(slices...); }) { - return v(slices...); + if constexpr (requires { v[slices...]; }) { + return v[slices...]; } else { - return submdspan(v, slices...); + return stdx::submdspan(v, slices...); } }, tup(i)); @@ -119,7 +117,7 @@ class matpack_mditer { if constexpr (N == 1) { return orig->operator[](pos); } else { - return sub(*orig, pos); + return sub(orig->view, pos); } } @@ -129,7 +127,7 @@ class matpack_mditer { if constexpr (N == 1) { return orig->operator[](pos + i); } else { - return sub(*orig, pos + i); + return sub(orig->view, pos + i); } } }; @@ -246,7 +244,7 @@ class matpack_elemwise_mditer { else return std::apply( [this](auto... inds) -> std::conditional_t { - return orig->operator()(inds...); + return orig->operator[](inds...); }, pos.pos); } @@ -258,7 +256,7 @@ class matpack_elemwise_mditer { else return std::apply( [this](auto... inds) -> std::conditional_t { - return orig->operator()(inds...); + return orig->operator[](inds...); }, (pos + i).pos); } diff --git a/src/core/matpack/matpack_math.h b/src/core/matpack/matpack_math.h index c82c0424b0..2f4b103714 100644 --- a/src/core/matpack/matpack_math.h +++ b/src/core/matpack/matpack_math.h @@ -35,7 +35,7 @@ constexpr MAT &inplace_transpose(MAT &x) { ARTS_ASSERT(x.nrows() == x.ncols(), "Matrix must be square") for (Index i = 0; i < x.nrows(); ++i) { for (Index j = 0; j < i; ++j) { - std::swap(x(i, j), x(j, i)); + std::swap(x[i, j], x[j, i]); } } return x; diff --git a/src/core/matpack/matpack_sparse.cc b/src/core/matpack/matpack_sparse.cc index 9926f30879..4fd5d8fbd2 100644 --- a/src/core/matpack/matpack_sparse.cc +++ b/src/core/matpack/matpack_sparse.cc @@ -83,7 +83,7 @@ Numeric& Sparse::rw(Index r, Index c) { \return The data element with these indices. */ -Numeric Sparse::operator()(Index r, Index c) const { +Numeric Sparse::operator[](Index r, Index c) const { return matrix.coeff((int)r, (int)c); } @@ -171,7 +171,7 @@ Sparse::operator Matrix() const { for (int i = 0; i < m; i++) { Eigen::SparseMatrix::InnerIterator it(matrix, i); for (; it; ++it) { - A(it.row(), it.col()) = it.value(); + A[it.row(), it.col()] = it.value(); } } return A; diff --git a/src/core/matpack/matpack_sparse.h b/src/core/matpack/matpack_sparse.h index a3bfdc1d9a..91661c80b5 100644 --- a/src/core/matpack/matpack_sparse.h +++ b/src/core/matpack/matpack_sparse.h @@ -102,7 +102,7 @@ struct Sparse { // Index Operators: [[nodiscard]] Numeric& rw(Index r, Index c); [[nodiscard]] Numeric ro(Index r, Index c) const; - [[nodiscard]] Numeric operator()(Index r, Index c) const; + [[nodiscard]] Numeric operator[](Index r, Index c) const; // Arithmetic operators: Sparse& operator+=(const Sparse& x); diff --git a/src/core/matpack/matpack_view.h b/src/core/matpack/matpack_view.h index 7917b1b3e3..3cc6a52156 100644 --- a/src/core/matpack/matpack_view.h +++ b/src/core/matpack/matpack_view.h @@ -321,7 +321,7 @@ std::string access_str(access... ind) { //! The basic view type template -class matpack_view { +struct matpack_view { static_assert(N > 0); //! The strided view type from mdspan @@ -380,7 +380,7 @@ class matpack_view { //! Allow any other matpack view type to access the private parts of this object template - friend class matpack_view; + friend struct matpack_view; //! Sets this view to another view type, ignoring shape-checks constexpr void secret_set(view_type x) { view = std::move(x); } @@ -699,8 +699,8 @@ class matpack_view { template , class ret_t = mutable_access> - [[nodiscard]] constexpr auto operator()(access&&... ind) -> ret_t - requires(sizeof...(access) == N and not constant) + [[nodiscard]] constexpr auto operator[](access&&... ind) -> ret_t + requires(sizeof...(access) == N and not constant and N > 1) { assert(check_index_sizes(view, 0, std::forward(ind)...)); ARTS_ASSERT(check_index_sizes(view, 0, std::forward(ind)...), @@ -708,7 +708,7 @@ class matpack_view { shape(), access_str(ind...)) if constexpr (N == M) - return view(std::forward(ind)...); + return view[std::forward(ind)...]; else return submdspan_substride(std::forward(ind)...); } @@ -716,8 +716,8 @@ class matpack_view { template , class ret_t = constant_access> - [[nodiscard]] constexpr auto operator()(access&&... ind) const -> ret_t - requires(sizeof...(access) == N) + [[nodiscard]] constexpr auto operator[](access&&... ind) const -> ret_t + requires(sizeof...(access) == N and N > 1) { assert(check_index_sizes(view, 0, std::forward(ind)...)); ARTS_ASSERT(check_index_sizes(view, 0, std::forward(ind)...), @@ -725,7 +725,7 @@ class matpack_view { shape(), access_str(ind...)) if constexpr (N == M) - return view(std::forward(ind)...); + return view[std::forward(ind)...]; else return submdspan_substride(std::forward(ind)...); } @@ -766,7 +766,7 @@ class matpack_view { /** Take a slice of the left-most dimension of this object * - * Unlike the operator() call, this will preserve the stridedness of the + * Unlike the operator[] call, this will preserve the stridedness of the * view, allowing you to use the much more efficient contigious element * access patterns * @@ -774,6 +774,7 @@ class matpack_view { * @param nelem Length of new view * @return matpack_view Slice of the view */ + [[nodiscard]] matpack_view slice(Index i0, Index nelem) { assert(extent(0) >= i0 + nelem); ARTS_ASSERT(extent(0) >= i0 + nelem, @@ -786,7 +787,7 @@ class matpack_view { /** Take a slice of the left-most dimension of this object * - * Unlike the operator() call, this will preserve the stridedness of the + * Unlike the operator[] call, this will preserve the stridedness of the * view, allowing you to use the much more efficient contigious element * access patterns * @@ -794,6 +795,7 @@ class matpack_view { * @param nelem Length of new view * @return matpack_view Slice of the view */ + [[nodiscard]] matpack_view slice(Index i0, Index nelem) const { assert(extent(0) >= i0 + nelem); ARTS_ASSERT(extent(0) >= i0 + nelem, @@ -814,6 +816,7 @@ class matpack_view { * @param[in] i The left-most index access * @return matpack_view Exhaustive slice of the sub-view */ + [[nodiscard]] matpack_view as_slice(Index i) requires(N > 1) { @@ -830,6 +833,7 @@ class matpack_view { * @param[in] i The left-most index access * @return matpack_view Exhaustive slice of the sub-view */ + [[nodiscard]] matpack_view as_slice(Index i) const requires(N > 1) { @@ -1059,7 +1063,7 @@ class matpack_view { const std::array& sz) const requires(not strided) { - assert (size() == mdsize(sz)) ; + assert(size() == mdsize(sz)); return matpack_view{data_handle(), sz}; } @@ -1352,7 +1356,7 @@ class matpack_view { this->operator[](i) = mdvalue(x, pos.pos); else std::apply( - [this](auto... ind) -> T& { return this->operator()(ind...); }, + [this](auto... ind) -> T& { return this->operator[](ind...); }, pos.pos) = mdvalue(x, pos.pos); ++pos; } @@ -1403,13 +1407,15 @@ template std::string describe(const matpack_view& m) { using namespace matpack; if constexpr (constant and strided) - return std::format("constant and strided matpack_view of rank {} of shape {}", - N, - m.shape()); + return std::format( + "constant and strided matpack_view of rank {} of shape {}", + N, + m.shape()); else if constexpr (constant) - return std::format("constant and exhaustive matpack_view of rank {} of shape {}", - N, - m.shape()); + return std::format( + "constant and exhaustive matpack_view of rank {} of shape {}", + N, + m.shape()); else if constexpr (strided) return std::format( "strided matpack_view of rank {} of shape {}", N, m.shape()); diff --git a/src/core/matpack/poly_roots.cc b/src/core/matpack/poly_roots.cc index 9d5dafa439..df70da4ebe 100644 --- a/src/core/matpack/poly_roots.cc +++ b/src/core/matpack/poly_roots.cc @@ -97,8 +97,8 @@ int poly_root_solve(Matrix &roots, Vector &coeffs) { #ifndef USE_DOUBLE if (status == GSL_SUCCESS) { for (Index i = 0; i < a - 1; i++) { - roots(i, 0) = (Numeric)s[i * 2]; - roots(i, 1) = (Numeric)s[i * 2 + 1]; + roots[i, 0] = (Numeric)s[i * 2]; + roots[i, 1] = (Numeric)s[i * 2 + 1]; } } diff --git a/src/core/matpack/sorted_grid.h b/src/core/matpack/sorted_grid.h index 7f06ee0bb6..0d24d5f376 100644 --- a/src/core/matpack/sorted_grid.h +++ b/src/core/matpack/sorted_grid.h @@ -103,11 +103,6 @@ class grid { operator ConstVectorView() const { return x; } operator ExhaustiveConstVectorView() const { return x; } - template - [[nodiscard]] constexpr auto operator()(const Op& op) const { - return x(op); - } - template [[nodiscard]] constexpr auto operator[](const Op& op) const { return x[op]; diff --git a/src/core/mc_antenna.cc b/src/core/mc_antenna.cc index 1cb67a627d..3e559b1be6 100644 --- a/src/core/mc_antenna.cc +++ b/src/core/mc_antenna.cc @@ -32,17 +32,17 @@ void rotmat_enu(MatrixView R_ant2enu, ConstVectorView prop_los) caa = cos(prop_los[1] * DEG2RAD); saa = sin(prop_los[1] * DEG2RAD); - R_ant2enu(0, 0) = -cza * saa; - R_ant2enu(0, 1) = caa; - R_ant2enu(0, 2) = sza * saa; + R_ant2enu[0, 0] = -cza * saa; + R_ant2enu[0, 1] = caa; + R_ant2enu[0, 2] = sza * saa; - R_ant2enu(1, 0) = -cza * caa; - R_ant2enu(1, 1) = -saa; - R_ant2enu(1, 2) = sza * caa; + R_ant2enu[1, 0] = -cza * caa; + R_ant2enu[1, 1] = -saa; + R_ant2enu[1, 2] = sza * caa; - R_ant2enu(2, 0) = sza; - R_ant2enu(2, 1) = 0.0; - R_ant2enu(2, 2) = cza; + R_ant2enu[2, 0] = sza; + R_ant2enu[2, 1] = 0.0; + R_ant2enu[2, 2] = cza; } void rotmat_stokes(MatrixView R_pra, @@ -55,18 +55,18 @@ void rotmat_stokes(MatrixView R_pra, const Numeric flip = f1_dir * f2_dir; Numeric cos_pra1, sin_pra1, cos_pra2, sin_pra2; - cos_pra1 = R_f1(joker, 0) * R_f2(joker, 0); - sin_pra1 = f2_dir * (R_f1(joker, 0) * R_f2(joker, 1)); - sin_pra2 = f1_dir * (R_f1(joker, 1) * R_f2(joker, 0)); - cos_pra2 = f1_dir * f2_dir * (R_f1(joker, 1) * R_f2(joker, 1)); + cos_pra1 = R_f1[joker, 0] * R_f2[joker, 0]; + sin_pra1 = f2_dir * (R_f1[joker, 0] * R_f2[joker, 1]); + sin_pra2 = f1_dir * (R_f1[joker, 1] * R_f2[joker, 0]); + cos_pra2 = f1_dir * f2_dir * (R_f1[joker, 1] * R_f2[joker, 1]); R_pra = 0.0; - R_pra(0, 0) = 1.0; - R_pra(1, 1) = 2 * cos_pra1 * cos_pra1 - 1.0; - R_pra(1, 2) = flip * 2 * cos_pra1 * sin_pra1; - R_pra(2, 1) = 2 * cos_pra2 * sin_pra2; - R_pra(2, 2) = flip * (2 * cos_pra2 * cos_pra2 - 1.0); - R_pra(3, 3) = flip * 1.0; + R_pra[0, 0] = 1.0; + R_pra[1, 1] = 2 * cos_pra1 * cos_pra1 - 1.0; + R_pra[1, 2] = flip * 2 * cos_pra1 * sin_pra1; + R_pra[2, 1] = 2 * cos_pra2 * sin_pra2; + R_pra[2, 2] = flip * (2 * cos_pra2 * cos_pra2 - 1.0); + R_pra[3, 3] = flip * 1.0; } void MCAntenna::set_pencil_beam() { atype = ANTENNA_TYPE_PENCIL_BEAM; } @@ -107,7 +107,7 @@ void MCAntenna::return_los(Numeric& wgt, case ANTENNA_TYPE_GAUSSIAN: - mult(k_vhk, R_enu2ant, R_return(joker, 2)); + mult(k_vhk, R_enu2ant, R_return[joker, 2]); // Assume Gaussian is narrow enough that response is 0 beyond 90 degrees // Same assumption is made for drawing samples (draw_los) @@ -168,27 +168,27 @@ void MCAntenna::draw_los(VectorView sampled_rte_los, k_vhk[0] = tel / ant_r; k_vhk[1] = taz / ant_r; k_vhk[2] = (Numeric)1.0 / ant_r; - mult(R_los(joker, 2), R_ant2enu, k_vhk); + mult(R_los[joker, 2], R_ant2enu, k_vhk); - sampled_rte_los[0] = acos(R_los(2, 2)) * RAD2DEG; + sampled_rte_los[0] = acos(R_los[2, 2]) * RAD2DEG; // Horizontal polarization basis // If drawn los is at zenith or nadir, assume same azimuth as boresight - if (((Numeric)1.0 - abs(R_los(2, 2))) < DBL_EPSILON) { + if (((Numeric)1.0 - abs(R_los[2, 2])) < DBL_EPSILON) { // H is aligned with H of bs, use row not column because tranpose - R_los(joker, 1) = R_ant2enu(1, joker); + R_los[joker, 1] = R_ant2enu[1, joker]; sampled_rte_los[1] = bore_sight_los[1]; } else { const Vector uhat{0.0, 0.0, 1.0}; Numeric magh; - sampled_rte_los[1] = atan2(R_los(0, 2), R_los(1, 2)) * RAD2DEG; - cross3(R_los(joker, 1), R_los(joker, 2), uhat); - magh = sqrt(R_los(joker, 1) * R_los(joker, 1)); - R_los(joker, 1) /= magh; + sampled_rte_los[1] = atan2(R_los[0, 2], R_los[1, 2]) * RAD2DEG; + cross3(R_los[joker, 1], R_los[joker, 2], uhat); + magh = sqrt(R_los[joker, 1] * R_los[joker, 1]); + R_los[joker, 1] /= magh; } // Vertical polarization basis - cross3(R_los(joker, 0), R_los(joker, 1), R_los(joker, 2)); + cross3(R_los[joker, 0], R_los[joker, 1], R_los[joker, 2]); break; diff --git a/src/core/mc_interp.cc b/src/core/mc_interp.cc index ed44ed3dd7..cef0fa1109 100644 --- a/src/core/mc_interp.cc +++ b/src/core/mc_interp.cc @@ -65,8 +65,8 @@ void interp(MatrixView tia, for (Index inr = 0; inr < anr; inr++) for (Index inc = 0; inc < anc; inc++) { - tia(inr, inc) = - a[tc.idx](inr, inc) * itw[0] + a[tc.idx + 1](inr, inc) * itw[1]; + tia[inr, inc] = + a[tc.idx][inr, inc] * itw[0] + a[tc.idx + 1][inr, inc] * itw[1]; } } @@ -140,7 +140,7 @@ void interp_scat_angle_temperature( //Output: for (Index i = 0; i < 6; i++) { pha_mat_int[i] = interp( - itw, scat_data_single.pha_mat_data(0, 0, joker, 0, 0, 0, i), thet_gp); + itw, scat_data_single.pha_mat_data[0, 0, joker, 0, 0, 0, i], thet_gp); } } else { gridpos(t_gp, scat_data_single.T_grid, rtp_temperature); @@ -151,7 +151,7 @@ void interp_scat_angle_temperature( //Output: for (Index i = 0; i < 6; i++) { pha_mat_int[i] = interp(itw, - scat_data_single.pha_mat_data(0, joker, joker, 0, 0, 0, i), + scat_data_single.pha_mat_data[0, joker, joker, 0, 0, 0, i], t_gp, thet_gp); } diff --git a/src/core/nlte.cc b/src/core/nlte.cc index d0879ccb21..55b9ae3a0e 100644 --- a/src/core/nlte.cc +++ b/src/core/nlte.cc @@ -39,11 +39,11 @@ void statistical_equilibrium_equation(MatrixView A, const Index i = upper[iline]; const Index j = lower[iline]; - A(j, j) -= Bji[iline] * Jij[iline] + Cji[iline]; - A(i, i) -= Aij[iline] + Bij[iline] * Jij[iline] + Cij[iline]; + A[j, j] -= Bji[iline] * Jij[iline] + Cji[iline]; + A[i, i] -= Aij[iline] + Bij[iline] * Jij[iline] + Cij[iline]; - A(j, i) += Aij[iline] + Bij[iline] * Jij[iline] + Cij[iline]; - A(i, j) += Bji[iline] * Jij[iline] + Cji[iline]; + A[j, i] += Aij[iline] + Bij[iline] * Jij[iline] + Cij[iline]; + A[i, j] += Bji[iline] * Jij[iline] + Cji[iline]; } } @@ -71,13 +71,13 @@ void dampened_statistical_equilibrium_equation( total_number_count * (x[i] * Aij[iline] / (x[j] * Bji[iline] - x[i] * Bij[iline])); - A(j, j) -= Bji[iline] * (Jij[iline] - Lambda[iline] * Source) + Cji[iline]; - A(i, i) -= Aij[iline] * (1.0 - Lambda[iline]) + + A[j, j] -= Bji[iline] * (Jij[iline] - Lambda[iline] * Source) + Cji[iline]; + A[i, i] -= Aij[iline] * (1.0 - Lambda[iline]) + Bij[iline] * (Jij[iline] - Lambda[iline] * Source) + Cij[iline]; - A(j, i) += Aij[iline] * (1.0 - Lambda[iline]) + + A[j, i] += Aij[iline] * (1.0 - Lambda[iline]) + Bij[iline] * (Jij[iline] - Lambda[iline] * Source) + Cij[iline]; - A(i, j) += Bji[iline] * (Jij[iline] - Lambda[iline] * Source) + Cji[iline]; + A[i, j] += Bji[iline] * (Jij[iline] - Lambda[iline] * Source) + Cji[iline]; } } @@ -85,7 +85,7 @@ void set_constant_statistical_equilibrium_matrix(MatrixView A, VectorView x, const Numeric& sem_ratio, const Index row) { - A(row, joker) = 1.0; + A[row, joker] = 1.0; x[row] = sem_ratio; } diff --git a/src/core/optproperties.cc b/src/core/optproperties.cc index 4dcb15a36c..e9abe32c30 100644 --- a/src/core/optproperties.cc +++ b/src/core/optproperties.cc @@ -171,15 +171,15 @@ void opt_prop_ScatSpecBulk( //Output ARTS_ASSERT(nT == abs_vec_se[i_ss][i_se].npages()); for (Index Tind = 0; Tind < nT; Tind++) { - if (pnds(i_se_flat, Tind) != 0.) { - if (t_ok(i_se_flat, Tind) > 0.) { - ext_tmp = ext_mat_se[i_ss][i_se](joker, Tind, joker, joker, joker); - ext_tmp *= pnds(i_se_flat, Tind); - ext_mat[i_ss](joker, Tind, joker, joker, joker) += ext_tmp; - - abs_tmp = abs_vec_se[i_ss][i_se](joker, Tind, joker, joker); - abs_tmp *= pnds(i_se_flat, Tind); - abs_vec[i_ss](joker, Tind, joker, joker) += abs_tmp; + if (pnds[i_se_flat, Tind] != 0.) { + if (t_ok[i_se_flat, Tind] > 0.) { + ext_tmp = ext_mat_se[i_ss][i_se][joker, Tind, joker, joker, joker]; + ext_tmp *= pnds[i_se_flat, Tind]; + ext_mat[i_ss][joker, Tind, joker, joker, joker] += ext_tmp; + + abs_tmp = abs_vec_se[i_ss][i_se][joker, Tind, joker, joker]; + abs_tmp *= pnds[i_se_flat, Tind]; + abs_vec[i_ss][joker, Tind, joker, joker] += abs_tmp; } else { ARTS_USER_ERROR( "Interpolation error for (flat-array) scattering element #{}\nat location/temperature point #{}\n", @@ -274,7 +274,7 @@ void opt_prop_NScatElems( //Output opt_prop_1ScatElem(ext_mat[i_ss][i_se], abs_vec[i_ss][i_se], ptypes[i_ss][i_se], - t_ok(i_se_flat, joker), + t_ok[i_se_flat, joker], scat_data[i_ss][i_se], T_array, dir_array, @@ -467,17 +467,17 @@ void opt_prop_1ScatElem( //Output Tensor3 ext_mat_tmp(nf, 4, 4); Matrix abs_vec_tmp(nf, 4); for (Index find = 0; find < nf; find++) { - ext_mat_SSD2Stokes(ext_mat_tmp(find, joker, joker), - ssd.ext_mat_data(find + f_start, 0, 0, 0, joker), + ext_mat_SSD2Stokes(ext_mat_tmp[find, joker, joker], + ssd.ext_mat_data[find + f_start, 0, 0, 0, joker], ptype); - abs_vec_SSD2Stokes(abs_vec_tmp(find, joker), - ssd.abs_vec_data(find + f_start, 0, 0, 0, joker), + abs_vec_SSD2Stokes(abs_vec_tmp[find, joker], + ssd.abs_vec_data[find + f_start, 0, 0, 0, joker], ptype); } for (Index Tind = 0; Tind < nTout; Tind++) for (Index dind = 0; dind < nDir; dind++) { - ext_mat(joker, Tind, dind, joker, joker) = ext_mat_tmp; - abs_vec(joker, Tind, dind, joker) = abs_vec_tmp; + ext_mat[joker, Tind, dind, joker, joker] = ext_mat_tmp; + abs_vec[joker, Tind, dind, joker] = abs_vec_tmp; } } else // T-interpolation required (but not dir). To be done on the compact // ssd format. @@ -488,37 +488,37 @@ void opt_prop_1ScatElem( //Output Matrix abs_vec_tmp_ssd(nTout, ssd.abs_vec_data.ncols()); for (Index find = 0; find < nf; find++) { for (Index nst = 0; nst < ext_mat_tmp_ssd.ncols(); nst++) { - reinterp(ext_mat_tmp_ssd(joker, nst), - ssd.ext_mat_data(find + f_start, joker, 0, 0, nst), + reinterp(ext_mat_tmp_ssd[joker, nst], + ssd.ext_mat_data[find + f_start, joker, 0, 0, nst], T_itw_lag, T_lag); } for (Index Tind = 0; Tind < nTout; Tind++) if (t_ok[Tind] > 0.) - ext_mat_SSD2Stokes(ext_mat_tmp(find, Tind, joker, joker), - ext_mat_tmp_ssd(Tind, joker), + ext_mat_SSD2Stokes(ext_mat_tmp[find, Tind, joker, joker], + ext_mat_tmp_ssd[Tind, joker], ptype); else - ext_mat_tmp(find, Tind, joker, joker) = 0.; + ext_mat_tmp[find, Tind, joker, joker] = 0.; for (Index nst = 0; nst < abs_vec_tmp_ssd.ncols(); nst++) { - reinterp(abs_vec_tmp_ssd(joker, nst), - ssd.abs_vec_data(find + f_start, joker, 0, 0, nst), + reinterp(abs_vec_tmp_ssd[joker, nst], + ssd.abs_vec_data[find + f_start, joker, 0, 0, nst], T_itw_lag, T_lag); } for (Index Tind = 0; Tind < nTout; Tind++) if (t_ok[Tind] > 0.) - abs_vec_SSD2Stokes(abs_vec_tmp(find, Tind, joker), - abs_vec_tmp_ssd(Tind, joker), + abs_vec_SSD2Stokes(abs_vec_tmp[find, Tind, joker], + abs_vec_tmp_ssd[Tind, joker], ptype); else - abs_vec_tmp(find, Tind, joker) = 0.; + abs_vec_tmp[find, Tind, joker] = 0.; } for (Index dind = 0; dind < nDir; dind++) { - ext_mat(joker, joker, dind, joker, joker) = ext_mat_tmp; - abs_vec(joker, joker, dind, joker) = abs_vec_tmp; + ext_mat[joker, joker, dind, joker, joker] = ext_mat_tmp; + abs_vec[joker, joker, dind, joker] = abs_vec_tmp; } } @@ -533,7 +533,7 @@ void opt_prop_1ScatElem( //Output // derive the direction interpolation weights. ArrayOfGridPos dir_gp(nDir); - gridpos(dir_gp, ssd.za_grid, dir_array(joker, 0)); + gridpos(dir_gp, ssd.za_grid, dir_array[joker, 0]); Matrix dir_itw(nDir, 2); // only interpolating in za, ie 1D linear interpol interpweights(dir_itw, dir_gp); @@ -548,29 +548,29 @@ void opt_prop_1ScatElem( //Output Tensor3 abs_vec_tmp(nf, nDir, 4); for (Index find = 0; find < nf; find++) { for (Index nst = 0; nst < next; nst++) - interp(ext_mat_tmp_ssd(joker, nst), + interp(ext_mat_tmp_ssd[joker, nst], dir_itw, - ssd.ext_mat_data(find + f_start, 0, joker, 0, nst), + ssd.ext_mat_data[find + f_start, 0, joker, 0, nst], dir_gp); for (Index Dind = 0; Dind < nDir; Dind++) - ext_mat_SSD2Stokes(ext_mat_tmp(find, Dind, joker, joker), - ext_mat_tmp_ssd(Dind, joker), + ext_mat_SSD2Stokes(ext_mat_tmp[find, Dind, joker, joker], + ext_mat_tmp_ssd[Dind, joker], ptype); for (Index nst = 0; nst < nabs; nst++) - interp(abs_vec_tmp_ssd(joker, nst), + interp(abs_vec_tmp_ssd[joker, nst], dir_itw, - ssd.abs_vec_data(find + f_start, 0, joker, 0, nst), + ssd.abs_vec_data[find + f_start, 0, joker, 0, nst], dir_gp); for (Index Dind = 0; Dind < nDir; Dind++) - abs_vec_SSD2Stokes(abs_vec_tmp(find, Dind, joker), - abs_vec_tmp_ssd(Dind, joker), + abs_vec_SSD2Stokes(abs_vec_tmp[find, Dind, joker], + abs_vec_tmp_ssd[Dind, joker], ptype); } for (Index Tind = 0; Tind < nTout; Tind++) { - ext_mat(joker, Tind, joker, joker, joker) = ext_mat_tmp; - abs_vec(joker, Tind, joker, joker) = abs_vec_tmp; + ext_mat[joker, Tind, joker, joker, joker] = ext_mat_tmp; + abs_vec[joker, Tind, joker, joker] = abs_vec_tmp; } } else // T- and dir-interpolation required. To be done on the compact ssd // format. @@ -583,38 +583,38 @@ void opt_prop_1ScatElem( //Output for (Index find = 0; find < nf; find++) { for (Index Tind = 0; Tind < nTin; Tind++) { for (Index nst = 0; nst < next; nst++) - interp(ext_mat_tmp_ssd(Tind, joker, nst), + interp(ext_mat_tmp_ssd[Tind, joker, nst], dir_itw, - ssd.ext_mat_data(find + f_start, Tind, joker, 0, nst), + ssd.ext_mat_data[find + f_start, Tind, joker, 0, nst], dir_gp); for (Index nst = 0; nst < nabs; nst++) - interp(abs_vec_tmp_ssd(Tind, joker, nst), + interp(abs_vec_tmp_ssd[Tind, joker, nst], dir_itw, - ssd.abs_vec_data(find + f_start, Tind, joker, 0, nst), + ssd.abs_vec_data[find + f_start, Tind, joker, 0, nst], dir_gp); } for (Index Dind = 0; Dind < nDir; Dind++) { for (Index nst = 0; nst < next; nst++) { - reinterp(ext_mat_tmp(joker, nst), - ext_mat_tmp_ssd(joker, Dind, nst), + reinterp(ext_mat_tmp[joker, nst], + ext_mat_tmp_ssd[joker, Dind, nst], T_itw_lag, T_lag); } for (Index Tind = 0; Tind < nTout; Tind++) - ext_mat_SSD2Stokes(ext_mat(find, Tind, Dind, joker, joker), - ext_mat_tmp(Tind, joker), + ext_mat_SSD2Stokes(ext_mat[find, Tind, Dind, joker, joker], + ext_mat_tmp[Tind, joker], ptype); for (Index nst = 0; nst < nabs; nst++) { - reinterp(abs_vec_tmp(joker, nst), - abs_vec_tmp_ssd(joker, Dind, nst), + reinterp(abs_vec_tmp[joker, nst], + abs_vec_tmp_ssd[joker, Dind, nst], T_itw_lag, T_lag); } for (Index Tind = 0; Tind < nTout; Tind++) - abs_vec_SSD2Stokes(abs_vec(find, Tind, Dind, joker), - abs_vec_tmp(Tind, joker), + abs_vec_SSD2Stokes(abs_vec[find, Tind, Dind, joker], + abs_vec_tmp[Tind, joker], ptype); } } @@ -647,14 +647,14 @@ void ext_mat_SSD2Stokes( //Output ext_mat_stokes = 0.; for (Index ist = 0; ist < 4; ist++) { - ext_mat_stokes(ist, ist) = ext_mat_ssd[0]; + ext_mat_stokes[ist, ist] = ext_mat_ssd[0]; } if (ptype > PTYPE_TOTAL_RND) { - ext_mat_stokes(2, 3) = ext_mat_ssd[2]; - ext_mat_stokes(3, 2) = -ext_mat_ssd[2]; - ext_mat_stokes(0, 1) = ext_mat_ssd[1]; - ext_mat_stokes(1, 0) = ext_mat_ssd[1]; + ext_mat_stokes[2, 3] = ext_mat_ssd[2]; + ext_mat_stokes[3, 2] = -ext_mat_ssd[2]; + ext_mat_stokes[0, 1] = ext_mat_ssd[1]; + ext_mat_stokes[1, 0] = ext_mat_ssd[1]; } } @@ -780,12 +780,12 @@ void pha_mat_ScatSpecBulk( //Output ARTS_ASSERT(nT == pha_mat_se[i_ss][i_se].nshelves()); for (Index Tind = 0; Tind < nT; Tind++) { - if (pnds(i_se_flat, Tind) != 0.) { - if (t_ok(i_se_flat, Tind) > 0.) { + if (pnds[i_se_flat, Tind] != 0.) { + if (t_ok[i_se_flat, Tind] > 0.) { pha_tmp = - pha_mat_se[i_ss][i_se](joker, Tind, joker, joker, joker, joker); - pha_tmp *= pnds(i_se_flat, Tind); - pha_mat[i_ss](joker, Tind, joker, joker, joker, joker) += pha_tmp; + pha_mat_se[i_ss][i_se][joker, Tind, joker, joker, joker, joker]; + pha_tmp *= pnds[i_se_flat, Tind]; + pha_mat[i_ss][joker, Tind, joker, joker, joker, joker] += pha_tmp; } else { ARTS_USER_ERROR( "Interpolation error for (flat-array) scattering element #{}\nat location/temperature point #{}\n", @@ -878,7 +878,7 @@ void pha_mat_NScatElems( //Output pha_mat_1ScatElem(pha_mat[i_ss][i_se], ptypes[i_ss][i_se], - t_ok(i_se_flat, joker), + t_ok[i_se_flat, joker], scat_data[i_ss][i_se], T_array, pdir_array, @@ -970,10 +970,10 @@ void pha_mat_1ScatElem( //Output for (Index pdir = 0; pdir < npDir; pdir++) for (Index idir = 0; idir < niDir; idir++) { // calc scat ang theta from incident and prop dirs - Numeric theta = scat_angle(pdir_array(pdir, 0), - pdir_array(pdir, 1), - idir_array(idir, 0), - idir_array(idir, 1)); + Numeric theta = scat_angle(pdir_array[pdir, 0], + pdir_array[pdir, 1], + idir_array[idir, 0], + idir_array[idir, 1]); // get scat angle interpolation weights GridPos dir_gp; @@ -988,20 +988,20 @@ void pha_mat_1ScatElem( //Output for (Index nst = 0; nst < npha; nst++) pha_mat_int[nst] = interp( dir_itw, - ssd.pha_mat_data(find + f_start, 0, joker, 0, 0, 0, nst), + ssd.pha_mat_data[find + f_start, 0, joker, 0, 0, 0, nst], dir_gp); // convert from scat to lab frame - pha_mat_labCalc(pha_mat_tmp(joker, joker), + pha_mat_labCalc(pha_mat_tmp[joker, joker], pha_mat_int, - pdir_array(pdir, 0), - pdir_array(pdir, 1), - idir_array(idir, 0), - idir_array(idir, 1), + pdir_array[pdir, 0], + pdir_array[pdir, 1], + idir_array[idir, 0], + idir_array[idir, 1], theta); for (Index Tind = 0; Tind < nTout; Tind++) - pha_mat(find, Tind, pdir, idir, joker, joker) = pha_mat_tmp; + pha_mat[find, Tind, pdir, idir, joker, joker] = pha_mat_tmp; } } } else // T-interpolation required. To be done on the compact ssd format. @@ -1009,10 +1009,10 @@ void pha_mat_1ScatElem( //Output for (Index pdir = 0; pdir < npDir; pdir++) for (Index idir = 0; idir < niDir; idir++) { // calc scat ang theta from incident and prop dirs - Numeric theta = scat_angle(pdir_array(pdir, 0), - pdir_array(pdir, 1), - idir_array(idir, 0), - idir_array(idir, 1)); + Numeric theta = scat_angle(pdir_array[pdir, 0], + pdir_array[pdir, 1], + idir_array[idir, 0], + idir_array[idir, 1]); // get scat angle interpolation weights GridPos dir_gp; @@ -1026,15 +1026,15 @@ void pha_mat_1ScatElem( //Output for (Index Tind = 0; Tind < nTin; Tind++) // perform the scat angle interpolation for (Index nst = 0; nst < npha; nst++) { - pha_mat_int(Tind, nst) = interp( + pha_mat_int[Tind, nst] = interp( dir_itw, - ssd.pha_mat_data(find + f_start, Tind, joker, 0, 0, 0, nst), + ssd.pha_mat_data[find + f_start, Tind, joker, 0, 0, 0, nst], dir_gp); } // perform the T-interpolation for (Index nst = 0; nst < npha; nst++) { - reinterp(pha_mat_tmp(joker, nst), - pha_mat_int(joker, nst), + reinterp(pha_mat_tmp[joker, nst], + pha_mat_int[joker, nst], T_itw_lag, T_lag); } @@ -1045,12 +1045,12 @@ void pha_mat_1ScatElem( //Output // should be faster.) for (Index Tind = 0; Tind < nTout; Tind++) { // convert from scat to lab frame - pha_mat_labCalc(pha_mat(find, Tind, pdir, idir, joker, joker), - pha_mat_tmp(Tind, joker), - pdir_array(pdir, 0), - pdir_array(pdir, 1), - idir_array(idir, 0), - idir_array(idir, 1), + pha_mat_labCalc(pha_mat[find, Tind, pdir, idir, joker, joker], + pha_mat_tmp[Tind, joker], + pdir_array[pdir, 0], + pdir_array[pdir, 1], + idir_array[idir, 0], + idir_array[idir, 1], theta); } } @@ -1066,17 +1066,17 @@ void pha_mat_1ScatElem( //Output ArrayOfGridPos daa_gp(nDir), pza_gp(nDir), iza_gp(nDir); ArrayOfGridPos pza_gp_tmp(npDir), iza_gp_tmp(niDir); - gridpos(pza_gp_tmp, ssd.za_grid, pdir_array(joker, 0)); - gridpos(iza_gp_tmp, ssd.za_grid, idir_array(joker, 0)); + gridpos(pza_gp_tmp, ssd.za_grid, pdir_array[joker, 0]); + gridpos(iza_gp_tmp, ssd.za_grid, idir_array[joker, 0]); Index j = 0; for (Index pdir = 0; pdir < npDir; pdir++) { for (Index idir = 0; idir < niDir; idir++) { - delta_aa(pdir, idir) = - pdir_array(pdir, 1) - idir_array(idir, 1) + - (pdir_array(pdir, 1) - idir_array(idir, 1) < -180) * 360 - - (pdir_array(pdir, 1) - idir_array(idir, 1) > 180) * 360; - adelta_aa[j] = abs(delta_aa(pdir, idir)); + delta_aa[pdir, idir] = + pdir_array[pdir, 1] - idir_array[idir, 1] + + (pdir_array[pdir, 1] - idir_array[idir, 1] < -180) * 360 - + (pdir_array[pdir, 1] - idir_array[idir, 1] > 180) * 360; + adelta_aa[j] = abs(delta_aa[pdir, idir]); pza_gp[j] = pza_gp_tmp[pdir]; iza_gp[j] = iza_gp_tmp[idir]; j++; @@ -1100,10 +1100,10 @@ void pha_mat_1ScatElem( //Output for (Index ist1 = 0; ist1 < 4; ist1++) for (Index ist2 = 0; ist2 < 4; ist2++) interp( - pha_mat_int(joker, ist1, ist2), + pha_mat_int[joker, ist1, ist2], dir_itw, - ssd.pha_mat_data( - find + f_start, 0, joker, joker, joker, 0, ist1 * 4 + ist2), + ssd.pha_mat_data[ + find + f_start, 0, joker, joker, joker, 0, ist1 * 4 + ist2], pza_gp, daa_gp, iza_gp); @@ -1113,31 +1113,31 @@ void pha_mat_1ScatElem( //Output Index i = 0; for (Index pdir = 0; pdir < npDir; pdir++) for (Index idir = 0; idir < niDir; idir++) { - pha_mat_tmp(pdir, idir, joker, joker) = - pha_mat_int(i, joker, joker); + pha_mat_tmp[pdir, idir, joker, joker] = + pha_mat_int[i, joker, joker]; i++; } for (Index pdir = 0; pdir < npDir; pdir++) for (Index idir = 0; idir < niDir; idir++) - if (delta_aa(pdir, idir) < 0.) { - pha_mat_tmp(pdir, idir, 0, 2) *= -1; - pha_mat_tmp(pdir, idir, 1, 2) *= -1; - pha_mat_tmp(pdir, idir, 2, 0) *= -1; - pha_mat_tmp(pdir, idir, 2, 1) *= -1; + if (delta_aa[pdir, idir] < 0.) { + pha_mat_tmp[pdir, idir, 0, 2] *= -1; + pha_mat_tmp[pdir, idir, 1, 2] *= -1; + pha_mat_tmp[pdir, idir, 2, 0] *= -1; + pha_mat_tmp[pdir, idir, 2, 1] *= -1; } for (Index pdir = 0; pdir < npDir; pdir++) for (Index idir = 0; idir < niDir; idir++) - if (delta_aa(pdir, idir) < 0.) { - pha_mat_tmp(pdir, idir, 0, 3) *= -1; - pha_mat_tmp(pdir, idir, 1, 3) *= -1; - pha_mat_tmp(pdir, idir, 3, 0) *= -1; - pha_mat_tmp(pdir, idir, 3, 1) *= -1; + if (delta_aa[pdir, idir] < 0.) { + pha_mat_tmp[pdir, idir, 0, 3] *= -1; + pha_mat_tmp[pdir, idir, 1, 3] *= -1; + pha_mat_tmp[pdir, idir, 3, 0] *= -1; + pha_mat_tmp[pdir, idir, 3, 1] *= -1; } for (Index Tind = 0; Tind < nTout; Tind++) - pha_mat(find, Tind, joker, joker, joker, joker) = pha_mat_tmp; + pha_mat[find, Tind, joker, joker, joker, joker] = pha_mat_tmp; } } @@ -1152,15 +1152,15 @@ void pha_mat_1ScatElem( //Output for (Index Tind = 0; Tind < nTin; Tind++) { for (Index ist1 = 0; ist1 < 4; ist1++) for (Index ist2 = 0; ist2 < 4; ist2++) - interp(pha_mat_int(Tind, joker, ist1, ist2), + interp(pha_mat_int[Tind, joker, ist1, ist2], dir_itw, - ssd.pha_mat_data(find + f_start, + ssd.pha_mat_data[find + f_start, Tind, joker, joker, joker, 0, - ist1 * 4 + ist2), + ist1 * 4 + ist2], pza_gp, daa_gp, iza_gp); @@ -1174,8 +1174,8 @@ void pha_mat_1ScatElem( //Output for (Index idir = 0; idir < niDir; idir++) { for (Index ist1 = 0; ist1 < 4; ist1++) for (Index ist2 = 0; ist2 < 4; ist2++) - reinterp(pha_mat(find, joker, pdir, idir, ist1, ist2), - pha_mat_int(joker, i, ist1, ist2), + reinterp(pha_mat[find, joker, pdir, idir, ist1, ist2], + pha_mat_int[joker, i, ist1, ist2], T_itw_lag, T_lag); i++; @@ -1183,20 +1183,20 @@ void pha_mat_1ScatElem( //Output for (Index pdir = 0; pdir < npDir; pdir++) for (Index idir = 0; idir < niDir; idir++) - if (delta_aa(pdir, idir) < 0.) { - pha_mat(find, joker, pdir, idir, 0, 2) *= -1; - pha_mat(find, joker, pdir, idir, 1, 2) *= -1; - pha_mat(find, joker, pdir, idir, 2, 0) *= -1; - pha_mat(find, joker, pdir, idir, 2, 1) *= -1; + if (delta_aa[pdir, idir] < 0.) { + pha_mat[find, joker, pdir, idir, 0, 2] *= -1; + pha_mat[find, joker, pdir, idir, 1, 2] *= -1; + pha_mat[find, joker, pdir, idir, 2, 0] *= -1; + pha_mat[find, joker, pdir, idir, 2, 1] *= -1; } for (Index pdir = 0; pdir < npDir; pdir++) for (Index idir = 0; idir < niDir; idir++) - if (delta_aa(pdir, idir) < 0.) { - pha_mat(find, joker, pdir, idir, 0, 3) *= -1; - pha_mat(find, joker, pdir, idir, 1, 3) *= -1; - pha_mat(find, joker, pdir, idir, 3, 0) *= -1; - pha_mat(find, joker, pdir, idir, 3, 1) *= -1; + if (delta_aa[pdir, idir] < 0.) { + pha_mat[find, joker, pdir, idir, 0, 3] *= -1; + pha_mat[find, joker, pdir, idir, 1, 3] *= -1; + pha_mat[find, joker, pdir, idir, 3, 0] *= -1; + pha_mat[find, joker, pdir, idir, 3, 1] *= -1; } } } @@ -1254,7 +1254,7 @@ void abs_vecTransform( //Output and Input abs_vec_lab = 0.0; - abs_vec_lab[0].I() = abs_vec_data(0, 0, 0); + abs_vec_lab[0].I() = abs_vec_data[0, 0, 0]; break; } @@ -1275,8 +1275,8 @@ void abs_vecTransform( //Output and Input abs_vec_lab = 0.0; - abs_vec_lab[0].I() = interp(itw, abs_vec_data(Range(joker), 0, 0), gp); - abs_vec_lab[0].Q() = interp(itw, abs_vec_data(Range(joker), 0, 1), gp); + abs_vec_lab[0].I() = interp(itw, abs_vec_data[Range(joker), 0, 0], gp); + abs_vec_lab[0].Q() = interp(itw, abs_vec_data[Range(joker), 0, 1], gp); break; } default: { @@ -1338,7 +1338,7 @@ void ext_matTransform( //Output and Input ext_mat_lab = 0.0; - ext_mat_lab[0].A() = ext_mat_data(0, 0, 0); + ext_mat_lab[0].A() = ext_mat_data[0, 0, 0]; break; } @@ -1362,11 +1362,11 @@ void ext_matTransform( //Output and Input ext_mat_lab = 0.0; - Kjj = interp(itw, ext_mat_data(Range(joker), 0, 0), gp); + Kjj = interp(itw, ext_mat_data[Range(joker), 0, 0], gp); ext_mat_lab[0].A() = Kjj; - K12 = interp(itw, ext_mat_data(Range(joker), 0, 1), gp); + K12 = interp(itw, ext_mat_data[Range(joker), 0, 1], gp); ext_mat_lab[0].B() = K12; - K34 = interp(itw, ext_mat_data(Range(joker), 0, 2), gp); + K34 = interp(itw, ext_mat_data[Range(joker), 0, 2], gp); ext_mat_lab[0].W() = K34; break; } @@ -1470,156 +1470,156 @@ void pha_matTransform( //Output interpweights(itw, za_sca_gp, delta_aa_gp, za_inc_gp); - pha_mat_lab(0, 0) = + pha_mat_lab[0, 0] = interp(itw, - pha_mat_data(Range(joker), Range(joker), Range(joker), 0, 0), + pha_mat_data[Range(joker), Range(joker), Range(joker), 0, 0], za_sca_gp, delta_aa_gp, za_inc_gp); - pha_mat_lab(0, 1) = + pha_mat_lab[0, 1] = interp(itw, - pha_mat_data(Range(joker), Range(joker), Range(joker), 0, 1), + pha_mat_data[Range(joker), Range(joker), Range(joker), 0, 1], za_sca_gp, delta_aa_gp, za_inc_gp); - pha_mat_lab(1, 0) = + pha_mat_lab[1, 0] = interp(itw, - pha_mat_data(Range(joker), Range(joker), Range(joker), 0, 4), + pha_mat_data[Range(joker), Range(joker), Range(joker), 0, 4], za_sca_gp, delta_aa_gp, za_inc_gp); - pha_mat_lab(1, 1) = + pha_mat_lab[1, 1] = interp(itw, - pha_mat_data(Range(joker), Range(joker), Range(joker), 0, 5), + pha_mat_data[Range(joker), Range(joker), Range(joker), 0, 5], za_sca_gp, delta_aa_gp, za_inc_gp); if (delta_aa >= 0) { - pha_mat_lab(0, 2) = interp( + pha_mat_lab[0, 2] = interp( itw, - pha_mat_data(Range(joker), Range(joker), Range(joker), 0, 2), + pha_mat_data[Range(joker), Range(joker), Range(joker), 0, 2], za_sca_gp, delta_aa_gp, za_inc_gp); - pha_mat_lab(1, 2) = interp( + pha_mat_lab[1, 2] = interp( itw, - pha_mat_data(Range(joker), Range(joker), Range(joker), 0, 6), + pha_mat_data[Range(joker), Range(joker), Range(joker), 0, 6], za_sca_gp, delta_aa_gp, za_inc_gp); - pha_mat_lab(2, 0) = interp( + pha_mat_lab[2, 0] = interp( itw, - pha_mat_data(Range(joker), Range(joker), Range(joker), 0, 8), + pha_mat_data[Range(joker), Range(joker), Range(joker), 0, 8], za_sca_gp, delta_aa_gp, za_inc_gp); - pha_mat_lab(2, 1) = interp( + pha_mat_lab[2, 1] = interp( itw, - pha_mat_data(Range(joker), Range(joker), Range(joker), 0, 9), + pha_mat_data[Range(joker), Range(joker), Range(joker), 0, 9], za_sca_gp, delta_aa_gp, za_inc_gp); } else { - pha_mat_lab(0, 2) = -interp( + pha_mat_lab[0, 2] = -interp( itw, - pha_mat_data(Range(joker), Range(joker), Range(joker), 0, 2), + pha_mat_data[Range(joker), Range(joker), Range(joker), 0, 2], za_sca_gp, delta_aa_gp, za_inc_gp); - pha_mat_lab(1, 2) = -interp( + pha_mat_lab[1, 2] = -interp( itw, - pha_mat_data(Range(joker), Range(joker), Range(joker), 0, 6), + pha_mat_data[Range(joker), Range(joker), Range(joker), 0, 6], za_sca_gp, delta_aa_gp, za_inc_gp); - pha_mat_lab(2, 0) = -interp( + pha_mat_lab[2, 0] = -interp( itw, - pha_mat_data(Range(joker), Range(joker), Range(joker), 0, 8), + pha_mat_data[Range(joker), Range(joker), Range(joker), 0, 8], za_sca_gp, delta_aa_gp, za_inc_gp); - pha_mat_lab(2, 1) = -interp( + pha_mat_lab[2, 1] = -interp( itw, - pha_mat_data(Range(joker), Range(joker), Range(joker), 0, 9), + pha_mat_data[Range(joker), Range(joker), Range(joker), 0, 9], za_sca_gp, delta_aa_gp, za_inc_gp); } - pha_mat_lab(2, 2) = interp( + pha_mat_lab[2, 2] = interp( itw, - pha_mat_data(Range(joker), Range(joker), Range(joker), 0, 10), + pha_mat_data[Range(joker), Range(joker), Range(joker), 0, 10], za_sca_gp, delta_aa_gp, za_inc_gp); if (delta_aa >= 0) { - pha_mat_lab(0, 3) = interp( + pha_mat_lab[0, 3] = interp( itw, - pha_mat_data(Range(joker), Range(joker), Range(joker), 0, 3), + pha_mat_data[Range(joker), Range(joker), Range(joker), 0, 3], za_sca_gp, delta_aa_gp, za_inc_gp); - pha_mat_lab(1, 3) = interp( + pha_mat_lab[1, 3] = interp( itw, - pha_mat_data(Range(joker), Range(joker), Range(joker), 0, 7), + pha_mat_data[Range(joker), Range(joker), Range(joker), 0, 7], za_sca_gp, delta_aa_gp, za_inc_gp); - pha_mat_lab(3, 0) = interp( + pha_mat_lab[3, 0] = interp( itw, - pha_mat_data(Range(joker), Range(joker), Range(joker), 0, 12), + pha_mat_data[Range(joker), Range(joker), Range(joker), 0, 12], za_sca_gp, delta_aa_gp, za_inc_gp); - pha_mat_lab(3, 1) = interp( + pha_mat_lab[3, 1] = interp( itw, - pha_mat_data(Range(joker), Range(joker), Range(joker), 0, 13), + pha_mat_data[Range(joker), Range(joker), Range(joker), 0, 13], za_sca_gp, delta_aa_gp, za_inc_gp); } else { - pha_mat_lab(0, 3) = -interp( + pha_mat_lab[0, 3] = -interp( itw, - pha_mat_data(Range(joker), Range(joker), Range(joker), 0, 3), + pha_mat_data[Range(joker), Range(joker), Range(joker), 0, 3], za_sca_gp, delta_aa_gp, za_inc_gp); - pha_mat_lab(1, 3) = -interp( + pha_mat_lab[1, 3] = -interp( itw, - pha_mat_data(Range(joker), Range(joker), Range(joker), 0, 7), + pha_mat_data[Range(joker), Range(joker), Range(joker), 0, 7], za_sca_gp, delta_aa_gp, za_inc_gp); - pha_mat_lab(3, 0) = -interp( + pha_mat_lab[3, 0] = -interp( itw, - pha_mat_data(Range(joker), Range(joker), Range(joker), 0, 12), + pha_mat_data[Range(joker), Range(joker), Range(joker), 0, 12], za_sca_gp, delta_aa_gp, za_inc_gp); - pha_mat_lab(3, 1) = -interp( + pha_mat_lab[3, 1] = -interp( itw, - pha_mat_data(Range(joker), Range(joker), Range(joker), 0, 13), + pha_mat_data[Range(joker), Range(joker), Range(joker), 0, 13], za_sca_gp, delta_aa_gp, za_inc_gp); } - pha_mat_lab(2, 3) = interp( + pha_mat_lab[2, 3] = interp( itw, - pha_mat_data(Range(joker), Range(joker), Range(joker), 0, 11), + pha_mat_data[Range(joker), Range(joker), Range(joker), 0, 11], za_sca_gp, delta_aa_gp, za_inc_gp); - pha_mat_lab(3, 2) = interp( + pha_mat_lab[3, 2] = interp( itw, - pha_mat_data(Range(joker), Range(joker), Range(joker), 0, 14), + pha_mat_data[Range(joker), Range(joker), Range(joker), 0, 14], za_sca_gp, delta_aa_gp, za_inc_gp); - pha_mat_lab(3, 3) = interp( + pha_mat_lab[3, 3] = interp( itw, - pha_mat_data(Range(joker), Range(joker), Range(joker), 0, 15), + pha_mat_data[Range(joker), Range(joker), Range(joker), 0, 15], za_sca_gp, delta_aa_gp, za_inc_gp); @@ -1669,12 +1669,12 @@ void ext_matFromabs_vec( //Output // first: diagonal elements for (Index is = 0; is < 4; is++) { - ext_mat(is, is) += abs_vec[0]; + ext_mat[is, is] += abs_vec[0]; } // second: off-diagonal elements, namely first row and column for (Index is = 1; is < 4; is++) { - ext_mat(0, is) += abs_vec[is]; - ext_mat(is, 0) += abs_vec[is]; + ext_mat[0, is] += abs_vec[is]; + ext_mat[is, 0] += abs_vec[is]; } } @@ -1760,7 +1760,7 @@ void interpolate_scat_angle( //Output: ARTS_ASSERT(pha_mat_data.ncols() == 6); for (Index i = 0; i < 6; i++) { - pha_mat_int[i] = interp(itw, pha_mat_data(joker, 0, 0, 0, i), thet_gp); + pha_mat_int[i] = interp(itw, pha_mat_data[joker, 0, 0, 0, i], thet_gp); } } @@ -1810,7 +1810,7 @@ void pha_mat_labCalc( //Output: "when doing MC calculations, it should not be critical. This path " "sampling will be rejected and replaced with a new one."); - pha_mat_lab(0, 0) = F11; + pha_mat_lab[0, 0] = F11; { Numeric za_sca_rad = Conversion::deg2rad(za_sca); @@ -1835,25 +1835,25 @@ void pha_mat_labCalc( //Output: || (abs(abs(aa_inc_rad - aa_sca_rad) - Constant::pi) < ANGTOL_RAD) // " ) { - pha_mat_lab(0, 1) = F12; - pha_mat_lab(1, 0) = F12; - pha_mat_lab(1, 1) = F22; + pha_mat_lab[0, 1] = F12; + pha_mat_lab[1, 0] = F12; + pha_mat_lab[1, 1] = F22; { - pha_mat_lab(0, 2) = 0; - pha_mat_lab(1, 2) = 0; - pha_mat_lab(2, 0) = 0; - pha_mat_lab(2, 1) = 0; - pha_mat_lab(2, 2) = F33; + pha_mat_lab[0, 2] = 0; + pha_mat_lab[1, 2] = 0; + pha_mat_lab[2, 0] = 0; + pha_mat_lab[2, 1] = 0; + pha_mat_lab[2, 2] = F33; { - pha_mat_lab(0, 3) = 0; - pha_mat_lab(1, 3) = 0; - pha_mat_lab(2, 3) = F34; - pha_mat_lab(3, 0) = 0; - pha_mat_lab(3, 1) = 0; - pha_mat_lab(3, 2) = -F34; - pha_mat_lab(3, 3) = F44; + pha_mat_lab[0, 3] = 0; + pha_mat_lab[1, 3] = 0; + pha_mat_lab[2, 3] = F34; + pha_mat_lab[3, 0] = 0; + pha_mat_lab[3, 1] = 0; + pha_mat_lab[3, 2] = -F34; + pha_mat_lab[3, 3] = F44; } } } @@ -1904,16 +1904,16 @@ void pha_mat_labCalc( //Output: const Numeric S1 = sin(2 * sigma1); const Numeric S2 = sin(2 * sigma2); - pha_mat_lab(0, 1) = C1 * F12; - pha_mat_lab(1, 0) = C2 * F12; - pha_mat_lab(1, 1) = C1 * C2 * F22 - S1 * S2 * F33; + pha_mat_lab[0, 1] = C1 * F12; + pha_mat_lab[1, 0] = C2 * F12; + pha_mat_lab[1, 1] = C1 * C2 * F22 - S1 * S2 * F33; //ARTS_ASSERT(!std::isnan(pha_mat_lab(0,1))); //ARTS_ASSERT(!std::isnan(pha_mat_lab(1,0))); //ARTS_ASSERT(!std::isnan(pha_mat_lab(1,1))); ARTS_USER_ERROR_IF( - std::isnan(pha_mat_lab(0, 1)) || std::isnan(pha_mat_lab(1, 0)) || - std::isnan(pha_mat_lab(1, 1)), + std::isnan(pha_mat_lab[0, 1]) || std::isnan(pha_mat_lab[1, 0]) || + std::isnan(pha_mat_lab[1, 1]), "NaN value(s) detected in *pha_mat_labCalc* (0/1,1). Could the " "input data contain NaNs? Please check with *scat_dataCheck*. If " "input data are OK and you critically need the ongoing calculations, " @@ -1936,31 +1936,31 @@ void pha_mat_labCalc( //Output: Numeric delta_aa = aa_sca - aa_inc + (aa_sca - aa_inc < -180) * 360 - (aa_sca - aa_inc > 180) * 360; if (delta_aa >= 0) { - pha_mat_lab(0, 2) = S1 * F12; - pha_mat_lab(1, 2) = S1 * C2 * F22 + C1 * S2 * F33; - pha_mat_lab(2, 0) = -S2 * F12; - pha_mat_lab(2, 1) = -C1 * S2 * F22 - S1 * C2 * F33; + pha_mat_lab[0, 2] = S1 * F12; + pha_mat_lab[1, 2] = S1 * C2 * F22 + C1 * S2 * F33; + pha_mat_lab[2, 0] = -S2 * F12; + pha_mat_lab[2, 1] = -C1 * S2 * F22 - S1 * C2 * F33; } else { - pha_mat_lab(0, 2) = -S1 * F12; - pha_mat_lab(1, 2) = -S1 * C2 * F22 - C1 * S2 * F33; - pha_mat_lab(2, 0) = S2 * F12; - pha_mat_lab(2, 1) = C1 * S2 * F22 + S1 * C2 * F33; + pha_mat_lab[0, 2] = -S1 * F12; + pha_mat_lab[1, 2] = -S1 * C2 * F22 - C1 * S2 * F33; + pha_mat_lab[2, 0] = S2 * F12; + pha_mat_lab[2, 1] = C1 * S2 * F22 + S1 * C2 * F33; } - pha_mat_lab(2, 2) = -S1 * S2 * F22 + C1 * C2 * F33; + pha_mat_lab[2, 2] = -S1 * S2 * F22 + C1 * C2 * F33; { if (delta_aa >= 0) { - pha_mat_lab(1, 3) = S2 * F34; - pha_mat_lab(3, 1) = S1 * F34; + pha_mat_lab[1, 3] = S2 * F34; + pha_mat_lab[3, 1] = S1 * F34; } else { - pha_mat_lab(1, 3) = -S2 * F34; - pha_mat_lab(3, 1) = -S1 * F34; + pha_mat_lab[1, 3] = -S2 * F34; + pha_mat_lab[3, 1] = -S1 * F34; } - pha_mat_lab(0, 3) = 0; - pha_mat_lab(2, 3) = C2 * F34; - pha_mat_lab(3, 0) = 0; - pha_mat_lab(3, 2) = -C1 * F34; - pha_mat_lab(3, 3) = F44; + pha_mat_lab[0, 3] = 0; + pha_mat_lab[2, 3] = C2 * F34; + pha_mat_lab[3, 0] = 0; + pha_mat_lab[3, 2] = -C1 * F34; + pha_mat_lab[3, 3] = F44; } } } @@ -2165,10 +2165,10 @@ void ConvertAzimuthallyRandomSingleScatteringData(SingleScatteringData& ssd) { ssd.za_grid.size(), tmpT5.nrows(), tmpT5.ncols()); - ssd.abs_vec_data(joker, joker, Range(0, nza / 2 + 1), joker, joker) = tmpT5; + ssd.abs_vec_data[joker, joker, Range(0, nza / 2 + 1), joker, joker] = tmpT5; for (Index i = 0; i < nza / 2; i++) { - ssd.abs_vec_data(joker, joker, nza - 1 - i, joker, joker) = - tmpT5(joker, joker, i, joker, joker); + ssd.abs_vec_data[joker, joker, nza - 1 - i, joker, joker] = + tmpT5[joker, joker, i, joker, joker]; } tmpT5 = ssd.ext_mat_data; @@ -2177,10 +2177,10 @@ void ConvertAzimuthallyRandomSingleScatteringData(SingleScatteringData& ssd) { ssd.za_grid.size(), tmpT5.nrows(), tmpT5.ncols()); - ssd.ext_mat_data(joker, joker, Range(0, nza / 2 + 1), joker, joker) = tmpT5; + ssd.ext_mat_data[joker, joker, Range(0, nza / 2 + 1), joker, joker] = tmpT5; for (Index i = 0; i < nza / 2; i++) { - ssd.ext_mat_data(joker, joker, nza - 1 - i, joker, joker) = - tmpT5(joker, joker, i, joker, joker); + ssd.ext_mat_data[joker, joker, nza - 1 - i, joker, joker] = + tmpT5[joker, joker, i, joker, joker]; } Tensor7 tmpT7 = ssd.pha_mat_data; @@ -2191,22 +2191,22 @@ void ConvertAzimuthallyRandomSingleScatteringData(SingleScatteringData& ssd) { ssd.za_grid.size(), tmpT7.nrows(), tmpT7.ncols()); - ssd.pha_mat_data( - joker, joker, joker, joker, Range(0, nza / 2 + 1), joker, joker) = tmpT7; + ssd.pha_mat_data[ + joker, joker, joker, joker, Range(0, nza / 2 + 1), joker, joker] = tmpT7; // scatt. matrix elements 13,23,31,32 and 14,24,41,42 (=elements 2,6,8,9 and // 3,7,12,13 in ARTS' flattened format, respectively) change sign. - tmpT7(joker, joker, joker, joker, joker, joker, Range(2, 2)) *= -1.; - tmpT7(joker, joker, joker, joker, joker, joker, Range(6, 4)) *= -1.; - tmpT7(joker, joker, joker, joker, joker, joker, Range(12, 2)) *= -1.; + tmpT7[joker, joker, joker, joker, joker, joker, Range(2, 2)] *= -1.; + tmpT7[joker, joker, joker, joker, joker, joker, Range(6, 4)] *= -1.; + tmpT7[joker, joker, joker, joker, joker, joker, Range(12, 2)] *= -1.; // For second half of incident polar angles (>90deg), we need to mirror the // original data in both incident and scattered polar angle around 90deg "planes". for (Index i = 0; i < nza / 2; i++) for (Index j = 0; j < nza; j++) - ssd.pha_mat_data( - joker, joker, nza - 1 - j, joker, nza - 1 - i, joker, joker) = - tmpT7(joker, joker, j, joker, i, joker, joker); + ssd.pha_mat_data[ + joker, joker, nza - 1 - j, joker, nza - 1 - i, joker, joker] = + tmpT7[joker, joker, j, joker, i, joker, joker]; } //! Convert particle ssd method name to enum value @@ -2357,7 +2357,7 @@ void ext_abs_pfun_from_tro(MatrixView ext_data, Index nvals = 0; for (Index icl = 0; icl < ncl; ++icl) { // Nothing to do if PND is zero - if (abs(pnd_data(ie, icl)) > 1e-3) { + if (abs(pnd_data[ie, icl]) > 1e-3) { const Numeric Tthis = T_grid[cl_start + icl]; ARTS_USER_ERROR_IF( Tthis < tmin || Tthis > tmax, @@ -2396,12 +2396,12 @@ void ext_abs_pfun_from_tro(MatrixView ext_data, Vector ext1(nvals), abs1(nvals); Matrix pfu1(nvals, nsa); interp( - ext1, itw1, scat_data[ie].ext_mat_data(iv, joker, 0, 0, 0), gp_t); + ext1, itw1, scat_data[ie].ext_mat_data[iv, joker, 0, 0, 0], gp_t); interp( - abs1, itw1, scat_data[ie].abs_vec_data(iv, joker, 0, 0, 0), gp_t); + abs1, itw1, scat_data[ie].abs_vec_data[iv, joker, 0, 0, 0], gp_t); interp(pfu1, itw2, - scat_data[ie].pha_mat_data(iv, joker, joker, 0, 0, 0, 0), + scat_data[ie].pha_mat_data[iv, joker, joker, 0, 0, 0, 0], gp_t, gp_sa); @@ -2409,10 +2409,10 @@ void ext_abs_pfun_from_tro(MatrixView ext_data, for (Index i = 0; i < nvals; i++) { const Index ic = cboxlayer[i]; const Index it = cl_start + ic; - ext_data(iv, it) += pnd_data(ie, ic) * ext1[i]; - abs_data(iv, it) += pnd_data(ie, ic) * abs1[i]; + ext_data[iv, it] += pnd_data[ie, ic] * ext1[i]; + abs_data[iv, it] += pnd_data[ie, ic] * abs1[i]; for (Index ia = 0; ia < nsa; ia++) { - pfun_data(iv, it, ia) += pnd_data(ie, ic) * pfu1(i, ia); + pfun_data[iv, it, ia] += pnd_data[ie, ic] * pfu1[i, ia]; } } } @@ -2422,15 +2422,15 @@ void ext_abs_pfun_from_tro(MatrixView ext_data, Matrix pfu1(nvals, nsa); interp(ext1, itw1, - scat_data[ie].ext_mat_data(f_index, joker, 0, 0, 0), + scat_data[ie].ext_mat_data[f_index, joker, 0, 0, 0], gp_t); interp(abs1, itw1, - scat_data[ie].abs_vec_data(f_index, joker, 0, 0, 0), + scat_data[ie].abs_vec_data[f_index, joker, 0, 0, 0], gp_t); interp(pfu1, itw2, - scat_data[ie].pha_mat_data(f_index, joker, joker, 0, 0, 0, 0), + scat_data[ie].pha_mat_data[f_index, joker, joker, 0, 0, 0, 0], gp_t, gp_sa); @@ -2438,10 +2438,10 @@ void ext_abs_pfun_from_tro(MatrixView ext_data, for (Index i = 0; i < nvals; i++) { const Index ic = cboxlayer[i]; const Index it = cl_start + ic; - ext_data(0, it) += pnd_data(ie, ic) * ext1[i]; - abs_data(0, it) += pnd_data(ie, ic) * abs1[i]; + ext_data[0, it] += pnd_data[ie, ic] * ext1[i]; + abs_data[0, it] += pnd_data[ie, ic] * abs1[i]; for (Index ia = 0; ia < nsa; ia++) { - pfun_data(0, it, ia) += pnd_data(ie, ic) * pfu1(i, ia); + pfun_data[0, it, ia] += pnd_data[ie, ic] * pfu1[i, ia]; } } } diff --git a/src/core/radiation_field.cc b/src/core/radiation_field.cc index d1a36892f5..c7dc436665 100644 --- a/src/core/radiation_field.cc +++ b/src/core/radiation_field.cc @@ -59,7 +59,7 @@ Numeric integrate_convolved(const MuelmatVector& T, const Index n = f.size(); for (Index i = 0; i < n - 1; i++) val += 0.5 * (f[i + 1] - f[i]) * - (T[i](0, 0) * F[i].real() + T[i + 1](0, 0) * F[i + 1].real()); + (T[i][0, 0] * F[i].real() + T[i + 1][0, 0] * F[i + 1].real()); return 1.0 - val; } diff --git a/src/core/raw.cc b/src/core/raw.cc index 801887f39a..66b68f343e 100644 --- a/src/core/raw.cc +++ b/src/core/raw.cc @@ -212,7 +212,7 @@ MatrixView cov(MatrixView cov, const Vector& y, const ArrayOfVector& ys, const I for (Index k=start; k 0; i--) { const muelmat R = Ts[i + 1][iv] * P; for (Index iq = 0; iq < nq; iq++) { - dI[i](iq, iv) += Pi[i][iv] * dTs[i](0, iq, iv) * P * src; - dI[i](iq, iv) += Pi[i - 1][iv] * dTs[i](1, iq, iv) * R * src; + dI[i][iq, iv] += Pi[i][iv] * dTs[i][0, iq, iv] * P * src; + dI[i][iq, iv] += Pi[i - 1][iv] * dTs[i][1, iq, iv] * R * src; } P = R; } for (Index iq = 0; iq < nq; iq++) { - dI[0](iq, iv) += Pi[0][iv] * dTs[0](0, iq, iv) * P * src; - dI[N - 1](iq, iv) += Pi[N - 2][iv] * dTs[N - 1](1, iq, iv) * src; + dI[0][iq, iv] += Pi[0][iv] * dTs[0][0, iq, iv] * P * src; + dI[N - 1][iq, iv] += Pi[N - 2][iv] * dTs[N - 1][1, iq, iv] * src; } } @@ -275,15 +275,15 @@ void two_level_linear_emission_cumulative_full( for (Size i = j - 1; i > 0; i--) { const muelmat R = Ts[i + 1][iv] * P; for (Index iq = 0; iq < nq; iq++) { - dI[i](iq, iv) += Pi[i][iv] * dTs[i](0, iq, iv) * P * jsrc; - dI[i](iq, iv) += Pi[i - 1][iv] * dTs[i](1, iq, iv) * R * jsrc; + dI[i][iq, iv] += Pi[i][iv] * dTs[i][0, iq, iv] * P * jsrc; + dI[i][iq, iv] += Pi[i - 1][iv] * dTs[i][1, iq, iv] * R * jsrc; } P = R; } for (Index iq = 0; iq < nq; iq++) { - dI[j](iq, iv) += Pi[j - 1][iv] * dTs[j](1, iq, iv) * jsrc; - dI[0](iq, iv) += (dTs[0](0, iq, iv) + dTs[0](1, iq, iv)) * P * jsrc; + dI[j][iq, iv] += Pi[j - 1][iv] * dTs[j][1, iq, iv] * jsrc; + dI[0][iq, iv] += (dTs[0][0, iq, iv] + dTs[0][1, iq, iv]) * P * jsrc; } } } @@ -345,15 +345,15 @@ void two_level_linear_transmission_step(stokvec_vector &I, for (Size i = N - 2; i > 0; i--) { const muelmat R = Ts[i + 1][iv] * P; for (Index iq = 0; iq < nq; iq++) { - dI[i](iq, iv) += Pi[i][iv] * dTs[i](0, iq, iv) * P * src; - dI[i](iq, iv) += Pi[i - 1][iv] * dTs[i](1, iq, iv) * R * src; + dI[i][iq, iv] += Pi[i][iv] * dTs[i][0, iq, iv] * P * src; + dI[i][iq, iv] += Pi[i - 1][iv] * dTs[i][1, iq, iv] * R * src; } P = R; } for (Index iq = 0; iq < nq; iq++) { - dI[0](iq, iv) += Pi[0][iv] * dTs[0](0, iq, iv) * P * src; - dI[N - 1](iq, iv) += Pi[N - 2][iv] * dTs[N - 1](1, iq, iv) * src; + dI[0][iq, iv] += Pi[0][iv] * dTs[0][0, iq, iv] * P * src; + dI[N - 1][iq, iv] += Pi[N - 2][iv] * dTs[N - 1][1, iq, iv] * src; } } } diff --git a/src/core/rtepack/rtepack_scattering.cc b/src/core/rtepack/rtepack_scattering.cc index c629cc7a64..6a79e985b9 100644 --- a/src/core/rtepack/rtepack_scattering.cc +++ b/src/core/rtepack/rtepack_scattering.cc @@ -17,46 +17,46 @@ Array bulk_backscatter(const ConstTensor5View &Pe, for (Index ip = 0; ip < np; ip++) { for (Index iv = 0; iv < nv; iv++) { - auto m = Pe(0, ip, iv, joker, joker); - aotm[ip][iv] = pnd(0, ip) * muelmat(m(0, 0), - m(0, 1), - m(0, 2), - m(0, 3), - m(1, 0), - m(1, 1), - m(1, 2), - m(1, 3), - m(2, 0), - m(2, 1), - m(2, 2), - m(2, 3), - m(3, 0), - m(3, 1), - m(3, 2), - m(3, 3)); + auto m = Pe[0, ip, iv, joker, joker]; + aotm[ip][iv] = pnd[0, ip] * muelmat(m[0, 0], + m[0, 1], + m[0, 2], + m[0, 3], + m[1, 0], + m[1, 1], + m[1, 2], + m[1, 3], + m[2, 0], + m[2, 1], + m[2, 2], + m[2, 3], + m[3, 0], + m[3, 1], + m[3, 2], + m[3, 3]); } } for (Index ie = 1; ie < ne; ie++) { for (Index ip = 0; ip < np; ip++) { for (Index iv = 0; iv < nv; iv++) { - auto m = Pe(ie, ip, iv, joker, joker); - aotm[ip][iv] += pnd(ie, ip) * muelmat(m(0, 0), - m(0, 1), - m(0, 2), - m(0, 3), - m(1, 0), - m(1, 1), - m(1, 2), - m(1, 3), - m(2, 0), - m(2, 1), - m(2, 2), - m(2, 3), - m(3, 0), - m(3, 1), - m(3, 2), - m(3, 3)); + auto m = Pe[ie, ip, iv, joker, joker]; + aotm[ip][iv] += pnd[ie, ip] * muelmat(m[0, 0], + m[0, 1], + m[0, 2], + m[0, 3], + m[1, 0], + m[1, 1], + m[1, 2], + m[1, 3], + m[2, 0], + m[2, 1], + m[2, 2], + m[2, 3], + m[3, 0], + m[3, 1], + m[3, 2], + m[3, 3]); } } } @@ -70,7 +70,7 @@ Array bulk_backscatter_derivative( const Index nv = Pe.npages(); const Index np = Pe.nbooks(); const Index ne = Pe.nshelves(); - const Size nq = dpnd_dx.size(); + const Size nq = dpnd_dx.size(); Array aoaotm(np, muelmat_matrix(nq, nv)); @@ -79,23 +79,23 @@ Array bulk_backscatter_derivative( aoaotm[ip][iq] = 0.0; for (Index iv = 0; iv < nv; iv++) { for (Index ie = 0; ie < ne; ie++) { - auto m = Pe(ie, ip, iv, joker, joker); - aoaotm[ip](iq, iv) += dpnd_dx[iq](ie, ip) * muelmat(m(0, 0), - m(0, 1), - m(0, 2), - m(0, 3), - m(1, 0), - m(1, 1), - m(1, 2), - m(1, 3), - m(2, 0), - m(2, 1), - m(2, 2), - m(2, 3), - m(3, 0), - m(3, 1), - m(3, 2), - m(3, 3)); + auto m = Pe[ie, ip, iv, joker, joker]; + aoaotm[ip][iq, iv] += dpnd_dx[iq][ie, ip] * muelmat(m[0, 0], + m[0, 1], + m[0, 2], + m[0, 3], + m[1, 0], + m[1, 1], + m[1, 2], + m[1, 3], + m[2, 0], + m[2, 1], + m[2, 2], + m[2, 3], + m[3, 0], + m[3, 1], + m[3, 2], + m[3, 3]); } } } @@ -118,7 +118,7 @@ void setBackscatterTransmissionDerivative(stokvec_matrix &out, const muelmat_matrix &dZ) { for (Index j = 0; j < dZ.nrows(); j++) for (Index i = 0; i < dZ.ncols(); i++) - out(j, i) += Tr[i] * dZ(j, i) * Tf[i] * I0[i]; + out[j, i] += Tr[i] * dZ[j, i] * Tf[i] * I0[i]; } void bulk_backscatter_commutative_transmission_rte( @@ -132,7 +132,7 @@ void bulk_backscatter_commutative_transmission_rte( const Array &dT1, const Array &dT2, const Array &dZ) { - const Size np = dT1.size(); + const Size np = dT1.size(); const Index nv = np ? dT1.front().ncols() : 0; const Index nq = np ? dT1.front().nrows() : 0; @@ -149,13 +149,13 @@ void bulk_backscatter_commutative_transmission_rte( for (Size j = ip; j < np; j++) { for (Index iq = 0; iq < nq; iq++) { for (Index iv = 0; iv < nv; iv++) { - dI[ip][j](iq, iv) += - T[ip][iv] * ((dT1[ip](iq, iv) + dT2[ip](iq, iv)) * I[j][iv]); + dI[ip][j][iq, iv] += + T[ip][iv] * ((dT1[ip][iq, iv] + dT2[ip][iq, iv]) * I[j][iv]); if (j < np - 1 and j > ip) - dI[ip][j](iq, iv) += + dI[ip][j][iq, iv] += inv(T[ip + 1][iv]) * - ((dT1[ip](iq, iv) + dT2[ip](iq, iv)) * I[j][iv]); + ((dT1[ip][iq, iv] + dT2[ip][iq, iv]) * I[j][iv]); } } } @@ -182,9 +182,9 @@ muelmat rayleigh_scattering(const Vector2 &los_in, using Constant::pi; using Math::pow2; - const auto cos_theta = cos_scat_angle(los_in, los_out); - const auto theta_rad = std::acos(cos_theta); - const auto sin_theta = std::sin(theta_rad); + const auto cos_theta = cos_scat_angle(los_in, los_out); + const auto theta_rad = std::acos(cos_theta); + const auto sin_theta = std::sin(theta_rad); const auto [za_sca, aa_sca] = los_out; const auto [za_inc, aa_inc] = los_in; @@ -200,7 +200,7 @@ muelmat rayleigh_scattering(const Vector2 &los_in, const auto F44 = 1.5 * delta * delta_prime * cos_theta; muelmat pha; - pha(0, 0) = F11; + pha[0, 0] = F11; const Numeric za_sca_rad = Conversion::deg2rad(za_sca); const Numeric za_inc_rad = Conversion::deg2rad(za_inc); @@ -223,21 +223,21 @@ muelmat rayleigh_scattering(const Vector2 &los_in, ANGTOL_RAD) // " || (std::abs(std::abs(aa_inc_rad - aa_sca_rad) - pi) < ANGTOL_RAD) // " ) { - pha(0, 1) = F12; - pha(1, 0) = F12; - pha(1, 1) = F22; - pha(0, 2) = 0; - pha(1, 2) = 0; - pha(2, 0) = 0; - pha(2, 1) = 0; - pha(2, 2) = F33; - pha(0, 3) = 0; - pha(1, 3) = 0; - pha(2, 3) = 0; - pha(3, 0) = 0; - pha(3, 1) = 0; - pha(3, 2) = 0; - pha(3, 3) = F44; + pha[0, 1] = F12; + pha[1, 0] = F12; + pha[1, 1] = F22; + pha[0, 2] = 0; + pha[1, 2] = 0; + pha[2, 0] = 0; + pha[2, 1] = 0; + pha[2, 2] = F33; + pha[0, 3] = 0; + pha[1, 3] = 0; + pha[2, 3] = 0; + pha[3, 0] = 0; + pha[3, 1] = 0; + pha[3, 2] = 0; + pha[3, 3] = F44; } else { Numeric sigma1; Numeric sigma2; @@ -274,12 +274,12 @@ muelmat rayleigh_scattering(const Vector2 &los_in, const Numeric S1 = std::sin(2 * sigma1); const Numeric S2 = std::sin(2 * sigma2); - pha(0, 1) = C1 * F12; - pha(1, 0) = C2 * F12; - pha(1, 1) = C1 * C2 * F22 - S1 * S2 * F33; + pha[0, 1] = C1 * F12; + pha[1, 0] = C2 * F12; + pha[1, 1] = C1 * C2 * F22 - S1 * S2 * F33; ARTS_USER_ERROR_IF( - std::isnan(pha(0, 1)) || std::isnan(pha(1, 0)) || std::isnan(pha(1, 1)), + std::isnan(pha[0, 1]) || std::isnan(pha[1, 0]) || std::isnan(pha[1, 1]), "NaN value(s) detected in *phaCalc* (0/1,1). Could the " "input data contain NaNs? Please check with *scat_dataCheck*. If " "input data are OK and you critically need the ongoing calculations, " @@ -301,27 +301,28 @@ muelmat rayleigh_scattering(const Vector2 &los_in, const Numeric delta_aa = aa_sca - aa_inc + (aa_sca - aa_inc < -180) * 360 - (aa_sca - aa_inc > 180) * 360; if (delta_aa >= 0) { - pha(0, 2) = S1 * F12; - pha(1, 2) = S1 * C2 * F22 + C1 * S2 * F33; - pha(2, 0) = -S2 * F12; - pha(2, 1) = -C1 * S2 * F22 - S1 * C2 * F33; + pha[0, 2] = S1 * F12; + pha[1, 2] = S1 * C2 * F22 + C1 * S2 * F33; + pha[2, 0] = -S2 * F12; + pha[2, 1] = -C1 * S2 * F22 - S1 * C2 * F33; } else { - pha(0, 2) = -S1 * F12; - pha(1, 2) = -S1 * C2 * F22 - C1 * S2 * F33; - pha(2, 0) = S2 * F12; - pha(2, 1) = C1 * S2 * F22 + S1 * C2 * F33; + pha[0, 2] = -S1 * F12; + pha[1, 2] = -S1 * C2 * F22 - C1 * S2 * F33; + pha[2, 0] = S2 * F12; + pha[2, 1] = C1 * S2 * F22 + S1 * C2 * F33; } - pha(2, 2) = -S1 * S2 * F22 + C1 * C2 * F33; - - pha(1, 3) = 0; - pha(3, 1) = 0; - pha(0, 3) = 0; - pha(2, 3) = 0; - pha(3, 0) = 0; - pha(3, 2) = 0; - pha(3, 3) = F44; + pha[2, 2] = -S1 * S2 * F22 + C1 * C2 * F33; + + pha[1, 3] = 0; + pha[3, 1] = 0; + pha[0, 3] = 0; + pha[2, 3] = 0; + pha[3, 0] = 0; + pha[3, 2] = 0; + pha[3, 3] = F44; } return pha; -} ARTS_METHOD_ERROR_CATCH +} +ARTS_METHOD_ERROR_CATCH } // namespace rtepack \ No newline at end of file diff --git a/src/core/rtepack/rtepack_source.cc b/src/core/rtepack/rtepack_source.cc index bbac2963f6..a8650efd82 100644 --- a/src/core/rtepack/rtepack_source.cc +++ b/src/core/rtepack/rtepack_source.cc @@ -39,7 +39,7 @@ void level_nlte_and_scattering_and_sun(stokvec_vector_view J, for (Index i = 0; i < N; i++) { if (K[i].is_rotational()) { J[i] = 0.0; - dJ(joker, i) = 0.0; + dJ[joker, i] = 0.0; } else { const auto invK = inv(K[i]); const auto src = a[i] * B[i] + S[i] + J_add[i]; @@ -47,8 +47,8 @@ void level_nlte_and_scattering_and_sun(stokvec_vector_view J, // TODO: Add jacobians dJ_add of additional source for (Index j = 0; j < M; j++) { - const auto dsrc = dS(j, i) + da(j, i) * B[i] + a[i] * dB(j, i); - dJ(j, i) = 0.5 * (invK * (dsrc - dK(j, i) * J[i])); + const auto dsrc = dS[j, i] + da[j, i] * B[i] + a[i] * dB[j, i]; + dJ[j, i] = 0.5 * (invK * (dsrc - dK[j, i] * J[i])); } } } @@ -84,15 +84,15 @@ void level_nlte_and_scattering(stokvec_vector_view J, for (Index i = 0; i < N; i++) { if (K[i].is_rotational()) { J[i] = 0.0; - dJ(joker, i) = 0.0; + dJ[joker, i] = 0.0; } else { const auto invK = inv(K[i]); const auto src = a[i] * B[i] + S[i]; J[i] = invK * src; for (Index j = 0; j < M; j++) { - const auto dsrc = dS(j, i) + da(j, i) * B[i] + a[i] * dB(j, i); - dJ(j, i) = 0.5 * (invK * (dsrc - dK(j, i) * J[i])); + const auto dsrc = dS[j, i] + da[j, i] * B[i] + a[i] * dB[j, i]; + dJ[j, i] = 0.5 * (invK * (dsrc - dK[j, i] * J[i])); } } } @@ -140,15 +140,15 @@ void level_nlte(stokvec_vector_view J, for (Index i = 0; i < N; i++) { if (K[i].is_rotational()) { J[i] = 0.0; - dJ(joker, i) = 0.0; + dJ[joker, i] = 0.0; } else { const auto b = stokvec{planck(f[i], t), 0, 0, 0}; const auto invK = inv(K[i]); J[i] = b + invK * S[i]; for (Index j = 0; j < M; j++) { - dJ(j, i) = {it == j ? dplanck_dt(f[i], t) : 0, 0, 0, 0}; - dJ(j, i) -= invK * (dK(j, i) * invK * S[i] - dS(j, i)); + dJ[j, i] = {it == j ? dplanck_dt(f[i], t) : 0, 0, 0, 0}; + dJ[j, i] -= invK * (dK[j, i] * invK * S[i] - dS[j, i]); } } } diff --git a/src/core/rtepack/rtepack_transmission.cc b/src/core/rtepack/rtepack_transmission.cc index be5c0463ca..1d7d4cb08a 100644 --- a/src/core/rtepack/rtepack_transmission.cc +++ b/src/core/rtepack/rtepack_transmission.cc @@ -223,7 +223,7 @@ struct tran { return { (dC0 + dC2 * (b2 + c2 + d2) + C2 * (db2 + dc2 + dd2)) * exp_a + - da * t(0, 0), + da * t[0, 0], (db * C1 + b * dC1 + dC2 * (-c * u - d * v) + C2 * (-dc * u - dd * v - c * du - d * dv) + dC3 * @@ -233,7 +233,7 @@ struct tran { u * (db * u - dd * w) - v * (db * v + dc * w) - u * (b * du - d * dw) - v * (b * dv + c * dw))) * exp_a + - da * t(0, 1), + da * t[0, 1], (dC1 * c + C1 * dc + dC2 * (b * u - d * w) + C2 * (db * u - dd * w + b * du - d * dw) + dC3 * @@ -243,7 +243,7 @@ struct tran { u * (dc * u + dd * v) - w * (db * v + dc * w) - u * (c * du + d * dv) - w * (b * dv + c * dw))) * exp_a + - da * t(0, 2), + da * t[0, 2], (dC1 * d + C1 * dd + dC2 * (b * v + c * w) + C2 * (db * v + dc * w + b * dv + c * dw) + dC3 * @@ -253,7 +253,7 @@ struct tran { v * (dc * u + dd * v) + w * (db * u - dd * w) - v * (c * du + d * dv) + w * (b * du - d * dw))) * exp_a + - da * t(0, 3), + da * t[0, 3], (db * C1 + b * dC1 + dC2 * (c * u + d * v) + C2 * (dc * u + dd * v + c * du + d * dv) + @@ -264,9 +264,9 @@ struct tran { c * (db * c - dv * w) + d * (db * d + du * w) + c * (b * dc - v * dw) + d * (b * dd + u * dw))) * exp_a + - da * t(1, 0), + da * t[1, 0], (dC0 + dC2 * (b2 - u2 - v2) + C2 * (db2 - du2 - dv2)) * exp_a + - da * t(1, 1), + da * t[1, 1], (dC2 * (b * c - v * w) + C2 * (db * c + b * dc - dv * w - v * dw) + dC1 * u + C1 * du + dC3 * @@ -276,7 +276,7 @@ struct tran { u * (-db2 + du2 + dv2) - w * (db * d + du * w) + c * (c * du + d * dv) - w * (b * dd + u * dw))) * exp_a + - da * t(1, 2), + da * t[1, 2], (dC2 * (b * d + u * w) + C2 * (db * d + b * dd + du * w + u * dw) + dC1 * v + C1 * dv + dC3 * @@ -286,7 +286,7 @@ struct tran { v * (-db2 + du2 + dv2) + w * (db * c - dv * w) + d * (c * du + d * dv) + w * (b * dc - v * dw))) * exp_a + - da * t(1, 3), + da * t[1, 3], (dC1 * c + C1 * dc + dC2 * (-b * u + d * w) + C2 * (-db * u + dd * w - b * du + d * dw) + @@ -297,7 +297,7 @@ struct tran { c * (-dc2 + du2 + dw2) + d * (dc * d - du * v) + b * (b * dc - v * dw) + d * (c * dd - u * dv))) * exp_a + - da * t(2, 0), + da * t[2, 0], (dC2 * (b * c - v * w) + C2 * (db * c + b * dc - dv * w - v * dw) - dC1 * u - C1 * du + dC3 * (-b * (b * u - d * w) + u * (-c2 + u2 + w2) - @@ -307,9 +307,9 @@ struct tran { u * (-dc2 + du2 + dw2) - v * (dc * d - du * v) - b * (b * du - d * dw) - v * (c * dd - u * dv))) * exp_a + - da * t(2, 1), + da * t[2, 1], (dC0 + dC2 * (c2 - u2 - w2) + C2 * (dc2 - du2 - dw2)) * exp_a + - da * t(2, 2), + da * t[2, 2], (dC2 * (c * d - u * v) + C2 * (dc * d + c * dd - du * v - u * dv) + dC1 * w + C1 * dw + dC3 * (-d * (b * u - d * w) + v * (b * c - v * w) - @@ -319,7 +319,7 @@ struct tran { v * (db * c - dv * w) - w * (-dc2 + du2 + dw2) - d * (b * du - d * dw) + v * (b * dc - v * dw))) * exp_a + - da * t(2, 3), + da * t[2, 3], (dC1 * d + C1 * dd + dC2 * (-b * v - c * w) + C2 * (-db * v - dc * w - b * dv - c * dw) + @@ -330,7 +330,7 @@ struct tran { c * (dc * d - du * v) - d * (-dd2 + dv2 + dw2) + b * (b * dd + u * dw) + c * (c * dd - u * dv))) * exp_a + - da * t(3, 0), + da * t[3, 0], (dC2 * (b * d + u * w) + C2 * (db * d + b * dd + du * w + u * dw) - dC1 * v - C1 * dv + dC3 * (-b * (b * v + c * w) - u * (c * d - u * v) + @@ -340,7 +340,7 @@ struct tran { u * (dc * d - du * v) + v * (-dd2 + dv2 + dw2) - b * (b * dv + c * dw) - u * (c * dd - u * dv))) * exp_a + - da * t(3, 1), + da * t[3, 1], (dC2 * (c * d - u * v) + C2 * (dc * d + c * dd - du * v - u * dv) - dC1 * w - C1 * dw + dC3 * (-c * (b * v + c * w) + u * (b * d + u * w) + @@ -350,9 +350,9 @@ struct tran { u * (db * d + du * w) + w * (-dd2 + dv2 + dw2) - c * (b * dv + c * dw) + u * (b * dd + u * dw))) * exp_a + - da * t(3, 2), + da * t[3, 2], (C2 * (dd2 - dv2 - dw2) + dC2 * (d2 - v2 - w2) + dC0) * exp_a + - da * t(3, 3)}; + da * t[3, 3]}; } }; @@ -410,10 +410,10 @@ void two_level_exp(muelmat_vector_view tv, tv[i] = tran_state(); for (Index j = 0; j < nq; j++) { - dt1v(j, i) = - tran_state.deriv(tv[i], k1v[i], k2v[i], dk1v(j, i), rv, dr1v[j]); - dt2v(j, i) = - tran_state.deriv(tv[i], k1v[i], k2v[i], dk2v(j, i), rv, dr2v[j]); + dt1v[j, i] = + tran_state.deriv(tv[i], k1v[i], k2v[i], dk1v[j, i], rv, dr1v[j]); + dt2v[j, i] = + tran_state.deriv(tv[i], k1v[i], k2v[i], dk2v[j, i], rv, dr2v[j]); } } } diff --git a/src/core/scattering/absorption_vector.h b/src/core/scattering/absorption_vector.h index 6321640326..968a05ee6e 100644 --- a/src/core/scattering/absorption_vector.h +++ b/src/core/scattering/absorption_vector.h @@ -106,7 +106,7 @@ class AbsorptionVectorData for (Index t_ind = 0; t_ind < t_grid_->size(); ++t_ind) { for (Index f_ind = 0; f_ind < f_grid_->size(); ++f_ind) { for (Index za_inc_ind = 0; za_inc_ind < za_inc_grid->size(); ++za_inc_ind) { - av_new(t_ind, f_ind, za_inc_ind, 0) = this->operator()(t_ind, f_ind, 0); + av_new[t_ind, f_ind, za_inc_ind, 0] = this->operator[](t_ind, f_ind, 0); } } } @@ -135,11 +135,11 @@ class AbsorptionVectorData GridPos gp_f = weights.f_grid_weights[i_f]; Numeric w_f_l = gp_f.fd[1]; Numeric w_f_r = gp_f.fd[0]; - coeffs_res(i_t, i_f) = - (w_t_l * w_f_l * coeffs_this(gp_t.idx, gp_f.idx) + - w_t_l * w_f_r * coeffs_this(gp_t.idx, gp_f.idx + 1) + - w_t_r * w_f_l * coeffs_this(gp_t.idx + 1, gp_f.idx) + - w_t_r * w_f_r * coeffs_this(gp_t.idx + 1, gp_f.idx + 1)); + coeffs_res[i_t, i_f] = + (w_t_l * w_f_l * coeffs_this[gp_t.idx, gp_f.idx] + + w_t_l * w_f_r * coeffs_this[gp_t.idx, gp_f.idx + 1] + + w_t_r * w_f_l * coeffs_this[gp_t.idx + 1, gp_f.idx] + + w_t_r * w_f_r * coeffs_this[gp_t.idx + 1, gp_f.idx + 1]); } } return result; @@ -248,24 +248,24 @@ class AbsorptionVectorData GridPos gp_za_inc = weights.za_inc_grid_weights[i_za_inc]; Numeric w_za_inc_l = gp_za_inc.fd[1]; Numeric w_za_inc_r = gp_za_inc.fd[0]; - coeffs_res(i_t, i_f, i_za_inc) = + coeffs_res[i_t, i_f, i_za_inc] = (w_t_l * w_f_l * w_za_inc_l * - coeffs_this(gp_t.idx, gp_f.idx, gp_za_inc.idx) + + coeffs_this[gp_t.idx, gp_f.idx, gp_za_inc.idx] + w_t_l * w_f_l * w_za_inc_r * - coeffs_this(gp_t.idx, gp_f.idx, gp_za_inc.idx + 1) + + coeffs_this[gp_t.idx, gp_f.idx, gp_za_inc.idx + 1] + w_t_l * w_f_r * w_za_inc_l * - coeffs_this(gp_t.idx, gp_f.idx + 1, gp_za_inc.idx) + + coeffs_this[gp_t.idx, gp_f.idx + 1, gp_za_inc.idx] + w_t_l * w_f_r * w_za_inc_r * - coeffs_this(gp_t.idx, gp_f.idx + 1, gp_za_inc.idx + 1) + + coeffs_this[gp_t.idx, gp_f.idx + 1, gp_za_inc.idx + 1] + w_t_r * w_f_l * w_za_inc_l * - coeffs_this(gp_t.idx + 1, gp_f.idx, gp_za_inc.idx) + + coeffs_this[gp_t.idx + 1, gp_f.idx, gp_za_inc.idx] + w_t_r * w_f_l * w_za_inc_r * - coeffs_this(gp_t.idx + 1, gp_f.idx, gp_za_inc.idx + 1) + + coeffs_this[gp_t.idx + 1, gp_f.idx, gp_za_inc.idx + 1] + w_t_r * w_f_r * w_za_inc_l * - coeffs_this(gp_t.idx + 1, gp_f.idx + 1, gp_za_inc.idx) + + coeffs_this[gp_t.idx + 1, gp_f.idx + 1, gp_za_inc.idx] + w_t_r * w_f_r * w_za_inc_r * - coeffs_this(gp_t.idx + 1, gp_f.idx + 1, gp_za_inc.idx + 1)); + coeffs_this[gp_t.idx + 1, gp_f.idx + 1, gp_za_inc.idx + 1]); } } } diff --git a/src/core/scattering/extinction_matrix.h b/src/core/scattering/extinction_matrix.h index 8c2f99145a..6d47fe557d 100644 --- a/src/core/scattering/extinction_matrix.h +++ b/src/core/scattering/extinction_matrix.h @@ -130,7 +130,7 @@ class ExtinctionMatrixData for (Index t_ind = 0; t_ind < t_grid_->size(); ++t_ind) { for (Index f_ind = 0; f_ind < f_grid_->size(); ++f_ind) { for (Index za_inc_ind = 0; za_inc_ind < za_inc_grid->size(); ++za_inc_ind) { - em_new(t_ind, f_ind, za_inc_ind, 0) = this->operator()(t_ind, f_ind, 0); + em_new[t_ind, f_ind, za_inc_ind, 0] = this->operator[](t_ind, f_ind, 0); } } } @@ -150,11 +150,11 @@ class ExtinctionMatrixData GridPos gp_f = weights.f_grid_weights[i_f]; Numeric w_f_l = gp_f.fd[1]; Numeric w_f_r = gp_f.fd[0]; - coeffs_res(i_t, i_f) = - (w_t_l * w_f_l * coeffs_this(gp_t.idx, gp_f.idx) + - w_t_l * w_f_r * coeffs_this(gp_t.idx, gp_f.idx + 1) + - w_t_r * w_f_l * coeffs_this(gp_t.idx + 1, gp_f.idx) + - w_t_r * w_f_r * coeffs_this(gp_t.idx + 1, gp_f.idx + 1)); + coeffs_res[i_t, i_f] = + (w_t_l * w_f_l * coeffs_this[gp_t.idx, gp_f.idx] + + w_t_l * w_f_r * coeffs_this[gp_t.idx, gp_f.idx + 1] + + w_t_r * w_f_l * coeffs_this[gp_t.idx + 1, gp_f.idx] + + w_t_r * w_f_r * coeffs_this[gp_t.idx + 1, gp_f.idx + 1]); } } return result; @@ -258,7 +258,7 @@ class ExtinctionMatrixData extract_stokes_coeffs() const { ExtinctionMatrixData result( t_grid_, f_grid_, za_inc_grid_); - result = this->operator()(joker, joker, joker, result.n_stokes_coeffs); + result = this->operator[](joker, joker, joker, result.n_stokes_coeffs); return result; } @@ -282,24 +282,24 @@ class ExtinctionMatrixData GridPos gp_za_inc = weights.za_inc_grid_weights[i_za_inc]; Numeric w_za_inc_l = gp_za_inc.fd[1]; Numeric w_za_inc_r = gp_za_inc.fd[0]; - coeffs_res(i_t, i_f, i_za_inc) = + coeffs_res[i_t, i_f, i_za_inc] = (w_t_l * w_f_l * w_za_inc_l * - coeffs_this(gp_t.idx, gp_f.idx, gp_za_inc.idx) + + coeffs_this[gp_t.idx, gp_f.idx, gp_za_inc.idx] + w_t_l * w_f_l * w_za_inc_r * - coeffs_this(gp_t.idx, gp_f.idx, gp_za_inc.idx + 1) + + coeffs_this[gp_t.idx, gp_f.idx, gp_za_inc.idx + 1] + w_t_l * w_f_r * w_za_inc_l * - coeffs_this(gp_t.idx, gp_f.idx + 1, gp_za_inc.idx) + + coeffs_this[gp_t.idx, gp_f.idx + 1, gp_za_inc.idx] + w_t_l * w_f_r * w_za_inc_r * - coeffs_this(gp_t.idx, gp_f.idx + 1, gp_za_inc.idx + 1) + + coeffs_this[gp_t.idx, gp_f.idx + 1, gp_za_inc.idx + 1] + w_t_r * w_f_l * w_za_inc_l * - coeffs_this(gp_t.idx + 1, gp_f.idx, gp_za_inc.idx) + + coeffs_this[gp_t.idx + 1, gp_f.idx, gp_za_inc.idx] + w_t_r * w_f_l * w_za_inc_r * - coeffs_this(gp_t.idx + 1, gp_f.idx, gp_za_inc.idx + 1) + + coeffs_this[gp_t.idx + 1, gp_f.idx, gp_za_inc.idx + 1] + w_t_r * w_f_r * w_za_inc_l * - coeffs_this(gp_t.idx + 1, gp_f.idx + 1, gp_za_inc.idx) + + coeffs_this[gp_t.idx + 1, gp_f.idx + 1, gp_za_inc.idx] + w_t_r * w_f_r * w_za_inc_r * - coeffs_this(gp_t.idx + 1, gp_f.idx + 1, gp_za_inc.idx + 1)); + coeffs_this[gp_t.idx + 1, gp_f.idx + 1, gp_za_inc.idx + 1]); } } } diff --git a/src/core/scattering/general_tro_spectral.cc b/src/core/scattering/general_tro_spectral.cc index b8928e5283..d2beeff4a7 100644 --- a/src/core/scattering/general_tro_spectral.cc +++ b/src/core/scattering/general_tro_spectral.cc @@ -46,7 +46,7 @@ ScatteringTroSpectralVector::to_general( for (Index f_ind = 0; f_ind < pm.npages(); ++f_ind) { for (Index ind = 0; ind < pm.nrows(); ++ind) { for (Index is = 0; is < pm.ncols(); is++) { - pm(0, f_ind, ind, is) = phase_matrix(f_ind, ind).data[is]; + pm[0, f_ind, ind, is] = phase_matrix[f_ind, ind].data[is]; } } } @@ -74,7 +74,7 @@ ScatteringTroSpectralVector::to_general( for (Index f_ind = 0; f_ind < emd.nrows(); ++f_ind) { for (Index i = 0; i < emd.ncols(); i++) { - emd(0, f_ind, i) = extinction_matrix[f_ind][i]; + emd[0, f_ind, i] = extinction_matrix[f_ind][i]; } } @@ -101,7 +101,7 @@ ScatteringTroSpectralVector::to_general( for (Index f_ind = 0; av.nrows(); ++f_ind) { for (Index i = 0; i < av.ncols(); i++) { - av(0, f_ind, i) = absorption_vector[f_ind][i]; + av[0, f_ind, i] = absorption_vector[f_ind][i]; } } return av; diff --git a/src/core/scattering/henyey_greenstein.cc b/src/core/scattering/henyey_greenstein.cc index 74e1c2b695..6d7b8a4d1b 100644 --- a/src/core/scattering/henyey_greenstein.cc +++ b/src/core/scattering/henyey_greenstein.cc @@ -47,12 +47,12 @@ HenyeyGreensteinScatterer::get_bulk_scattering_properties_tro_gridded( std::tie(extinction, ssa) = ext_ssa_callback(f_grid[f_ind], atm_point); float scattering_xsec = extinction * ssa; - emd(0, f_ind, 0) = extinction; - av(0, f_ind, 0) = extinction - scattering_xsec; + emd[0, f_ind, 0] = extinction; + av[0, f_ind, 0] = extinction - scattering_xsec; Numeric g2 = g * g; for (Index ind = 0; ind < zenith_angles.size(); ++ind) { - pm(0, f_ind, ind, 0) = (1.0 - g2); - pm(0, f_ind, ind, 0) /= std::pow( + pm[0, f_ind, ind, 0] = (1.0 - g2); + pm[0, f_ind, ind, 0] /= std::pow( 1.0 + g2 - 2.0 * g * cos(Conversion::deg2rad(zenith_angles[ind])), 3.0 / 2.0); } @@ -85,7 +85,7 @@ HenyeyGreensteinScatterer::get_bulk_scattering_properties_tro_spectral( for (Index ind = 0; ind <= l; ++ind) { for (Index i = 0; i < 4; i++) - pm(f_ind, ind)(i, i) = f[ind] * scattering_xsec; + pm[f_ind, ind][i, i] = f[ind] * scattering_xsec; } emd[f_ind].A() = extinction; diff --git a/src/core/scattering/integration.h b/src/core/scattering/integration.h index a408223092..64d3bfb383 100644 --- a/src/core/scattering/integration.h +++ b/src/core/scattering/integration.h @@ -471,12 +471,12 @@ Sparse calculate_downsampling_matrix(const VectorView& old_grid, Scalar overlap = std::min(right_new, right_old) - std::max(left_new, left_old); if (overlap > 0.0) { - weights(i_new, i_old) += 0.5 * overlap; - weights(i_new, i_old + 1) += 0.5 * overlap; + weights[i_new, i_old] += 0.5 * overlap; + weights[i_new, i_old + 1] += 0.5 * overlap; ; } } - weights(i_new, joker) /= (right_new - left_new); + weights[i_new, joker] /= (right_new - left_new); } // Convert matrix to sparse. @@ -489,7 +489,7 @@ Sparse calculate_downsampling_matrix(const VectorView& old_grid, Index comp_index = 0; for (Index i_r = 0; i_r < weights.nrows(); ++i_r) { for (Index i_c = 0; i_c < weights.ncols(); ++i_c) { - Numeric elem = weights(i_r, i_c); + Numeric elem = weights[i_r, i_c]; if (elem > 0.0) { row_inds[comp_index] = i_r; col_inds[comp_index] = i_c; diff --git a/src/core/scattering/mie.h b/src/core/scattering/mie.h index 60ac54651a..6ea73388f4 100644 --- a/src/core/scattering/mie.h +++ b/src/core/scattering/mie.h @@ -356,12 +356,12 @@ class MieSphere { } MatrixGen result{theta_.size(), 6}; - result(joker, 0) = s11; - result(joker, 1) = s12; - result(joker, 2) = s11; - result(joker, 3) = s33; - result(joker, 4) = s34; - result(joker, 5) = s33; + result[joker, 0] = s11; + result[joker, 1] = s12; + result[joker, 2] = s11; + result[joker, 3] = s33; + result[joker, 4] = s34; + result[joker, 5] = s33; result /= (k * k); return result; } diff --git a/src/core/scattering/phase_matrix.h b/src/core/scattering/phase_matrix.h index 0399ee104a..9ea42c1d33 100644 --- a/src/core/scattering/phase_matrix.h +++ b/src/core/scattering/phase_matrix.h @@ -386,7 +386,7 @@ class BackscatterMatrixData : public matpack::matpack_data { for (Index i_t = 0; i_t < n_temps_; ++i_t) { for (Index i_f = 0; i_f < n_freqs_; ++i_f) { for (Index i_s = 0; i_s < n_stokes_coeffs_new; ++i_s) { - result(i_t, i_f, i_s) = this->operator()(i_t, i_f, i_s); + result[i_t, i_f, i_s] = this->operator[](i_t, i_f, i_s); } } } @@ -406,11 +406,11 @@ class BackscatterMatrixData : public matpack::matpack_data { GridPos gp_f = weights.f_grid_weights[i_f]; Numeric w_f_l = gp_f.fd[1]; Numeric w_f_r = gp_f.fd[0]; - coeffs_res(i_t, i_f) = - (w_t_l * w_f_l * coeffs_this(gp_t.idx, gp_f.idx) + - w_t_l * w_f_r * coeffs_this(gp_t.idx, gp_f.idx + 1) + - w_t_r * w_f_l * coeffs_this(gp_t.idx + 1, gp_f.idx) + - w_t_r * w_f_r * coeffs_this(gp_t.idx + 1, gp_f.idx + 1)); + coeffs_res[i_t, i_f] = + (w_t_l * w_f_l * coeffs_this[gp_t.idx, gp_f.idx] + + w_t_l * w_f_r * coeffs_this[gp_t.idx, gp_f.idx + 1] + + w_t_r * w_f_l * coeffs_this[gp_t.idx + 1, gp_f.idx] + + w_t_r * w_f_r * coeffs_this[gp_t.idx + 1, gp_f.idx + 1]); } } return result; @@ -487,8 +487,8 @@ class BackscatterMatrixData for (Index i_f = 0; i_f < n_freqs_; ++i_f) { for (Index i_za_inc = 0; i_za_inc < n_za_inc_; ++i_za_inc) { for (Index i_s = 0; i_s < n_stokes_coeffs_new; ++i_s) { - result(i_t, i_f, i_za_inc, i_s) = - this->operator()(i_t, i_f, i_za_inc, i_s); + result[i_t, i_f, i_za_inc, i_s] = + this->operator[](i_t, i_f, i_za_inc, i_s); } } } @@ -515,25 +515,25 @@ class BackscatterMatrixData Numeric w_za_inc_l = gp_za_inc.fd[1]; Numeric w_za_inc_r = gp_za_inc.fd[0]; for (Index i_s = 0; i_s < n_stokes_coeffs; ++i_s) { - coeffs_res(i_t, i_f, i_za_inc) = + coeffs_res[i_t, i_f, i_za_inc] = (w_t_l * w_f_l * w_za_inc_l * - coeffs_this(gp_t.idx, gp_f.idx, gp_za_inc.idx) + + coeffs_this[gp_t.idx, gp_f.idx, gp_za_inc.idx] + w_t_l * w_f_l * w_za_inc_r * - coeffs_this(gp_t.idx, gp_f.idx, gp_za_inc.idx + 1) + + coeffs_this[gp_t.idx, gp_f.idx, gp_za_inc.idx + 1] + w_t_l * w_f_r * w_za_inc_l * - coeffs_this(gp_t.idx, gp_f.idx + 1, gp_za_inc.idx) + + coeffs_this[gp_t.idx, gp_f.idx + 1, gp_za_inc.idx] + w_t_l * w_f_r * w_za_inc_r * - coeffs_this(gp_t.idx, gp_f.idx + 1, gp_za_inc.idx + 1) + + coeffs_this[gp_t.idx, gp_f.idx + 1, gp_za_inc.idx + 1] + w_t_r * w_f_l * w_za_inc_l * - coeffs_this(gp_t.idx + 1, gp_f.idx, gp_za_inc.idx) + + coeffs_this[gp_t.idx + 1, gp_f.idx, gp_za_inc.idx] + w_t_r * w_f_l * w_za_inc_r * - coeffs_this(gp_t.idx + 1, gp_f.idx, gp_za_inc.idx + 1) + + coeffs_this[gp_t.idx + 1, gp_f.idx, gp_za_inc.idx + 1] + w_t_r * w_f_r * w_za_inc_l * - coeffs_this(gp_t.idx + 1, gp_f.idx + 1, gp_za_inc.idx) + + coeffs_this[gp_t.idx + 1, gp_f.idx + 1, gp_za_inc.idx] + w_t_r * w_f_r * w_za_inc_r * - coeffs_this( - gp_t.idx + 1, gp_f.idx + 1, gp_za_inc.idx + 1)); + coeffs_this[ + gp_t.idx + 1, gp_f.idx + 1, gp_za_inc.idx + 1]); } } } @@ -695,8 +695,8 @@ class PhaseMatrixData for (Index i_t = 0; i_t < n_temps_; ++i_t) { for (Index i_f = 0; i_f < n_freqs_; ++i_f) { for (Index i_s = 0; i_s < n_stokes_coeffs; ++i_s) { - result(i_t, i_f, joker, i_s) = - sht->transform(this->operator()(i_t, Range(i_f, 1), joker, i_s)); + result[i_t, i_f, joker, i_s] = + sht->transform(this->operator[](i_t, Range(i_f, 1), joker, i_s)); } } } @@ -742,12 +742,12 @@ class PhaseMatrixData for (Index i_s = 0; i_s < n_stokes_coeffs; ++i_s) { pm_comps[i_s] = (angle_interp.fd[1] * - this->operator()(i_t, i_f, angle_interp.idx, i_s) + + this->operator[](i_t, i_f, angle_interp.idx, i_s) + angle_interp.fd[0] * - this->operator()(i_t, i_f, angle_interp.idx + 1, i_s)); + this->operator[](i_t, i_f, angle_interp.idx + 1, i_s)); } detail::expand_and_transform( - result(i_t, i_f, i_za_inc, i_delta_aa, i_za_scat, joker), + result[i_t, i_f, i_za_inc, i_delta_aa, i_za_scat, joker], pm_comps, coeffs, (*delta_aa_grid)[i_delta_aa] > 180.0); @@ -768,9 +768,9 @@ class PhaseMatrixData for (Index i_t = 0; i_t < n_temps_; ++i_t) { for (Index i_f = 0; i_f < n_freqs_; ++i_f) { for (Index i_s = 0; i_s < n_stokes_coeffs; ++i_s) { - result(i_t, i_f, i_s) = - (interp.fd[1] * this->operator()(i_t, i_f, interp.idx, i_s) + - interp.fd[0] * this->operator()(i_t, i_f, interp.idx + 1, i_s)); + result[i_t, i_f, i_s] = + (interp.fd[1] * this->operator[](i_t, i_f, interp.idx, i_s) + + interp.fd[0] * this->operator[](i_t, i_f, interp.idx + 1, i_s)); } } } @@ -786,9 +786,9 @@ class PhaseMatrixData for (Index i_t = 0; i_t < n_temps_; ++i_t) { for (Index i_f = 0; i_f < n_freqs_; ++i_f) { for (Index i_s = 0; i_s < n_stokes_coeffs; ++i_s) { - result(i_t, i_f, i_s) = - (interp.fd[1] * this->operator()(i_t, i_f, interp.idx, i_s) + - interp.fd[0] * this->operator()(i_t, i_f, interp.idx + 1, i_s)); + result[i_t, i_f, i_s] = + (interp.fd[1] * this->operator[](i_t, i_f, interp.idx, i_s) + + interp.fd[0] * this->operator[](i_t, i_f, interp.idx + 1, i_s)); } } } @@ -817,9 +817,9 @@ class PhaseMatrixData auto this_vec = get_coeff_vector_view(); for (Index i_t = 0; i_t < n_temps_; ++i_t) { for (Index i_f = 0; i_f < n_freqs_; ++i_f) { - result_vec(i_t, i_f) = + result_vec[i_t, i_f] = 2.0 * pi_v * - integrate_zenith_angle(this_vec(i_t, i_f, joker), *za_scat_grid_); + integrate_zenith_angle(this_vec[i_t, i_f, joker], *za_scat_grid_); } } return results; @@ -840,8 +840,8 @@ class PhaseMatrixData for (Index i_f = 0; i_f < n_freqs_; ++i_f) { for (Index i_za_scat = 0; i_za_scat < n_za_scat_; ++i_za_scat) { for (Index i_s = 0; i_s < result.n_stokes_coeffs; ++i_s) { - result(i_t, i_f, i_za_scat, i_s) = - this->operator()(i_t, i_f, i_za_scat, i_s); + result[i_t, i_f, i_za_scat, i_s] = + this->operator[](i_t, i_f, i_za_scat, i_s); } } } @@ -869,42 +869,42 @@ class PhaseMatrixData Numeric w_za_scat_l = gp_za_scat.fd[1]; Numeric w_za_scat_r = gp_za_scat.fd[0]; - coeffs_res(i_t, i_f, i_za_scat).setZero(); + coeffs_res[i_t, i_f, i_za_scat].setZero(); if (w_t_l > 0.0) { if (w_f_l > 0.0) { - coeffs_res(i_t, i_f, i_za_scat) += + coeffs_res[i_t, i_f, i_za_scat] += w_t_l * w_f_l * w_za_scat_l * - coeffs_this(gp_t.idx, gp_f.idx, gp_za_scat.idx); - coeffs_res(i_t, i_f, i_za_scat) += + coeffs_this[gp_t.idx, gp_f.idx, gp_za_scat.idx]; + coeffs_res[i_t, i_f, i_za_scat] += w_t_l * w_f_l * w_za_scat_r * - coeffs_this(gp_t.idx, gp_f.idx, gp_za_scat.idx + 1); + coeffs_this[gp_t.idx, gp_f.idx, gp_za_scat.idx + 1]; } if (w_f_r > 0.0) { - coeffs_res(i_t, i_f, i_za_scat) += + coeffs_res[i_t, i_f, i_za_scat] += w_t_l * w_f_r * w_za_scat_l * - coeffs_this(gp_t.idx, gp_f.idx + 1, gp_za_scat.idx); - coeffs_res(i_t, i_f, i_za_scat) += + coeffs_this[gp_t.idx, gp_f.idx + 1, gp_za_scat.idx]; + coeffs_res[i_t, i_f, i_za_scat] += w_t_l * w_f_r * w_za_scat_r * - coeffs_this(gp_t.idx, gp_f.idx + 1, gp_za_scat.idx + 1); + coeffs_this[gp_t.idx, gp_f.idx + 1, gp_za_scat.idx + 1]; } } if (w_t_r > 0.0) { if (w_f_l > 0.0) { - coeffs_res(i_t, i_f, i_za_scat) += + coeffs_res[i_t, i_f, i_za_scat] += w_t_r * w_f_l * w_za_scat_l * - coeffs_this(gp_t.idx + 1, gp_f.idx, gp_za_scat.idx); - coeffs_res(i_t, i_f, i_za_scat) += + coeffs_this[gp_t.idx + 1, gp_f.idx, gp_za_scat.idx]; + coeffs_res[i_t, i_f, i_za_scat] += w_t_r * w_f_l * w_za_scat_r * - coeffs_this(gp_t.idx + 1, gp_f.idx, gp_za_scat.idx + 1); + coeffs_this[gp_t.idx + 1, gp_f.idx, gp_za_scat.idx + 1]; } if (w_f_r > 0.0) { - coeffs_res(i_t, i_f, i_za_scat) += + coeffs_res[i_t, i_f, i_za_scat] += w_t_r * w_f_r * w_za_scat_l * - coeffs_this(gp_t.idx + 1, gp_f.idx + 1, gp_za_scat.idx); - coeffs_res(i_t, i_f, i_za_scat) += + coeffs_this[gp_t.idx + 1, gp_f.idx + 1, gp_za_scat.idx]; + coeffs_res[i_t, i_f, i_za_scat] += w_t_r * w_f_r * w_za_scat_r * - coeffs_this(gp_t.idx + 1, gp_f.idx + 1, gp_za_scat.idx + 1); + coeffs_this[gp_t.idx + 1, gp_f.idx + 1, gp_za_scat.idx + 1]; } } } @@ -1068,8 +1068,8 @@ class PhaseMatrixData for (Index i_t = 0; i_t < n_temps_; ++i_t) { for (Index i_f = 0; i_f < n_freqs_; ++i_f) { for (Index i_s = 0; i_s < n_stokes_coeffs; ++i_s) { - result(i_t, i_f, joker, i_s) = sht_->synthesize( - this->operator()(i_t, i_f, joker, i_s))(0, joker); + result[i_t, i_f, joker, i_s] = sht_->synthesize( + this->operator[](i_t, i_f, joker, i_s))[0]; } } } @@ -1088,8 +1088,8 @@ class PhaseMatrixData for (Index i_t = 0; i_t < n_temps_; ++i_t) { for (Index i_f = 0; i_f < n_freqs_; ++i_f) { for (Index i_s = 0; i_s < n_stokes_coeffs; ++i_s) { - result(i_t, i_f, i_s) = - sht_->evaluate(this->operator()(i_t, i_f, joker, i_s), + result[i_t, i_f, i_s] = + sht_->evaluate(this->operator[](i_t, i_f, joker, i_s), Conversion::deg2rad(0.0), Conversion::deg2rad(180.0)); } @@ -1104,8 +1104,8 @@ class PhaseMatrixData for (Index i_t = 0; i_t < n_temps_; ++i_t) { for (Index i_f = 0; i_f < n_freqs_; ++i_f) { for (Index i_s = 0; i_s < n_stokes_coeffs; ++i_s) { - result(i_t, i_f, i_s) = - sht_->evaluate(this->operator()(i_t, i_f, joker, i_s), 0.0, 0.0); + result[i_t, i_f, i_s] = + sht_->evaluate(this->operator[](i_t, i_f, joker, i_s), 0.0, 0.0); } } } @@ -1124,7 +1124,7 @@ class PhaseMatrixData for (Index i_t = 0; i_t < n_temps_; ++i_t) { for (Index i_f = 0; i_f < n_freqs_; ++i_f) { for (Index i_s = 0; i_s < n_stokes_coeffs; ++i_s) { - results(i_t, i_f, i_s) = this->operator()(i_t, i_f, 0, i_s).real() * + results[i_t, i_f, i_s] = this->operator[](i_t, i_f, 0, i_s).real() * sqrt(4.0 * pi_v); } } @@ -1147,8 +1147,8 @@ class PhaseMatrixData for (Index i_f = 0; i_f < n_freqs_; ++i_f) { for (Index i_sht = 0; i_sht < n_spectral_coeffs_; ++i_sht) { for (Index i_s = 0; i_s < result.n_stokes_coeffs; ++i_s) { - result(i_t, i_f, i_sht, i_s) = - this->operator()(i_t, i_f, i_sht, i_s); + result[i_t, i_f, i_sht, i_s] = + this->operator[](i_t, i_f, i_sht, i_s); } } } @@ -1180,35 +1180,35 @@ class PhaseMatrixData Numeric w_f_r = gp_f.fd[0]; for (Index i_sht = 0; i_sht < n_spectral_coeffs_; ++i_sht) { - coeffs_res(i_t, i_f, i_sht).setZero(); + coeffs_res[i_t, i_f, i_sht].setZero(); } if (w_t_l > 0.0) { if (w_f_l > 0.0) { for (Index i_sht = 0; i_sht < n_spectral_coeffs_; ++i_sht) { - coeffs_res(i_t, i_f, i_sht) += - w_t_l * w_f_l * coeffs_this(gp_t.idx, gp_f.idx, i_sht); + coeffs_res[i_t, i_f, i_sht] += + w_t_l * w_f_l * coeffs_this[gp_t.idx, gp_f.idx, i_sht]; } } if (w_f_r > 0.0) { for (Index i_sht = 0; i_sht < n_spectral_coeffs_; ++i_sht) { - coeffs_res(i_t, i_f, i_sht) += - w_t_l * w_f_r * coeffs_this(gp_t.idx, gp_f.idx + 1, i_sht); + coeffs_res[i_t, i_f, i_sht] += + w_t_l * w_f_r * coeffs_this[gp_t.idx, gp_f.idx + 1, i_sht]; } } } if (w_t_r > 0.0) { if (w_f_l > 0.0) { for (Index i_sht = 0; i_sht < n_spectral_coeffs_; ++i_sht) { - coeffs_res(i_t, i_f, i_sht) += - w_t_r * w_f_l * coeffs_this(gp_t.idx + 1, gp_f.idx, i_sht); + coeffs_res[i_t, i_f, i_sht] += + w_t_r * w_f_l * coeffs_this[gp_t.idx + 1, gp_f.idx, i_sht]; } } if (w_f_r > 0.0) { for (Index i_sht = 0; i_sht < n_spectral_coeffs_; ++i_sht) { - coeffs_res(i_t, i_f, i_sht) += + coeffs_res[i_t, i_f, i_sht] += w_t_r * w_f_r * - coeffs_this(gp_t.idx + 1, gp_f.idx + 1, i_sht); + coeffs_this[gp_t.idx + 1, gp_f.idx + 1, i_sht]; } } } @@ -1349,8 +1349,8 @@ class PhaseMatrixData for (Index i_f = 0; i_f < n_freqs_; ++i_f) { for (Index i_za_inc = 0; i_za_inc < n_za_inc_; ++i_za_inc) { for (Index i_s = 0; i_s < n_stokes_coeffs; ++i_s) { - result(i_t, i_f, i_za_inc, joker, i_s) = sht->transform( - this->operator()(i_t, i_f, i_za_inc, joker, joker, i_s)); + result[i_t, i_f, i_za_inc, joker, i_s] = sht->transform( + this->operator[](i_t, i_f, i_za_inc, joker, joker, i_s)); } } } @@ -1383,8 +1383,8 @@ class PhaseMatrixData interpweights(weights, delta_aa_interp, za_scat_interp); for (Index i_s = 0; i_s < n_stokes_coeffs; ++i_s) { - auto mat = this->operator()(i_t, i_f, i_za_inc, joker, joker, i_s); - result(i_t, i_f, i_za_inc, i_s) = + auto mat = this->operator[](i_t, i_f, i_za_inc, joker, joker, i_s); + result[i_t, i_f, i_za_inc, i_s] = interp(weights, mat, delta_aa_interp, za_scat_interp); } } @@ -1409,8 +1409,8 @@ class PhaseMatrixData interpweights(weights, delta_aa_interp, za_scat_interp); for (Index i_s = 0; i_s < n_stokes_coeffs; ++i_s) { - auto mat = this->operator()(i_t, i_f, i_za_inc, joker, joker, i_s); - result(i_t, i_f, i_za_inc, i_s) = + auto mat = this->operator[](i_t, i_f, i_za_inc, joker, joker, i_s); + result[i_t, i_f, i_za_inc, i_s] = interp(weights, mat, delta_aa_interp, za_scat_interp); } } @@ -1436,8 +1436,8 @@ class PhaseMatrixData for (Index i_aa_scat = 0; i_aa_scat < n_delta_aa_; ++i_aa_scat) { for (Index i_za_scat = 0; i_za_scat < n_za_scat_; ++i_za_scat) { for (Index i_s = 0; i_s < result.n_stokes_coeffs; ++i_s) { - result(i_t, i_f, i_za_inc, i_aa_scat, i_za_scat, i_s) = - this->operator()( + result[i_t, i_f, i_za_inc, i_aa_scat, i_za_scat, i_s] = + this->operator[]( i_t, i_f, i_za_inc, i_aa_scat, i_za_scat, i_s); } } @@ -1484,246 +1484,246 @@ class PhaseMatrixData Numeric w_za_scat_l = gp_za_scat.fd[1]; Numeric w_za_scat_r = gp_za_scat.fd[0]; - coeffs_res(i_t, i_f, i_za_inc, i_aa_scat, i_za_scat).setZero(); + coeffs_res[i_t, i_f, i_za_inc, i_aa_scat, i_za_scat].setZero(); if (w_t_l > 0.0) { if (w_f_l > 0.0) { - coeffs_res(i_t, i_f, i_za_inc, i_aa_scat, i_za_scat) += + coeffs_res[i_t, i_f, i_za_inc, i_aa_scat, i_za_scat] += w_t_l * w_f_l * w_za_inc_l * w_aa_scat_l * w_za_scat_l * - coeffs_this(gp_t.idx, + coeffs_this[gp_t.idx, gp_f.idx, gp_za_inc.idx, gp_aa_scat.idx, - gp_za_scat.idx); - coeffs_res(i_t, i_f, i_za_inc, i_aa_scat, i_za_scat) += + gp_za_scat.idx]; + coeffs_res[i_t, i_f, i_za_inc, i_aa_scat, i_za_scat] += w_t_l * w_f_l * w_za_inc_l * w_aa_scat_l * w_za_scat_r * - coeffs_this(gp_t.idx, + coeffs_this[gp_t.idx, gp_f.idx, gp_za_inc.idx, gp_aa_scat.idx, - gp_za_scat.idx + 1); - coeffs_res(i_t, i_f, i_za_inc, i_aa_scat, i_za_scat) += + gp_za_scat.idx + 1]; + coeffs_res[i_t, i_f, i_za_inc, i_aa_scat, i_za_scat] += w_t_l * w_f_l * w_za_inc_l * w_aa_scat_r * w_za_scat_l * - coeffs_this(gp_t.idx, + coeffs_this[gp_t.idx, gp_f.idx, gp_za_inc.idx, gp_aa_scat.idx + 1, - gp_za_scat.idx); - coeffs_res(i_t, i_f, i_za_inc, i_aa_scat, i_za_scat) += + gp_za_scat.idx]; + coeffs_res[i_t, i_f, i_za_inc, i_aa_scat, i_za_scat] += w_t_l * w_f_l * w_za_inc_l * w_aa_scat_r * w_za_scat_r * - coeffs_this(gp_t.idx, + coeffs_this[gp_t.idx, gp_f.idx, gp_za_inc.idx, gp_aa_scat.idx + 1, - gp_za_scat.idx + 1); + gp_za_scat.idx + 1]; - coeffs_res(i_t, i_f, i_za_inc, i_aa_scat, i_za_scat) += + coeffs_res[i_t, i_f, i_za_inc, i_aa_scat, i_za_scat] += w_t_l * w_f_l * w_za_inc_r * w_aa_scat_l * w_za_scat_l * - coeffs_this(gp_t.idx, + coeffs_this[gp_t.idx, gp_f.idx, gp_za_inc.idx + 1, gp_aa_scat.idx, - gp_za_scat.idx); - coeffs_res(i_t, i_f, i_za_inc, i_aa_scat, i_za_scat) += + gp_za_scat.idx]; + coeffs_res[i_t, i_f, i_za_inc, i_aa_scat, i_za_scat] += w_t_l * w_f_l * w_za_inc_r * w_aa_scat_l * w_za_scat_r * - coeffs_this(gp_t.idx, + coeffs_this[gp_t.idx, gp_f.idx, gp_za_inc.idx + 1, gp_aa_scat.idx, - gp_za_scat.idx + 1); - coeffs_res(i_t, i_f, i_za_inc, i_aa_scat, i_za_scat) += + gp_za_scat.idx + 1]; + coeffs_res[i_t, i_f, i_za_inc, i_aa_scat, i_za_scat] += w_t_l * w_f_l * w_za_inc_r * w_aa_scat_r * w_za_scat_l * - coeffs_this(gp_t.idx, + coeffs_this[gp_t.idx, gp_f.idx, gp_za_inc.idx + 1, gp_aa_scat.idx + 1, - gp_za_scat.idx); - coeffs_res(i_t, i_f, i_za_inc, i_aa_scat, i_za_scat) += + gp_za_scat.idx]; + coeffs_res[i_t, i_f, i_za_inc, i_aa_scat, i_za_scat] += w_t_l * w_f_l * w_za_inc_r * w_aa_scat_r * w_za_scat_r * - coeffs_this(gp_t.idx, + coeffs_this[gp_t.idx, gp_f.idx, gp_za_inc.idx + 1, gp_aa_scat.idx + 1, - gp_za_scat.idx + 1); + gp_za_scat.idx + 1]; } if (w_f_r > 0.0) { - coeffs_res(i_t, i_f, i_za_inc, i_aa_scat, i_za_scat) += + coeffs_res[i_t, i_f, i_za_inc, i_aa_scat, i_za_scat] += w_t_l * w_f_r * w_za_inc_l * w_aa_scat_l * w_za_scat_l * - coeffs_this(gp_t.idx, + coeffs_this[gp_t.idx, gp_f.idx + 1, gp_za_inc.idx, gp_aa_scat.idx, - gp_za_scat.idx); - coeffs_res(i_t, i_f, i_za_inc, i_aa_scat, i_za_scat) += + gp_za_scat.idx]; + coeffs_res[i_t, i_f, i_za_inc, i_aa_scat, i_za_scat] += w_t_l * w_f_r * w_za_inc_l * w_aa_scat_l * w_za_scat_r * - coeffs_this(gp_t.idx, + coeffs_this[gp_t.idx, gp_f.idx + 1, gp_za_inc.idx, gp_aa_scat.idx, - gp_za_scat.idx + 1); - coeffs_res(i_t, i_f, i_za_inc, i_aa_scat, i_za_scat) += + gp_za_scat.idx + 1]; + coeffs_res[i_t, i_f, i_za_inc, i_aa_scat, i_za_scat] += w_t_l * w_f_r * w_za_inc_l * w_aa_scat_r * w_za_scat_l * - coeffs_this(gp_t.idx, + coeffs_this[gp_t.idx, gp_f.idx + 1, gp_za_inc.idx, gp_aa_scat.idx + 1, - gp_za_scat.idx); - coeffs_res(i_t, i_f, i_za_inc, i_aa_scat, i_za_scat) += + gp_za_scat.idx]; + coeffs_res[i_t, i_f, i_za_inc, i_aa_scat, i_za_scat] += w_t_l * w_f_r * w_za_inc_l * w_aa_scat_r * w_za_scat_r * - coeffs_this(gp_t.idx, + coeffs_this[gp_t.idx, gp_f.idx + 1, gp_za_inc.idx, gp_aa_scat.idx + 1, - gp_za_scat.idx + 1); + gp_za_scat.idx + 1]; - coeffs_res(i_t, i_f, i_za_inc, i_aa_scat, i_za_scat) += + coeffs_res[i_t, i_f, i_za_inc, i_aa_scat, i_za_scat] += w_t_l * w_f_r * w_za_inc_r * w_aa_scat_l * w_za_scat_l * - coeffs_this(gp_t.idx, + coeffs_this[gp_t.idx, gp_f.idx + 1, gp_za_inc.idx + 1, gp_aa_scat.idx, - gp_za_scat.idx); - coeffs_res(i_t, i_f, i_za_inc, i_aa_scat, i_za_scat) += + gp_za_scat.idx]; + coeffs_res[i_t, i_f, i_za_inc, i_aa_scat, i_za_scat] += w_t_l * w_f_r * w_za_inc_r * w_aa_scat_l * w_za_scat_r * - coeffs_this(gp_t.idx, + coeffs_this[gp_t.idx, gp_f.idx + 1, gp_za_inc.idx + 1, gp_aa_scat.idx, - gp_za_scat.idx + 1); - coeffs_res(i_t, i_f, i_za_inc, i_aa_scat, i_za_scat) += + gp_za_scat.idx + 1]; + coeffs_res[i_t, i_f, i_za_inc, i_aa_scat, i_za_scat] += w_t_l * w_f_r * w_za_inc_r * w_aa_scat_r * w_za_scat_l * - coeffs_this(gp_t.idx, + coeffs_this[gp_t.idx, gp_f.idx + 1, gp_za_inc.idx + 1, gp_aa_scat.idx + 1, - gp_za_scat.idx); - coeffs_res(i_t, i_f, i_za_inc, i_aa_scat, i_za_scat) += + gp_za_scat.idx]; + coeffs_res[i_t, i_f, i_za_inc, i_aa_scat, i_za_scat] += w_t_l * w_f_r * w_za_inc_r * w_aa_scat_r * w_za_scat_r * - coeffs_this(gp_t.idx, + coeffs_this[gp_t.idx, gp_f.idx + 1, gp_za_inc.idx + 1, gp_aa_scat.idx + 1, - gp_za_scat.idx + 1); + gp_za_scat.idx + 1]; } } if (w_t_r > 0.0) { if (w_f_l > 0.0) { - coeffs_res(i_t, i_f, i_za_inc, i_aa_scat, i_za_scat) += + coeffs_res[i_t, i_f, i_za_inc, i_aa_scat, i_za_scat] += w_t_r * w_f_l * w_za_inc_l * w_aa_scat_l * w_za_scat_l * - coeffs_this(gp_t.idx + 1, + coeffs_this[gp_t.idx + 1, gp_f.idx, gp_za_inc.idx, gp_aa_scat.idx, - gp_za_scat.idx); - coeffs_res(i_t, i_f, i_za_inc, i_aa_scat, i_za_scat) += + gp_za_scat.idx]; + coeffs_res[i_t, i_f, i_za_inc, i_aa_scat, i_za_scat] += w_t_r * w_f_l * w_za_inc_l * w_aa_scat_l * w_za_scat_r * - coeffs_this(gp_t.idx + 1, + coeffs_this[gp_t.idx + 1, gp_f.idx, gp_za_inc.idx, gp_aa_scat.idx, - gp_za_scat.idx + 1); - coeffs_res(i_t, i_f, i_za_inc, i_aa_scat, i_za_scat) += + gp_za_scat.idx + 1]; + coeffs_res[i_t, i_f, i_za_inc, i_aa_scat, i_za_scat] += w_t_r * w_f_l * w_za_inc_l * w_aa_scat_r * w_za_scat_l * - coeffs_this(gp_t.idx + 1, + coeffs_this[gp_t.idx + 1, gp_f.idx, gp_za_inc.idx, gp_aa_scat.idx + 1, - gp_za_scat.idx); - coeffs_res(i_t, i_f, i_za_inc, i_aa_scat, i_za_scat) += + gp_za_scat.idx]; + coeffs_res[i_t, i_f, i_za_inc, i_aa_scat, i_za_scat] += w_t_r * w_f_l * w_za_inc_l * w_aa_scat_r * w_za_scat_r * - coeffs_this(gp_t.idx + 1, + coeffs_this[gp_t.idx + 1, gp_f.idx, gp_za_inc.idx, gp_aa_scat.idx + 1, - gp_za_scat.idx + 1); + gp_za_scat.idx + 1]; - coeffs_res(i_t, i_f, i_za_inc, i_aa_scat, i_za_scat) += + coeffs_res[i_t, i_f, i_za_inc, i_aa_scat, i_za_scat] += w_t_r * w_f_l * w_za_inc_r * w_aa_scat_l * w_za_scat_l * - coeffs_this(gp_t.idx + 1, + coeffs_this[gp_t.idx + 1, gp_f.idx, gp_za_inc.idx + 1, gp_aa_scat.idx, - gp_za_scat.idx); - coeffs_res(i_t, i_f, i_za_inc, i_aa_scat, i_za_scat) += + gp_za_scat.idx]; + coeffs_res[i_t, i_f, i_za_inc, i_aa_scat, i_za_scat] += w_t_r * w_f_l * w_za_inc_r * w_aa_scat_l * w_za_scat_r * - coeffs_this(gp_t.idx + 1, + coeffs_this[gp_t.idx + 1, gp_f.idx, gp_za_inc.idx + 1, gp_aa_scat.idx, - gp_za_scat.idx + 1); - coeffs_res(i_t, i_f, i_za_inc, i_aa_scat, i_za_scat) += + gp_za_scat.idx + 1]; + coeffs_res[i_t, i_f, i_za_inc, i_aa_scat, i_za_scat] += w_t_r * w_f_l * w_za_inc_r * w_aa_scat_r * w_za_scat_l * - coeffs_this(gp_t.idx + 1, + coeffs_this[gp_t.idx + 1, gp_f.idx, gp_za_inc.idx + 1, gp_aa_scat.idx + 1, - gp_za_scat.idx); - coeffs_res(i_t, i_f, i_za_inc, i_aa_scat, i_za_scat) += + gp_za_scat.idx]; + coeffs_res[i_t, i_f, i_za_inc, i_aa_scat, i_za_scat] += w_t_r * w_f_l * w_za_inc_r * w_aa_scat_r * w_za_scat_r * - coeffs_this(gp_t.idx + 1, + coeffs_this[gp_t.idx + 1, gp_f.idx, gp_za_inc.idx + 1, gp_aa_scat.idx + 1, - gp_za_scat.idx + 1); + gp_za_scat.idx + 1]; } if (w_f_r > 0.0) { - coeffs_res(i_t, i_f, i_za_inc, i_aa_scat, i_za_scat) += + coeffs_res[i_t, i_f, i_za_inc, i_aa_scat, i_za_scat] += w_t_r * w_f_r * w_za_inc_l * w_aa_scat_l * w_za_scat_l * - coeffs_this(gp_t.idx + 1, + coeffs_this[gp_t.idx + 1, gp_f.idx + 1, gp_za_inc.idx, gp_aa_scat.idx, - gp_za_scat.idx); - coeffs_res(i_t, i_f, i_za_inc, i_aa_scat, i_za_scat) += + gp_za_scat.idx]; + coeffs_res[i_t, i_f, i_za_inc, i_aa_scat, i_za_scat] += w_t_r * w_f_r * w_za_inc_l * w_aa_scat_l * w_za_scat_r * - coeffs_this(gp_t.idx + 1, + coeffs_this[gp_t.idx + 1, gp_f.idx + 1, gp_za_inc.idx, gp_aa_scat.idx, - gp_za_scat.idx + 1); - coeffs_res(i_t, i_f, i_za_inc, i_aa_scat, i_za_scat) += + gp_za_scat.idx + 1]; + coeffs_res[i_t, i_f, i_za_inc, i_aa_scat, i_za_scat] += w_t_r * w_f_r * w_za_inc_l * w_aa_scat_r * w_za_scat_l * - coeffs_this(gp_t.idx + 1, + coeffs_this[gp_t.idx + 1, gp_f.idx + 1, gp_za_inc.idx, gp_aa_scat.idx + 1, - gp_za_scat.idx); - coeffs_res(i_t, i_f, i_za_inc, i_aa_scat, i_za_scat) += + gp_za_scat.idx]; + coeffs_res[i_t, i_f, i_za_inc, i_aa_scat, i_za_scat] += w_t_r * w_f_r * w_za_inc_l * w_aa_scat_r * w_za_scat_r * - coeffs_this(gp_t.idx + 1, + coeffs_this[gp_t.idx + 1, gp_f.idx + 1, gp_za_inc.idx, gp_aa_scat.idx + 1, - gp_za_scat.idx + 1); + gp_za_scat.idx + 1]; - coeffs_res(i_t, i_f, i_za_inc, i_aa_scat, i_za_scat) += + coeffs_res[i_t, i_f, i_za_inc, i_aa_scat, i_za_scat] += w_t_r * w_f_r * w_za_inc_r * w_aa_scat_l * w_za_scat_l * - coeffs_this(gp_t.idx + 1, + coeffs_this[gp_t.idx + 1, gp_f.idx + 1, gp_za_inc.idx + 1, gp_aa_scat.idx, - gp_za_scat.idx); - coeffs_res(i_t, i_f, i_za_inc, i_aa_scat, i_za_scat) += + gp_za_scat.idx]; + coeffs_res[i_t, i_f, i_za_inc, i_aa_scat, i_za_scat] += w_t_r * w_f_r * w_za_inc_r * w_aa_scat_l * w_za_scat_r * - coeffs_this(gp_t.idx + 1, + coeffs_this[gp_t.idx + 1, gp_f.idx + 1, gp_za_inc.idx + 1, gp_aa_scat.idx, - gp_za_scat.idx + 1); - coeffs_res(i_t, i_f, i_za_inc, i_aa_scat, i_za_scat) += + gp_za_scat.idx + 1]; + coeffs_res[i_t, i_f, i_za_inc, i_aa_scat, i_za_scat] += w_t_r * w_f_r * w_za_inc_r * w_aa_scat_r * w_za_scat_l * - coeffs_this(gp_t.idx + 1, + coeffs_this[gp_t.idx + 1, gp_f.idx + 1, gp_za_inc.idx + 1, gp_aa_scat.idx + 1, - gp_za_scat.idx); - coeffs_res(i_t, i_f, i_za_inc, i_aa_scat, i_za_scat) += + gp_za_scat.idx]; + coeffs_res[i_t, i_f, i_za_inc, i_aa_scat, i_za_scat] += w_t_r * w_f_r * w_za_inc_r * w_aa_scat_r * w_za_scat_r * - coeffs_this(gp_t.idx + 1, + coeffs_this[gp_t.idx + 1, gp_f.idx + 1, gp_za_inc.idx + 1, gp_aa_scat.idx + 1, - gp_za_scat.idx + 1); + gp_za_scat.idx + 1]; } } } @@ -1860,8 +1860,8 @@ class PhaseMatrixData for (Index i_f = 0; i_f < n_freqs_; ++i_f) { for (Index i_za_inc = 0; i_za_inc < n_za_inc_; ++i_za_inc) { for (Index i_s = 0; i_s < n_stokes_coeffs; ++i_s) { - result(i_t, i_f, i_za_inc, joker, joker, i_s) = sht_->synthesize( - this->operator()(i_t, i_f, i_za_inc, joker, i_s)); + result[i_t, i_f, i_za_inc, joker, joker, i_s] = sht_->synthesize( + this->operator[](i_t, i_f, i_za_inc, joker, i_s)); } } } @@ -1880,7 +1880,7 @@ class PhaseMatrixData for (Index t_ind = 0; t_ind < t_grid_->size(); ++t_ind) { for (Index za_inc_ind = 0; za_inc_ind < za_inc_grid_->size(); ++za_inc_ind) { for (Index coeff_ind = 0; coeff_ind < std::min(this->size(4), pm_new.size(4)); ++coeff_ind) { - pm_new(t_ind, f_ind, za_inc_ind, coeff_ind) = (*this)(t_ind, f_ind, za_inc_ind, coeff_ind); + pm_new[t_ind, f_ind, za_inc_ind, coeff_ind] = (*this)(t_ind, f_ind, za_inc_ind, coeff_ind); } } } @@ -1899,8 +1899,8 @@ class PhaseMatrixData auto za_inc = (*za_inc_grid_)[i_za_inc]; Scalar za_scat = 180.0 - za_inc; for (Index i_s = 0; i_s < n_stokes_coeffs; ++i_s) { - auto coeffs = this->operator()(i_t, i_f, i_za_inc, joker, i_s); - result(i_t, i_f, i_za_inc, i_s) = + auto coeffs = this->operator[](i_t, i_f, i_za_inc, joker, i_s); + result[i_t, i_f, i_za_inc, i_s] = sht_->evaluate(coeffs, Conversion::deg2rad(180.0), Conversion::deg2rad(za_scat)); @@ -1921,8 +1921,8 @@ class PhaseMatrixData for (Index i_za_inc = 0; i_za_inc < n_za_inc_; ++i_za_inc) { auto za_inc = (*za_inc_grid_)[i_za_inc]; for (Index i_s = 0; i_s < n_stokes_coeffs; ++i_s) { - auto coeffs = this->operator()(i_t, i_f, i_za_inc, joker, i_s); - result(i_t, i_f, i_za_inc, i_s) = sht_->evaluate( + auto coeffs = this->operator[](i_t, i_f, i_za_inc, joker, i_s); + result[i_t, i_f, i_za_inc, i_s] = sht_->evaluate( coeffs, Conversion::deg2rad(0.0), Conversion::deg2rad(za_inc)); } } @@ -1937,8 +1937,8 @@ class PhaseMatrixData for (Index i_f = 0; i_f < n_freqs_; ++i_f) { for (Index i_za_inc = 0; i_za_inc < n_za_inc_; ++i_za_inc) { for (Index i_s = 0; i_s < n_stokes_coeffs; ++i_s) { - results(i_t, i_f, i_za_inc, i_s) = - this->operator()(i_t, i_f, i_za_inc, 0, i_s).real() * + results[i_t, i_f, i_za_inc, i_s] = + this->operator[](i_t, i_f, i_za_inc, 0, i_s).real() * sqrt(4.0 * pi_v); } } @@ -1963,8 +1963,8 @@ class PhaseMatrixData for (Index i_za_inc = 0; i_za_inc < n_za_inc_; ++i_za_inc) { for (Index i_sht = 0; i_sht < n_spectral_coeffs_; ++i_sht) { for (Index i_s = 0; i_s < result.n_stokes_coeffs; ++i_s) { - result(i_t, i_f, i_za_inc, i_sht, i_s) = - this->operator()(i_t, i_f, i_za_inc, i_sht, i_s); + result[i_t, i_f, i_za_inc, i_sht, i_s] = + this->operator[](i_t, i_f, i_za_inc, i_sht, i_s); } } } @@ -1994,54 +1994,54 @@ class PhaseMatrixData Numeric w_za_inc_r = gp_za_inc.fd[0]; for (Index i_sht = 0; i_sht < n_spectral_coeffs_; ++i_sht) { - coeffs_res(i_t, i_f, i_za_inc, i_sht).setZero(); + coeffs_res[i_t, i_f, i_za_inc, i_sht].setZero(); } if (w_t_l > 0.0) { if (w_f_l > 0.0) { for (Index i_sht = 0; i_sht < n_spectral_coeffs_; ++i_sht) { - coeffs_res(i_t, i_f, i_za_inc, i_sht) += + coeffs_res[i_t, i_f, i_za_inc, i_sht] += w_t_l * w_f_l * w_za_inc_l * - coeffs_this(gp_t.idx, gp_f.idx, gp_za_inc.idx, i_sht); - coeffs_res(i_t, i_f, i_za_inc, i_sht) += + coeffs_this[gp_t.idx, gp_f.idx, gp_za_inc.idx, i_sht]; + coeffs_res[i_t, i_f, i_za_inc, i_sht] += w_t_l * w_f_l * w_za_inc_r * - coeffs_this(gp_t.idx, gp_f.idx, gp_za_inc.idx + 1, i_sht); + coeffs_this[gp_t.idx, gp_f.idx, gp_za_inc.idx + 1, i_sht]; } } if (w_f_r > 0.0) { for (Index i_sht = 0; i_sht < n_spectral_coeffs_; ++i_sht) { - coeffs_res(i_t, i_f, i_za_inc, i_sht) += + coeffs_res[i_t, i_f, i_za_inc, i_sht] += w_t_l * w_f_r * w_za_inc_l * - coeffs_this(gp_t.idx, gp_f.idx + 1, gp_za_inc.idx, i_sht); - coeffs_res(i_t, i_f, i_za_inc, i_sht) += + coeffs_this[gp_t.idx, gp_f.idx + 1, gp_za_inc.idx, i_sht]; + coeffs_res[i_t, i_f, i_za_inc, i_sht] += w_t_l * w_f_r * w_za_inc_r * - coeffs_this( - gp_t.idx, gp_f.idx + 1, gp_za_inc.idx + 1, i_sht); + coeffs_this[ + gp_t.idx, gp_f.idx + 1, gp_za_inc.idx + 1, i_sht]; } } } if (w_t_r > 0.0) { if (w_f_l > 0.0) { for (Index i_sht = 0; i_sht < n_spectral_coeffs_; ++i_sht) { - coeffs_res(i_t, i_f, i_za_inc, i_sht) += + coeffs_res[i_t, i_f, i_za_inc, i_sht] += w_t_r * w_f_l * w_za_inc_l * - coeffs_this(gp_t.idx + 1, gp_f.idx, gp_za_inc.idx, i_sht); - coeffs_res(i_t, i_f, i_za_inc, i_sht) += + coeffs_this[gp_t.idx + 1, gp_f.idx, gp_za_inc.idx, i_sht]; + coeffs_res[i_t, i_f, i_za_inc, i_sht] += w_t_r * w_f_l * w_za_inc_r * - coeffs_this( - gp_t.idx + 1, gp_f.idx, gp_za_inc.idx + 1, i_sht); + coeffs_this[ + gp_t.idx + 1, gp_f.idx, gp_za_inc.idx + 1, i_sht]; } } if (w_f_r > 0.0) { for (Index i_sht = 0; i_sht < n_spectral_coeffs_; ++i_sht) { - coeffs_res(i_t, i_f, i_za_inc, i_sht) += + coeffs_res[i_t, i_f, i_za_inc, i_sht] += w_t_r * w_f_r * w_za_inc_l * - coeffs_this( - gp_t.idx + 1, gp_f.idx + 1, gp_za_inc.idx, i_sht); - coeffs_res(i_t, i_f, i_za_inc, i_sht) += + coeffs_this[ + gp_t.idx + 1, gp_f.idx + 1, gp_za_inc.idx, i_sht]; + coeffs_res[i_t, i_f, i_za_inc, i_sht] += w_t_r * w_f_r * w_za_inc_r * - coeffs_this( - gp_t.idx + 1, gp_f.idx + 1, gp_za_inc.idx + 1, i_sht); + coeffs_this[ + gp_t.idx + 1, gp_f.idx + 1, gp_za_inc.idx + 1, i_sht]; } } } diff --git a/src/core/scattering/sht.cc b/src/core/scattering/sht.cc index 758f732503..bd8c9342e4 100644 --- a/src/core/scattering/sht.cc +++ b/src/core/scattering/sht.cc @@ -156,7 +156,7 @@ ComplexVector SHT::transform(const ConstMatrixView &view [[maybe_unused]]) { #else if (is_trivial_) { ComplexVector result(1); - result[0] = view(0, 0); + result[0] = view[0, 0]; return result; } set_spatial_coeffs(view); @@ -177,7 +177,7 @@ ComplexVector SHT::transform_cmplx(const ConstComplexMatrixView &view #else if (is_trivial_) { ComplexVector result(1); - result[0] = view(0, 0); + result[0] = view[0, 0]; return result; } set_spatial_coeffs(view); @@ -220,7 +220,7 @@ ComplexMatrix SHT::synthesize_cmplx(const ConstComplexVectorView &view #else if (is_trivial_) { ComplexMatrix result(1, 1); - result(0, 0) = view[0]; + result[0, 0] = view[0]; return result; } set_spectral_coeffs_cmplx(view); @@ -269,7 +269,7 @@ Vector SHT::evaluate(const ComplexVectorView &view [[maybe_unused]], shtns_mutex.lock(); for (auto i = 0; i < n_points; ++i) { result[i] = - SH_to_point(shtns, spectral_coeffs_, std::cos(points(i, 1)), points(i, 0)); + SH_to_point(shtns, spectral_coeffs_, std::cos(points[i, 1]), points[i, 0]); } shtns_mutex.lock(); diff --git a/src/core/scattering/sht.h b/src/core/scattering/sht.h index 7dde8e4844..2e47e95fce 100644 --- a/src/core/scattering/sht.h +++ b/src/core/scattering/sht.h @@ -270,9 +270,9 @@ class SHT { for (int i = 0; i < view.nrows(); ++i) { for (int j = 0; j < view.ncols(); ++j) { if constexpr (matpack::complex_type) { - spatial_coeffs_cmplx_[index] = view(i, j); + spatial_coeffs_cmplx_[index] = view[i, j]; } else { - spatial_coeffs_[index] = view(i, j); + spatial_coeffs_[index] = view[i, j]; } ++index; } @@ -577,7 +577,7 @@ matpack::matpack_data add_coeffs( (l <= static_cast(sht_inc_v.m_max_)) ? l : sht_inc_v.m_max_); for (int m = -m_max; m <= m_max; ++m) { if ((l > sht_inc_w.l_max_) || (std::abs(m) > sht_inc_w.m_max_)) { - result(index_l, joker) = v.row(index_l, joker); + result[index_l, joker] = v.row(index_l, joker); } else { int h = static_cast( std::min(static_cast(sht_inc_w.m_max_), l)); @@ -585,7 +585,7 @@ matpack::matpack_data add_coeffs( auto r = add_coeffs(sht_scat_v, v.row(index_l), sht_scat_w, w.row(index_r)); - result(index_l, joker) = r; + result[index_l, joker] = r; } ++index_l; } diff --git a/src/core/scattering/single_scattering_data.h b/src/core/scattering/single_scattering_data.h index 3012276fba..60ed8ce1a5 100644 --- a/src/core/scattering/single_scattering_data.h +++ b/src/core/scattering/single_scattering_data.h @@ -59,17 +59,17 @@ struct SingleScatteringData { for (Index i_za_scat = 0; i_za_scat < grid_size(*za_scat_grid); ++i_za_scat) { for (Index i_s = 0; i_s < phase_matrix.n_stokes_coeffs; ++i_s) { - phase_matrix(i_t, i_f, i_za_scat, i_s) = - ssd.pha_mat_data(i_f, i_t, i_za_scat, 0, 0, 0, i_s); + phase_matrix[i_t, i_f, i_za_scat, i_s] = + ssd.pha_mat_data[i_f, i_t, i_za_scat, 0, 0, 0, i_s]; } } for (Index i_s = 0; i_s < absorption_vector.n_stokes_coeffs; ++i_s) { - absorption_vector(i_t, i_f, i_s) = - ssd.abs_vec_data(i_f, i_t, 0, 0, i_s); + absorption_vector[i_t, i_f, i_s] = + ssd.abs_vec_data[i_f, i_t, 0, 0, i_s]; } for (Index i_s = 0; i_s < extinction_matrix.n_stokes_coeffs; ++i_s) { - extinction_matrix(i_t, i_f, i_s) = - ssd.ext_mat_data(i_f, i_t, 0, 0, i_s); + extinction_matrix[i_t, i_f, i_s] = + ssd.ext_mat_data[i_f, i_t, 0, 0, i_s]; } } } diff --git a/src/core/sensor.cc b/src/core/sensor.cc index 2902def12f..d5f48b9144 100644 --- a/src/core/sensor.cc +++ b/src/core/sensor.cc @@ -111,10 +111,10 @@ void antenna1d_matrix(Sparse& H, { if (pol_step) // Polarisation variation, update always needed { - aresponse = antenna_response.data(ip, 0, joker, 0); + aresponse = antenna_response.data[ip, 0, joker, 0]; } else if (f == 0 && ip == 0) // Set fully constant pattern { - aresponse = antenna_response.data(0, 0, joker, 0); + aresponse = antenna_response.data[0, 0, joker, 0]; } else // The one set just above can be reused { new_antenna = 0; @@ -131,10 +131,10 @@ void antenna1d_matrix(Sparse& H, Matrix aresponse_matrix(1, n_ar_za); interp(aresponse_matrix, itw, - antenna_response.data(ip, joker, joker, 0), + antenna_response.data[ip, joker, joker, 0], gp_f, gp_za); - aresponse = aresponse_matrix(0, joker); + aresponse = aresponse_matrix[0]; } else // Reuse pattern for ip==0 { new_antenna = 0; @@ -183,7 +183,7 @@ void antenna2d_gridded_dlos(Sparse& H, "must have two columns."); Index nza = 1; - for (Index i = 0; i < n_dlos - 1 && mblock_dlos(i + 1, 0) > mblock_dlos(i, 0); + for (Index i = 0; i < n_dlos - 1 && mblock_dlos[i + 1, 0] > mblock_dlos[i, 0]; i++) { nza++; } @@ -194,11 +194,11 @@ void antenna2d_gridded_dlos(Sparse& H, "For the gridded_dlos option, the number of dlos angles " "must be a product of two integers."); const Index naa = n_dlos / nza; - const Vector za_grid{mblock_dlos(Range(0, nza), 0)}; - const Vector aa_grid{mblock_dlos(Range(0, naa, nza), 1)}; + const Vector za_grid{mblock_dlos[Range(0, nza), 0]}; + const Vector aa_grid{mblock_dlos[Range(0, naa, nza), 1]}; for (Index i = 0; i < n_dlos; i++) { ARTS_USER_ERROR_IF( - i >= nza && abs(mblock_dlos(i, 0) - mblock_dlos(i - nza, 0)) > 1e-6, + i >= nza && abs(mblock_dlos[i, 0] - mblock_dlos[i - nza, 0]) > 1e-6, "Zenith angle of dlos {}" " (0-based) differs to zenith {}" "angle of dlos" @@ -206,7 +206,7 @@ void antenna2d_gridded_dlos(Sparse& H, "to form rectangular grid.", i, i - nza) - ARTS_USER_ERROR_IF(abs(mblock_dlos(i, 1) - aa_grid[i / nza]) > 1e-6, + ARTS_USER_ERROR_IF(abs(mblock_dlos[i, 1] - aa_grid[i / nza]) > 1e-6, "Azimuth angle of dlos {}", " (0-based) differs to azimuth " "angle {}" @@ -253,8 +253,8 @@ void antenna2d_gridded_dlos(Sparse& H, for (Index i4 = 0; i4 < n_ar_aa; i4++) { for (Index i2 = 0; i2 < n_ar_f; i2++) { for (Index i1 = 0; i1 < n_ar_pol; i1++) { - aresponse_with_cos(i1, i2, i3, i4) = - t * antenna_response.data(i1, i2, i3, i4); + aresponse_with_cos[i1, i2, i3, i4] = + t * antenna_response.data[i1, i2, i3, i4]; } } } @@ -292,10 +292,10 @@ void antenna2d_gridded_dlos(Sparse& H, { if (pol_step) // Polarisation variation, update always needed { - aresponse = aresponse_with_cos(ip, 0, joker, joker); + aresponse = aresponse_with_cos[ip, 0, joker, joker]; } else if (f == 0 && ip == 0) // Set fully constant pattern { - aresponse = aresponse_with_cos(0, 0, joker, joker); + aresponse = aresponse_with_cos[0, 0, joker, joker]; } else // The one set just above can be reused { new_antenna = 0; @@ -312,11 +312,11 @@ void antenna2d_gridded_dlos(Sparse& H, Tensor3 aresponse_matrix(1, n_ar_za, n_ar_aa); interp(aresponse_matrix, itw, - aresponse_with_cos(ip, joker, joker, joker), + aresponse_with_cos[ip, joker, joker, joker], gp_f, gp_za, gp_aa); - aresponse = aresponse_matrix(0, joker, joker); + aresponse = aresponse_matrix[0, joker, joker]; } else // Reuse pattern for ip==0 { new_antenna = 0; @@ -327,7 +327,7 @@ void antenna2d_gridded_dlos(Sparse& H, if (new_antenna) { // za grid positions Vector zas{aresponse_za_grid}; - zas += antenna_dlos(ia, 0); + zas += antenna_dlos[ia, 0]; ARTS_USER_ERROR_IF( zas[0] < za_grid[0], "The zenith angle grid in *mblock_dlos* is too narrow. " @@ -345,7 +345,7 @@ void antenna2d_gridded_dlos(Sparse& H, // aa grid positions Vector aas{aresponse_aa_grid}; if (antenna_dlos.ncols() > 1) { - aas += antenna_dlos(ia, 1); + aas += antenna_dlos[ia, 1]; } ARTS_USER_ERROR_IF( aas[0] < aa_grid[0], @@ -377,17 +377,17 @@ void antenna2d_gridded_dlos(Sparse& H, const Index z = gp_za[iza].idx; const Index x = z + 1; - if (itw(iza, iaa, 0) > 1e-9) { - hza[a * nza + z] += aresponse(iza, iaa) * itw(iza, iaa, 0); + if (itw[iza, iaa, 0] > 1e-9) { + hza[a * nza + z] += aresponse[iza, iaa] * itw[iza, iaa, 0]; } - if (itw(iza, iaa, 1) > 1e-9) { - hza[b * nza + z] += aresponse(iza, iaa) * itw(iza, iaa, 1); + if (itw[iza, iaa, 1] > 1e-9) { + hza[b * nza + z] += aresponse[iza, iaa] * itw[iza, iaa, 1]; } - if (itw(iza, iaa, 2) > 1e-9) { - hza[a * nza + x] += aresponse(iza, iaa) * itw(iza, iaa, 2); + if (itw[iza, iaa, 2] > 1e-9) { + hza[a * nza + x] += aresponse[iza, iaa] * itw[iza, iaa, 2]; } - if (itw(iza, iaa, 3) > 1e-9) { - hza[b * nza + x] += aresponse(iza, iaa) * itw(iza, iaa, 3); + if (itw[iza, iaa, 3] > 1e-9) { + hza[b * nza + x] += aresponse[iza, iaa] * itw[iza, iaa, 3]; } } } @@ -459,8 +459,8 @@ void antenna2d_interp_response(Sparse& H, for (Index i4 = 0; i4 < n_ar_aa; i4++) { for (Index i2 = 0; i2 < n_ar_f; i2++) { for (Index i1 = 0; i1 < n_ar_pol; i1++) { - aresponse_with_cos(i1, i2, i3, i4) = - t * antenna_response.data(i1, i2, i3, i4); + aresponse_with_cos[i1, i2, i3, i4] = + t * antenna_response.data[i1, i2, i3, i4]; } } } @@ -501,10 +501,10 @@ void antenna2d_interp_response(Sparse& H, { if (pol_step) // Polarisation variation, update always needed { - aresponse = antenna_response.data(ip, 0, joker, joker); + aresponse = antenna_response.data[ip, 0, joker, joker]; } else if (f == 0 && ip == 0) // Set fully constant pattern { - aresponse = antenna_response.data(0, 0, joker, joker); + aresponse = antenna_response.data[0, 0, joker, joker]; } else // The one set just above can be reused { new_antenna = 0; @@ -521,11 +521,11 @@ void antenna2d_interp_response(Sparse& H, Tensor3 aresponse_matrix(1, n_ar_za, n_ar_aa); interp(aresponse_matrix, itw, - antenna_response.data(ip, joker, joker, joker), + antenna_response.data[ip], gp_f, gp_za, gp_aa); - aresponse = aresponse_matrix(0, joker, joker); + aresponse = aresponse_matrix[0]; } else // Reuse pattern for ip==0 { new_antenna = 0; @@ -535,13 +535,13 @@ void antenna2d_interp_response(Sparse& H, // Calculate response weights if (new_antenna) { for (Index l = 0; l < n_dlos; l++) { - const Numeric za = mblock_dlos(l, 0) - antenna_dlos(ia, 0); + const Numeric za = mblock_dlos[l, 0] - antenna_dlos[ia, 0]; Numeric aa = 0.0; if (mblock_dlos.ncols() > 1) { - aa += mblock_dlos(l, 1); + aa += mblock_dlos[l, 1]; } if (antenna_dlos.ncols() > 1) { - aa -= antenna_dlos(ia, 1); + aa -= antenna_dlos[ia, 1]; } // The response is zero if mblock_dlos is outside of @@ -682,21 +682,21 @@ void mixer_matrix(Sparse& H, void muellersparse_rotation(Sparse& H, const Numeric& rotangle) { ARTS_ASSERT(H.nrows() == 4); ARTS_ASSERT(H.ncols() == 4); - ARTS_ASSERT(H(0, 1) == 0); - ARTS_ASSERT(H(1, 0) == 0); + ARTS_ASSERT((H[0, 1] == 0)); + ARTS_ASSERT((H[1, 0] == 0)); // H.rw(0, 0) = 1; const Numeric a = Conversion::cosd(2 * rotangle); H.rw(1, 1) = a; - ARTS_ASSERT(H(2, 0) == 0); - ARTS_ASSERT(H(0, 2) == 0); + ARTS_ASSERT((H[2, 0] == 0)); + ARTS_ASSERT((H[0, 2] == 0)); const Numeric b = Conversion::sind(2 * rotangle); H.rw(1, 2) = b; H.rw(2, 1) = -b; H.rw(2, 2) = a; // More values should be checked, but to save time we just ARTS_ASSERT one - ARTS_ASSERT(H(2, 3) == 0); + ARTS_ASSERT((H[2, 3] == 0)); H.rw(3, 3) = 1; } @@ -832,7 +832,7 @@ void met_mm_polarisation_hmatrix(Sparse& H, Vector hrow(nch * 4, 0.0); const Index i0 = i * 4; for (Index s = 0; s < 4; s++) { - hrow[i0 + s] = Hc(0, s); + hrow[i0 + s] = Hc[0, s]; } H.insert_row(i, hrow); } @@ -868,7 +868,7 @@ void sensor_aux_vectors(Vector& sensor_response_f, // sensor_response_f[i] = sensor_response_f_grid[ifr]; sensor_response_pol[i] = sensor_response_pol_grid[ip]; - sensor_response_dlos(i, joker) = sensor_response_dlos_grid(ilos, joker); + sensor_response_dlos[i, joker] = sensor_response_dlos_grid[ilos, joker]; } } } diff --git a/src/core/sensor/obsel.cpp b/src/core/sensor/obsel.cpp index 2acd48b865..d03ee6e21d 100644 --- a/src/core/sensor/obsel.cpp +++ b/src/core/sensor/obsel.cpp @@ -251,7 +251,7 @@ void make_exhaustive(ArrayOfSensorObsel& obsels) { poslos_grid.end()); if (ipn == poslos_grid.size()) continue; - weights(ivn, ipn) = obsel.weight_matrix()(iv, ip); + weights[ivn, ipn] = obsel.weight_matrix()[iv, ip]; } } diff --git a/src/core/special_interp.cc b/src/core/special_interp.cc index 06598d9e23..1e413925d1 100644 --- a/src/core/special_interp.cc +++ b/src/core/special_interp.cc @@ -251,7 +251,7 @@ void regrid_atmfield_by_gp_oem(Tensor3& field_new, // if (np_is1 && nlat_is1 && nlon_is1) // 1: No interpolation at all { - field_new(joker, joker, joker) = field_old(0, 0, 0); + field_new = field_old[0, 0, 0]; } else if (np_is1) // No pressure interpolation -------------- @@ -261,12 +261,12 @@ void regrid_atmfield_by_gp_oem(Tensor3& field_new, Matrix itw(n3, 2); interpweights(itw, gp_lon); Vector tmp(n3); - interp(tmp, itw, field_old(0, 0, joker), gp_lon); + interp(tmp, itw, field_old[0, 0, joker], gp_lon); for (Size p = 0; p < n1; p++) { ARTS_ASSERT(gp_p[p].fd[0] < 1e-6); for (Size lat = 0; lat < n2; lat++) { ARTS_ASSERT(gp_lat[lat].fd[0] < 1e-6); - field_new(p, lat, joker) = tmp; + field_new[p, lat, joker] = tmp; } } } else if (nlon_is1) // 3: Just latitude interpolation @@ -274,12 +274,12 @@ void regrid_atmfield_by_gp_oem(Tensor3& field_new, Matrix itw(n2, 2); interpweights(itw, gp_lat); Vector tmp(n2); - interp(tmp, itw, field_old(0, joker, 0), gp_lat); + interp(tmp, itw, field_old[0, joker, 0], gp_lat); for (Size p = 0; p < n1; p++) { ARTS_ASSERT(gp_p[p].fd[0] < 1e-6); for (Size lon = 0; lon < n3; lon++) { ARTS_ASSERT(gp_lon[lon].fd[0] < 1e-6); - field_new(p, joker, lon) = tmp; + field_new[p, joker, lon] = tmp; } } } else // 4: Both lat and lon interpolation @@ -287,10 +287,10 @@ void regrid_atmfield_by_gp_oem(Tensor3& field_new, Tensor3 itw(n2, n3, 4); interpweights(itw, gp_lat, gp_lon); Matrix tmp(n2, n3); - interp(tmp, itw, field_old(0, joker, joker), gp_lat, gp_lon); + interp(tmp, itw, field_old[0], gp_lat, gp_lon); for (Size p = 0; p < n1; p++) { ARTS_ASSERT(gp_p[p].fd[0] < 1e-6); - field_new(p, joker, joker) = tmp; + field_new[p] = tmp; } } } @@ -302,12 +302,12 @@ void regrid_atmfield_by_gp_oem(Tensor3& field_new, Matrix itw(n1, 2); interpweights(itw, gp_p); Vector tmp(n1); - interp(tmp, itw, field_old(joker, 0, 0), gp_p); + interp(tmp, itw, field_old[joker, 0, 0], gp_p); for (Size lat = 0; lat < n2; lat++) { ARTS_ASSERT(gp_lat[lat].fd[0] < 1e-6); for (Size lon = 0; lon < n3; lon++) { ARTS_ASSERT(gp_lon[lon].fd[0] < 1e-6); - field_new(joker, lat, lon) = tmp; + field_new[joker, lat, lon] = tmp; } } } else if (nlat_is1) // 6: Both p and lon interpolation @@ -315,20 +315,20 @@ void regrid_atmfield_by_gp_oem(Tensor3& field_new, Tensor3 itw(n1, n3, 4); interpweights(itw, gp_p, gp_lon); Matrix tmp(n1, n3); - interp(tmp, itw, field_old(joker, 0, joker), gp_p, gp_lon); + interp(tmp, itw, field_old[joker, 0, joker], gp_p, gp_lon); for (Size lat = 0; lat < n2; lat++) { ARTS_ASSERT(gp_lat[lat].fd[0] < 1e-6); - field_new(joker, lat, joker) = tmp; + field_new[joker, lat, joker] = tmp; } } else // 7: Both p and lat interpolation { Tensor3 itw(n1, n2, 4); interpweights(itw, gp_p, gp_lat); Matrix tmp(n1, n2); - interp(tmp, itw, field_old(joker, joker, 0), gp_p, gp_lat); + interp(tmp, itw, field_old[joker, joker, 0], gp_p, gp_lat); for (Size lon = 0; lon < n3; lon++) { ARTS_ASSERT(gp_lon[lon].fd[0] < 1e-6); - field_new(joker, joker, lon) = tmp; + field_new[joker, joker, lon] = tmp; } } } @@ -356,26 +356,26 @@ void regrid_atmsurf_by_gp_oem(Matrix& field_new, // if (nlat_is1 && nlon_is1) // 1: No interpolation at all { - field_new(joker, joker) = field_old(0, 0); + field_new = field_old[0, 0]; } else if (nlon_is1) // 2: Just latitude interpolation { Matrix itw(n1, 2); interpweights(itw, gp_lat); Vector tmp(n1); - interp(tmp, itw, field_old(joker, 0), gp_lat); + interp(tmp, itw, field_old[joker, 0], gp_lat); for (Index lon = 0; lon < n2; lon++) { ARTS_ASSERT(gp_lon[lon].fd[0] < 1e-6); - field_new(joker, lon) = tmp; + field_new[joker, lon] = tmp; } } else // 2: Just longitude interpolation { Matrix itw(n2, 2); interpweights(itw, gp_lon); Vector tmp(n2); - interp(tmp, itw, field_old(0, joker), gp_lon); + interp(tmp, itw, field_old[0], gp_lon); for (Index lat = 0; lat < n1; lat++) { ARTS_ASSERT(gp_lat[lat].fd[0] < 1e-6); - field_new(lat, joker) = tmp; + field_new[lat] = tmp; } } } @@ -515,7 +515,7 @@ void z_at_lat_2d(VectorView z, interpweights(itw, gp_z, agp_lat); interp(z_matrix, itw, z_field, gp_z, agp_lat); - z = z_matrix(Range(joker), 0); + z = z_matrix[Range(joker), 0]; } void z_at_latlon(VectorView z, @@ -549,7 +549,7 @@ void z_at_latlon(VectorView z, interp(z_tensor, itw, z_field, agp_z, agp_lat, agp_lon); - z = z_tensor(Range(joker), 0, 0); + z = z_tensor[Range(joker), 0, 0]; } /*=========================================================================== @@ -591,8 +591,8 @@ void complex_n_interp(MatrixView n_real, // if (nf_in == 1) { for (Index i = 0; i < nf_out; i++) { - nrf(i, joker) = complex_n.data(0, joker).real(); - nif(i, joker) = complex_n.data(0, joker).imag(); + nrf[i] = complex_n.data[0].real(); + nif[i] = complex_n.data[0].imag(); } } else { chk_interpolation_grids("Frequency interpolation", f_grid_in, f_grid); @@ -602,8 +602,8 @@ void complex_n_interp(MatrixView n_real, gridpos(gp, f_grid_in, f_grid); interpweights(itw, gp); for (Index i = 0; i < nt_in; i++) { - interp(nrf(joker, i), itw, complex_n.data(joker, i).real(), gp); - interp(nif(joker, i), itw, complex_n.data(joker, i).imag(), gp); + interp(nrf[joker, i], itw, complex_n.data[joker, i].real(), gp); + interp(nif[joker, i], itw, complex_n.data[joker, i].imag(), gp); } } @@ -611,8 +611,8 @@ void complex_n_interp(MatrixView n_real, // if (nt_in == 1) { for (Index i = 0; i < nt_out; i++) { - n_real(joker, i) = nrf(joker, 0); - n_imag(joker, i) = nif(joker, 0); + n_real[joker, i] = nrf[joker, 0]; + n_imag[joker, i] = nif[joker, 0]; } } else { chk_interpolation_grids("Temperature interpolation", t_grid_in, t_grid); @@ -622,8 +622,8 @@ void complex_n_interp(MatrixView n_real, gridpos(gp, t_grid_in, t_grid); interpweights(itw, gp); for (Index i = 0; i < nf_out; i++) { - interp(n_real(i, joker), itw, nrf(i, joker), gp); - interp(n_imag(i, joker), itw, nif(i, joker), gp); + interp(n_real[i], itw, nrf[i], gp); + interp(n_imag[i], itw, nif[i], gp); } } } diff --git a/src/core/sun.cc b/src/core/sun.cc index ce6f623984..22d5a03c28 100644 --- a/src/core/sun.cc +++ b/src/core/sun.cc @@ -100,9 +100,9 @@ Matrix regrid_sun_spectrum(const GriddedField2& sun_spectrum_raw, interpweights(itw, f_gp); for (int i = 0; i < 4; i++) { - interp(int_data(Range(i_fstart, f_extent), i), + interp(int_data[Range(i_fstart, f_extent), i], itw, - sun_spectrum_raw.data(active_range, i), + sun_spectrum_raw.data[active_range, i], f_gp); } } @@ -119,10 +119,10 @@ Matrix regrid_sun_spectrum(const GriddedField2& sun_spectrum_raw, } if (temperature > 0) { for (int i = 0; i < i_fstart; i++) { - int_data(i, 0) = planck(f_grid[i], temperature); + int_data[i, 0] = planck(f_grid[i], temperature); } for (Index i = f_extent; i < nf; i++) { - int_data(i, 0) = planck(f_grid[i], temperature); + int_data[i, 0] = planck(f_grid[i], temperature); } } } @@ -355,7 +355,7 @@ bool set_spectral_radiance_if_sun_intersection( for (Index iv = 0; iv < nf; ++iv) { for (Index is = 0; is < 4; ++is) { - spectral_radiance[iv][is] = sun.spectrum(iv, is) / Constant::pi; + spectral_radiance[iv][is] = sun.spectrum[iv, is] / Constant::pi; } } diff --git a/src/core/surface/surf.cpp b/src/core/surface/surf.cpp index da90538025..350b61a7c1 100644 --- a/src/core/surface/surf.cpp +++ b/src/core/surface/surf.cpp @@ -253,7 +253,7 @@ Numeric numeric_interpolation( } if (lats.size() == 1 and lons.size() == 1) { - return data.data(0, 0); + return data.data[0, 0]; } if (lats.size() == 1) { diff --git a/src/core/telsem.cc b/src/core/telsem.cc index 77391e266c..c89a31e96a 100644 --- a/src/core/telsem.cc +++ b/src/core/telsem.cc @@ -58,9 +58,9 @@ inline constexpr Numeric PI=Constant::pi; if (ind < 0) { throw std::runtime_error("The cell is not contained in the atlas."); } else { - e_v[0] = emis(ind, 0); - e_v[1] = emis(ind, 3); - e_v[2] = emis(ind, 5); + e_v[0] = emis[ind, 0]; + e_v[1] = emis[ind, 3]; + e_v[2] = emis[ind, 5]; } return e_v; } @@ -71,9 +71,9 @@ inline constexpr Numeric PI=Constant::pi; if (ind < 0) { throw std::runtime_error("The cell is not contained in the atlas."); } else { - e_h[0] = emis(ind, 1); - e_h[1] = emis(ind, 4); - e_h[2] = emis(ind, 6); + e_h[0] = emis[ind, 1]; + e_h[1] = emis[ind, 4]; + e_h[2] = emis[ind, 6]; } return e_h; } @@ -83,7 +83,7 @@ inline constexpr Numeric PI=Constant::pi; if (ind < 0) { throw std::runtime_error("The cell is not contained in the atlas."); } else { - return emis(ind, joker); + return emis[ind]; } } @@ -125,8 +125,8 @@ void TelsemAtlas::read(std::istream& is) { if (class1 > 0 && class2 > 0 && ipos < ndat) { ipos++; for (Index i = 0; i < nchan; i++) { - emis(ipos, i) = ssmi[i]; - emis_err(ipos, i) = std::sqrt(ssmi[nchan + i]); + emis[ipos, i] = ssmi[i]; + emis_err[ipos, i] = std::sqrt(ssmi[nchan + i]); } cellnums[ipos] = cellnum; classes1[ipos] = class1; diff --git a/src/core/tessem.cc b/src/core/tessem.cc index 988f490871..89e319c026 100644 --- a/src/core/tessem.cc +++ b/src/core/tessem.cc @@ -29,11 +29,11 @@ void tessem_read_ascii(std::ifstream& is, TessemNN& net) { net.w1.resize(net.nb_cache, net.nb_inputs); for (Index i = 0; i < net.nb_cache; i++) - for (Index j = 0; j < net.nb_inputs; j++) is >> double_imanip() >> net.w1(i, j); + for (Index j = 0; j < net.nb_inputs; j++) is >> double_imanip() >> net.w1[i, j]; net.w2.resize(net.nb_outputs, net.nb_cache); for (Index i = 0; i < net.nb_outputs; i++) - for (Index j = 0; j < net.nb_cache; j++) is >> double_imanip() >> net.w2(i, j); + for (Index j = 0; j < net.nb_cache; j++) is >> double_imanip() >> net.w2[i, j]; net.x_min.resize(net.nb_inputs); for (Index i = 0; i < net.nb_inputs; i++) is >> double_imanip() >> net.x_min[i]; @@ -84,7 +84,7 @@ void tessem_prop_nn(VectorView ny, const TessemNN& net, ConstVectorView nx) { Vector trans = net.b1; for (Index i = 0; i < net.nb_cache; i++) { for (Index j = 0; j < net.nb_inputs; j++) - trans[i] += net.w1(i, j) * new_x[j]; + trans[i] += net.w1[i, j] * new_x[j]; trans[i] = 2. / (1. + exp(-2. * trans[i])) - 1.; } @@ -92,7 +92,7 @@ void tessem_prop_nn(VectorView ny, const TessemNN& net, ConstVectorView nx) { Vector new_y = net.b2; for (Index i = 0; i < net.nb_outputs; i++) { for (Index j = 0; j < net.nb_cache; j++) - new_y[i] += net.w2(i, j) * trans[j]; + new_y[i] += net.w2[i, j] * trans[j]; } // postprocessing diff --git a/src/core/tmatrix.cc b/src/core/tmatrix.cc index 994c71e52d..e226cfdd89 100644 --- a/src/core/tmatrix.cc +++ b/src/core/tmatrix.cc @@ -439,33 +439,33 @@ void ampmat_to_phamat(Matrix& z, const Complex& s21, const Complex& s22) { z.resize(4, 4); - z(0, 0) = 0.5 * (s11 * conj(s11) + s12 * conj(s12) + s21 * conj(s21) + + z[0, 0] = 0.5 * (s11 * conj(s11) + s12 * conj(s12) + s21 * conj(s21) + s22 * conj(s22)) .real(); - z(0, 1) = 0.5 * (s11 * conj(s11) - s12 * conj(s12) + s21 * conj(s21) - + z[0, 1] = 0.5 * (s11 * conj(s11) - s12 * conj(s12) + s21 * conj(s21) - s22 * conj(s22)) .real(); - z(0, 2) = (-s11 * conj(s12) - s22 * conj(s21)).real(); - z(0, 3) = (Complex(0., 1.) * (s11 * conj(s12) - s22 * conj(s21))).real(); + z[0, 2] = (-s11 * conj(s12) - s22 * conj(s21)).real(); + z[0, 3] = (Complex(0., 1.) * (s11 * conj(s12) - s22 * conj(s21))).real(); - z(1, 0) = 0.5 * (s11 * conj(s11) + s12 * conj(s12) - s21 * conj(s21) - + z[1, 0] = 0.5 * (s11 * conj(s11) + s12 * conj(s12) - s21 * conj(s21) - s22 * conj(s22)) .real(); - z(1, 1) = 0.5 * (s11 * conj(s11) - s12 * conj(s12) - s21 * conj(s21) + + z[1, 1] = 0.5 * (s11 * conj(s11) - s12 * conj(s12) - s21 * conj(s21) + s22 * conj(s22)) .real(); - z(1, 2) = (-s11 * conj(s12) + s22 * conj(s21)).real(); - z(1, 3) = (Complex(0., 1.) * (s11 * conj(s12) + s22 * conj(s21))).real(); - - z(2, 0) = (-s11 * conj(s21) - s22 * conj(s12)).real(); - z(2, 1) = (-s11 * conj(s21) + s22 * conj(s12)).real(); - z(2, 2) = (s11 * conj(s22) + s12 * conj(s21)).real(); - z(2, 3) = (Complex(0., -1.) * (s11 * conj(s22) + s21 * conj(s12))).real(); - - z(3, 0) = (Complex(0., 1.) * (s21 * conj(s11) + s22 * conj(s12))).real(); - z(3, 1) = (Complex(0., 1.) * (s21 * conj(s11) - s22 * conj(s12))).real(); - z(3, 2) = (Complex(0., -1.) * (s22 * conj(s11) - s12 * conj(s21))).real(); - z(3, 3) = (s22 * conj(s11) - s12 * conj(s21)).real(); + z[1, 2] = (-s11 * conj(s12) + s22 * conj(s21)).real(); + z[1, 3] = (Complex(0., 1.) * (s11 * conj(s12) + s22 * conj(s21))).real(); + + z[2, 0] = (-s11 * conj(s21) - s22 * conj(s12)).real(); + z[2, 1] = (-s11 * conj(s21) + s22 * conj(s12)).real(); + z[2, 2] = (s11 * conj(s22) + s12 * conj(s21)).real(); + z[2, 3] = (Complex(0., -1.) * (s11 * conj(s22) + s21 * conj(s12))).real(); + + z[3, 0] = (Complex(0., 1.) * (s21 * conj(s11) + s22 * conj(s12))).real(); + z[3, 1] = (Complex(0., 1.) * (s21 * conj(s11) - s22 * conj(s12))).real(); + z[3, 2] = (Complex(0., -1.) * (s22 * conj(s11) - s12 * conj(s21))).real(); + z[3, 3] = (s22 * conj(s11) - s12 * conj(s21)).real(); } static const Numeric GaussLeg6[][3] = {{0.23861918, 0.66120939, 0.93246951}, @@ -1038,8 +1038,8 @@ void calcSingleScatteringDataProperties(SingleScatteringData& ssd, aspect_ratio, np, lam[f_index], - ref_index_real(f_index, T_index), - ref_index_imag(f_index, T_index), + ref_index_real[f_index, T_index], + ref_index_imag[f_index, T_index], precision, nza, ndgs, @@ -1058,19 +1058,19 @@ void calcSingleScatteringDataProperties(SingleScatteringData& ssd, } if (!thisfailed) { - mono_pha_mat_data(joker, 0) = f11; - mono_pha_mat_data(joker, 1) = f12; - mono_pha_mat_data(joker, 2) = f22; - mono_pha_mat_data(joker, 3) = f33; - mono_pha_mat_data(joker, 4) = f34; - mono_pha_mat_data(joker, 5) = f44; + mono_pha_mat_data[joker, 0] = f11; + mono_pha_mat_data[joker, 1] = f12; + mono_pha_mat_data[joker, 2] = f22; + mono_pha_mat_data[joker, 3] = f33; + mono_pha_mat_data[joker, 4] = f34; + mono_pha_mat_data[joker, 5] = f44; mono_pha_mat_data *= csca / 4. / PI; - ssd.pha_mat_data(f_index, T_index, joker, 0, 0, 0, joker) = + ssd.pha_mat_data[f_index, T_index, joker, 0, 0, 0, joker] = mono_pha_mat_data; - ssd.ext_mat_data(f_index, T_index, 0, 0, 0) = cext; - ssd.abs_vec_data(f_index, T_index, 0, 0, 0) = cext - csca; + ssd.ext_mat_data[f_index, T_index, 0, 0, 0] = cext; + ssd.abs_vec_data[f_index, T_index, 0, 0, 0] = cext - csca; } } if (anyfailed) @@ -1116,8 +1116,8 @@ void calcSingleScatteringDataProperties(SingleScatteringData& ssd, aspect_ratio, np, lam_f, - ref_index_real(f_index, T_index), - ref_index_imag(f_index, T_index), + ref_index_real[f_index, T_index], + ref_index_imag[f_index, T_index], precision); } catch (const std::runtime_error& e) { std::ostringstream os; @@ -1158,34 +1158,34 @@ void calcSingleScatteringDataProperties(SingleScatteringData& ssd, 0.0); } - ssd.pha_mat_data(f_index, + ssd.pha_mat_data[f_index, T_index, za_scat_index, aa_index, za_inc_index, 0, - Range(0, 4)) = phamat(0, joker); - ssd.pha_mat_data(f_index, + Range(0, 4)] = phamat[0]; + ssd.pha_mat_data[f_index, T_index, za_scat_index, aa_index, za_inc_index, 0, - Range(4, 4)) = phamat(1, joker); - ssd.pha_mat_data(f_index, + Range(4, 4)] = phamat[1]; + ssd.pha_mat_data[f_index, T_index, za_scat_index, aa_index, za_inc_index, 0, - Range(8, 4)) = phamat(2, joker); - ssd.pha_mat_data(f_index, + Range(8, 4)] = phamat[2]; + ssd.pha_mat_data[f_index, T_index, za_scat_index, aa_index, za_inc_index, 0, - Range(12, 4)) = phamat(3, joker); + Range(12, 4)] = phamat[3]; } // Csca integral @@ -1220,8 +1220,8 @@ void calcSingleScatteringDataProperties(SingleScatteringData& ssd, 0., 0.); } - csca_data(f_index, T_index, za_scat_index, 0, joker) = - csca_integral(Range(0, 2), 0); + csca_data[f_index, T_index, za_scat_index, 0, joker] = + csca_integral[Range(0, 2), 0]; } // Extinction matrix @@ -1236,7 +1236,7 @@ void calcSingleScatteringDataProperties(SingleScatteringData& ssd, Complex s21; Complex s22; VectorView K = - ssd.ext_mat_data(f_index, T_index, za_inc_index, 0, joker); + ssd.ext_mat_data[f_index, T_index, za_inc_index, 0, joker]; const Numeric beta = 0.; const Numeric alpha = 0.; @@ -1264,7 +1264,7 @@ void calcSingleScatteringDataProperties(SingleScatteringData& ssd, csca_data *= 2. * PI * PI / 32400.; ssd.abs_vec_data = - ssd.ext_mat_data(joker, joker, joker, joker, Range(0, 2)); + ssd.ext_mat_data[joker, joker, joker, joker, Range(0, 2)]; ssd.abs_vec_data -= csca_data; break; @@ -1408,15 +1408,15 @@ void calc_ssp_random_test() { Matrix mrr(ssd.f_grid.nelem(), ssd.T_grid.nelem(), 1.78031135); Matrix mri(ssd.f_grid.nelem(), ssd.T_grid.nelem(), 0.00278706); - mrr(0, 0) = 1.78031135; - mrr(0, 1) = 1.78150475; - mrr(1, 0) = 1.78037238; - mrr(1, 1) = 1.78147686; + mrr[0, 0] = 1.78031135; + mrr[0, 1] = 1.78150475; + mrr[1, 0] = 1.78037238; + mrr[1, 1] = 1.78147686; - mri(0, 0) = 0.00278706; - mri(0, 1) = 0.00507565; - mri(1, 0) = 0.00287245; - mri(1, 1) = 0.00523012; + mri[0, 0] = 0.00278706; + mri[0, 1] = 0.00507565; + mri[1, 0] = 0.00287245; + mri[1, 1] = 0.00523012; calcSingleScatteringDataProperties(ssd, mrr, mri, 200.e-6, -1, 1.5); @@ -1438,15 +1438,15 @@ void calc_ssp_fixed_test() { Matrix mrr(ssd.f_grid.nelem(), ssd.T_grid.nelem(), 1.78031135); Matrix mri(ssd.f_grid.nelem(), ssd.T_grid.nelem(), 0.00278706); - mrr(0, 0) = 1.78031135; - mrr(0, 1) = 1.78150475; - mrr(1, 0) = 1.78037238; - mrr(1, 1) = 1.78147686; + mrr[0, 0] = 1.78031135; + mrr[0, 1] = 1.78150475; + mrr[1, 0] = 1.78037238; + mrr[1, 1] = 1.78147686; - mri(0, 0) = 0.00278706; - mri(0, 1) = 0.00507565; - mri(1, 0) = 0.00287245; - mri(1, 1) = 0.00523012; + mri[0, 0] = 0.00278706; + mri[0, 1] = 0.00507565; + mri[1, 0] = 0.00287245; + mri[1, 1] = 0.00523012; calcSingleScatteringDataProperties(ssd, mrr, mri, 200.e-6, -1, 1.5); calcSingleScatteringDataProperties(ssd, mrr, mri, 200.e-6, -1, 0.7); diff --git a/src/m_abs.cc b/src/m_abs.cc index 4bc1258d05..c08be9e766 100644 --- a/src/m_abs.cc +++ b/src/m_abs.cc @@ -160,8 +160,8 @@ void AbsInputFromAtmFields( // WS Output: ARTS_USER_ERROR_IF(1 != 3, "Atmospheric dimension must be 1D, but 3 is 3") abs_p = p_grid; - abs_t = t_field(joker, 0, 0); - abs_vmrs = vmr_field(joker, joker, 0, 0); + abs_t = t_field[joker, 0, 0]; + abs_vmrs = vmr_field[joker, joker, 0, 0]; } //====================================================================== @@ -285,20 +285,20 @@ void propagation_matrixAddFaraday( for (Size i = 0; i < 3; i++) { if (jacs[i].first) { - propagation_matrix_jacobian(jacs[i].second->target_pos, iv).U() += + propagation_matrix_jacobian[jacs[i].second->target_pos, iv].U() += ne * dc1[i] / f2; } } for (Size i = 3; i < 6; i++) { if (jacs[i].first) { - propagation_matrix_jacobian(jacs[i].second->target_pos, iv).U() += + propagation_matrix_jacobian[jacs[i].second->target_pos, iv].U() += -2.0 * ne * r / frequency_grid[iv]; } } if (jacs[6].first) { - propagation_matrix_jacobian(jacs[6].second->target_pos, iv).U() += r; + propagation_matrix_jacobian[jacs[6].second->target_pos, iv].U() += r; } } } @@ -378,7 +378,7 @@ void propagation_matrixAddParticles( T_array = atm_point.temperature; } Matrix dir_array(1, 2); - dir_array(0, joker) = rtp_los_back; + dir_array[0] = rtp_los_back; // ext/abs per scat element for all freqs at once opt_prop_NScatElems(ext_mat_Nse, @@ -419,22 +419,22 @@ void propagation_matrixAddParticles( sp) if (atm_point[absorption_species[sp].Species()] > 0.) { - ARTS_USER_ERROR_IF(t_ok(i_se_flat, 0) < 0., + ARTS_USER_ERROR_IF((t_ok[i_se_flat, 0] < 0.), "Temperature interpolation error:\n" "scat species #{}, scat elem #{}\n", i_ss, i_se) if (use_abs_as_ext) { for (Index iv = 0; iv < frequency_grid.nelem(); iv++) { - internal_propmat[iv].A() += abs_vec_Nse[i_ss][i_se](iv, 0, 0, 0); - internal_propmat[iv].B() += abs_vec_Nse[i_ss][i_se](iv, 0, 0, 1); - internal_propmat[iv].C() += abs_vec_Nse[i_ss][i_se](iv, 0, 0, 2); - internal_propmat[iv].D() += abs_vec_Nse[i_ss][i_se](iv, 0, 0, 3); + internal_propmat[iv].A() += abs_vec_Nse[i_ss][i_se][iv, 0, 0, 0]; + internal_propmat[iv].B() += abs_vec_Nse[i_ss][i_se][iv, 0, 0, 1]; + internal_propmat[iv].C() += abs_vec_Nse[i_ss][i_se][iv, 0, 0, 2]; + internal_propmat[iv].D() += abs_vec_Nse[i_ss][i_se][iv, 0, 0, 3]; } } else { for (Index iv = 0; iv < frequency_grid.nelem(); iv++) { internal_propmat[iv] = rtepack::to_propmat( - ext_mat_Nse[i_ss][i_se](iv, 0, 0, joker, joker)); + ext_mat_Nse[i_ss][i_se][iv, 0, 0, joker, joker]); } } @@ -445,7 +445,7 @@ void propagation_matrixAddParticles( } // For temperature derivatives (so we don't need to check it in jac loop) - ARTS_USER_ERROR_IF(jac_temperature.first and t_ok(i_se_flat, 1) < 0., + ARTS_USER_ERROR_IF((jac_temperature.first and t_ok[i_se_flat, 1] < 0.), "Temperature interpolation error (in perturbation):\n" "scat species #{}, scat elem #{}\n", i_ss, @@ -455,11 +455,11 @@ void propagation_matrixAddParticles( const auto iq = jac_temperature.second->target_pos; if (use_abs_as_ext) { - tmp(joker, joker, 0) = abs_vec_Nse[i_ss][i_se](joker, 1, 0, joker); - tmp(joker, joker, 0) -= abs_vec_Nse[i_ss][i_se](joker, 0, 0, joker); + tmp[joker, joker, 0] = abs_vec_Nse[i_ss][i_se][joker, 1, 0, joker]; + tmp[joker, joker, 0] -= abs_vec_Nse[i_ss][i_se][joker, 0, 0, joker]; } else { - tmp = ext_mat_Nse[i_ss][i_se](joker, 1, 0, joker, joker); - tmp -= ext_mat_Nse[i_ss][i_se](joker, 0, 0, joker, joker); + tmp = ext_mat_Nse[i_ss][i_se][joker, 1, 0, joker, joker]; + tmp -= ext_mat_Nse[i_ss][i_se][joker, 0, 0, joker, joker]; } tmp *= atm_point[absorption_species[sp].Species()]; @@ -467,13 +467,12 @@ void propagation_matrixAddParticles( for (Index iv = 0; iv < frequency_grid.nelem(); iv++) { if (use_abs_as_ext) { - propagation_matrix_jacobian(iq, iv).A() += tmp(iv, 0, 0); - propagation_matrix_jacobian(iq, iv).B() += tmp(iv, 1, 0); - propagation_matrix_jacobian(iq, iv).C() += tmp(iv, 2, 0); - propagation_matrix_jacobian(iq, iv).D() += tmp(iv, 3, 0); + propagation_matrix_jacobian[iq, iv].A() += tmp[iv, 0, 0]; + propagation_matrix_jacobian[iq, iv].B() += tmp[iv, 1, 0]; + propagation_matrix_jacobian[iq, iv].C() += tmp[iv, 2, 0]; + propagation_matrix_jacobian[iq, iv].D() += tmp[iv, 3, 0]; } else { - propagation_matrix_jacobian(iq, iv) += - rtepack::to_propmat(tmp(iv, joker, joker)); + propagation_matrix_jacobian[iq, iv] += rtepack::to_propmat(tmp[iv]); } } } @@ -484,7 +483,7 @@ void propagation_matrixAddParticles( const auto iq = jac_species.second->target_pos; for (Index iv = 0; iv < frequency_grid.nelem(); iv++) - propagation_matrix_jacobian(iq, iv) += internal_propmat[iv]; + propagation_matrix_jacobian[iq, iv] += internal_propmat[iv]; } sp++; diff --git a/src/m_atm.cc b/src/m_atm.cc index ace95783ff..dc8c198b1a 100644 --- a/src/m_atm.cc +++ b/src/m_atm.cc @@ -582,10 +582,10 @@ struct atmospheric_fieldHydrostaticPressureData { for (Index j = 0; j < lat.nelem(); j++) { for (Index k = 0; k < lon.nelem(); k++) { const Numeric h = alt[i] - alt[i - 1]; - const Numeric p0 = pre(i - 1, j, k); - const Numeric d0 = grad_p(i - 1, j, k); + const Numeric p0 = pre[i - 1, j, k]; + const Numeric d0 = grad_p[i - 1, j, k]; - pre(i, j, k) = step(p0, h, d0); + pre[i, j, k] = step(p0, h, d0); } } } @@ -679,7 +679,7 @@ void atmospheric_fieldHydrostaticPressure( : 1.0 / atmospheric_point.temperature; // Partial rho, no pressure - scl(i, j, k) = g * inv_specific_gas_constant * inv_temp; + scl[i, j, k] = g * inv_specific_gas_constant * inv_temp; } } } @@ -799,7 +799,7 @@ lon: {:Bs,} [{} elements] for (Index i = 0; i < alt.size(); i++) { for (Index j = 0; j < lat.size(); j++) { for (Index k = 0; k < lon.size(); k++) { - new_field(i, j, k) = data.at(alt[i], lat[j], lon[k]); + new_field[i, j, k] = data.at(alt[i], lat[j], lon[k]); } } } diff --git a/src/m_cia.cc b/src/m_cia.cc index e7a5e78424..cb206fb17d 100644 --- a/src/m_cia.cc +++ b/src/m_cia.cc @@ -153,7 +153,7 @@ void propagation_matrixAddCIA( // WS Output: if (jac_temps.first) { const auto iq = jac_temps.second->target_pos; - propagation_matrix_jacobian(iq, iv).A() += + propagation_matrix_jacobian[iq, iv].A() += ((nd_sec * (dxsec_temp_dT[iv] - xsec_temp[iv]) / dt + xsec_temp[iv] * dnd_dt_sec) * nd + @@ -164,7 +164,7 @@ void propagation_matrixAddCIA( // WS Output: for (auto& j : jac_freqs) { if (j.first) { const auto iq = j.second->target_pos; - propagation_matrix_jacobian(iq, iv).A() += + propagation_matrix_jacobian[iq, iv].A() += nd_sec * (dxsec_temp_dF[iv] - xsec_temp[iv]) / df * nd * atm_point[this_cia.Species(1)]; } @@ -174,14 +174,14 @@ void propagation_matrixAddCIA( // WS Output: jacobian_targets.find(this_cia.Species(0)); j.first) { const auto iq = j.second->target_pos; - propagation_matrix_jacobian(iq, iv).A() += nd_sec * xsec_temp[iv] * nd; + propagation_matrix_jacobian[iq, iv].A() += nd_sec * xsec_temp[iv] * nd; } if (const auto j = jacobian_targets.find(this_cia.Species(1)); j.first) { const auto iq = j.second->target_pos; - propagation_matrix_jacobian(iq, iv).A() += nd_sec * xsec_temp[iv] * nd; + propagation_matrix_jacobian[iq, iv].A() += nd_sec * xsec_temp[iv] * nd; } } } diff --git a/src/m_disort.cc b/src/m_disort.cc index 62996d8d95..69a7d7bd33 100644 --- a/src/m_disort.cc +++ b/src/m_disort.cc @@ -74,9 +74,9 @@ void disort_spectral_flux_fieldCalc(Tensor3& disort_spectral_flux_field, try { disort_settings.set(dis, iv); - dis.gridded_flux(disort_spectral_flux_field(iv, 0, joker), - disort_spectral_flux_field(iv, 1, joker), - disort_spectral_flux_field(iv, 2, joker)); + dis.gridded_flux(disort_spectral_flux_field[iv, 0, joker], + disort_spectral_flux_field[iv, 1, joker], + disort_spectral_flux_field[iv, 2, joker]); } catch (const std::exception& e) { #pragma omp critical if (error.empty()) error = e.what(); diff --git a/src/m_disort_settings.cc b/src/m_disort_settings.cc index 42418d8c6b..401b46ed6f 100644 --- a/src/m_disort_settings.cc +++ b/src/m_disort_settings.cc @@ -75,7 +75,7 @@ sun.spectrum.nrows(): {} sun.spectrum.nrows()) for (Index iv = 0; iv < nv; iv++) { - disort_settings.solar_source[iv] = sun.spectrum(iv, 0) * sin2_alpha; + disort_settings.solar_source[iv] = sun.spectrum[iv, 0] * sin2_alpha; } disort_settings.solar_zenith_angle = los[0]; @@ -119,12 +119,12 @@ void disort_settingsLayerThermalEmissionLinearInTau( const Numeric y1 = planck(f, t1); const Numeric x0 = - i == 0 ? 0.0 : disort_settings.optical_thicknesses(iv, i - 1); - const Numeric x1 = disort_settings.optical_thicknesses(iv, i); + i == 0 ? 0.0 : disort_settings.optical_thicknesses[iv, i - 1]; + const Numeric x1 = disort_settings.optical_thicknesses[iv, i]; const Numeric b = (y1 - y0) / (x1 - x0); - disort_settings.source_polynomial(iv, i, 0) = y0 - b * x0; - disort_settings.source_polynomial(iv, i, 1) = b; + disort_settings.source_polynomial[iv, i, 0] = y0 - b * x0; + disort_settings.source_polynomial[iv, i, 1] = b; } } } @@ -160,7 +160,7 @@ void disort_settingsSurfaceEmissionByTemperature( "Must have at least one fourier mode to use the positive boundary condition.") for (Index iv = 0; iv < nv; iv++) { - disort_settings.positive_boundary_condition(iv, 0, joker) = + disort_settings.positive_boundary_condition[iv, 0, joker] = planck(frequency_grid[iv], T); } } @@ -190,7 +190,7 @@ void disort_settingsCosmicMicrowaveBackgroundRadiation( "Must have at leaat one fourier mode to use the negative boundary condition.") for (Index iv = 0; iv < nv; iv++) { - disort_settings.negative_boundary_condition(iv, 0, joker) = planck( + disort_settings.negative_boundary_condition[iv, 0, joker] = planck( frequency_grid[iv], Constant::cosmic_microwave_background_temperature); } } @@ -205,7 +205,7 @@ void disort_settingsNoLegendre(DisortSettings& disort_settings) { "Must have at least one Legendre mode to use the Legendre coefficients.") disort_settings.legendre_coefficients = 0.0; - disort_settings.legendre_coefficients(joker, joker, 0) = 1.0; + disort_settings.legendre_coefficients[joker, joker, 0] = 1.0; } //////////////////////////////////////////////////////////////////////////////// @@ -269,15 +269,15 @@ ray_path: {:B,} for (Index iv = 0; iv < nv; iv++) { for (Index i = 0; i < N; i++) { - disort_settings.optical_thicknesses(iv, i) = + disort_settings.optical_thicknesses[iv, i] = r[i] * std::midpoint(ray_path_propagation_matrix[i + 1][iv].A(), ray_path_propagation_matrix[i + 0][iv].A()); if (i > 0) { - disort_settings.optical_thicknesses(iv, i) += - disort_settings.optical_thicknesses(iv, i - 1); + disort_settings.optical_thicknesses[iv, i] += + disort_settings.optical_thicknesses[iv, i - 1]; - ARTS_USER_ERROR_IF(disort_settings.optical_thicknesses(iv, i) <= - disort_settings.optical_thicknesses(iv, i - 1), + ARTS_USER_ERROR_IF((disort_settings.optical_thicknesses[iv, i] <= + disort_settings.optical_thicknesses[iv, i - 1]), R"( Not strictly increasing optical thicknesses between layers. @@ -289,8 +289,8 @@ Old layer: {} New layer: {} Frequency grid point: {} )", - disort_settings.optical_thicknesses(iv, i - 1), - disort_settings.optical_thicknesses(iv, i), + disort_settings.optical_thicknesses[iv, i - 1], + disort_settings.optical_thicknesses[iv, i], i - 1, i, iv); @@ -314,7 +314,7 @@ void disort_settingsSurfaceLambertian(DisortSettings& disort_settings, disort_settings.nfreq, 1); for (Index iv = 0; iv < disort_settings.nfreq; iv++) { - disort_settings.bidirectional_reflectance_distribution_functions(iv, 0) = + disort_settings.bidirectional_reflectance_distribution_functions[iv, 0] = DisortBDRF{ [value = vec[iv]](ExhaustiveMatrixView x, const ExhaustiveConstVectorView&, @@ -386,12 +386,12 @@ void disort_settingsLegendreCoefficientsFromPath( for (Size i = 0; i < N; i++) { for (Index iv = 0; iv < F; iv++) { for (Index j = 0; j < L; j++) { - disort_settings.legendre_coefficients(iv, i, j) = + disort_settings.legendre_coefficients[iv, i, j] = invfac[j] * std::midpoint( - ray_path_phase_matrix_scattering_spectral[i](iv, j)(0, 0) + ray_path_phase_matrix_scattering_spectral[i][iv, j][0, 0] .real(), - ray_path_phase_matrix_scattering_spectral[i + 1](iv, j)(0, 0) + ray_path_phase_matrix_scattering_spectral[i + 1][iv, j][0, 0] .real()); } } @@ -401,17 +401,17 @@ void disort_settingsLegendreCoefficientsFromPath( for (Size i = 0; i < N; i++) { for (Index iv = 0; iv < F; iv++) { // Disort wants the first value to be 1.0, so we normalize - if (std::isnormal(disort_settings.legendre_coefficients(iv, i, 0))) { - disort_settings.legendre_coefficients(iv, i, joker) /= - disort_settings.legendre_coefficients(iv, i, 0); + if (std::isnormal(disort_settings.legendre_coefficients[iv, i, 0])) { + disort_settings.legendre_coefficients[iv, i, joker] /= + disort_settings.legendre_coefficients[iv, i, 0]; //! WARNING: Numerical instabiliy occurs for large j-values in invfac cf what scattering_species does - for (auto& v : disort_settings.legendre_coefficients(iv, i, joker)) { + for (auto& v : disort_settings.legendre_coefficients[iv, i, joker]) { v = std::clamp(v, -1.0, 1.0); } } else { - disort_settings.legendre_coefficients(iv, i, joker) = 0.0; - disort_settings.legendre_coefficients(iv, i, 0) = 1.0; + disort_settings.legendre_coefficients[iv, i, joker] = 0.0; + disort_settings.legendre_coefficients[iv, i, 0] = 1.0; } } } @@ -470,7 +470,7 @@ void disort_settingsSingleScatteringAlbedoFromPath( (inv(ray_path_propagation_matrix_scattering[i][iv]) * ray_path_absorption_vector_scattering[i][iv]) .I()); - disort_settings.single_scattering_albedo(iv, i) = + disort_settings.single_scattering_albedo[iv, i] = std::isnormal(x) ? x : 0.0; } } diff --git a/src/m_fwd.cc b/src/m_fwd.cc index c328223373..4a11836e52 100644 --- a/src/m_fwd.cc +++ b/src/m_fwd.cc @@ -146,7 +146,7 @@ void spectral_radiance_fieldFromOperatorPlanarGeometric( for (Index j = 0; j < naa; ++j) { const auto path = pathstep(zenith_grid[i], azimuth_grid[j]); for (Index n = 0; n < nfreq; ++n) { - spectral_radiance_field.data(i, j, joker, 0, 0, n) = + spectral_radiance_field.data[i, j, joker, 0, 0, n] = freqstep(frequency_grid[n], zenith_grid[i], path); } } @@ -160,7 +160,7 @@ void spectral_radiance_fieldFromOperatorPlanarGeometric( try { const auto path = pathstep(zenith_grid[i], azimuth_grid[j]); for (Index n = 0; n < nfreq; ++n) { - spectral_radiance_field.data(i, j, joker, 0, 0, n) = + spectral_radiance_field.data[i, j, joker, 0, 0, n] = freqstep(frequency_grid[n], zenith_grid[i], path); } } catch (std::exception& e) { @@ -228,7 +228,7 @@ void spectral_radiance_fieldFromOperatorPath( std::transform( frequency_grid.begin(), frequency_grid.end(), - spectral_radiance_field(iza, iaa, ialt, ilat, ilon, joker) + spectral_radiance_field[iza, iaa, ialt, ilat, ilon, joker] .begin(), [path = spectral_radiance_operator.from_path(ray_path), &spectral_radiance_operator](Numeric f) { @@ -261,7 +261,7 @@ void spectral_radiance_fieldFromOperatorPath( std::transform( frequency_grid.begin(), frequency_grid.end(), - spectral_radiance_field(iza, iaa, ialt, ilat, ilon, joker) + spectral_radiance_field[iza, iaa, ialt, ilat, ilon, joker] .begin(), [path = spectral_radiance_operator.from_path(ray_path), &spectral_radiance_operator](Numeric f) { diff --git a/src/m_lbl.cc b/src/m_lbl.cc index 43ec1dad95..f4886956c2 100644 --- a/src/m_lbl.cc +++ b/src/m_lbl.cc @@ -604,8 +604,8 @@ void propagation_matrixAddLines(PropmatVector& pm, try { lbl::calculate(pm.slice(ompv[i].first, ompv[i].second), sv.slice(ompv[i].first, ompv[i].second), - dpm(joker, Range(ompv[i].first, ompv[i].second)), - dsv(joker, Range(ompv[i].first, ompv[i].second)), + dpm[joker, Range(ompv[i].first, ompv[i].second)], + dsv[joker, Range(ompv[i].first, ompv[i].second)], static_cast(f_grid).slice(ompv[i].first, ompv[i].second), jacobian_targets, @@ -736,7 +736,7 @@ void absorption_bandsLineMixingAdaptation( PartitionFunctions::Q(temperatures[i], band_key.Isotopologue()); for (Size k = 0; k < N; k++) { auto& line = band.lines[k]; - lbl_str(i, k) = line.s(temperatures[i], Q) * Math::pow2(Constant::c) / + lbl_str[i, k] = line.s(temperatures[i], Q) * Math::pow2(Constant::c) / (8 * Constant::pi); } } @@ -754,7 +754,7 @@ void absorption_bandsLineMixingAdaptation( for (Size j = 0; j < K; j++) { for (Size k = 0; k < N; k++) { auto& line = band.lines[k]; - lbl_val(i, j, k) = Complex{ + lbl_val[i, j, k] = Complex{ line.f0 + line.ls.single_models[j].D0(line.ls.T0, temperatures[i], atmospheric_point.pressure), @@ -766,8 +766,8 @@ void absorption_bandsLineMixingAdaptation( for (Size i = 0; i < M; i++) { for (Size j = 0; j < K; j++) { - auto s = eqv_str(i, j, joker); - auto v = eqv_val(i, j, joker); + auto s = eqv_str[i, j, joker]; + auto v = eqv_val[i, j, joker]; bubble_sort_by( [&](auto I1, auto I2) { return v[I1].real() > v[I2].real(); }, s, v); } @@ -775,7 +775,7 @@ void absorption_bandsLineMixingAdaptation( eqv_val -= lbl_val; - for (Size j = 0; j < K; j++) eqv_str(joker, j, joker) /= lbl_str; + for (Size j = 0; j < K; j++) eqv_str[joker, j, joker] /= lbl_str; eqv_val.real() /= Math::pow2(atmospheric_point.pressure); eqv_val.imag() /= Math::pow3(atmospheric_point.pressure); @@ -789,7 +789,7 @@ void absorption_bandsLineMixingAdaptation( for (Size k = 0; k < N; k++) { if (rosenkranz_fit_order >= 1) { auto [success_y, yfit] = curve_fit( - temperatures, eqv_str(joker, j, k).imag(), polynomial_fit_degree); + temperatures, eqv_str[joker, j, k].imag(), polynomial_fit_degree); ARTS_USER_ERROR_IF( not success_y, "Cannot fit y for line {} of band {}", k, band_key) band.lines[k].ls.single_models[j].data.emplace_back( @@ -799,7 +799,7 @@ void absorption_bandsLineMixingAdaptation( if (rosenkranz_fit_order >= 2) { auto [success_g, gfit] = curve_fit( - temperatures, eqv_str(joker, j, k).real(), polynomial_fit_degree); + temperatures, eqv_str[joker, j, k].real(), polynomial_fit_degree); ARTS_USER_ERROR_IF( not success_g, "Cannot fit g for line {} of band {}", k, band_key) band.lines[k].ls.single_models[j].data.emplace_back( @@ -807,7 +807,7 @@ void absorption_bandsLineMixingAdaptation( lbl::temperature::data{LineShapeModelType::POLY, Vector{gfit}}); auto [success_d, dfit] = curve_fit( - temperatures, eqv_val(joker, j, k).real(), polynomial_fit_degree); + temperatures, eqv_val[joker, j, k].real(), polynomial_fit_degree); ARTS_USER_ERROR_IF( not success_d, "Cannot fit dv for line {} of band {}", k, band_key) band.lines[k].ls.single_models[j].data.emplace_back( diff --git a/src/m_lookup.cc b/src/m_lookup.cc index 65a810538b..1a2f0aaae7 100644 --- a/src/m_lookup.cc +++ b/src/m_lookup.cc @@ -130,7 +130,7 @@ std::conditional_t _propagation_matrixAddLookup( const Numeric d_inv = 1.0 / jacobian_target.d; for (Index i = 0; i < frequency_grid.size(); i++) { if (no_negative_absorption == 0 or d_absorption[i] > 0.0) { - propagation_matrix_jacobian(jacobian_target.target_pos, i).A() = + propagation_matrix_jacobian[jacobian_target.target_pos, i].A() = (d_absorption[i] - absorption[i]) * d_inv; } } diff --git a/src/m_measurement_vector.cc b/src/m_measurement_vector.cc index 83d696635d..031d935532 100644 --- a/src/m_measurement_vector.cc +++ b/src/m_measurement_vector.cc @@ -76,7 +76,7 @@ struct polyfit { for (Index i = 0; i < p.size(); i++) { const Numeric xn = std::pow(t[j], i); y[j] += p[i] * xn; - dy(j, i) = xn; + dy[j, i] = xn; } } } diff --git a/src/m_obsel.cc b/src/m_obsel.cc index 0cb986e54f..6f961b20e0 100644 --- a/src/m_obsel.cc +++ b/src/m_obsel.cc @@ -30,7 +30,7 @@ void measurement_sensorAddSimple(ArrayOfSensorObsel& measurement_sensor, for (Index i = 0; i < n; i++) { StokvecMatrix w(1, n, 0); - w(0, i) = pol; + w[0, i] = pol; measurement_sensor[i + sz] = {f, p, std::move(w)}; } } @@ -68,7 +68,7 @@ void measurement_sensorAddVectorGaussian(ArrayOfSensorObsel& measurement_sensor, const gauss dist(frequency_grid[i], stds[i]); for (Index j = 0; j < n; j++) { - w(0, j) *= pdf(dist, frequency_grid[j]); + w[0, j] *= pdf(dist, frequency_grid[j]); } measurement_sensor[i + sz] = {f, p, std::move(w)}; diff --git a/src/m_partfun.cc b/src/m_partfun.cc index 90d7a506df..f59a805279 100644 --- a/src/m_partfun.cc +++ b/src/m_partfun.cc @@ -25,8 +25,8 @@ void WriteBuiltinPartitionFunctionsXML( PartitionFunctionsData data{PartitionFunctionsType::Interp, Matrix(N, 2)}; for (Index i=0; i= 0) { for (Size ip = 1; ip < N; ip++) { - ray_path_distance_jacobian(0, ip, temperature_derivative_position) = + ray_path_distance_jacobian[0, ip, temperature_derivative_position] = ray_path_distance[ip] / (2.0 * ray_path_atmospheric_point[ip - 1].temperature); - ray_path_distance_jacobian(1, ip, temperature_derivative_position) = + ray_path_distance_jacobian[1, ip, temperature_derivative_position] = ray_path_distance[ip] / (2.0 * ray_path_atmospheric_point[ip].temperature); } diff --git a/src/m_sun.cc b/src/m_sun.cc index 72835afe07..749f7b4f89 100644 --- a/src/m_sun.cc +++ b/src/m_sun.cc @@ -88,7 +88,7 @@ void sunBlackbody(Sun& sun, // spectrum sun.spectrum = Matrix(frequency_grid.nelem(), 4, 0.); - planck(sun.spectrum(joker, 0), frequency_grid, temperature); + planck(sun.spectrum[joker, 0], frequency_grid, temperature); sun.spectrum *= pi; // outgoing flux at the surface of the sun. sun.description = "Blackbody sun"; diff --git a/src/m_xsec_fit.cc b/src/m_xsec_fit.cc index a39eab34d2..317c544268 100644 --- a/src/m_xsec_fit.cc +++ b/src/m_xsec_fit.cc @@ -150,7 +150,7 @@ void propagation_matrixAddXsecFit( // WS Output: if (temp_jac.first) { const auto iq = temp_jac.second->target_pos; - propagation_matrix_jacobian(iq, f).A() += + propagation_matrix_jacobian[iq, f].A() += ((dxsec_temp_dT[f] - xsec_temp[f]) / dt * nd + xsec_temp[f] * dnd_dt) * vmr; @@ -159,7 +159,7 @@ void propagation_matrixAddXsecFit( // WS Output: for (auto& j : freq_jac) { if (j.first) { const auto iq = j.second->target_pos; - propagation_matrix_jacobian(iq, f).A() += + propagation_matrix_jacobian[iq, f].A() += (dxsec_temp_dF[f] - xsec_temp[f]) * nd * vmr / df; } } @@ -168,7 +168,7 @@ void propagation_matrixAddXsecFit( // WS Output: jacobian_targets.find(this_xdata.Species()); j.first) { const auto iq = j.second->target_pos; - propagation_matrix_jacobian(iq, f).A() += xsec_temp[f] * nd * vmr; + propagation_matrix_jacobian[iq, f].A() += xsec_temp[f] * nd * vmr; } } } diff --git a/src/oem.h b/src/oem.h index 43b054bd81..81d6327024 100644 --- a/src/oem.h +++ b/src/oem.h @@ -612,7 +612,7 @@ void Tensor4Clip(Tensor4 &x, for (Index p = 0; p < x.npages(); p++) { for (Index r = 0; r < x.nrows(); r++) { for (Index c = 0; c < x.ncols(); c++) { - if (x(i, p, r, c) < limit_low) x(i, p, r, c) = limit_low; + if (x[i, p, r, c] < limit_low) x[i, p, r, c] = limit_low; } } } @@ -624,7 +624,7 @@ void Tensor4Clip(Tensor4 &x, for (Index p = 0; p < x.npages(); p++) { for (Index r = 0; r < x.nrows(); r++) { for (Index c = 0; c < x.ncols(); c++) { - if (x(i, p, r, c) > limit_high) x(i, p, r, c) = limit_high; + if (x[i, p, r, c] > limit_high) x[i, p, r, c] = limit_high; } } } diff --git a/src/partfun/make_auto_partfuns.cc b/src/partfun/make_auto_partfuns.cc index 7b1c007d41..6a62f50d4b 100644 --- a/src/partfun/make_auto_partfuns.cc +++ b/src/partfun/make_auto_partfuns.cc @@ -49,7 +49,7 @@ void print_data(const PartitionFunctionsData& data, auto& os) { if (i % cutline == 0) { os << '\n'; } - os << data.data(i, 1) << ',' << ' '; + os << data.data[i, 1] << ',' << ' '; } os << "};\n\n"; @@ -58,7 +58,7 @@ void print_data(const PartitionFunctionsData& data, auto& os) { if (i % cutline == 0) { os << '\n'; } - os << data.data(i, 0) << ',' << ' '; + os << data.data[i, 0] << ',' << ' '; } os << "};\n"; break; @@ -68,7 +68,7 @@ void print_data(const PartitionFunctionsData& data, auto& os) { if (i % cutline == 0) { os << '\n'; } - os << data.data(i, 0) << ',' << ' '; + os << data.data[i, 0] << ',' << ' '; } os << "};\n"; break; @@ -78,12 +78,12 @@ void print_data(const PartitionFunctionsData& data, auto& os) { if (i % cutline == 0) { os << '\n'; } - os << data.data(i, 1) << ',' << ' '; + os << data.data[i, 1] << ',' << ' '; } os << "};\n\n"; - os << "static constexpr inline Numeric dT = " << data.data(0, 0) << ";\n"; - os << "static constexpr inline Numeric T0 = " << data.data(1, 0) - data.data(0, 0) << ";\n"; + os << "static constexpr inline Numeric dT = " << data.data[0, 0] << ";\n"; + os << "static constexpr inline Numeric T0 = " << data.data[1, 0] - data.data[0, 0] << ";\n"; break; } } diff --git a/src/python_interface/py_disort.cpp b/src/python_interface/py_disort.cpp index 95b400d62a..5ac0a23868 100644 --- a/src/python_interface/py_disort.cpp +++ b/src/python_interface/py_disort.cpp @@ -167,7 +167,7 @@ void py_disort(py::module_& m) try { Tensor3 out(dis.mu().size(), tau.size(), phi.size()); for (Index i = 0; i < tau.size(); i++) { - out(joker, i, joker) = transpose(res[sorting[i]]); + out[joker, i, joker] = transpose(res[sorting[i]]); } return out; }, @@ -190,7 +190,7 @@ void py_disort(py::module_& m) try { Vector out(tau.size()); for (Index i = 0; i < tau.size(); i++) { - out[i] = res(0, sorting[i]); + out[i] = res[0, sorting[i]]; } return out; }, @@ -212,8 +212,8 @@ void py_disort(py::module_& m) try { ArrayOfVector out(2, Vector(tau.size())); for (Index i = 0; i < tau.size(); i++) { - out[0][i] = res(1, sorting[i]); - out[1][i] = res(2, sorting[i]); + out[0][i] = res[1, sorting[i]]; + out[1][i] = res[2, sorting[i]]; } return out; }, diff --git a/src/tests/linemixing_jmh.cc b/src/tests/linemixing_jmh.cc index c0d61e003a..0e9db0554f 100644 --- a/src/tests/linemixing_jmh.cc +++ b/src/tests/linemixing_jmh.cc @@ -123,7 +123,7 @@ int main() try { const Index jjfp = jf[iRp]; if (jjip > jji) continue; - Wipert(iRp, iR, ipp) = relaxation_matrix_element( + Wipert[iRp, iR, ipp] = relaxation_matrix_element( li, lf, jji, jjf, jjip, jjfp, ECS, QL); } } @@ -131,8 +131,8 @@ int main() try { for (Index iR = 0; iR <= nraies; iR++) { for (Index iRp = 0; iRp <= nraies; iRp++) { - W(iRp, iR, itemp) = - 0.79 * Wipert(iRp, iR, 0) + 0.21 * Wipert(iRp, iR, 1); + W[iRp, iR, itemp] = + 0.79 * Wipert[iRp, iR, 0] + 0.21 * Wipert[iRp, iR, 1]; } } } @@ -143,20 +143,20 @@ int main() try { for (Index iR = 0; iR <= nraies; iR++) { for (Index iRp = 0; iRp <= nraies; iRp++) { if (ji[iRp] > ji[iR]) continue; - if (max(W(iRp, iR, joker)) == min(W(iRp, iR, joker))) continue; + if (max(W[iRp, iR, joker]) == min(W[iRp, iR, joker])) continue; char str[200]; std::sprintf( str, " %0.12E %0.12E %0.12E %0.12E %0.12E %0.12E %0.12E %0.12E %" PRId64 " %" PRId64 " %" PRId64 " %" PRId64 "\n", - W(iRp, iR, 0), - W(iRp, iR, 1), - W(iRp, iR, 2), - W(iRp, iR, 3), - W(iRp, iR, 4), - W(iRp, iR, 5), - W(iRp, iR, 6), - W(iRp, iR, 7), + W[iRp, iR, 0], + W[iRp, iR, 1], + W[iRp, iR, 2], + W[iRp, iR, 3], + W[iRp, iR, 4], + W[iRp, iR, 5], + W[iRp, iR, 6], + W[iRp, iR, 7], ji[iR], jf[iR], ji[iRp], diff --git a/src/tests/scattering/test_absorption_vector.cc b/src/tests/scattering/test_absorption_vector.cc index 0ba8bc5cc8..f2ff2812ab 100644 --- a/src/tests/scattering/test_absorption_vector.cc +++ b/src/tests/scattering/test_absorption_vector.cc @@ -24,7 +24,7 @@ bool test_absorption_vector_tro() { auto absorption_vector_interp = absorption_vector.regrid(grids, weights); Numeric err = - std::abs(absorption_vector(0, 0, 0) - absorption_vector_interp(0, 0, 0)); + std::abs(absorption_vector[0, 0, 0] - absorption_vector_interp[0, 0, 0]); if (err > 1e-10) { return false; } @@ -40,7 +40,7 @@ bool test_absorption_vector_tro() { weights = calc_regrid_weights( t_grid, f_grid, nullptr, nullptr, nullptr, nullptr, grids); absorption_vector_interp = absorption_vector.regrid(grids, weights); - err = std::abs(absorption_vector_interp(0, 0, 0) - 1.2345); + err = std::abs(absorption_vector_interp[0, 0, 0] - 1.2345); if (err > 1e-10) { return false; } @@ -48,7 +48,7 @@ bool test_absorption_vector_tro() { fill_along_axis<1>( reinterpret_cast &>(absorption_vector)); absorption_vector_interp = absorption_vector.regrid(grids, weights); - err = std::abs(absorption_vector_interp(0, 0, 0) - 1.2346); + err = std::abs(absorption_vector_interp[0, 0, 0] - 1.2346); if (err > 1e-10) { return false; } @@ -79,8 +79,8 @@ bool test_absorption_vector_aro() { t_grid, f_grid, nullptr, za_inc_grid, nullptr, nullptr, grids); auto absorption_vector_interp = absorption_vector.regrid(grids, weights); - Numeric err = std::abs(absorption_vector(0, 0, 0, 0) - - absorption_vector_interp(0, 0, 0, 0)); + Numeric err = std::abs(absorption_vector[0, 0, 0, 0] - + absorption_vector_interp[0, 0, 0, 0]); if (err > 1e-10) { return false; } @@ -99,7 +99,7 @@ bool test_absorption_vector_aro() { weights = calc_regrid_weights( t_grid, f_grid, nullptr, za_inc_grid, nullptr, nullptr, grids); absorption_vector_interp = absorption_vector.regrid(grids, weights); - err = std::abs(absorption_vector_interp(0, 0, 0, 0) - 1.2345); + err = std::abs(absorption_vector_interp[0, 0, 0, 0] - 1.2345); if (err > 1e-10) { return false; } @@ -107,7 +107,7 @@ bool test_absorption_vector_aro() { fill_along_axis<1>( reinterpret_cast &>(absorption_vector)); absorption_vector_interp = absorption_vector.regrid(grids, weights); - err = std::abs(absorption_vector_interp(0, 0, 0, 0) - 1.2346); + err = std::abs(absorption_vector_interp[0, 0, 0, 0] - 1.2346); if (err > 1e-10) { return false; } @@ -115,7 +115,7 @@ bool test_absorption_vector_aro() { fill_along_axis<2>( reinterpret_cast &>(absorption_vector)); absorption_vector_interp = absorption_vector.regrid(grids, weights); - err = std::abs(absorption_vector_interp(0, 0, 0, 0) - 1.2347); + err = std::abs(absorption_vector_interp[0, 0, 0, 0] - 1.2347); if (err > 1e-10) { return false; } diff --git a/src/tests/scattering/test_extinction_matrix.cc b/src/tests/scattering/test_extinction_matrix.cc index 328298fe7f..20874932c2 100644 --- a/src/tests/scattering/test_extinction_matrix.cc +++ b/src/tests/scattering/test_extinction_matrix.cc @@ -24,7 +24,7 @@ bool test_extinction_matrix_tro() { auto extinction_matrix_interp = extinction_matrix.regrid(grids, weights); Numeric err = - std::abs(extinction_matrix(0, 0, 0) - extinction_matrix_interp(0, 0, 0)); + std::abs(extinction_matrix[0, 0, 0] - extinction_matrix_interp[0, 0, 0]); if (err > 1e-10) { return false; } @@ -40,7 +40,7 @@ bool test_extinction_matrix_tro() { weights = calc_regrid_weights( t_grid, f_grid, nullptr, nullptr, nullptr, nullptr, grids); extinction_matrix_interp = extinction_matrix.regrid(grids, weights); - err = std::abs(extinction_matrix_interp(0, 0, 0) - 1.2345); + err = std::abs(extinction_matrix_interp[0, 0, 0] - 1.2345); if (err > 1e-10) { return false; } @@ -48,7 +48,7 @@ bool test_extinction_matrix_tro() { fill_along_axis<1>( reinterpret_cast &>(extinction_matrix)); extinction_matrix_interp = extinction_matrix.regrid(grids, weights); - err = std::abs(extinction_matrix_interp(0, 0, 0) - 1.2346); + err = std::abs(extinction_matrix_interp[0, 0, 0] - 1.2346); if (err > 1e-10) { return false; } @@ -79,8 +79,8 @@ bool test_extinction_matrix_aro() { t_grid, f_grid, nullptr, za_inc_grid, nullptr, nullptr, grids); auto extinction_matrix_interp = extinction_matrix.regrid(grids, weights); - Numeric err = std::abs(extinction_matrix(0, 0, 0, 0) - - extinction_matrix_interp(0, 0, 0, 0)); + Numeric err = std::abs(extinction_matrix[0, 0, 0, 0] - + extinction_matrix_interp[0, 0, 0, 0]); if (err > 1e-10) { return false; } @@ -99,7 +99,7 @@ bool test_extinction_matrix_aro() { weights = calc_regrid_weights( t_grid, f_grid, nullptr, za_inc_grid, nullptr, nullptr, grids); extinction_matrix_interp = extinction_matrix.regrid(grids, weights); - err = std::abs(extinction_matrix_interp(0, 0, 0, 0) - 1.2345); + err = std::abs(extinction_matrix_interp[0, 0, 0, 0] - 1.2345); if (err > 1e-10) { return false; } @@ -107,7 +107,7 @@ bool test_extinction_matrix_aro() { fill_along_axis<1>( reinterpret_cast &>(extinction_matrix)); extinction_matrix_interp = extinction_matrix.regrid(grids, weights); - err = std::abs(extinction_matrix_interp(0, 0, 0, 0) - 1.2346); + err = std::abs(extinction_matrix_interp[0, 0, 0, 0] - 1.2346); if (err > 1e-10) { return false; } @@ -115,7 +115,7 @@ bool test_extinction_matrix_aro() { fill_along_axis<2>( reinterpret_cast &>(extinction_matrix)); extinction_matrix_interp = extinction_matrix.regrid(grids, weights); - err = std::abs(extinction_matrix_interp(0, 0, 0, 0) - 1.2347); + err = std::abs(extinction_matrix_interp[0, 0, 0, 0] - 1.2347); if (err > 1e-10) { return false; } diff --git a/src/tests/scattering/test_particle_habit.cc b/src/tests/scattering/test_particle_habit.cc index c6f1aaca15..c4adf5d32e 100644 --- a/src/tests/scattering/test_particle_habit.cc +++ b/src/tests/scattering/test_particle_habit.cc @@ -19,20 +19,20 @@ bool test_particle_habit_from_legacy_tro() { for (Index ind = 0; ind < habit.size(); ++ind) { - Numeric err = max_error((*std::get(habit[ind]).phase_matrix)(joker, 0, joker, joker), - legacy_data[ind].pha_mat_data(0, joker, joker, 0, 0, 0, joker)); + Numeric err = max_error((*std::get(habit[ind]).phase_matrix)[joker, 0, joker, joker], + legacy_data[ind].pha_mat_data[0, joker, joker, 0, 0, 0, joker]); if (err > 0) { return false; } - err = max_error(std::get(habit[ind]).extinction_matrix(0, joker, joker), - legacy_data[ind].ext_mat_data(joker, 0, 0, 0, joker)); + err = max_error(std::get(habit[ind]).extinction_matrix[0, joker, joker], + legacy_data[ind].ext_mat_data[joker, 0, 0, 0, joker]); if (err > 0) { return false; } - err = max_error(std::get(habit[ind]).absorption_vector(joker, 0, joker), - legacy_data[ind].abs_vec_data(0, joker, 0, 0, joker)); + err = max_error(std::get(habit[ind]).absorption_vector[joker, 0, joker], + legacy_data[ind].abs_vec_data[0, joker, 0, 0, joker]); if (err > 0) { return false; } diff --git a/src/tests/scattering/test_phase_matrix.cc b/src/tests/scattering/test_phase_matrix.cc index 8bd9f80415..5d4761cd15 100644 --- a/src/tests/scattering/test_phase_matrix.cc +++ b/src/tests/scattering/test_phase_matrix.cc @@ -45,7 +45,7 @@ PhaseMatrixTROGridded make_phase_matrix( for (Index i_t = 0; i_t < t_grid->size(); ++i_t) { for (Index i_f = 0; i_f < f_grid->size(); ++i_f) { for (Index i_s = 0; i_s < phase_matrix.n_stokes_coeffs; ++i_s) { - phase_matrix(i_t, Range(i_f, 1), joker, i_s) = + phase_matrix[i_t, Range(i_f, 1), joker, i_s] = evaluate_spherical_harmonic(i_f, 0, aa_grid, za_grid); } } @@ -69,7 +69,7 @@ PhaseMatrixTROGridded make_phase_matrix_liquid_sphere( (*f_grid)[i_f], (*t_grid)[i_t], 1e-3, Vector(grid_vector(*za_scat_grid))); auto scat_matrix = scat_data.get_scattering_matrix_compact(); for (Index i_s = 0; i_s < phase_matrix.n_stokes_coeffs; ++i_s) { - phase_matrix(i_t, i_f, joker, i_s) = scat_matrix(joker, i_s); + phase_matrix[i_t, i_f, joker, i_s] = scat_matrix[joker, i_s]; } } } @@ -101,7 +101,7 @@ PhaseMatrixAROGridded make_phase_matrix( for (Index i_s = 0; i_s < phase_matrix.n_stokes_coeffs; ++i_s) { Index l = i_t; Index m = std::min(i_t, i_f); - phase_matrix(i_t, i_f, i_za_inc, joker, joker, i_s) = + phase_matrix[i_t, i_f, i_za_inc, joker, joker, i_s] = evaluate_spherical_harmonic(l, m, aa_grid, za_grid); } } @@ -131,7 +131,7 @@ bool test_phase_matrix_tro() { Numeric err = max_error( coeffs_ref, static_cast( - phase_matrix_spectral(i_t, i_f, joker, i_s))); + phase_matrix_spectral[i_t, i_f, joker, i_s])); if (err > 1e-6) return false; } } @@ -165,9 +165,9 @@ bool test_phase_matrix_tro() { for (Index i_f = 0; i_f < f_grid->size(); ++i_f) { // Backward scattering direction. Only two independent elements. // Off-diagonal elements must be close to 0. - auto pm_f = phase_matrix_lab(i_t, i_f, 0, 0, 0, joker); + auto pm_f = phase_matrix_lab[i_t, i_f, 0, 0, 0, joker]; Numeric coeff_max_f = pm_f[0]; - auto pm_b = phase_matrix_lab(i_t, i_f, 0, 1, 0, joker); + auto pm_b = phase_matrix_lab[i_t, i_f, 0, 1, 0, joker]; Numeric coeff_max_b = pm_b[0]; // For the forward direction we have: @@ -209,14 +209,14 @@ bool test_phase_matrix_tro() { auto backscatter_matrix = phase_matrix_liquid.extract_backscatter_matrix(); err = max_error( backscatter_matrix, - static_cast(phase_matrix_liquid(joker, joker, 4, joker))); + static_cast(phase_matrix_liquid[joker, joker, 4, joker])); if (err > 1e-15) return false; auto forwardscatter_matrix = phase_matrix_liquid.extract_forwardscatter_matrix(); err = max_error( forwardscatter_matrix, - static_cast(phase_matrix_liquid(joker, joker, 0, joker))); + static_cast(phase_matrix_liquid[joker, joker, 0, joker])); if (err > 1e-15) return false; auto phase_matrix_liquid_sht = @@ -313,8 +313,8 @@ bool test_phase_matrix_regrid_tro() { auto phase_matrix_gridded_interp = phase_matrix_gridded.regrid(grids, weights); Numeric err = max_error( - static_cast(phase_matrix_gridded(0, 0, joker, joker)), - static_cast(phase_matrix_gridded_interp(0, 0, joker, joker))); + static_cast(phase_matrix_gridded[0, 0, joker, joker]), + static_cast(phase_matrix_gridded_interp[0, 0, joker, joker])); if (err > 0.0) { return false; } @@ -330,8 +330,8 @@ bool test_phase_matrix_regrid_tro() { phase_matrix_gridded_interp = phase_matrix_spectral_interp.to_gridded(); err = max_error( - static_cast(phase_matrix_gridded(0, 0, joker, joker)), - static_cast(phase_matrix_gridded_interp(0, 0, joker, joker))); + static_cast(phase_matrix_gridded[0, 0, joker, joker]), + static_cast(phase_matrix_gridded_interp[0, 0, joker, joker])); if (err > 1e-10) { return false; } @@ -355,13 +355,13 @@ bool test_phase_matrix_regrid_tro() { for (Index i_f = 0; i_f < 2; ++i_f) { for (Index i_za_scat = 0; i_za_scat < 2; ++i_za_scat) { phase_matrix_ref += static_cast>( - 0.125 * phase_matrix_gridded(i_t, i_f, i_za_scat, joker)); + 0.125 * phase_matrix_gridded[i_t, i_f, i_za_scat, joker]); } } } err = max_error( static_cast(phase_matrix_ref), - static_cast(phase_matrix_gridded_interp(0, 0, 0, joker))); + static_cast(phase_matrix_gridded_interp[0, 0, 0, joker])); if (err > 1e-15) { return false; } @@ -378,12 +378,12 @@ bool test_phase_matrix_regrid_tro() { for (Index i_f = 0; i_f < 2; ++i_f) { phase_matrix_spectral_ref += static_cast>( - 0.25 * phase_matrix_gridded(i_t, i_f, joker, joker)); + 0.25 * phase_matrix_gridded[i_t, i_f, joker, joker]); } } err = max_error( static_cast(phase_matrix_spectral_ref), - static_cast(phase_matrix_interp(0, 0, joker, joker))); + static_cast(phase_matrix_interp[0, 0, joker, joker])); if (err > 1e-10) { return false; } @@ -409,7 +409,7 @@ bool test_phase_matrix_regrid_tro() { weights = calc_regrid_weights( t_grid, f_grid, nullptr, nullptr, nullptr, za_scat_grid_inc, grids); phase_matrix_gridded_interp = phase_matrix_gridded.regrid(grids, weights); - err = std::abs(phase_matrix_gridded_interp(0, 0, 0, 0) - 1.2345); + err = std::abs(phase_matrix_gridded_interp[0, 0, 0, 0] - 1.2345); if (err > 1e-10) { return false; } @@ -418,7 +418,7 @@ bool test_phase_matrix_regrid_tro() { reinterpret_cast, 4> &>( phase_matrix_spectral)); phase_matrix_spectral_interp = phase_matrix_spectral.regrid(grids, weights); - err = std::abs(phase_matrix_spectral_interp(0, 0, 0, 0) - 1.2345); + err = std::abs(phase_matrix_spectral_interp[0, 0, 0, 0] - 1.2345); if (err > 1e-10) { return false; } @@ -428,7 +428,7 @@ bool test_phase_matrix_regrid_tro() { fill_along_axis<1>(reinterpret_cast &>( phase_matrix_gridded)); phase_matrix_gridded_interp = phase_matrix_gridded.regrid(grids, weights); - err = std::abs(phase_matrix_gridded_interp(0, 0, 0, 0) - 1.2345); + err = std::abs(phase_matrix_gridded_interp[0, 0, 0, 0] - 1.2345); if (err > 1e-10) { return false; } @@ -437,7 +437,7 @@ bool test_phase_matrix_regrid_tro() { reinterpret_cast, 4> &>( phase_matrix_spectral)); phase_matrix_spectral_interp = phase_matrix_spectral.regrid(grids, weights); - err = std::abs(phase_matrix_spectral_interp(0, 0, 0, 0) - 1.2345); + err = std::abs(phase_matrix_spectral_interp[0, 0, 0, 0] - 1.2345); if (err > 1e-10) { return false; } @@ -447,7 +447,7 @@ bool test_phase_matrix_regrid_tro() { fill_along_axis<2>(reinterpret_cast &>( phase_matrix_gridded)); phase_matrix_gridded_interp = phase_matrix_gridded.regrid(grids, weights); - err = std::abs(phase_matrix_gridded_interp(0, 0, 0, 0) - 1.2345); + err = std::abs(phase_matrix_gridded_interp[0, 0, 0, 0] - 1.2345); if (err > 1e-10) { return false; } @@ -477,8 +477,8 @@ bool test_backscatter_matrix_regrid_tro() { auto backscatter_matrix_interp = backscatter_matrix.regrid(grids, weights); Numeric err = max_error( - static_cast(backscatter_matrix(0, 0, joker)), - static_cast(backscatter_matrix_interp(0, 0, joker))); + static_cast(backscatter_matrix[0, 0, joker]), + static_cast(backscatter_matrix_interp[0, 0, joker])); if (err > 0.0) { return false; } @@ -502,7 +502,7 @@ bool test_backscatter_matrix_regrid_tro() { weights = calc_regrid_weights( t_grid, f_grid, nullptr, nullptr, nullptr, nullptr, grids); backscatter_matrix_interp = backscatter_matrix.regrid(grids, weights); - err = std::abs(backscatter_matrix_interp(0, 0, 0) - 1.2345); + err = std::abs(backscatter_matrix_interp[0, 0, 0] - 1.2345); if (err > 1e-10) { return false; } @@ -511,7 +511,7 @@ bool test_backscatter_matrix_regrid_tro() { fill_along_axis<1>(reinterpret_cast &>( backscatter_matrix)); backscatter_matrix_interp = backscatter_matrix.regrid(grids, weights); - err = std::abs(backscatter_matrix_interp(0, 0, 0) - 1.2345); + err = std::abs(backscatter_matrix_interp[0, 0, 0] - 1.2345); if (err > 1e-10) { return false; } @@ -548,7 +548,7 @@ bool test_phase_matrix_aro() { Numeric err = max_error( coeffs_ref, static_cast( - phase_matrix_spectral(i_t, i_f, i_za_inc, joker, i_s))); + phase_matrix_spectral[i_t, i_f, i_za_inc, joker, i_s])); if (err > 1e-6) return false; } } @@ -626,9 +626,9 @@ bool test_phase_matrix_regrid_aro() { auto phase_matrix_gridded_interp = phase_matrix_gridded.regrid(grids, weights); Numeric err = max_error( - static_cast(phase_matrix_gridded(0, 0, 0, 0, 0, joker)), + static_cast(phase_matrix_gridded[0, 0, 0, 0, 0, joker]), static_cast( - phase_matrix_gridded_interp(0, 0, 0, 0, 0, joker))); + phase_matrix_gridded_interp[0, 0, 0, 0, 0, joker])); if (err > 1e-10) { return false; } @@ -644,9 +644,9 @@ bool test_phase_matrix_regrid_aro() { phase_matrix_gridded_interp = phase_matrix_spectral_interp.to_gridded(); err = max_error(static_cast( - phase_matrix_gridded(0, 0, 0, joker, joker, joker)), - static_cast(phase_matrix_gridded_interp( - 0, 0, 0, joker, joker, joker))); + phase_matrix_gridded[0, 0, 0, joker, joker, joker]), + static_cast(phase_matrix_gridded_interp[ + 0, 0, 0, joker, joker, joker])); if (err > 1e-10) { return false; } @@ -689,7 +689,7 @@ bool test_phase_matrix_regrid_aro() { za_scat_grid_inc, grids); phase_matrix_gridded_interp = phase_matrix_gridded.regrid(grids, weights); - err = std::abs(phase_matrix_gridded_interp(0, 0, 0, 0, 0, 0) - 1.2345); + err = std::abs(phase_matrix_gridded_interp[0, 0, 0, 0, 0, 0] - 1.2345); if (err > 1e-10) { return false; @@ -699,7 +699,7 @@ bool test_phase_matrix_regrid_aro() { reinterpret_cast, 5> &>( phase_matrix_spectral)); phase_matrix_spectral_interp = phase_matrix_spectral.regrid(grids, weights); - err = std::abs(phase_matrix_spectral_interp(0, 0, 0, 0, 0) - 1.2345); + err = std::abs(phase_matrix_spectral_interp[0, 0, 0, 0, 0] - 1.2345); if (err > 1e-10) { return false; } @@ -709,7 +709,7 @@ bool test_phase_matrix_regrid_aro() { fill_along_axis<1>(reinterpret_cast &>( phase_matrix_gridded)); phase_matrix_gridded_interp = phase_matrix_gridded.regrid(grids, weights); - err = std::abs(phase_matrix_gridded_interp(0, 0, 0, 0, 0, 0) - 1.2345); + err = std::abs(phase_matrix_gridded_interp[0, 0, 0, 0, 0, 0] - 1.2345); if (err > 1e-10) { return false; } @@ -718,7 +718,7 @@ bool test_phase_matrix_regrid_aro() { reinterpret_cast, 5> &>( phase_matrix_spectral)); phase_matrix_spectral_interp = phase_matrix_spectral.regrid(grids, weights); - err = std::abs(phase_matrix_spectral_interp(0, 0, 0, 0, 0) - 1.2345); + err = std::abs(phase_matrix_spectral_interp[0, 0, 0, 0, 0] - 1.2345); if (err > 1e-10) { return false; } @@ -728,7 +728,7 @@ bool test_phase_matrix_regrid_aro() { fill_along_axis<2>(reinterpret_cast &>( phase_matrix_gridded)); phase_matrix_gridded_interp = phase_matrix_gridded.regrid(grids, weights); - err = std::abs(phase_matrix_gridded_interp(0, 0, 0, 0, 0, 0) - 1.2345); + err = std::abs(phase_matrix_gridded_interp[0, 0, 0, 0, 0, 0] - 1.2345); if (err > 1e-10) { return false; } @@ -737,7 +737,7 @@ bool test_phase_matrix_regrid_aro() { reinterpret_cast, 5> &>( phase_matrix_spectral)); phase_matrix_spectral_interp = phase_matrix_spectral.regrid(grids, weights); - err = std::abs(phase_matrix_spectral_interp(0, 0, 0, 0, 0) - 1.2345); + err = std::abs(phase_matrix_spectral_interp[0, 0, 0, 0, 0] - 1.2345); if (err > 1e-10) { return false; } @@ -746,7 +746,7 @@ bool test_phase_matrix_regrid_aro() { fill_along_axis<3>(reinterpret_cast &>( phase_matrix_gridded)); phase_matrix_gridded_interp = phase_matrix_gridded.regrid(grids, weights); - err = std::abs(phase_matrix_gridded_interp(0, 0, 0, 0, 0, 0) - 1.2345); + err = std::abs(phase_matrix_gridded_interp[0, 0, 0, 0, 0, 0] - 1.2345); if (err > 1e-10) { return false; } @@ -755,7 +755,7 @@ bool test_phase_matrix_regrid_aro() { fill_along_axis<4>(reinterpret_cast &>( phase_matrix_gridded)); phase_matrix_gridded_interp = phase_matrix_gridded.regrid(grids, weights); - err = std::abs(phase_matrix_gridded_interp(0, 0, 0, 0, 0, 0) - 1.2345); + err = std::abs(phase_matrix_gridded_interp[0, 0, 0, 0, 0, 0] - 1.2345); if (err > 1e-10) { return false; } @@ -800,8 +800,8 @@ bool test_backscatter_matrix_regrid_aro() { auto backscatter_matrix_interp = backscatter_matrix.regrid(grids, weights); Numeric err = max_error( - static_cast(backscatter_matrix(0, 0, 0, joker)), - static_cast(backscatter_matrix_interp(0, 0, 0, joker))); + static_cast(backscatter_matrix[0, 0, 0, joker]), + static_cast(backscatter_matrix_interp[0, 0, 0, joker])); if (err > 1e-10) { return false; } @@ -843,7 +843,7 @@ bool test_backscatter_matrix_regrid_aro() { za_scat_grid_inc, grids); backscatter_matrix_interp = backscatter_matrix.regrid(grids, weights); - err = std::abs(backscatter_matrix_interp(0, 0, 0, 0) - 1.2345); + err = std::abs(backscatter_matrix_interp[0, 0, 0, 0] - 1.2345); if (err > 1e-10) { return false; } @@ -853,7 +853,7 @@ bool test_backscatter_matrix_regrid_aro() { fill_along_axis<1>(reinterpret_cast &>( backscatter_matrix)); backscatter_matrix_interp = backscatter_matrix.regrid(grids, weights); - err = std::abs(backscatter_matrix_interp(0, 0, 0, 0) - 1.2345); + err = std::abs(backscatter_matrix_interp[0, 0, 0, 0] - 1.2345); if (err > 1e-10) { return false; } @@ -863,7 +863,7 @@ bool test_backscatter_matrix_regrid_aro() { fill_along_axis<2>(reinterpret_cast &>( backscatter_matrix)); backscatter_matrix_interp = backscatter_matrix.regrid(grids, weights); - err = std::abs(backscatter_matrix_interp(0, 0, 0, 0) - 1.2345); + err = std::abs(backscatter_matrix_interp[0, 0, 0, 0] - 1.2345); if (err > 1e-10) { return false; } diff --git a/src/tests/scattering/test_single_scattering_data.cc b/src/tests/scattering/test_single_scattering_data.cc index 9ec625b263..271b791fcc 100644 --- a/src/tests/scattering/test_single_scattering_data.cc +++ b/src/tests/scattering/test_single_scattering_data.cc @@ -24,20 +24,20 @@ bool test_single_scattering_data_from_legacy_tro() { auto ssd = SingleScatteringData::from_legacy_tro(legacy_data, legacy_meta); Numeric err = max_error( - (*ssd.phase_matrix)(joker, 0, joker, joker), - legacy_data.pha_mat_data(0, joker, joker, 0, 0, 0, joker)); + (*ssd.phase_matrix)[joker, 0, joker, joker], + legacy_data.pha_mat_data[0, joker, joker, 0, 0, 0, joker]); if (err > 0) { return false; } - err = max_error(ssd.extinction_matrix(0, joker, joker), - legacy_data.ext_mat_data(joker, 0, 0, 0, joker)); + err = max_error(ssd.extinction_matrix[0, joker, joker], + legacy_data.ext_mat_data[joker, 0, 0, 0, joker]); if (err > 0) { return false; } - err = max_error(ssd.absorption_vector(joker, 0, joker), - legacy_data.abs_vec_data(0, joker, 0, 0, joker)); + err = max_error(ssd.absorption_vector[joker, 0, joker], + legacy_data.abs_vec_data[0, joker, 0, 0, joker]); if (err > 0) { return false; } diff --git a/src/tests/scattering/test_utils.h.in b/src/tests/scattering/test_utils.h.in index 7e2bb0c93e..5f845ece46 100644 --- a/src/tests/scattering/test_utils.h.in +++ b/src/tests/scattering/test_utils.h.in @@ -77,7 +77,7 @@ inline Matrix evaluate_spherical_harmonic(Index l, if (l > 2) { throw std::runtime_error("l must be less than or equal to 1."); } - results(i, j) = norm * p * clon; + results[i, j] = norm * p * clon; } } return results; diff --git a/src/tests/test_binaryio.cc b/src/tests/test_binaryio.cc index 6396b987c8..1ef35b746a 100644 --- a/src/tests/test_binaryio.cc +++ b/src/tests/test_binaryio.cc @@ -12,7 +12,7 @@ int main(int /* argc */, char* /* argv */[]) { for (Index j = 0; j < 4; j++) for (Index k = 0; k < 4; k++) for (Index l = 0; l < 4; l++) - v(i, j, k, l) = double(i * 4 * 4 * 4 + j * 4 * 4 + k * 4 + l); + v[i, j, k, l] = double(i * 4 * 4 * 4 + j * 4 * 4 + k * 4 + l); xml_write_to_file("outfile.xml", v, FileType::binary, 0); diff --git a/src/tests/test_cia.cc b/src/tests/test_cia.cc index 138c395e65..f10800d428 100644 --- a/src/tests/test_cia.cc +++ b/src/tests/test_cia.cc @@ -15,7 +15,7 @@ void test01() { GriddedField2 cia_data; Matrix A(5, 3, 0.); - A(2, 1) = 1; + A[2, 1] = 1; // cout << "A:" << A << std::endl; cia_data.data = A; diff --git a/src/tests/test_complex.cc b/src/tests/test_complex.cc index 51a8580a95..06517ab433 100644 --- a/src/tests/test_complex.cc +++ b/src/tests/test_complex.cc @@ -64,11 +64,11 @@ void test01() { ComplexVector X2(4); ComplexMatrix C(4, 4); for (Index i = 0; i < 4; i++) { - X1(i, 0) = Complex((Numeric)i * 5.0 + 2.0, (Numeric)i + 1.0); + X1[i, 0] = Complex((Numeric)i * 5.0 + 2.0, (Numeric)i + 1.0); X2[i] = Complex((Numeric)i * 5.0 + 2.0, (Numeric)i + 1.0); for (Index j = 0; j < 4; j++) { - A(i, j) = Complex((Numeric)i + (Numeric)j, 0.0) + Complex(1.0, 1.0); - B(i, j) = + A[i, j] = Complex((Numeric)i + (Numeric)j, 0.0) + Complex(1.0, 1.0); + B[i, j] = Complex(2.0 * (Numeric)i + 4.0 * (Numeric)j, 0.0) + Complex(3.0, 3.0); } } @@ -83,16 +83,16 @@ void test01() { std::cout << "Same matrix can be both input and output, here is the above to the power of 4:\n" << matpack::eigen::mat(C) << "\n\n"; - mult(C(joker, 1), A, X2); + mult(C[joker, 1], A, X2); std::cout << matpack::eigen::mat(A) << "\nx\n" << matpack::eigen::row_vec(X2) << "\n=\n" - << matpack::eigen::row_vec(C(joker, 1)) << "\n\n"; - mult(C(Range(1, 3), Range(0, 3)), - A(Range(1, 3), Range(1, 2)), - B(Range(1, 2), Range(1, 3))); - std::cout << matpack::eigen::mat(A(Range(1, 3), Range(1, 2))) << "\nx\n" - << matpack::eigen::mat(B(Range(1, 2), Range(1, 3))) << "\n=\n" - << matpack::eigen::mat(C(Range(1, 3), Range(0, 3))) << "\n\n"; + << matpack::eigen::row_vec(C[joker, 1]) << "\n\n"; + mult(C[Range(1, 3), Range(0, 3)], + A[Range(1, 3), Range(1, 2)], + B[Range(1, 2), Range(1, 3)]); + std::cout << matpack::eigen::mat(A[Range(1, 3), Range(1, 2)]) << "\nx\n" + << matpack::eigen::mat(B[Range(1, 2), Range(1, 3)]) << "\n=\n" + << matpack::eigen::mat(C[Range(1, 3), Range(0, 3)]) << "\n\n"; } void test02() { @@ -173,7 +173,7 @@ void test03() ComplexMatrix M(n, n); for (Index i=0; i(C[x], A[x], B); } - some_results.push_back(C(0, 0)); + some_results.push_back(C[0, 0]); }); ts.emplace_back("matmat-naive-dotprod"); @@ -149,10 +149,10 @@ void matmat(int N) { Matrix C(m, p); for (Index x = 0; x < m; x++) { for (Index j = 0; j < p; j++) { - C(x, j) = A[x] * B(joker, j); + C[x, j] = A[x] * B[joker, j]; } } - some_results.push_back(C(0, 0)); + some_results.push_back(C[0, 0]); }); ts.emplace_back("matmat-naive-optimized"); @@ -164,11 +164,11 @@ void matmat(int N) { for (Index x = 0; x < m; x++) { for (Index k = 0; k < n; k++) { for (Index j = 0; j < p; j++) { - C(x, j) += A(x, k) * B(k, j); + C[x, j] += A[x, k] * B[k, j]; } } } - some_results.push_back(C(0, 0)); + some_results.push_back(C[0, 0]); }); ts.emplace_back("matmat-partial-einsum-matvec"); @@ -178,9 +178,9 @@ void matmat(int N) { Matrix C(m, p); C = 0; for (Index x = 0; x < p; x++) { - einsum<"m", "mn", "n">(C(joker, x), A, B(joker, x)); + einsum<"m", "mn", "n">(C[joker, x], A, B[joker, x]); } - some_results.push_back(C(0, 0)); + some_results.push_back(C[0, 0]); }); ts.emplace_back("matmat-partial-lapack-matvec"); @@ -190,9 +190,9 @@ void matmat(int N) { Matrix C(m, p); C = 0; for (Index x = 0; x < p; x++) { - mult(C(joker, x), A, B(joker, x)); + mult(C[joker, x], A, B[joker, x]); } - some_results.push_back(C(0, 0)); + some_results.push_back(C[0, 0]); }); ts.emplace_back("matmat-lapack"); @@ -201,7 +201,7 @@ void matmat(int N) { const Matrix B(n, p, 1); Matrix C(m, p); mult(C, A, B); - some_results.push_back(C(0, 0)); + some_results.push_back(C[0, 0]); }); ts.emplace_back("matmat-einsum-view"); @@ -210,7 +210,7 @@ void matmat(int N) { const Matrix B(n, p, 1); Matrix C(m, p); einsum<"mp", "mn", "np">(C, A, B); - some_results.push_back(C(0, 0)); + some_results.push_back(C[0, 0]); }); ts.emplace_back("matmat-einsum-retval"); @@ -218,7 +218,7 @@ void matmat(int N) { const Matrix A(m, n, 1); const Matrix B(n, p, 1); const auto C = einsum({m, p}, A, B); - some_results.push_back(C(0, 0)); + some_results.push_back(C[0, 0]); }); } @@ -245,10 +245,10 @@ void pathing(int N) { const Matrix A(i, j, .1); const Matrix B(j, k, .2); Matrix C(k, l, .3); - C(0, 0) = 2; + C[0, 0] = 2; Matrix D(i, l); einsum<"il", "ij", "jk", "kl">(D, A, B, C); - some_results.push_back(D(0, 0)); + some_results.push_back(D[0, 0]); }); ts.emplace_back("ij,jk,kl->il-np.einsum_path-einsum"); @@ -256,36 +256,36 @@ void pathing(int N) { const Matrix A(i, j, .1); const Matrix B(j, k, .2); Matrix C(k, l, .3); - C(0, 0) = 2; + C[0, 0] = 2; Matrix CB(j, l); Matrix D(i, l); einsum<"jl", "kl", "jk">(CB, C, B); einsum<"il", "jl", "ij">(D, CB, A); - some_results.push_back(D(0, 0)); + some_results.push_back(D[0, 0]); }); ts.emplace_back("ea,fb,abcd,gc,hd->efgh-direct-einsum"); ts.back()([&]() { const Tensor4 I(i, i, i, i, 1); Matrix C(i, i, 1); - C(0, 0) = 2; + C[0, 0] = 2; Tensor4 D(i, i, i, i); einsum<"efgh", "ea", "fb", "abcd", "gc", "hd">(D, C, C, I, C, C); - some_results.push_back(D(0, 0, 0, 0)); + some_results.push_back(D[0, 0, 0, 0]); }); ts.emplace_back("ea,fb,abcd,gc,hd->efgh-np.einsum_path-einsum"); ts.back()([&]() { const Tensor4 I(i, i, i, i, 1); Matrix C(i, i, 1); - C(0, 0) = 2; + C[0, 0] = 2; Tensor4 B(i, i, i, i); Tensor4 D(i, i, i, i); einsum<"bcde", "abcd", "ea">(B, I, C); einsum<"cdef", "bcde", "fb">(D, B, C); einsum<"defg", "cdef", "gc">(B, D, C); einsum<"efgh", "defg", "hd">(D, B, C); - some_results.push_back(D(0, 0, 0, 0)); + some_results.push_back(D[0, 0, 0, 0]); }); } diff --git a/src/tests/test_integration.cc b/src/tests/test_integration.cc index 3074034f9a..d766c377d4 100644 --- a/src/tests/test_integration.cc +++ b/src/tests/test_integration.cc @@ -164,7 +164,7 @@ void init_xy(float stepsize, // The r=1 so we get a circle for (Index i = 0; i < n_za; i++) - for (Index j = 0; j < n_aa; j++) Integrand(i, j) = 1; + for (Index j = 0; j < n_aa; j++) Integrand[i, j] = 1; //za_grid (Theta) is between 0 and 180 for (Index i = 0; i < n_za; i++) za_grid[i] = (float)i * stepsize; @@ -177,10 +177,10 @@ void init_xy(float stepsize, << "n_aa = " << n_aa << std::endl << "stepsize = " << stepsize << std::endl << "frequency = " << frequency << std::endl - << "Integrand(*,0): von " << Integrand(0, 0) << " bis " - << Integrand(n_za - 1, 0) << std::endl - << "Integrand(0,*): von " << Integrand(0, 0) << " bis " - << Integrand(0, n_aa - 1) << std::endl + << "Integrand(*,0): von " << Integrand[0, 0] << " bis " + << Integrand[n_za - 1, 0] << std::endl + << "Integrand(0,*): von " << Integrand[0, 0] << " bis " + << Integrand[0, n_aa - 1] << std::endl << "za_grid (Theta): von " << za_grid[0] << " bis " << za_grid[za_grid.nelem() - 1] << std::endl << "aa_grid (Phi) : von " << aa_grid[0] << " bis " @@ -212,7 +212,7 @@ Numeric AngIntegrate_trapezoid_original(MatrixView Integrand, res1[i] = 0.0; for (Index j = 0; j < m - 1; ++j) { - res1[i] += 0.5 * DEG2RAD * (Integrand(i, j) + Integrand(i, j + 1)) * + res1[i] += 0.5 * DEG2RAD * (Integrand[i, j] + Integrand[i, j + 1]) * (aa_grid[j + 1] - aa_grid[j]) * sin(za_grid[i] * DEG2RAD); } } @@ -249,7 +249,7 @@ Numeric AngIntegrate_trapezoid_opt(MatrixView Integrand, res1[i] = 0.0; for (Index j = 0; j < m - 1; ++j) { - res1[i] += 0.5 * DEG2RAD * (Integrand(i, j) + Integrand(i, j + 1)) * + res1[i] += 0.5 * DEG2RAD * (Integrand[i, j] + Integrand[i, j + 1]) * (aa_grid[j + 1] - aa_grid[j]) * sin(za_grid[i] * DEG2RAD); } } @@ -289,7 +289,7 @@ Numeric AngIntegrate_trapezoid_fixedstep(MatrixView Integrand, res1[i] = 0.0; for (Index j = 0; j < m - 1; ++j) { - res1[i] += 0.5 * DEG2RAD * (Integrand(i, j) + Integrand(i, j + 1)) * + res1[i] += 0.5 * DEG2RAD * (Integrand[i, j] + Integrand[i, j + 1]) * stepsize * sin(za_grid[i] * DEG2RAD); } } @@ -327,11 +327,11 @@ Numeric AngIntegrate_trapezoid_fixedstep_opt(MatrixView Integrand, for (Index i = 0; i < n; ++i) { res1[i] = 0.0; - res1[i] += Integrand(i, 0); + res1[i] += Integrand[i, 0]; for (Index j = 1; j < m - 1; j++) { - res1[i] += Integrand(i, j) * 2; + res1[i] += Integrand[i, j] * 2; } - res1[i] += Integrand(i, m - 1); + res1[i] += Integrand[i, m - 1]; res1[i] *= 0.5 * DEG2RAD * stepsize * sin(za_grid[i] * DEG2RAD); } Numeric res = 0.0; @@ -372,11 +372,11 @@ Numeric AngIntegrate_trapezoid_fixedstep_opt2(MatrixView Integrand, Numeric temp = 0.0; for (Index i = 0; i < n; ++i) { - temp = Integrand(i, 0); + temp = Integrand[i, 0]; for (Index j = 1; j < m - 1; j++) { - temp += Integrand(i, j) * 2; + temp += Integrand[i, j] * 2; } - temp += Integrand(i, m - 1); + temp += Integrand[i, m - 1]; temp *= 0.5 * DEG2RAD * stepsize * sin(za_grid[i] * DEG2RAD); res1[i] = temp; } diff --git a/src/tests/test_interp_perf.cc b/src/tests/test_interp_perf.cc index bcc5747097..3393f9dd29 100644 --- a/src/tests/test_interp_perf.cc +++ b/src/tests/test_interp_perf.cc @@ -269,7 +269,7 @@ std::vector test_linear_interpweights_cost(Index n) { out.emplace_back("gridpos")([&]() { Matrix iw(gp.size(), 2); interpweights(iw, gp); - X = iw(0, 0); + X = iw[0, 0]; }); xvec.push_back(X); diff --git a/src/tests/test_linalg.cc b/src/tests/test_linalg.cc index 4b321ebce1..b670495ad9 100644 --- a/src/tests/test_linalg.cc +++ b/src/tests/test_linalg.cc @@ -39,7 +39,7 @@ void test_lusolve1D(void) { Matrix b(1, 1); /* Assign test-matrix element. */ - a(0, 0) = 3; + a[0, 0] = 3; /* ------------------------------------------------------------------------ Test the function ludcmp. @@ -47,7 +47,7 @@ void test_lusolve1D(void) { cout << "\n LU decomposition test \n"; cout << "initial matrix: \n"; - cout << " " << a(0, 0) << endl; + cout << " " << a[0, 0] << endl; /* input: Test-matrix a, output: Decomposed matrix b (includes upper and lower triangle, cp. @@ -56,15 +56,15 @@ void test_lusolve1D(void) { ludcmp(b, indx, a); cout << "\n after decomposition: "; - cout << b(0, 0) << endl; + cout << b[0, 0] << endl; /* Seperate b into the two triangular matrices. */ Matrix l(1, 1, 0.0); Matrix u(1, 1, 0.0); Matrix lu(1, 1, 0.0); - l(0, 0) = 1.0; - u(0, 0) = b(0, 0); + l[0, 0] = 1.0; + u[0, 0] = b[0, 0]; /*------------------------------------------------------------------- end of ludcmp test @@ -97,22 +97,22 @@ void test_lusolve4D(void) { /* Assign test-matrix elements. */ - a(0, 0) = 1; - a(0, 1) = 3; - a(0, 2) = 5; - a(0, 3) = 6; - a(1, 0) = 2; - a(1, 1) = 3; - a(1, 2) = 4; - a(1, 3) = 4; - a(2, 0) = 1; - a(2, 1) = 2; - a(2, 2) = 5; - a(2, 3) = 1; - a(3, 0) = 7; - a(3, 1) = 2; - a(3, 2) = 4; - a(3, 3) = 3; + a[0, 0] = 1; + a[0, 1] = 3; + a[0, 2] = 5; + a[0, 3] = 6; + a[1, 0] = 2; + a[1, 1] = 3; + a[1, 2] = 4; + a[1, 3] = 4; + a[2, 0] = 1; + a[2, 1] = 2; + a[2, 2] = 5; + a[2, 3] = 1; + a[3, 0] = 7; + a[3, 1] = 2; + a[3, 2] = 4; + a[3, 3] = 3; /* ------------------------------------------------------------------------ Test the function ludcmp. @@ -122,7 +122,7 @@ void test_lusolve4D(void) { cout << "initial matrix: \n"; for (Index i = 0; i < 4; i++) { cout << "\n"; - for (Index j = 0; j < 4; j++) cout << " " << a(i, j); + for (Index j = 0; j < 4; j++) cout << " " << a[i, j]; } cout << "\n"; @@ -135,7 +135,7 @@ void test_lusolve4D(void) { cout << "\n after decomposition"; for (Index i = 0; i < 4; i++) { cout << "\n"; - for (Index j = 0; j < 4; j++) cout << " " << b(i, j); + for (Index j = 0; j < 4; j++) cout << " " << b[i, j]; } cout << "\n"; @@ -144,27 +144,27 @@ void test_lusolve4D(void) { Matrix u(4, 4, 0.0); Matrix lu(4, 4, 0.0); - for (Index i = 0; i < 4; i++) l(i, i) = 1.0; - l(1, 0) = b(1, 0); - l(2, Range(0, 2)) = b(2, Range(0, 2)); - l(3, Range(0, 3)) = b(3, Range(0, 3)); + for (Index i = 0; i < 4; i++) l[i, i] = 1.0; + l[1, 0] = b[1, 0]; + l[2, Range(0, 2)] = b[2, Range(0, 2)]; + l[3, Range(0, 3)] = b[3, Range(0, 3)]; cout << "\n Matrix L"; for (Index i = 0; i < 4; i++) { cout << "\n"; - for (Index j = 0; j < 4; j++) cout << " " << l(i, j); + for (Index j = 0; j < 4; j++) cout << " " << l[i, j]; } cout << "\n"; - u(0, Range(0, 4)) = b(0, Range(0, 4)); - u(1, Range(1, 3)) = b(1, Range(1, 3)); - u(2, Range(2, 2)) = b(2, Range(2, 2)); - u(3, Range(3, 1)) = b(3, Range(3, 1)); + u[0, Range(0, 4)] = b[0, Range(0, 4)]; + u[1, Range(1, 3)] = b[1, Range(1, 3)]; + u[2, Range(2, 2)] = b[2, Range(2, 2)]; + u[3, Range(3, 1)] = b[3, Range(3, 1)]; cout << "\n Matrix U"; for (Index i = 0; i < 4; i++) { cout << "\n"; - for (Index j = 0; j < 4; j++) cout << " " << u(i, j); + for (Index j = 0; j < 4; j++) cout << " " << u[i, j]; } cout << "\n"; @@ -174,7 +174,7 @@ void test_lusolve4D(void) { cout << "\n product L*U"; for (Index i = 0; i < 4; i++) { cout << "\n"; - for (Index j = 0; j < 4; j++) cout << " " << lu(i, j); + for (Index j = 0; j < 4; j++) cout << " " << lu[i, j]; } cout << "\n"; @@ -345,22 +345,22 @@ void test_inv(Index ntests, Index dim, bool verbose = false) { void test_matrix_exp4D(void) { Matrix A(4, 4); Matrix F(4, 4); - A(0, 0) = 1; - A(0, 1) = 3; - A(0, 2) = 5; - A(0, 3) = 6; - A(1, 0) = 2; - A(1, 1) = 3; - A(1, 2) = 4; - A(1, 3) = 4; - A(2, 0) = 1; - A(2, 1) = 2; - A(2, 2) = 5; - A(2, 3) = 1; - A(3, 0) = 7; - A(3, 1) = 2; - A(3, 2) = 4; - A(3, 3) = 3; + A[0, 0] = 1; + A[0, 1] = 3; + A[0, 2] = 5; + A[0, 3] = 6; + A[1, 0] = 2; + A[1, 1] = 3; + A[1, 2] = 4; + A[1, 3] = 4; + A[2, 0] = 1; + A[2, 1] = 2; + A[2, 2] = 5; + A[2, 3] = 1; + A[3, 0] = 7; + A[3, 1] = 2; + A[3, 2] = 4; + A[3, 3] = 3; /* set parameter for accuracy */ Index q = 8; @@ -371,7 +371,7 @@ void test_matrix_exp4D(void) { cout << "\n Exponential of Matrix K"; for (Index i = 0; i < 4; i++) { cout << "\n"; - for (Index j = 0; j < 4; j++) cout << " " << F(i, j); + for (Index j = 0; j < 4; j++) cout << " " << F[i, j]; } cout << "\n"; } @@ -383,7 +383,7 @@ void test_matrix_exp4D(void) { void test_matrix_exp1D(void) { Matrix A(1, 1); Matrix F(1, 1); - A(0, 0) = 5; + A[0, 0] = 5; /* set parameter for accuracy */ Index q = 8; @@ -392,7 +392,7 @@ void test_matrix_exp1D(void) { matrix_exp(F, A, q); cout << "\n Exponential of Matrix A:\n"; - cout << F(0, 0); + cout << F[0, 0]; cout << "\n"; } @@ -403,15 +403,15 @@ void test_matrix_exp1D(void) { void test_matrix_exp3D(void) { Matrix A(3, 3); Matrix F(3, 3); - A(0, 0) = 1; - A(0, 1) = 3; - A(0, 2) = 5; - A(1, 0) = 2; - A(1, 1) = 3; - A(1, 2) = 4; - A(2, 0) = 1; - A(2, 1) = 2; - A(2, 2) = 5; + A[0, 0] = 1; + A[0, 1] = 3; + A[0, 2] = 5; + A[1, 0] = 2; + A[1, 1] = 3; + A[1, 2] = 4; + A[2, 0] = 1; + A[2, 1] = 2; + A[2, 2] = 5; /* set parameter for accuracy */ Index q = 8; @@ -422,7 +422,7 @@ void test_matrix_exp3D(void) { cout << "\n Exponential of Matrix A"; for (Index i = 0; i < 3; i++) { cout << "\n"; - for (Index j = 0; j < 3; j++) cout << " " << F(i, j); + for (Index j = 0; j < 3; j++) cout << " " << F[i, j]; } cout << "\n"; } @@ -463,7 +463,7 @@ void test_real_diagonalize(Index ntests, Index dim) { // Minus W as diagonal matrix for (Index j = 0; j < dim; j++) { - tmp1(j, j) -= Wr[j]; + tmp1[j, j] -= Wr[j]; } err2 = get_maximum_error(ZEROES, tmp1, false); @@ -502,7 +502,7 @@ void test_complex_diagonalize(Index ntests, Index dim) { // Minus W as diagonal matrix for (Index j = 0; j < dim; j++) { - tmp1(j, j) -= W[j]; + tmp1[j, j] -= W[j]; } err = get_maximum_error(ZEROES, tmp1, false); diff --git a/src/tests/test_magfield.cc b/src/tests/test_magfield.cc index 0ee666f41b..57107dbdc3 100644 --- a/src/tests/test_magfield.cc +++ b/src/tests/test_magfield.cc @@ -41,8 +41,8 @@ int main() { Matrix g(14, 14), h(14, 14); for (Index i = 0; i < 14; i++) { for (Index j = 0; j < 14; j++) { - gstream >> g(i, j); - hstream >> h(i, j); + gstream >> g[i, j]; + hstream >> h[i, j]; } } diff --git a/src/tests/test_matpack.cc b/src/tests/test_matpack.cc index 68db5ea3e6..c40d64068b 100644 --- a/src/tests/test_matpack.cc +++ b/src/tests/test_matpack.cc @@ -74,28 +74,28 @@ int test1() { { Numeric n = 0; for (Index i = 0; i < M.nrows(); ++i) - for (Index j = 0; j < M.ncols(); ++j) M(i, j) = ++n; + for (Index j = 0; j < M.ncols(); ++j) M[i, j] = ++n; } cout << "\nM =\n" << M << "\n"; cout << "\nM(Range(2,4),Range(2,4)) =\n" - << M(Range(2, 4), Range(2, 4)) << "\n"; + << M[Range(2, 4), Range(2, 4)] << "\n"; cout << "\nM(Range(2,4),Range(2,4))(Range(1,2),Range(1,2)) =\n" - << M(Range(2, 4), Range(2, 4))(Range(1, 2), Range(1, 2)) << "\n"; + << M[Range(2, 4), Range(2, 4)][Range(1, 2), Range(1, 2)] << "\n"; - cout << "\nM(1,Range(joker)) =\n" << M(1, Range(joker)) << "\n"; + cout << "\nM(1,Range(joker)) =\n" << M[1, Range(joker)] << "\n"; cout << "\nFilling M(1,Range(1,2)) with junk.\n"; - fill_with_junk(M(1, Range(1, 2))); + fill_with_junk(M[1, Range(1, 2)]); cout << "\nM(Range(0,4),Range(0,4)) =\n" - << M(Range(0, 4), Range(0, 4)) << "\n"; + << M[Range(0, 4), Range(0, 4)] << "\n"; cout << "\nFilling M(Range(4,2,2),Range(6,3)) with junk.\n"; - MatrixView s = M(Range(4, 2, 2), Range(6, 3)); + MatrixView s = M[Range(4, 2, 2), Range(6, 3)]; fill_with_junk(s); cout << "\nM =\n" << M << "\n"; @@ -103,10 +103,10 @@ int test1() { const Matrix C = M; cout << "\nC(Range(3,4,2),Range(2,3,3)) =\n" - << C(Range(3, 4, 2), Range(2, 3, 3)) << "\n"; + << C[Range(3, 4, 2), Range(2, 3, 3)] << "\n"; cout << "\nC(Range(3,4,2),Range(2,3,3)).transpose() =\n" - << transpose(C(Range(3, 4, 2), Range(2, 3, 3))) << "\n"; + << transpose(C[Range(3, 4, 2), Range(2, 3, 3)]) << "\n"; return 0; } @@ -142,7 +142,7 @@ void test4() { B = 2; C = 3; - mult(A(Range(1, joker), Range(1, joker)), B, C); + mult(A[Range(1, joker), Range(1, joker)], B, C); // cout << "\nB =\n" << B << "\n"; // cout << "\nC =\n" << C << "\n"; @@ -206,7 +206,7 @@ void test8() { void test9() { // Initialization of Matrix with view of other Matrix: Matrix A(4, 8); - Matrix B(A(Range(joker), Range(0, 3))); + Matrix B(A[Range(joker), Range(0, 3)]); cout << "B = " << B << "\n"; } @@ -397,10 +397,10 @@ void test29() { Matrix b; b.resize(2, 2); - b(0, 0) = 1; - b(0, 1) = 2; - b(1, 0) = 3; - b(1, 1) = 4; + b[0, 0] = 1; + b[0, 1] = 2; + b[1, 0] = 3; + b[1, 1] = 4; a.push_back(b); b *= 2; a.push_back(b); @@ -446,27 +446,27 @@ void test31() { // Fill with some numbers for (Index i = 0; i < a.npages(); ++i) for (Index j = 0; j < a.nrows(); ++j) - for (Index k = 0; k < a.ncols(); ++k) a(i, j, k) = (Numeric)(++fill); + for (Index k = 0; k < a.ncols(); ++k) a[i, j, k] = (Numeric)(++fill); cout << "a =\n" << a << "\n"; cout << "Taking out first row of first page:\n" - << a(0, 0, Range(joker)) << "\n"; + << a[0, 0, Range(joker)] << "\n"; cout << "Taking out last column of second page:\n" - << a(1, Range(joker), a.ncols() - 1) << "\n"; + << a[1, Range(joker), a.ncols() - 1] << "\n"; cout << "Taking out the first letter on every page:\n" - << a(Range(joker), 0, 0) << "\n"; + << a[Range(joker), 0, 0] << "\n"; cout << "Taking out first page:\n" - << a(0, Range(joker), Range(joker)) << "\n"; + << a[0, Range(joker), Range(joker)] << "\n"; cout << "Taking out last row of all pages:\n" - << a(Range(joker), a.nrows() - 1, Range(joker)) << "\n"; + << a[Range(joker), a.nrows() - 1, Range(joker)] << "\n"; cout << "Taking out second column of all pages:\n" - << a(Range(joker), Range(joker), 1) << "\n"; + << a[Range(joker), Range(joker), 1] << "\n"; a *= 2; @@ -486,14 +486,14 @@ void test31() { a = 1; - cout << "a(900,900,900) = " << a(90, 90, 90) << "\n"; + cout << "a(900,900,900) = " << a[90, 90, 90] << "\n"; fill = 0; cout << "Fill with running numbers, using for loops...\n"; for (Index i = 0; i < a.npages(); ++i) for (Index j = 0; j < a.nrows(); ++j) - for (Index k = 0; k < a.ncols(); ++k) a(i, j, k) = (Numeric)(++fill); + for (Index k = 0; k < a.ncols(); ++k) a[i, j, k] = (Numeric)(++fill); cout << "Max(a) = ...\n"; @@ -506,8 +506,8 @@ void test32() { for (Index j = 0; j < A.nrows(); ++j) for (Index k = 0; k < A.ncols(); ++k) { - X(j, k) = 1; - A(j, k) = (Numeric)(j + k); + X[j, k] = 1; + A[j, k] = (Numeric)(j + k); } cout << "A:\n" << A << "\n"; cout << "X:\n" << X << "\n"; @@ -550,7 +550,7 @@ void test33() { Tensor3View at3 = Tensor3View{am}; cout << "at3 = \n" << at3 << "\n"; cout << "Describe at3: " << describe(at3) << "\n"; - at3(0, 2, 0) += 1; + at3[0, 2, 0] += 1; cout << "a after Increasing element at3(0,2,0) by 1: \n" << a << "\n\n"; Tensor4View at4 = Tensor4View{at3}; @@ -569,7 +569,7 @@ void test33() { cout << "at7 = \n" << at7 << "\n"; cout << "Describe at7: " << describe(at7) << "\n"; - at7(0, 0, 0, 0, 0, 2, 0) -= 1; + at7[0, 0, 0, 0, 0, 2, 0] -= 1; cout << "After subtracting 1 from at7(0,0,0,0,0,2,0)\n" << "a = " << a << "\n"; @@ -717,11 +717,11 @@ void test42() { ConstMatrixView z((MatrixView)y); cout << "z:\n" << z << endl; - cout << "Every other z:\n" << z(Range(1, 2, 2), joker) << endl; + cout << "Every other z:\n" << z[Range(1, 2, 2), joker] << endl; // Try write access also: MatrixView zz(y); - zz(Range(1, 2, 2), joker) = 0; + zz[Range(1, 2, 2), joker] = 0; cout << "zz:\n" << zz << endl; cout << "New x: " << x << endl; } @@ -850,7 +850,7 @@ bool test_diagonal(Index ntests) { ConstMatrixView AT = transpose(A); ConstMatrixView B = A; if (n_diag > 3) { - B.set(A(Range(1, Joker(), 2), Range(1, Joker(), 2))); // FIXME: NO MORE = for ConstXYZ + B.set(A[Range(1, Joker(), 2), Range(1, Joker(), 2)]); // FIXME: NO MORE = for ConstXYZ } ConstVectorView v(A.diagonal()); @@ -860,10 +860,10 @@ bool test_diagonal(Index ntests) { random_fill_matrix(A, 10, true); for (Index j = 0; j < n_diag; j++) { - pass = pass && (v[j] == A(j, j)); - pass = pass && (vt[j] == AT(j, j)); + pass = pass && (v[j] == A[j, j]); + pass = pass && (vt[j] == AT[j, j]); - if (j < vb.size()) pass = pass && (vb[j] == B(j, j)); + if (j < vb.size()) pass = pass && (vb[j] == B[j, j]); } cout << endl; } @@ -921,10 +921,10 @@ Numeric matrix_vector_mult(Index m, Index n, Index ntests, bool verbose) { n_sub = (n - 1) / column_stride + 1; mult(y[Range(0, joker, row_stride)], - A(Range(0, m_sub), Range(0, n_sub)), + A[Range(0, m_sub), Range(0, n_sub)], x[Range(0, joker, column_stride)]); mult(y_ref[Range(0, joker, row_stride)], - A(Range(0, m_sub), Range(0, n_sub)), + A[Range(0, m_sub), Range(0, n_sub)], x[Range(0, joker, column_stride)]); err_mul = get_maximum_error(y[Range(0, joker, row_stride)], @@ -945,10 +945,10 @@ Numeric matrix_vector_mult(Index m, Index n, Index ntests, bool verbose) { n_sub = n - x_offset - 1; mult(y[Range(y_offset, m_sub)], - A(Range(y_offset, m_sub), Range(x_offset, n_sub)), + A[Range(y_offset, m_sub), Range(x_offset, n_sub)], x[Range(x_offset, n_sub)]); mult(y_ref[Range(y_offset, m_sub)], - A(Range(y_offset, m_sub), Range(x_offset, n_sub)), + A[Range(y_offset, m_sub), Range(x_offset, n_sub)], x[Range(x_offset, n_sub)]); err_mul = get_maximum_error( @@ -1125,11 +1125,11 @@ Numeric matrix_mult( Range r2(random_range(k1)); Range r3(random_range(n1)); - MatrixView C_sub(C(r1, r3)); - MatrixView C_sub_ref(C_ref(r1, r3)); + MatrixView C_sub(C[r1, r3]); + MatrixView C_sub_ref(C_ref[r1, r3]); - ConstMatrixView A_sub(A(r1, r2)); - ConstMatrixView B_sub(B(r2, r3)); + ConstMatrixView A_sub(A[r1, r2]); + ConstMatrixView B_sub(B[r2, r3]); mult(C_sub, A_sub, B_sub); mult(C_sub_ref, A_sub, B_sub); @@ -1320,14 +1320,14 @@ void test47() { Matrix m; VectorView vv = v[joker]; - MatrixView mv = m(joker, joker); + MatrixView mv = m[joker, joker]; std::cout << "vv.size: " << vv.size() << std::endl; std::cout << "mv.nrows: " << mv.nrows() << " "; std::cout << "mv.ncols: " << mv.ncols() << std::endl; Matrix m2(0, 5); - MatrixView mv2 = MatrixView{m2(joker, 3)}; + MatrixView mv2 = MatrixView{m2[joker, 3]}; std::cout << "mv2.nrows: " << mv2.nrows() << " "; std::cout << "mv2.ncols: " << mv2.ncols() << std::endl; } @@ -1389,7 +1389,7 @@ void test48() { for (Index m=0; m<5; m++) { for (Index n=0; n<7; n++) { for (Index o=0; o<11; o++) { - testvar(i, j, k, l, m, n, o) = Numeric(val++); + testvar[i, j, k, l, m, n, o] = Numeric(val++); } } } @@ -1404,8 +1404,8 @@ void test48() { for (Index m=0; m<5; m++) { for (Index n=0; n<7; n++) { for (Index o=0; o<11; o++) { - std::cout << Tensor7(testvar(joker, Range(j, 1), Range(k, 1), Range(l, 1), Range(m, 1), Range(n, 1), Range(o, 1))).reduce_rank<0>() << '\n'; - std::cout << testvar(joker, j, k, l, m, n, o) << '\n'; + std::cout << Tensor7(testvar[joker, Range(j, 1), Range(k, 1), Range(l, 1), Range(m, 1), Range(n, 1), Range(o, 1)]).reduce_rank<0>() << '\n'; + std::cout << testvar[joker, j, k, l, m, n, o] << '\n'; std::cout << '\n'; } } @@ -1419,8 +1419,8 @@ void test48() { for (Index m=0; m<5; m++) { for (Index n=0; n<7; n++) { for (Index o=0; o<11; o++) { - std::cout << Tensor7(testvar(Range(i, 1), joker, Range(k, 1), Range(l, 1), Range(m, 1), Range(n, 1), Range(o, 1))).reduce_rank<1>() << '\n'; - std::cout << testvar(i, joker, k, l, m, n, o) << '\n'; + std::cout << Tensor7(testvar[Range(i, 1), joker, Range(k, 1), Range(l, 1), Range(m, 1), Range(n, 1), Range(o, 1)]).reduce_rank<1>() << '\n'; + std::cout << testvar[i, joker, k, l, m, n, o] << '\n'; std::cout << '\n'; } } @@ -1434,8 +1434,8 @@ void test48() { for (Index m=0; m<5; m++) { for (Index n=0; n<7; n++) { for (Index o=0; o<11; o++) { - std::cout << Tensor7(testvar(Range(i, 1), Range(j, 1), joker, Range(l, 1), Range(m, 1), Range(n, 1), Range(o, 1))).reduce_rank<2>() << '\n'; - std::cout << testvar(i, j, joker, l, m, n, o) << '\n'; + std::cout << Tensor7(testvar[Range(i, 1), Range(j, 1), joker, Range(l, 1), Range(m, 1), Range(n, 1), Range(o, 1)]).reduce_rank<2>() << '\n'; + std::cout << testvar[i, j, joker, l, m, n, o] << '\n'; std::cout << '\n'; } } @@ -1449,8 +1449,8 @@ void test48() { for (Index m=0; m<5; m++) { for (Index n=0; n<7; n++) { for (Index o=0; o<11; o++) { - std::cout << Tensor7(testvar(Range(i, 1), Range(j, 1), Range(k, 1), joker, Range(m, 1), Range(n, 1), Range(o, 1))).reduce_rank<3>() << '\n'; - std::cout << testvar(i, j, k, joker, m, n, o) << '\n'; + std::cout << Tensor7(testvar[Range(i, 1), Range(j, 1), Range(k, 1), joker, Range(m, 1), Range(n, 1), Range(o, 1)]).reduce_rank<3>() << '\n'; + std::cout << testvar[i, j, k, joker, m, n, o] << '\n'; std::cout << '\n'; } } @@ -1464,8 +1464,8 @@ void test48() { for (Index l=0; l<3; l++) { for (Index n=0; n<7; n++) { for (Index o=0; o<11; o++) { - std::cout << Tensor7(testvar(Range(i, 1), Range(j, 1), Range(k, 1), Range(l, 1), joker, Range(n, 1), Range(o, 1))).reduce_rank<4>() << '\n'; - std::cout << testvar(i, j, k, l, joker, n, o) << '\n'; + std::cout << Tensor7(testvar[Range(i, 1), Range(j, 1), Range(k, 1), Range(l, 1), joker, Range(n, 1), Range(o, 1)]).reduce_rank<4>() << '\n'; + std::cout << testvar[i, j, k, l, joker, n, o] << '\n'; std::cout << '\n'; } } @@ -1479,8 +1479,8 @@ void test48() { for (Index l=0; l<3; l++) { for (Index m=0; m<5; m++) { for (Index o=0; o<11; o++) { - std::cout << Tensor7(testvar(Range(i, 1), Range(j, 1), Range(k, 1), Range(l, 1), Range(m, 1), joker, Range(o, 1))).reduce_rank<5>() << '\n'; - std::cout << testvar(i, j, k, l, m, joker, o) << '\n'; + std::cout << Tensor7(testvar[Range(i, 1), Range(j, 1), Range(k, 1), Range(l, 1), Range(m, 1), joker, Range(o, 1)]).reduce_rank<5>() << '\n'; + std::cout << testvar[i, j, k, l, m, joker, o] << '\n'; std::cout << '\n'; } } @@ -1494,8 +1494,8 @@ void test48() { for (Index l=0; l<3; l++) { for (Index m=0; m<5; m++) { for (Index n=0; n<7; n++) { - std::cout << Tensor7(testvar(Range(i, 1), Range(j, 1), Range(k, 1), Range(l, 1), Range(m, 1), Range(n, 1), joker)).reduce_rank<6>() << '\n'; - std::cout << testvar(i, j, k, l, m, n, joker) << '\n'; + std::cout << Tensor7(testvar[Range(i, 1), Range(j, 1), Range(k, 1), Range(l, 1), Range(m, 1), Range(n, 1), joker]).reduce_rank<6>() << '\n'; + std::cout << testvar[i, j, k, l, m, n, joker] << '\n'; std::cout << '\n'; } } @@ -1510,8 +1510,8 @@ void test48() { for (Index m=0; m<5; m++) { for (Index n=0; n<7; n++) { for (Index o=0; o<11; o++) { - std::cout << Tensor7(testvar(joker, joker, Range(k, 1), Range(l, 1), Range(m, 1), Range(n, 1), Range(o, 1))).reduce_rank<0, 1>() << '\n'; - std::cout << testvar(joker, joker, k, l, m, n, o) << '\n'; + std::cout << Tensor7(testvar[joker, joker, Range(k, 1), Range(l, 1), Range(m, 1), Range(n, 1), Range(o, 1)]).reduce_rank<0, 1>() << '\n'; + std::cout << testvar[joker, joker, k, l, m, n, o] << '\n'; std::cout << '\n'; } } @@ -1523,8 +1523,8 @@ void test48() { for (Index m=0; m<5; m++) { for (Index n=0; n<7; n++) { for (Index o=0; o<11; o++) { - std::cout << Tensor7(testvar(joker, Range(j, 1), joker, Range(l, 1), Range(m, 1), Range(n, 1), Range(o, 1))).reduce_rank<0, 2>() << '\n'; - std::cout << testvar(joker, j, joker, l, m, n, o) << '\n'; + std::cout << Tensor7(testvar[joker, Range(j, 1), joker, Range(l, 1), Range(m, 1), Range(n, 1), Range(o, 1)]).reduce_rank<0, 2>() << '\n'; + std::cout << testvar[joker, j, joker, l, m, n, o] << '\n'; std::cout << '\n'; } } @@ -1536,8 +1536,8 @@ void test48() { for (Index m=0; m<5; m++) { for (Index n=0; n<7; n++) { for (Index o=0; o<11; o++) { - std::cout << Tensor7(testvar(joker, Range(j, 1), Range(k, 1), joker, Range(m, 1), Range(n, 1), Range(o, 1))).reduce_rank<0, 3>() << '\n'; - std::cout << testvar(joker, j, k, joker, m, n, o) << '\n'; + std::cout << Tensor7(testvar[joker, Range(j, 1), Range(k, 1), joker, Range(m, 1), Range(n, 1), Range(o, 1)]).reduce_rank<0, 3>() << '\n'; + std::cout << testvar[joker, j, k, joker, m, n, o] << '\n'; std::cout << '\n'; } } @@ -1549,8 +1549,8 @@ void test48() { for (Index l=0; l<3; l++) { for (Index n=0; n<7; n++) { for (Index o=0; o<11; o++) { - std::cout << Tensor7(testvar(joker, Range(j, 1), Range(k, 1), Range(l, 1), joker, Range(n, 1), Range(o, 1))).reduce_rank<0, 4>() << '\n'; - std::cout << testvar(joker, j, k, l, joker, n, o) << '\n'; + std::cout << Tensor7(testvar[joker, Range(j, 1), Range(k, 1), Range(l, 1), joker, Range(n, 1), Range(o, 1)]).reduce_rank<0, 4>() << '\n'; + std::cout << testvar[joker, j, k, l, joker, n, o] << '\n'; std::cout << '\n'; } } @@ -1562,8 +1562,8 @@ void test48() { for (Index l=0; l<3; l++) { for (Index m=0; m<5; m++) { for (Index o=0; o<11; o++) { - std::cout << Tensor7(testvar(joker, Range(j, 1), Range(k, 1), Range(l, 1), Range(m, 1), joker, Range(o, 1))).reduce_rank<0, 5>() << '\n'; - std::cout << testvar(joker, j, k, l, m, joker, o) << '\n'; + std::cout << Tensor7(testvar[joker, Range(j, 1), Range(k, 1), Range(l, 1), Range(m, 1), joker, Range(o, 1)]).reduce_rank<0, 5>() << '\n'; + std::cout << testvar[joker, j, k, l, m, joker, o] << '\n'; std::cout << '\n'; } } @@ -1575,8 +1575,8 @@ void test48() { for (Index l=0; l<3; l++) { for (Index m=0; m<5; m++) { for (Index n=0; n<7; n++) { - std::cout << Tensor7(testvar(joker, Range(j, 1), Range(k, 1), Range(l, 1), Range(m, 1), Range(n, 1), joker)).reduce_rank<0, 6>() << '\n'; - std::cout << testvar(joker, j, k, l, m, n, joker) << '\n'; + std::cout << Tensor7(testvar[joker, Range(j, 1), Range(k, 1), Range(l, 1), Range(m, 1), Range(n, 1), joker]).reduce_rank<0, 6>() << '\n'; + std::cout << testvar[joker, j, k, l, m, n, joker] << '\n'; std::cout << '\n'; } } @@ -1588,8 +1588,8 @@ void test48() { for (Index m=0; m<5; m++) { for (Index n=0; n<7; n++) { for (Index o=0; o<11; o++) { - std::cout << Tensor7(testvar(Range(i, 1), joker, joker, Range(l, 1), Range(m, 1), Range(n, 1), Range(o, 1))).reduce_rank<1, 2>() << '\n'; - std::cout << testvar(i, joker, joker, l, m, n, o) << '\n'; + std::cout << Tensor7(testvar[Range(i, 1), joker, joker, Range(l, 1), Range(m, 1), Range(n, 1), Range(o, 1)]).reduce_rank<1, 2>() << '\n'; + std::cout << testvar[i, joker, joker, l, m, n, o] << '\n'; std::cout << '\n'; } } @@ -1601,8 +1601,8 @@ void test48() { for (Index m=0; m<5; m++) { for (Index n=0; n<7; n++) { for (Index o=0; o<11; o++) { - std::cout << Tensor7(testvar(Range(i, 1), joker, Range(k, 1), joker, Range(m, 1), Range(n, 1), Range(o, 1))).reduce_rank<1, 3>() << '\n'; - std::cout << testvar(i, joker, k, joker, m, n, o) << '\n'; + std::cout << Tensor7(testvar[Range(i, 1), joker, Range(k, 1), joker, Range(m, 1), Range(n, 1), Range(o, 1)]).reduce_rank<1, 3>() << '\n'; + std::cout << testvar[i, joker, k, joker, m, n, o] << '\n'; std::cout << '\n'; } } @@ -1614,8 +1614,8 @@ void test48() { for (Index l=0; l<3; l++) { for (Index n=0; n<7; n++) { for (Index o=0; o<11; o++) { - std::cout << Tensor7(testvar(Range(i, 1), joker, Range(k, 1), Range(l, 1), joker, Range(n, 1), Range(o, 1))).reduce_rank<1, 4>() << '\n'; - std::cout << testvar(i, joker, k, l, joker, n, o) << '\n'; + std::cout << Tensor7(testvar[Range(i, 1), joker, Range(k, 1), Range(l, 1), joker, Range(n, 1), Range(o, 1)]).reduce_rank<1, 4>() << '\n'; + std::cout << testvar[i, joker, k, l, joker, n, o] << '\n'; std::cout << '\n'; } } @@ -1627,8 +1627,8 @@ void test48() { for (Index l=0; l<3; l++) { for (Index m=0; m<5; m++) { for (Index o=0; o<11; o++) { - std::cout << Tensor7(testvar(Range(i, 1), joker, Range(k, 1), Range(l, 1), Range(m, 1), joker, Range(o, 1))).reduce_rank<1, 5>() << '\n'; - std::cout << testvar(i, joker, k, l, m, joker, o) << '\n'; + std::cout << Tensor7(testvar[Range(i, 1), joker, Range(k, 1), Range(l, 1), Range(m, 1), joker, Range(o, 1)]).reduce_rank<1, 5>() << '\n'; + std::cout << testvar[i, joker, k, l, m, joker, o] << '\n'; std::cout << '\n'; } } @@ -1640,8 +1640,8 @@ void test48() { for (Index l=0; l<3; l++) { for (Index m=0; m<5; m++) { for (Index n=0; n<7; n++) { - std::cout << Tensor7(testvar(Range(i, 1), joker, Range(k, 1), Range(l, 1), Range(m, 1), Range(n, 1), joker)).reduce_rank<1, 6>() << '\n'; - std::cout << testvar(i, joker, k, l, m, n, joker) << '\n'; + std::cout << Tensor7(testvar[Range(i, 1), joker, Range(k, 1), Range(l, 1), Range(m, 1), Range(n, 1), joker]).reduce_rank<1, 6>() << '\n'; + std::cout << testvar[i, joker, k, l, m, n, joker] << '\n'; std::cout << '\n'; } } @@ -1653,8 +1653,8 @@ void test48() { for (Index m=0; m<5; m++) { for (Index n=0; n<7; n++) { for (Index o=0; o<11; o++) { - std::cout << Tensor7(testvar(Range(i, 1), Range(j, 1), joker, joker, Range(m, 1), Range(n, 1), Range(o, 1))).reduce_rank<2, 3>() << '\n'; - std::cout << testvar(i, j, joker, joker, m, n, o) << '\n'; + std::cout << Tensor7(testvar[Range(i, 1), Range(j, 1), joker, joker, Range(m, 1), Range(n, 1), Range(o, 1)]).reduce_rank<2, 3>() << '\n'; + std::cout << testvar[i, j, joker, joker, m, n, o] << '\n'; std::cout << '\n'; } } @@ -1666,8 +1666,8 @@ void test48() { for (Index l=0; l<3; l++) { for (Index n=0; n<7; n++) { for (Index o=0; o<11; o++) { - std::cout << Tensor7(testvar(Range(i, 1), Range(j, 1), joker, Range(l, 1), joker, Range(n, 1), Range(o, 1))).reduce_rank<2, 4>() << '\n'; - std::cout << testvar(i, j, joker, l, joker, n, o) << '\n'; + std::cout << Tensor7(testvar[Range(i, 1), Range(j, 1), joker, Range(l, 1), joker, Range(n, 1), Range(o, 1)]).reduce_rank<2, 4>() << '\n'; + std::cout << testvar[i, j, joker, l, joker, n, o] << '\n'; std::cout << '\n'; } } @@ -1679,8 +1679,8 @@ void test48() { for (Index l=0; l<3; l++) { for (Index m=0; m<5; m++) { for (Index o=0; o<11; o++) { - std::cout << Tensor7(testvar(Range(i, 1), Range(j, 1), joker, Range(l, 1), Range(m, 1), joker, Range(o, 1))).reduce_rank<2, 5>() << '\n'; - std::cout << testvar(i, j, joker, l, m, joker, o) << '\n'; + std::cout << Tensor7(testvar[Range(i, 1), Range(j, 1), joker, Range(l, 1), Range(m, 1), joker, Range(o, 1)]).reduce_rank<2, 5>() << '\n'; + std::cout << testvar[i, j, joker, l, m, joker, o] << '\n'; std::cout << '\n'; } } @@ -1692,8 +1692,8 @@ void test48() { for (Index l=0; l<3; l++) { for (Index m=0; m<5; m++) { for (Index n=0; n<7; n++) { - std::cout << Tensor7(testvar(Range(i, 1), Range(j, 1), joker, Range(l, 1), Range(m, 1), Range(n, 1), joker)).reduce_rank<2, 6>() << '\n'; - std::cout << testvar(i, j, joker, l, m, n, joker) << '\n'; + std::cout << Tensor7(testvar[Range(i, 1), Range(j, 1), joker, Range(l, 1), Range(m, 1), Range(n, 1), joker]).reduce_rank<2, 6>() << '\n'; + std::cout << testvar[i, j, joker, l, m, n, joker] << '\n'; std::cout << '\n'; } } @@ -1705,8 +1705,8 @@ void test48() { for (Index k=0; k<4; k++) { for (Index n=0; n<7; n++) { for (Index o=0; o<11; o++) { - std::cout << Tensor7(testvar(Range(i, 1), Range(j, 1), Range(k, 1), joker, joker, Range(n, 1), Range(o, 1))).reduce_rank<3, 4>() << '\n'; - std::cout << testvar(i, j, k, joker, joker, n, o) << '\n'; + std::cout << Tensor7(testvar[Range(i, 1), Range(j, 1), Range(k, 1), joker, joker, Range(n, 1), Range(o, 1)]).reduce_rank<3, 4>() << '\n'; + std::cout << testvar[i, j, k, joker, joker, n, o] << '\n'; std::cout << '\n'; } } @@ -1718,8 +1718,8 @@ void test48() { for (Index k=0; k<4; k++) { for (Index m=0; m<5; m++) { for (Index o=0; o<11; o++) { - std::cout << Tensor7(testvar(Range(i, 1), Range(j, 1), Range(k, 1), joker, Range(m, 1), joker, Range(o, 1))).reduce_rank<3, 5>() << '\n'; - std::cout << testvar(i, j, k, joker, m, joker, o) << '\n'; + std::cout << Tensor7(testvar[Range(i, 1), Range(j, 1), Range(k, 1), joker, Range(m, 1), joker, Range(o, 1)]).reduce_rank<3, 5>() << '\n'; + std::cout << testvar[i, j, k, joker, m, joker, o] << '\n'; std::cout << '\n'; } } @@ -1731,8 +1731,8 @@ void test48() { for (Index k=0; k<4; k++) { for (Index m=0; m<5; m++) { for (Index n=0; n<7; n++) { - std::cout << Tensor7(testvar(Range(i, 1), Range(j, 1), Range(k, 1), joker, Range(m, 1), Range(n, 1), joker)).reduce_rank<3, 6>() << '\n'; - std::cout << testvar(i, j, k, joker, m, n, joker) << '\n'; + std::cout << Tensor7(testvar[Range(i, 1), Range(j, 1), Range(k, 1), joker, Range(m, 1), Range(n, 1), joker]).reduce_rank<3, 6>() << '\n'; + std::cout << testvar[i, j, k, joker, m, n, joker] << '\n'; std::cout << '\n'; } } @@ -1744,8 +1744,8 @@ void test48() { for (Index k=0; k<4; k++) { for (Index l=0; l<3; l++) { for (Index o=0; o<11; o++) { - std::cout << Tensor7(testvar(Range(i, 1), Range(j, 1), Range(k, 1), Range(l, 1), joker, joker, Range(o, 1))).reduce_rank<4, 5>() << '\n'; - std::cout << testvar(i, j, k, l, joker, joker, o) << '\n'; + std::cout << Tensor7(testvar[Range(i, 1), Range(j, 1), Range(k, 1), Range(l, 1), joker, joker, Range(o, 1)]).reduce_rank<4, 5>() << '\n'; + std::cout << testvar[i, j, k, l, joker, joker, o] << '\n'; std::cout << '\n'; } } @@ -1757,8 +1757,8 @@ void test48() { for (Index k=0; k<4; k++) { for (Index l=0; l<3; l++) { for (Index n=0; n<7; n++) { - std::cout << Tensor7(testvar(Range(i, 1), Range(j, 1), Range(k, 1), Range(l, 1), joker, Range(n, 1), joker)).reduce_rank<4, 6>() << '\n'; - std::cout << testvar(i, j, k, l, joker, n, joker) << '\n'; + std::cout << Tensor7(testvar[Range(i, 1), Range(j, 1), Range(k, 1), Range(l, 1), joker, Range(n, 1), joker]).reduce_rank<4, 6>() << '\n'; + std::cout << testvar[i, j, k, l, joker, n, joker] << '\n'; std::cout << '\n'; } } @@ -1770,8 +1770,8 @@ void test48() { for (Index k=0; k<4; k++) { for (Index l=0; l<3; l++) { for (Index m=0; m<5; m++) { - std::cout << Tensor7(testvar(Range(i, 1), Range(j, 1), Range(k, 1), Range(l, 1), Range(m, 1), joker, joker)).reduce_rank<5, 6>() << '\n'; - std::cout << testvar(i, j, k, l, m, joker, joker) << '\n'; + std::cout << Tensor7(testvar[Range(i, 1), Range(j, 1), Range(k, 1), Range(l, 1), Range(m, 1), joker, joker]).reduce_rank<5, 6>() << '\n'; + std::cout << testvar[i, j, k, l, m, joker, joker] << '\n'; std::cout << '\n'; } } @@ -1802,7 +1802,7 @@ Matrix build_test_matrix(Index rows, Index cols) { Matrix a(rows, cols); for (Index i = 0; i < rows; i++) { for (Index j = 0; j < cols; j++) { - a(i, j) = static_cast(10 * i + j + 1); + a[i, j] = static_cast(10 * i + j + 1); } } return a; diff --git a/src/tests/test_matpack_perf.cc b/src/tests/test_matpack_perf.cc index 1fb3f9e6ed..1376399dcd 100644 --- a/src/tests/test_matpack_perf.cc +++ b/src/tests/test_matpack_perf.cc @@ -152,25 +152,25 @@ Array test_Matrix_multiply(Index N) { mult(A, B, C); mult(A, B, C); mult(A, B, C); - X = A(0, 0); + X = A[0, 0]; } results_.push_back(X); out.emplace_back("mult(Matrix,Matrix,Matrix)")([&]() { mult(A, B, C); - X = A(0, 0) + A(N - 1, N - 1); + X = A[0, 0] + A[N - 1, N - 1]; }); results_.push_back(X); out.emplace_back("mult(ExhaustiveMatrixView,ExhaustiveMatrixView,ExhaustiveMatrixView)")([&]() { mult(Ae, Be, Ce); - X = Ae(0, 0) + Ae(N - 1, N - 1); + X = Ae[0, 0] + Ae[N - 1, N - 1]; }); results_.push_back(X); out.emplace_back("mult(MatrixView,MatrixView,MatrixView)")([&]() { mult(Av, Bv, Cv); - X = Av(0, 0) + Ae(N - 1, N - 1); + X = Av[0, 0] + Ae[N - 1, N - 1]; }); results_.push_back(X); @@ -308,97 +308,97 @@ Array test_elementary_ops_Matrix(Index N) { A *= 2; A /= 2; A -= 1; - X = A(0, 0) + A(N - 1, N - 1); + X = A[0, 0] + A[N - 1, N - 1]; } results_.push_back(X); out.emplace_back("Matrix::operator=(Numeric)")([&]() { A = 1; - X = A(0, 0) + A(N - 1, N - 1); + X = A[0, 0] + A[N - 1, N - 1]; }); results_.push_back(X); out.emplace_back("ExhaustiveMatrixView::operator=(Numeric)")([&]() { Ae = 1; - X = Ae(0, 0) + Ae(N - 1, N - 1); + X = Ae[0, 0] + Ae[N - 1, N - 1]; }); results_.push_back(X); out.emplace_back("MatrixView::operator=(Numeric)")([&]() { Av = 1; - X = Av(0, 0) + Av(N - 1, N - 1); + X = Av[0, 0] + Av[N - 1, N - 1]; }); results_.push_back(X); out.emplace_back("Matrix::operator+=(Numeric)")([&]() { A += 1.33; - X = A(0, 0) + A(N - 1, N - 1); + X = A[0, 0] + A[N - 1, N - 1]; }); results_.push_back(X); out.emplace_back("ExhaustiveMatrixView::operator+=(Numeric)")([&]() { Ae += 1.33; - X = Ae(0, 0) + Ae(N - 1, N - 1); + X = Ae[0, 0] + Ae[N - 1, N - 1]; }); results_.push_back(X); out.emplace_back("MatrixView::operator+=(Numeric)")([&]() { Av += 1.33; - X = Av(0, 0) + Av(N - 1, N - 1); + X = Av[0, 0] + Av[N - 1, N - 1]; }); results_.push_back(X); out.emplace_back("Matrix::operator-=(Numeric)")([&]() { A -= 1.5; - X = A(0, 0) + A(N - 1, N - 1); + X = A[0, 0] + A[N - 1, N - 1]; }); results_.push_back(X); out.emplace_back("ExhaustiveMatrixView::operator-=(Numeric)")([&]() { Ae -= 1.5; - X = Ae(0, 0) + Ae(N - 1, N - 1); + X = Ae[0, 0] + Ae[N - 1, N - 1]; }); results_.push_back(X); out.emplace_back("MatrixView::operator-=(Numeric)")([&]() { Av -= 1.5; - X = Av(0, 0) + Av(N - 1, N - 1); + X = Av[0, 0] + Av[N - 1, N - 1]; }); results_.push_back(X); out.emplace_back("Matrix::operator*=(Numeric)")([&]() { A *= 3.5; - X = A(0, 0) + A(N - 1, N - 1); + X = A[0, 0] + A[N - 1, N - 1]; }); results_.push_back(X); out.emplace_back("ExhaustiveMatrixView::operator*=(Numeric)")([&]() { Ae *= 3.5; - X = Ae(0, 0) + Ae(N - 1, N - 1); + X = Ae[0, 0] + Ae[N - 1, N - 1]; }); results_.push_back(X); out.emplace_back("MatrixView::operator*=(Numeric)")([&]() { Av *= 3.5; - X = Av(0, 0) + Av(N - 1, N - 1); + X = Av[0, 0] + Av[N - 1, N - 1]; }); results_.push_back(X); out.emplace_back("Matrix::operator/=(Numeric)")([&]() { A /= 7.77; - X = A(0, 0) + A(N - 1, N - 1); + X = A[0, 0] + A[N - 1, N - 1]; }); results_.push_back(X); out.emplace_back("ExhaustiveMatrixView::operator/=(Numeric)")([&]() { Ae /= 7.77; - X = Ae(0, 0) + Ae(N - 1, N - 1); + X = Ae[0, 0] + Ae[N - 1, N - 1]; }); results_.push_back(X); out.emplace_back("MatrixView::operator/=(Numeric)")([&]() { Av /= 7.77; - X = Av(0, 0) + Av(N - 1, N - 1); + X = Av[0, 0] + Av[N - 1, N - 1]; }); results_.push_back(X); @@ -522,79 +522,79 @@ Array test_ops_Matrix(Index N) { a -= b; a *= b; a /= b; - X = a(0, 0) + a(N - 1, N - 1); + X = a[0, 0] + a[N - 1, N - 1]; } results_.push_back(X); out.emplace_back("Matrix::operator+=(Matrix)")([&]() { a += b; - X = a(0, 0) + a(N - 1, N - 1); + X = a[0, 0] + a[N - 1, N - 1]; }); results_.push_back(X); out.emplace_back("ExhaustiveMatrixView::operator+=(ExhaustiveMatrixView)")([&]() { ae += be; - X = ae(0, 0) + ae(N - 1, N - 1); + X = ae[0, 0] + ae[N - 1, N - 1]; }); results_.push_back(X); out.emplace_back("MatrixView::operator+=(MatrixView)")([&]() { av += bv; - X = av(0, 0) + av(N - 1, N - 1); + X = av[0, 0] + av[N - 1, N - 1]; }); results_.push_back(X); out.emplace_back("Matrix::operator-=(Matrix)")([&]() { a -= b; - X = a(0, 0) + a(N - 1, N - 1); + X = a[0, 0] + a[N - 1, N - 1]; }); results_.push_back(X); out.emplace_back("ExhaustiveMatrixView::operator-=(ExhaustiveMatrixView)")([&]() { ae -= be; - X = ae(0, 0) + ae(N - 1, N - 1); + X = ae[0, 0] + ae[N - 1, N - 1]; }); results_.push_back(X); out.emplace_back("MatrixView::operator-=(MatrixView)")([&]() { av -= bv; - X = av(0, 0) + av(N - 1, N - 1); + X = av[0, 0] + av[N - 1, N - 1]; }); results_.push_back(X); out.emplace_back("Matrix::operator*=(Matrix)")([&]() { a *= b; - X = a(0, 0) + a(N - 1, N - 1); + X = a[0, 0] + a[N - 1, N - 1]; }); results_.push_back(X); out.emplace_back("ExhaustiveMatrixView::operator*=(ExhaustiveMatrixView)")([&]() { ae *= be; - X = ae(0, 0) + ae(N - 1, N - 1); + X = ae[0, 0] + ae[N - 1, N - 1]; }); results_.push_back(X); out.emplace_back("MatrixView::operator*=(MatrixView)")([&]() { av *= bv; - X = av(0, 0) + av(N - 1, N - 1); + X = av[0, 0] + av[N - 1, N - 1]; }); results_.push_back(X); out.emplace_back("Matrix::operator/=(Matrix)")([&]() { a /= b; - X = a(0, 0) + a(N - 1, N - 1); + X = a[0, 0] + a[N - 1, N - 1]; }); results_.push_back(X); out.emplace_back("ExhaustiveMatrixView::operator/=(ExhaustiveMatrixView)")([&]() { ae /= be; - X = ae(0, 0) + ae(N - 1, N - 1); + X = ae[0, 0] + ae[N - 1, N - 1]; }); results_.push_back(X); out.emplace_back("MatrixView::operator/=(MatrixView)")([&]() { av /= bv; - X = av(0, 0) + av(N - 1, N - 1); + X = av[0, 0] + av[N - 1, N - 1]; }); results_.push_back(X); diff --git a/src/tests/test_matpack_simple.cc b/src/tests/test_matpack_simple.cc index ad9577c5c2..b838c3342b 100644 --- a/src/tests/test_matpack_simple.cc +++ b/src/tests/test_matpack_simple.cc @@ -9,7 +9,7 @@ void test1() { Matrix m(500, 500); for (Index k = 0; k < 1000; k++) for (Index i = 0; i < m.nrows(); i++) - for (Index j = 0; j < m.ncols(); j++) m(i, j) = 2.; + for (Index j = 0; j < m.ncols(); j++) m[i, j] = 2.; } int main() { diff --git a/src/tests/test_mdspan.cc b/src/tests/test_mdspan.cc index 1315a1ce1c..7885838187 100644 --- a/src/tests/test_mdspan.cc +++ b/src/tests/test_mdspan.cc @@ -36,7 +36,7 @@ void test_view() { x.data(), std::array{Index{2}, Index{2}, Index{2}}}}; for (Index i = 0; i < 2; i++) { [[maybe_unused]] auto g = - y(i, joker, matpack::matpack_strided_access{joker})(i, i); + y[i, joker, matpack::matpack_strided_access{joker}][i, i]; [[maybe_unused]] auto h = y[i][i][i]; static_assert(std::same_as); static_assert(std::same_as); @@ -58,7 +58,7 @@ void test_view() { x.data(), std::array{Index{2}, Index{2}, Index{2}}}}; for (Index i = 0; i < 2; i++) { [[maybe_unused]] auto& g = - y(i, joker, matpack::matpack_strided_access{joker})(i, i); + y[i, joker, matpack::matpack_strided_access{joker}][i, i]; [[maybe_unused]] auto& h = y[i][i][i]; static_assert(std::same_as); static_assert(std::same_as); @@ -80,7 +80,7 @@ void test_view() { x.data(), std::array{Index{2}, Index{2}, Index{2}}}}; for (Index i = 0; i < 2; i++) { [[maybe_unused]] auto g = - y(i, joker, matpack::matpack_strided_access{joker})(i, i); + y[i, joker, matpack::matpack_strided_access{joker}][i, i]; [[maybe_unused]] auto h = y[i][i][i]; static_assert(std::same_as); static_assert(std::same_as); @@ -102,7 +102,7 @@ void test_view() { x.data(), std::array{Index{2}, Index{2}, Index{2}}}}; for (Index i = 0; i < 2; i++) { [[maybe_unused]] auto& g = - y(i, joker, matpack::matpack_strided_access{joker})(i, i); + y[i, joker, matpack::matpack_strided_access{joker}][i, i]; [[maybe_unused]] auto& h = y[i][i][i]; static_assert(std::same_as); static_assert(std::same_as); @@ -155,7 +155,7 @@ void test_view() { xr.data(), std::array{Index{2}, Index{2}, Index{2}}}}; const ExhaustiveTensor3View yi{matpack::exhaustive_mdspan{ xi.data(), std::array{Index{2}, Index{2}, Index{2}}}}; - auto z = y(joker, matpack::matpack_strided_access(0, -1, 2), joker); + auto z = y[joker, matpack::matpack_strided_access(0, -1, 2), joker]; std::vector reszr{1, 2, 3, 4, 5, 6, 7, 8}; std::vector reszi{1, 2, 0, 0, 5, 6, 0, 0}; @@ -493,7 +493,7 @@ void test_mult() { { Matrix A(4, 4, 1); for (Index i = 0; i < 4; i++) - for (Index j = 0; j < 4; j++) A(i, j) = static_cast(i); + for (Index j = 0; j < 4; j++) A[i, j] = static_cast(i); Vector y({1, 2, 3, 4}), x(4); Vector eig_x{A * y}; @@ -504,7 +504,7 @@ void test_mult() { ComplexMatrix A(4, 4, 1); for (Index i = 0; i < 4; i++) for (Index j = 0; j < 4; j++) - A(i, j) = {static_cast(i), 2 * static_cast(i)}; + A[i, j] = {static_cast(i), 2 * static_cast(i)}; ComplexVector y({1, 2, 3, 4}), x(4); ComplexVector eig_x{A * y}; @@ -520,8 +520,8 @@ void test_const_view() { { matpack::matpack_constant_view xv(x); ARTS_USER_ERROR_IF(xv != xv, "Bad") - ARTS_USER_ERROR_IF(xv(2, 2) != x.back(), "Bad") - ARTS_USER_ERROR_IF(xv(0, 0) != x.front(), "Bad") + ARTS_USER_ERROR_IF((xv[2, 2] != x.back()), "Bad") + ARTS_USER_ERROR_IF((xv[0, 0] != x.front()), "Bad") ARTS_USER_ERROR_IF( xv[0] != (matpack::matpack_constant_view{x3}), "Bad") ARTS_USER_ERROR_IF(xv[0][0] != x.front(), "Bad") @@ -530,8 +530,8 @@ void test_const_view() { { matpack::matpack_constant_view xv(x); ARTS_USER_ERROR_IF(xv != xv, "Bad") - ARTS_USER_ERROR_IF(xv(2, 2) != x.back(), "Bad") - ARTS_USER_ERROR_IF(xv(0, 0) != x.front(), "Bad") + ARTS_USER_ERROR_IF((xv[2, 2] != x.back()), "Bad") + ARTS_USER_ERROR_IF((xv[0, 0] != x.front()), "Bad") ARTS_USER_ERROR_IF( xv[0] != (matpack::matpack_constant_view{x3}), "Bad") ARTS_USER_ERROR_IF(xv[0][0] != x.front(), "Bad") diff --git a/src/tests/test_sparse.cc b/src/tests/test_sparse.cc index 36b4955fbf..1e70f00094 100644 --- a/src/tests/test_sparse.cc +++ b/src/tests/test_sparse.cc @@ -174,9 +174,9 @@ void test40() { std::cout << "c = A*b (should be [11,44,99]):\n" << c << "\n"; Matrix D(3, 2); - D(joker, 0) = b; - D(joker, 1) = b; - D(joker, 1) *= 2; + D[joker, 0] = b; + D[joker, 1] = b; + D[joker, 1] *= 2; std::cout << "D:\n" << D << "\n"; Matrix E(3, 2); @@ -463,7 +463,7 @@ Numeric test_insert_row(Index ntests, bool verbose) { A = static_cast(A_sparse); - Numeric err = get_maximum_error(A(r, joker), v, true); + Numeric err = get_maximum_error(A[r, joker], v, true); if (err > err_max) err_max = err; if (verbose) { @@ -618,7 +618,7 @@ Numeric test_sparse_unary_operations(Index m, for (Index j = 0; j < m; j++) { for (Index k = 0; k < n; k++) { - B(j, k) = abs(A(j, k)); + B[j, k] = abs(A[j, k]); } } @@ -704,10 +704,10 @@ Numeric test_dense_sparse_multiplication(Index m, std::cout << std::setw(10) << c_stride; } - MatrixView A_view = A(Range(m1, dm, r_stride), joker); - MatrixView A_ref_view = A_ref(Range(m1, dm, r_stride), joker); + MatrixView A_view = A[Range(m1, dm, r_stride), joker]; + MatrixView A_ref_view = A_ref[Range(m1, dm, r_stride), joker]; Matrix C(dn, n); - MatrixView B_mul = B(Range(m1, dm, r_stride), Range(n1, dn, c_stride)); + MatrixView B_mul = B[Range(m1, dm, r_stride), Range(n1, dn, c_stride)]; Sparse C_sparse(dn, n), C_sparse_transpose(dn, n); // @@ -734,8 +734,8 @@ Numeric test_dense_sparse_multiplication(Index m, A.resize(n, m); A_ref.resize(n, m); - MatrixView A_view_transp = A(joker, Range(m1, dm, r_stride)); - MatrixView A_ref_view_transp = A_ref(joker, Range(m1, dm, r_stride)); + MatrixView A_view_transp = A[joker, Range(m1, dm, r_stride)]; + MatrixView A_ref_view_transp = A_ref[joker, Range(m1, dm, r_stride)]; C_sparse.resize(n, dn); C.resize(n, dn); @@ -744,7 +744,7 @@ Numeric test_dense_sparse_multiplication(Index m, C = static_cast(C_sparse); MatrixView B_mul_transp = - B(Range(n1, dn, c_stride), Range(m1, dm, r_stride)); + B[Range(n1, dn, c_stride), Range(m1, dm, r_stride)]; mult(transpose(A_ref_view_transp), transpose(B_mul_transp), transpose(C)); mult(transpose(A_view_transp), transpose(B_mul_transp), C_sparse_transpose); @@ -825,9 +825,9 @@ Numeric test_sparse_dense_multiplication(Index m, dm = dm / r_stride; Matrix B(m, dm); - MatrixView A_view = A(joker, Range(n1, dn, c_stride)); - MatrixView A_ref_view = A_ref(joker, Range(n1, dn, c_stride)); - MatrixView C_mul = C(Range(m1, dm, r_stride), Range(n1, dn, c_stride)); + MatrixView A_view = A[joker, Range(n1, dn, c_stride)]; + MatrixView A_ref_view = A_ref[joker, Range(n1, dn, c_stride)]; + MatrixView C_mul = C[Range(m1, dm, r_stride), Range(n1, dn, c_stride)]; Sparse B_sparse(m, dm), B_sparse_transpose(m, dm); // @@ -855,8 +855,8 @@ Numeric test_sparse_dense_multiplication(Index m, A.resize(n, m); A_ref.resize(n, m); - MatrixView A_view_transp = A(Range(n1, dn, c_stride), joker); - MatrixView A_ref_view_transp = A_ref(Range(n1, dn, c_stride), joker); + MatrixView A_view_transp = A[Range(n1, dn, c_stride), joker]; + MatrixView A_ref_view_transp = A_ref[Range(n1, dn, c_stride), joker]; B_sparse.resize(dm, m); B.resize(dm, m); @@ -864,7 +864,7 @@ Numeric test_sparse_dense_multiplication(Index m, transpose(B_sparse_transpose, B_sparse); B = static_cast(B_sparse); - MatrixView C_mul2 = C(Range(n1, dn, c_stride), Range(m1, dm, r_stride)); + MatrixView C_mul2 = C[Range(n1, dn, c_stride), Range(m1, dm, r_stride)]; // Transposed sparse-dense multiplication mult(transpose(A_ref_view_transp), transpose(B), transpose(C_mul2)); diff --git a/src/tests/test_utils.cc b/src/tests/test_utils.cc index c88edbb36c..bc258b7e57 100644 --- a/src/tests/test_utils.cc +++ b/src/tests/test_utils.cc @@ -47,7 +47,7 @@ void random_fill_matrix(MatrixView A, Numeric range, bool positive) { for (Index i = 0; i < m; i++) { for (Index j = 0; j < n; j++) { - A(i, j) = (Numeric)rand(); + A[i, j] = (Numeric)rand(); } } } @@ -59,7 +59,7 @@ void random_fill_matrix(ComplexMatrixView A, Numeric range, bool positive) { for (Index i = 0; i < m; i++) { for (Index j = 0; j < n; j++) { - A(i, j) = Complex((Numeric)rand(), (Numeric)rand()); + A[i, j] = Complex((Numeric)rand(), (Numeric)rand()); } } } @@ -122,8 +122,8 @@ void random_fill_matrix(Matrix& A, Sparse& B, Numeric range, bool positive) { m1 = rand() % m; n1 = rand() % n; - A(m1, n1) = random_number(); - B.rw(m1, n1) = A(m1, n1); + A[m1, n1] = random_number(); + B.rw(m1, n1) = A[m1, n1]; } } @@ -174,7 +174,7 @@ void random_fill_matrix_pos_def(MatrixView A, Numeric range, bool positive) { // Add identity matrix. for (Index i = 0; i < n; i++) { - A(i, i) += 1.0; + A[i, i] += 1.0; } } @@ -242,7 +242,7 @@ MatrixView random_submatrix(MatrixView A, int m, int n) { n1 = rand_n(); Range r1(m1, m), r2(n1, n); - return A(r1, r2); + return A[r1, r2]; } //! Generate random sub-range of the range [0, n-1]. @@ -328,12 +328,12 @@ Numeric get_maximum_error(ConstMatrixView A1, err = 0.0; if (relative) { - if (A2(i, j) != 0.0) { - err = abs((A2(i, j) - A1(i, j)) / A2(i, j)); + if (A2[i, j] != 0.0) { + err = abs((A2[i, j] - A1[i, j]) / A2[i, j]); } } else { - err = A2(i, j) - A1(i, j); + err = A2[i, j] - A1[i, j]; } if (err > max) { @@ -357,12 +357,12 @@ Numeric get_maximum_error(ConstComplexMatrixView A1, err = 0.0; if (relative) { - if (A2(i, j).real() != 0.0 && A2(i, j).imag() != 0.0) { - err = abs((A2(i, j) - A1(i, j)) / A2(i, j)); + if (A2[i, j].real() != 0.0 && A2[i, j].imag() != 0.0) { + err = abs((A2[i, j] - A1[i, j]) / A2[i, j]); } } else { - err = abs(A2(i, j) - A1(i, j)); + err = abs(A2[i, j] - A1[i, j]); } if (err > max) { diff --git a/src/xml_io_compound_types.cc b/src/xml_io_compound_types.cc index e414f0a2d8..e1e192bedf 100644 --- a/src/xml_io_compound_types.cc +++ b/src/xml_io_compound_types.cc @@ -448,7 +448,7 @@ void xml_read_from_stream(std::istream& is_xml, } else { for (Index r = 0; r < nrows; r++) { for (Index c = 0; c < ncols; c++) { - is_xml >> double_imanip() >> matrix.real()(r, c) >> matrix.imag()(r, c); + is_xml >> double_imanip() >> matrix.real()[r, c] >> matrix.imag()[r, c]; if (is_xml.fail()) { std::ostringstream os; os << " near " @@ -490,15 +490,15 @@ void xml_write_to_stream(std::ostream& os_xml, // Write the elements: for (Index r = 0; r < matrix.nrows(); ++r) { if (pbofs) - *pbofs << matrix(r, 0); + *pbofs << matrix[r, 0]; else - os_xml << matrix(r, 0).real() << ' ' << matrix(r, 0).imag(); + os_xml << matrix[r, 0].real() << ' ' << matrix[r, 0].imag(); for (Index c = 1; c < matrix.ncols(); ++c) { if (pbofs) - *pbofs << matrix(r, c); + *pbofs << matrix[r, c]; else - os_xml << " " << matrix(r, c).real() << ' ' << matrix(r, c).imag(); + os_xml << " " << matrix[r, c].real() << ' ' << matrix[r, c].imag(); } if (!pbofs) os_xml << '\n'; diff --git a/src/xml_io_general_types.cc b/src/xml_io_general_types.cc index c60ab9e1db..07b8e51c61 100644 --- a/src/xml_io_general_types.cc +++ b/src/xml_io_general_types.cc @@ -109,7 +109,7 @@ void xml_read_from_stream(std::istream& is_xml, } else { for (Index r = 0; r < nrows; r++) { for (Index c = 0; c < ncols; c++) { - is_xml >> double_imanip() >> matrix(r, c); + is_xml >> double_imanip() >> matrix[r, c]; if (is_xml.fail()) { std::ostringstream os; os << " near " @@ -530,7 +530,7 @@ void xml_read_from_stream(std::istream& is_xml, for (Index p = 0; p < npages; p++) { for (Index r = 0; r < nrows; r++) { for (Index c = 0; c < ncols; c++) { - is_xml >> double_imanip() >> tensor(p, r, c); + is_xml >> double_imanip() >> tensor[p, r, c]; if (is_xml.fail()) { std::ostringstream os; os << " near " @@ -614,7 +614,7 @@ void xml_read_from_stream(std::istream& is_xml, for (Index p = 0; p < npages; p++) { for (Index r = 0; r < nrows; r++) { for (Index c = 0; c < ncols; c++) { - is_xml >> double_imanip() >> tensor(b, p, r, c); + is_xml >> double_imanip() >> tensor[b, p, r, c]; if (is_xml.fail()) { std::ostringstream os; os << " near " @@ -702,7 +702,7 @@ void xml_read_from_stream(std::istream& is_xml, for (Index p = 0; p < npages; p++) { for (Index r = 0; r < nrows; r++) { for (Index c = 0; c < ncols; c++) { - is_xml >> double_imanip() >> tensor(s, b, p, r, c); + is_xml >> double_imanip() >> tensor[s, b, p, r, c]; if (is_xml.fail()) { std::ostringstream os; os << " near " @@ -796,7 +796,7 @@ void xml_read_from_stream(std::istream& is_xml, for (Index p = 0; p < npages; p++) { for (Index r = 0; r < nrows; r++) { for (Index c = 0; c < ncols; c++) { - is_xml >> double_imanip() >> tensor(v, s, b, p, r, c); + is_xml >> double_imanip() >> tensor[v, s, b, p, r, c]; if (is_xml.fail()) { std::ostringstream os; os << " near " @@ -894,7 +894,7 @@ void xml_read_from_stream(std::istream& is_xml, for (Index p = 0; p < npages; p++) { for (Index r = 0; r < nrows; r++) { for (Index c = 0; c < ncols; c++) { - is_xml >> double_imanip() >> tensor(l, v, s, b, p, r, c); + is_xml >> double_imanip() >> tensor[l, v, s, b, p, r, c]; if (is_xml.fail()) { std::ostringstream os; os << " near "