Skip to content

Commit

Permalink
Fix getters
Browse files Browse the repository at this point in the history
  • Loading branch information
niermann999 committed Nov 20, 2024
1 parent 53dc7a4 commit d33751e
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 19 deletions.
4 changes: 2 additions & 2 deletions storage/cmath/include/algebra/storage/impl/cmath_getter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ struct block_getter {
template <std::size_t SIZE, std::size_t ROWS, std::size_t COLS,
concepts::scalar scalar_t,
template <typename, std::size_t> class array_t>
ALGEBRA_HOST_DEVICE inline array_t<scalar_t, SIZE> operator()(
ALGEBRA_HOST_DEVICE inline array_t<scalar_t, SIZE> vector(
const array_t<array_t<scalar_t, ROWS>, COLS> &m, std::size_t row,
std::size_t col) {

Expand Down Expand Up @@ -204,7 +204,7 @@ ALGEBRA_HOST_DEVICE inline array_t<scalar_t, SIZE> vector(
const array_t<array_t<scalar_t, ROWS>, COLS> &m, std::size_t row,
std::size_t col) {

return block_getter().template operator()<SIZE>(m, row, col);
return block_getter().template vector<SIZE>(m, row, col);
}

/// Sets a matrix of dimension @tparam ROW and @tparam COL as submatrix of
Expand Down
4 changes: 2 additions & 2 deletions storage/common/include/algebra/storage/matrix_getter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ struct block_getter {
template <std::size_t SIZE, std::size_t ROWS, std::size_t COLS,
concepts::scalar scalar_t,
template <typename, std::size_t> class array_t>
ALGEBRA_HOST_DEVICE constexpr auto operator()(
ALGEBRA_HOST_DEVICE constexpr auto vector(
const matrix<array_t, scalar_t, ROWS, COLS> &m, const std::size_t row,
const std::size_t col) noexcept {

Expand All @@ -192,7 +192,7 @@ struct block_getter {
assert(col <= COLS);

using input_matrix_t = matrix<array_t, scalar_t, ROWS, COLS>;
using vector_t = vector<SIZE, scalar_t, array_t>;
using vector_t = algebra::storage::vector<SIZE, scalar_t, array_t>;

vector_t res_v{};

Expand Down
14 changes: 7 additions & 7 deletions storage/eigen/include/algebra/storage/impl/eigen_getter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ struct element_getter {

/// Function extracting an element from a matrix (const)
template <typename derived_type>
ALGEBRA_HOST_DEVICE inline auto element(
ALGEBRA_HOST_DEVICE inline decltype(auto) element(
const Eigen::MatrixBase<derived_type> &m, std::size_t row,
std::size_t col) {

Expand All @@ -90,7 +90,7 @@ template <typename derived_type>
requires std::is_base_of_v<
Eigen::DenseCoeffsBase<derived_type, Eigen::WriteAccessors>,
Eigen::MatrixBase<derived_type> >
ALGEBRA_HOST_DEVICE inline auto &element(Eigen::MatrixBase<derived_type> &m,
ALGEBRA_HOST_DEVICE inline decltype(auto) element(Eigen::MatrixBase<derived_type> &m,
std::size_t row, std::size_t col) {

return element_getter()(m, static_cast<Eigen::Index>(row),
Expand All @@ -99,7 +99,7 @@ requires std::is_base_of_v<

/// Function extracting an element from a matrix (const)
template <typename derived_type>
ALGEBRA_HOST_DEVICE inline auto element(
ALGEBRA_HOST_DEVICE inline decltype(auto) element(
const Eigen::MatrixBase<derived_type> &m, std::size_t row) {

return element_getter()(m, static_cast<Eigen::Index>(row));
Expand All @@ -110,7 +110,7 @@ template <typename derived_type>
requires std::is_base_of_v<
Eigen::DenseCoeffsBase<derived_type, Eigen::WriteAccessors>,
Eigen::MatrixBase<derived_type> >
ALGEBRA_HOST_DEVICE inline auto &element(Eigen::MatrixBase<derived_type> &m,
ALGEBRA_HOST_DEVICE inline decltype(auto) element(Eigen::MatrixBase<derived_type> &m,
std::size_t row) {

return element_getter()(m, static_cast<Eigen::Index>(row));
Expand Down Expand Up @@ -139,7 +139,7 @@ struct block_getter {

template <int SIZE, typename derived_type, concepts::index size_type_1,
concepts::index size_type_2>
ALGEBRA_HOST_DEVICE decltype(auto) operator()(
ALGEBRA_HOST_DEVICE decltype(auto) vector(
Eigen::MatrixBase<derived_type> &m, size_type_1 row,
size_type_2 col) const {

Expand All @@ -148,7 +148,7 @@ struct block_getter {

template <int SIZE, typename derived_type, concepts::index size_type_1,
concepts::index size_type_2>
ALGEBRA_HOST_DEVICE decltype(auto) operator()(
ALGEBRA_HOST_DEVICE decltype(auto) vector(
const Eigen::MatrixBase<derived_type> &m, size_type_1 row,
size_type_2 col) const {

Expand Down Expand Up @@ -180,7 +180,7 @@ ALGEBRA_HOST_DEVICE inline decltype(auto) vector(
const Eigen::MatrixBase<derived_type> &m, std::size_t row,
std::size_t col) {

return block_getter{}.template operator()<SIZE>(
return block_getter{}.template vector<SIZE>(
m, static_cast<Eigen::Index>(row), static_cast<Eigen::Index>(col));
}

Expand Down
4 changes: 2 additions & 2 deletions storage/fastor/include/algebra/storage/impl/fastor_getter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ struct block_getter {

template <std::size_t SIZE, std::size_t oROWS, std::size_t oCOLS,
concepts::scalar scalar_t>
ALGEBRA_HOST_DEVICE Fastor::Tensor<scalar_t, SIZE> operator()(
ALGEBRA_HOST_DEVICE Fastor::Tensor<scalar_t, SIZE> vector(
const Fastor::Tensor<scalar_t, oROWS, oCOLS> &m, std::size_t row,
std::size_t col) const {

Expand All @@ -170,7 +170,7 @@ ALGEBRA_HOST_DEVICE inline decltype(auto) vector(
const Fastor::Tensor<scalar_t, ROWS, COLS> &m, std::size_t row,
std::size_t col) {

return block_getter{}.template operator()<SIZE>(m, row, col);
return block_getter{}.template vector<SIZE>(m, row, col);
}

/// Operator setting a block with a matrix
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ struct block_getter {

template <unsigned int SIZE, unsigned int ROWS, unsigned int COLS,
concepts::scalar scalar_t>
ALGEBRA_HOST_DEVICE ROOT::Math::SVector<scalar_t, SIZE> operator()(
ALGEBRA_HOST_DEVICE ROOT::Math::SVector<scalar_t, SIZE> vector(
const ROOT::Math::SMatrix<scalar_t, ROWS, COLS> &m, unsigned int row,
unsigned int col) const {

Expand All @@ -159,7 +159,7 @@ ALGEBRA_HOST_DEVICE inline auto vector(
const ROOT::Math::SMatrix<scalar_t, ROWS, COLS> &m, std::size_t row,
std::size_t col) {

return block_getter{}.template operator()<SIZE>(
return block_getter{}.template vector<SIZE>(
m, static_cast<unsigned int>(row), static_cast<unsigned int>(col));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ template <std::size_t SIZE, std::size_t ROW, std::size_t COL,
ALGEBRA_HOST_DEVICE constexpr auto vector(
const algebra::storage::matrix<array_t, scalar_t, ROW, COL> &m,
const std::size_t row, const std::size_t col) noexcept {
return algebra::storage::block_getter{}.template operator()<SIZE>(m, row,
col);
return algebra::storage::block_getter{}.template vector<SIZE>(m, row, col);
}

} // namespace algebra::vc_aos::storage
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ template <std::size_t SIZE, std::size_t ROW, std::size_t COL,
ALGEBRA_HOST_DEVICE constexpr auto vector(
const algebra::storage::matrix<array_t, scalar_t, ROW, COL> &m,
const std::size_t row, const std::size_t col) noexcept {
return algebra::storage::block_getter{}.template operator()<SIZE>(m, row,
col);
return algebra::storage::block_getter{}.template vector<SIZE>(m, row, col);
}

} // namespace algebra::vc_soa::storage

0 comments on commit d33751e

Please sign in to comment.