diff --git a/src/TiledArray/einsum/tiledarray.h b/src/TiledArray/einsum/tiledarray.h index ace7caa15a..1c25f22a4f 100644 --- a/src/TiledArray/einsum/tiledarray.h +++ b/src/TiledArray/einsum/tiledarray.h @@ -420,8 +420,8 @@ auto einsum(expressions::TsrExpr A, expressions::TsrExpr B, using ResultTensor = typename ArrayC::value_type; using ResultShape = typename ArrayC::shape_type; - auto const& tnsrExprA = A; - auto const& tnsrExprB = B; + auto const &tnsrExprA = A; + auto const &tnsrExprB = B; auto a = std::get<0>(Einsum::idx(A)); auto b = std::get<0>(Einsum::idx(B)); @@ -489,12 +489,12 @@ auto einsum(expressions::TsrExpr A, expressions::TsrExpr B, auto sum_tot_2_tos = [](auto const &tot) { using tot_t = std::remove_reference_t; - typename tot_t::value_type result( - tot.range(), [tot](auto &&ix) { - if (!tot(ix).empty()) - return tot(ix).sum(); - else return typename tot_t::numeric_type{}; - }); + typename tot_t::value_type result(tot.range(), [tot](auto &&ix) { + if (!tot(ix).empty()) + return tot(ix).sum(); + else + return typename tot_t::numeric_type{}; + }); return result; }; diff --git a/src/TiledArray/tensor/kernels.h b/src/TiledArray/tensor/kernels.h index 0b0767ed81..1fa12552bc 100644 --- a/src/TiledArray/tensor/kernels.h +++ b/src/TiledArray/tensor/kernels.h @@ -419,7 +419,9 @@ inline void inplace_tensor_op(Op&& op, TR& result, const Ts&... tensors) { auto volume = result.total_size(); for (decltype(volume) ord = 0; ord < volume; ++ord) { - if constexpr (is_tensor_of_tensor_v) + if constexpr (is_tensor_of_tensor_v) + if (result.data()[ord].range().volume() == 0) continue; + if constexpr (is_tensor_of_tensor_v) if (((tensors.data()[ord].range().volume() == 0) || ...)) continue; if constexpr (std::is_invocable_r_v) @@ -997,8 +999,9 @@ auto tensor_reduce(ReduceOp&& reduce_op, JoinOp&& join_op, auto result = identity; for (std::remove_cv_t ord = 0ul; ord < volume; ++ord) { - if (tensor1.data()[ord].range().volume() == 0 - || ((tensors.data()[ord].range().volume() == 0) || ...)) continue; + if (tensor1.data()[ord].range().volume() == 0 || + ((tensors.data()[ord].range().volume() == 0) || ...)) + continue; auto temp = tensor_reduce(reduce_op, join_op, identity, tensor1.data()[ord], tensors.data()[ord]...); join_op(result, temp);