From 028c53d343792437482a8122102cb64f98c600ac Mon Sep 17 00:00:00 2001 From: Eduard Valeyev Date: Fri, 10 Mar 2023 12:14:02 -0500 Subject: [PATCH] cleanup [skip ci] --- src/TiledArray/math/solvers/cp.h | 2 +- src/TiledArray/tensor/tensor.h | 3 ++- src/TiledArray/tile_interface/scale.h | 17 ++++++++++++----- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/TiledArray/math/solvers/cp.h b/src/TiledArray/math/solvers/cp.h index d21df2d46d..f94ea259ff 100644 --- a/src/TiledArray/math/solvers/cp.h +++ b/src/TiledArray/math/solvers/cp.h @@ -35,4 +35,4 @@ using TiledArray::math::cp::CP_ALS; using TiledArray::math::cp::cp_reconstruct; } // namespace TiledArray -#endif // TILEDARRAY_MATH_SOLVERS_DIIS_H__INCLUDED +#endif // TILEDARRAY_MATH_SOLVERS_CP_H__INCLUDED diff --git a/src/TiledArray/tensor/tensor.h b/src/TiledArray/tensor/tensor.h index d3c91361f5..1f09b92701 100644 --- a/src/TiledArray/tensor/tensor.h +++ b/src/TiledArray/tensor/tensor.h @@ -872,8 +872,9 @@ class Tensor { const_reference operator()(const Index&... i) const { TA_ASSERT(!this->empty()); TA_ASSERT(this->batch_size() == 1); + using Int = std::common_type_t; const auto iord = this->range_.ordinal( - std::array, sizeof...(Index)>{{i...}}); + std::array{{static_cast(i)...}}); TA_ASSERT(this->range_.includes_ordinal(iord)); return this->data()[iord]; } diff --git a/src/TiledArray/tile_interface/scale.h b/src/TiledArray/tile_interface/scale.h index 8d548114b9..cbfa48c972 100644 --- a/src/TiledArray/tile_interface/scale.h +++ b/src/TiledArray/tile_interface/scale.h @@ -38,9 +38,13 @@ namespace TiledArray { /// \tparam Scalar A numeric type (i.e. TiledArray::detail::is_numeric_v /// is true) \param arg The left-hand argument to be scaled \param factor The /// scaling factor \return A tile that is equal to arg * factor -template && - !TiledArray::detail::is_array_v>* = nullptr> +template < + typename Arg, typename Scalar, + std::enable_if_t< + TiledArray::detail::is_numeric_v && + !TiledArray::detail::is_array_v && + std::is_void_v().scale( + std::declval()))>>>* = nullptr> inline auto scale(const Arg& arg, const Scalar factor) { return arg.scale(factor); } @@ -55,8 +59,11 @@ inline auto scale(const Arg& arg, const Scalar factor) { /// \return A tile that is equal to perm ^ (arg * factor) template < typename Arg, typename Scalar, typename Perm, - std::enable_if_t && - TiledArray::detail::is_permutation_v>* = nullptr> + std::enable_if_t< + TiledArray::detail::is_numeric_v && + TiledArray::detail::is_permutation_v && + std::is_void_v().scale( + std::declval(), std::declval()))>>>* = nullptr> inline auto scale(const Arg& arg, const Scalar factor, const Perm& perm) { return arg.scale(factor, perm); }