Skip to content

Commit

Permalink
simplify promote_shape to always set AbstractVectors to RowVectors
Browse files Browse the repository at this point in the history
  • Loading branch information
chriselrod committed Feb 10, 2024
1 parent 6b981ca commit 7985c35
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions include/Math/ArrayOps.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,9 @@ template <typename X, typename Y>
}
template <typename A, typename B>
[[gnu::always_inline]] constexpr auto promote_shape(const A &a, const B &b) {
if constexpr (ColVector<A> && RowVector<B>) {
return CartesianIndex(
std::integral_constant<ptrdiff_t, 1>{},
check_sizes(unwrapRow(a.numRow()), unwrapCol(b.numCol())));
} else if constexpr (RowVector<A> && ColVector<B>) {
return CartesianIndex(
std::integral_constant<ptrdiff_t, 1>{},
check_sizes(unwrapRow(b.numRow()), unwrapCol(a.numCol())));
if constexpr (AbstractVector<A> && AbstractVector<B>) {
return CartesianIndex(std::integral_constant<ptrdiff_t, 1>{},
check_sizes(a.size(), b.size()));
} else {
auto sa = shape(a);
// broadcasting static sizes is awkward, as it can prevent propogating
Expand Down

0 comments on commit 7985c35

Please sign in to comment.