Skip to content

Commit

Permalink
cleanup [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
evaleev committed Mar 10, 2023
1 parent 1888438 commit 028c53d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/TiledArray/math/solvers/cp.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion src/TiledArray/tensor/tensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<Index...>;
const auto iord = this->range_.ordinal(
std::array<std::common_type_t<Index...>, sizeof...(Index)>{{i...}});
std::array<Int, sizeof...(Index)>{{static_cast<Int>(i)...}});
TA_ASSERT(this->range_.includes_ordinal(iord));
return this->data()[iord];
}
Expand Down
17 changes: 12 additions & 5 deletions src/TiledArray/tile_interface/scale.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,13 @@ namespace TiledArray {
/// \tparam Scalar A numeric type (i.e. TiledArray::detail::is_numeric_v<Scalar>
/// is true) \param arg The left-hand argument to be scaled \param factor The
/// scaling factor \return A tile that is equal to <tt>arg * factor</tt>
template <typename Arg, typename Scalar,
std::enable_if_t<TiledArray::detail::is_numeric_v<Scalar> &&
!TiledArray::detail::is_array_v<Arg>>* = nullptr>
template <
typename Arg, typename Scalar,
std::enable_if_t<
TiledArray::detail::is_numeric_v<Scalar> &&
!TiledArray::detail::is_array_v<Arg> &&
std::is_void_v<std::void_t<decltype(std::declval<const Arg&>().scale(
std::declval<Scalar>()))>>>* = nullptr>
inline auto scale(const Arg& arg, const Scalar factor) {
return arg.scale(factor);
}
Expand All @@ -55,8 +59,11 @@ inline auto scale(const Arg& arg, const Scalar factor) {
/// \return A tile that is equal to <tt>perm ^ (arg * factor)</tt>
template <
typename Arg, typename Scalar, typename Perm,
std::enable_if_t<TiledArray::detail::is_numeric_v<Scalar> &&
TiledArray::detail::is_permutation_v<Perm>>* = nullptr>
std::enable_if_t<
TiledArray::detail::is_numeric_v<Scalar> &&
TiledArray::detail::is_permutation_v<Perm> &&
std::is_void_v<std::void_t<decltype(std::declval<const Arg&>().scale(
std::declval<Scalar>(), std::declval<const Perm&>()))>>>* = nullptr>
inline auto scale(const Arg& arg, const Scalar factor, const Perm& perm) {
return arg.scale(factor, perm);
}
Expand Down

0 comments on commit 028c53d

Please sign in to comment.