Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/integrals/ao_integrals/coulomb_metric.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct Kernel {
// Unwrap buffer info
tensorwrapper::allocator::Eigen<FloatType> 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);
Expand All @@ -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));
}
Expand Down
6 changes: 3 additions & 3 deletions src/integrals/ao_integrals/uq_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
3 changes: 2 additions & 1 deletion src/integrals/libint/libint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ auto fill_tensor(const std::vector<libint2::BasisSet>& 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);
}
}

Expand Down
18 changes: 9 additions & 9 deletions tests/cxx/unit/integrals/ao_integrals/ao_integrals_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
36 changes: 18 additions & 18 deletions tests/cxx/unit/integrals/ao_integrals/test_uq_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<FloatType>;
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<FloatType>;
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;
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/cxx/unit/integrals/testing.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ auto eigen_tensor_(const tensorwrapper::buffer::BufferBase& buffer,
std::array<int, N> extents, std::index_sequence<Is...>) {
const auto& b = tensorwrapper::allocator::Eigen<FloatType>::rebind(buffer);
using eigen_type = Eigen::Tensor<const FloatType, N, Eigen::RowMajor>;
return Eigen::TensorMap<eigen_type>(b.data(), extents[Is]...);
return Eigen::TensorMap<eigen_type>(b.get_immutable_data(), extents[Is]...);
}

// Checking eigen outputs
Expand Down