Skip to content

Commit

Permalink
fix infinite recursion crash on missing matrix_product overloads for …
Browse files Browse the repository at this point in the history
…transposed and scaled inputs kokkos#218
  • Loading branch information
Mikołaj Zuzek committed May 27, 2022
1 parent 4b4b634 commit 098f6ef
Showing 1 changed file with 30 additions and 17 deletions.
47 changes: 30 additions & 17 deletions include/experimental/__p1673_bits/blas3_matrix_product.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,23 +368,6 @@ constexpr bool extractConj ()
template <class Exec, class A_t, class B_t, class C_t, class = void>
struct is_custom_matrix_product_avail : std::false_type {};

template <class Exec, class A_t, class B_t, class C_t>
struct is_custom_matrix_product_avail<
Exec, A_t, B_t, C_t,
std::enable_if_t<
std::is_void_v<
decltype(
matrix_product
(std::declval<Exec>(),
std::declval<A_t>(),
std::declval<B_t>(),
std::declval<C_t>()))
>
&& !linalg::impl::is_inline_exec_v<Exec>
>
>
: std::true_type{};

template <class Exec, class A_t, class B_t, class E_t, class C_t, class = void>
struct is_custom_matrix_product_with_update_avail : std::false_type {};

Expand Down Expand Up @@ -2235,6 +2218,36 @@ void hermitian_matrix_right_product(
hermitian_matrix_right_product(std::experimental::linalg::impl::default_exec_t(), A, t, B, E, C);
}

template <class Exec, class A_t, class B_t, class C_t>
struct is_custom_matrix_product_avail<
Exec, A_t, B_t, C_t,
std::enable_if_t<
std::is_void_v<
decltype(
matrix_product(
std::declval<Exec>(),
std::declval<A_t>(),
std::declval<B_t>(),
std::declval<C_t>()))
>
&& !std::is_same_v< // see #218
decltype(
std::experimental::linalg::matrix_product(
std::declval<Exec>(),
std::declval<A_t>(),
std::declval<B_t>(),
std::declval<C_t>())),
decltype(
matrix_product(
std::declval<Exec>(),
std::declval<A_t>(),
std::declval<B_t>(),
std::declval<C_t>()))
>
&& !linalg::impl::is_inline_exec_v<Exec>
>
>
: std::true_type{};

} // end namespace linalg
} // end inline namespace __p1673_version_0
Expand Down

0 comments on commit 098f6ef

Please sign in to comment.