diff --git a/src/integrals/ao_integrals/coulomb_metric.cpp b/src/integrals/ao_integrals/coulomb_metric.cpp index 9564a9f2..163e9e79 100644 --- a/src/integrals/ao_integrals/coulomb_metric.cpp +++ b/src/integrals/ao_integrals/coulomb_metric.cpp @@ -30,7 +30,7 @@ struct Kernel { // Unwrap buffer info tensorwrapper::allocator::Eigen allocator(rv); const auto& eigen_I = allocator.rebind(I); - const auto* pI = eigen_I.data(); + const auto* pI = eigen_I.get_immutable_data(); const auto& shape_I = eigen_I.layout().shape().as_smooth(); auto rows = shape_I.extent(0); auto cols = shape_I.extent(1); @@ -49,8 +49,10 @@ struct Kernel { tensorwrapper::shape::Smooth matrix_shape{rows, cols}; tensorwrapper::layout::Physical matrix_layout(matrix_shape); auto pM_buffer = allocator.allocate(matrix_layout); - for(auto i = 0; i < rows; ++i) { - for(auto j = 0; j < cols; ++j) { pM_buffer->at(i, j) = Linv(i, j); } + for(decltype(rows) i = 0; i < rows; ++i) { + for(decltype(cols) j = 0; j < cols; ++j) { + pM_buffer->set_elem({i, j}, Linv(i, j)); + } } return simde::type::tensor(matrix_shape, std::move(pM_buffer)); } diff --git a/src/integrals/ao_integrals/uq_driver.cpp b/src/integrals/ao_integrals/uq_driver.cpp index 379a6b8b..96df9906 100644 --- a/src/integrals/ao_integrals/uq_driver.cpp +++ b/src/integrals/ao_integrals/uq_driver.cpp @@ -34,9 +34,9 @@ struct Kernel { auto rv_buffer = alloc.allocate(t_eigen.layout()); for(std::size_t i = 0; i < t_eigen.size(); ++i) { - const auto elem = (t_eigen.data() + i)->mean(); - const auto elem_error = (error_eigen.data() + i)->mean(); - *(rv_buffer->data() + i) = FloatType(elem, elem_error); + const auto elem = t_eigen.get_data(i).mean(); + const auto elem_error = error_eigen.get_data(i).mean(); + rv_buffer->set_data(i, FloatType(elem, elem_error)); } const auto& shape = t_eigen.layout().shape(); diff --git a/src/integrals/libint/libint.cpp b/src/integrals/libint/libint.cpp index 583ed776..6bf6bb0f 100644 --- a/src/integrals/libint/libint.cpp +++ b/src/integrals/libint/libint.cpp @@ -75,7 +75,8 @@ auto fill_tensor(const std::vector& basis_sets, auto ord = detail_::shells2ord(basis_sets, shells); auto n_ord = ord.size(); for(decltype(n_ord) i_ord = 0; i_ord < n_ord; ++i_ord) { - pbuffer->data()[ord[i_ord]] += vals[i_ord]; + auto update = pbuffer->get_data(ord[i_ord]) + vals[i_ord]; + pbuffer->set_data(ord[i_ord], update); } } diff --git a/tests/cxx/unit/integrals/ao_integrals/ao_integrals_driver.cpp b/tests/cxx/unit/integrals/ao_integrals/ao_integrals_driver.cpp index 35a394e0..d4f17f48 100644 --- a/tests/cxx/unit/integrals/ao_integrals/ao_integrals_driver.cpp +++ b/tests/cxx/unit/integrals/ao_integrals/ao_integrals_driver.cpp @@ -26,15 +26,15 @@ void compare_matrices(const tensor& A, const tensor& A_corr) { const auto& A_corr_buffer = alloc_type::rebind(A_corr.buffer()); const auto tol = 1E-6; - auto A00 = A_buffer.at(0, 0); - auto A01 = A_buffer.at(0, 1); - auto A10 = A_buffer.at(1, 0); - auto A11 = A_buffer.at(1, 1); - - REQUIRE(A00 == Catch::Approx(A_corr_buffer.at(0, 0)).margin(tol)); - REQUIRE(A01 == Catch::Approx(A_corr_buffer.at(0, 1)).margin(tol)); - REQUIRE(A10 == Catch::Approx(A_corr_buffer.at(1, 0)).margin(tol)); - REQUIRE(A11 == Catch::Approx(A_corr_buffer.at(1, 1)).margin(tol)); + auto A00 = A_buffer.get_elem({0, 0}); + auto A01 = A_buffer.get_elem({0, 1}); + auto A10 = A_buffer.get_elem({1, 0}); + auto A11 = A_buffer.get_elem({1, 1}); + + REQUIRE(A00 == Catch::Approx(A_corr_buffer.get_elem({0, 0})).margin(tol)); + REQUIRE(A01 == Catch::Approx(A_corr_buffer.get_elem({0, 1})).margin(tol)); + REQUIRE(A10 == Catch::Approx(A_corr_buffer.get_elem({1, 0})).margin(tol)); + REQUIRE(A11 == Catch::Approx(A_corr_buffer.get_elem({1, 1})).margin(tol)); } } // namespace diff --git a/tests/cxx/unit/integrals/ao_integrals/test_uq_driver.cpp b/tests/cxx/unit/integrals/ao_integrals/test_uq_driver.cpp index 75def409..37a8945b 100644 --- a/tests/cxx/unit/integrals/ao_integrals/test_uq_driver.cpp +++ b/tests/cxx/unit/integrals/ao_integrals/test_uq_driver.cpp @@ -22,24 +22,24 @@ auto corr_answer(const simde::type::tensor& T) { return T; } else { simde::type::tensor T_corr(T); - using alloc_type = tensorwrapper::allocator::Eigen; - auto& corr_buffer = alloc_type::rebind(T_corr.buffer()); - corr_buffer.at(0, 0, 0, 0) = FloatType{0.774606, 0}; - corr_buffer.at(0, 0, 0, 1) = FloatType{0.265558, 2.49687e-06}; - corr_buffer.at(0, 0, 1, 0) = FloatType{0.265558, 2.49687e-06}; - corr_buffer.at(0, 0, 1, 1) = FloatType{0.446701, 0}; - corr_buffer.at(0, 1, 0, 0) = FloatType{0.265558, 2.49687e-06}; - corr_buffer.at(0, 1, 0, 1) = FloatType{0.120666, 1.10748e-05}; - corr_buffer.at(0, 1, 1, 0) = FloatType{0.120666, 1.10748e-05}; - corr_buffer.at(0, 1, 1, 1) = FloatType{0.265558, 2.49687e-06}; - corr_buffer.at(1, 0, 0, 0) = FloatType{0.265558, 2.49687e-06}; - corr_buffer.at(1, 0, 0, 1) = FloatType{0.120666, 1.10748e-05}; - corr_buffer.at(1, 0, 1, 0) = FloatType{0.120666, 1.10748e-05}; - corr_buffer.at(1, 0, 1, 1) = FloatType{0.265558, 2.49687e-06}; - corr_buffer.at(1, 1, 0, 0) = FloatType{0.446701, 0}; - corr_buffer.at(1, 1, 0, 1) = FloatType{0.265558, 2.49687e-06}; - corr_buffer.at(1, 1, 1, 0) = FloatType{0.265558, 2.49687e-06}; - corr_buffer.at(1, 1, 1, 1) = FloatType{0.774606, 0}; + using alloc_type = tensorwrapper::allocator::Eigen; + auto& corr_buffer = alloc_type::rebind(T_corr.buffer()); + corr_buffer.set_elem({0, 0, 0, 0}, FloatType{0.774606, 0}); + corr_buffer.set_elem({0, 0, 0, 1}, FloatType{0.265558, 2.49687e-06}); + corr_buffer.set_elem({0, 0, 1, 0}, FloatType{0.265558, 2.49687e-06}); + corr_buffer.set_elem({0, 0, 1, 1}, FloatType{0.446701, 0}); + corr_buffer.set_elem({0, 1, 0, 0}, FloatType{0.265558, 2.49687e-06}); + corr_buffer.set_elem({0, 1, 0, 1}, FloatType{0.120666, 1.10748e-05}); + corr_buffer.set_elem({0, 1, 1, 0}, FloatType{0.120666, 1.10748e-05}); + corr_buffer.set_elem({0, 1, 1, 1}, FloatType{0.265558, 2.49687e-06}); + corr_buffer.set_elem({1, 0, 0, 0}, FloatType{0.265558, 2.49687e-06}); + corr_buffer.set_elem({1, 0, 0, 1}, FloatType{0.120666, 1.10748e-05}); + corr_buffer.set_elem({1, 0, 1, 0}, FloatType{0.120666, 1.10748e-05}); + corr_buffer.set_elem({1, 0, 1, 1}, FloatType{0.265558, 2.49687e-06}); + corr_buffer.set_elem({1, 1, 0, 0}, FloatType{0.446701, 0}); + corr_buffer.set_elem({1, 1, 0, 1}, FloatType{0.265558, 2.49687e-06}); + corr_buffer.set_elem({1, 1, 1, 0}, FloatType{0.265558, 2.49687e-06}); + corr_buffer.set_elem({1, 1, 1, 1}, FloatType{0.774606, 0}); return T_corr; } } diff --git a/tests/cxx/unit/integrals/testing.hpp b/tests/cxx/unit/integrals/testing.hpp index 6f7258dd..2a5d549b 100644 --- a/tests/cxx/unit/integrals/testing.hpp +++ b/tests/cxx/unit/integrals/testing.hpp @@ -33,7 +33,7 @@ auto eigen_tensor_(const tensorwrapper::buffer::BufferBase& buffer, std::array extents, std::index_sequence) { const auto& b = tensorwrapper::allocator::Eigen::rebind(buffer); using eigen_type = Eigen::Tensor; - return Eigen::TensorMap(b.data(), extents[Is]...); + return Eigen::TensorMap(b.get_immutable_data(), extents[Is]...); } // Checking eigen outputs