67 requires(have_same_value_type_v<X, Y, M>
and mem::have_compatible_addr_space<X, Y, M>
and is_blas_lapack_v<get_value_t<X>>)
68 void ger(get_value_t<X> alpha, X
const &x, Y
const &y, M &&m) {
69 EXPECTS(m.extent(0) == x.extent(0));
70 EXPECTS(m.extent(1) == y.extent(0));
73 EXPECTS(m.indexmap().min_stride() == 1);
76 if (has_C_layout<M>) {
77 ger(alpha, y, x, transpose(m));
81 if constexpr (mem::have_device_compatible_addr_space<X, Y, M>) {
82#if defined(NDA_HAVE_DEVICE)
83 device::ger(m.extent(0), m.extent(1), alpha, x.data(), x.indexmap().strides()[0], y.data(), y.indexmap().strides()[0], m.data(), get_ld(m));
88 f77::ger(m.extent(0), m.extent(1), alpha, x.data(), x.indexmap().strides()[0], y.data(), y.indexmap().strides()[0], m.data(), get_ld(m));
112 if constexpr (Scalar<A>
or Scalar<B>) {
115 if (
not a.is_contiguous())
NDA_RUNTIME_ERROR <<
"Error in nda::blas::outer_product: First argument has non-contiguous layout";
116 if (
not b.is_contiguous())
NDA_RUNTIME_ERROR <<
"Error in nda::blas::outer_product: Second argument has non-contiguous layout";
119 auto res = zeros<get_value_t<A>, mem::common_addr_space<A, B>>(stdutil::join(a.shape(), b.shape()));
120 auto a_vec = reshape(a, std::array{a.size()});
121 auto b_vec = reshape(b, std::array{b.size()});
122 auto mat = reshape(res, std::array{a.size(), b.size()});
123 ger(1.0, a_vec, b_vec, mat);
void ger(get_value_t< X > alpha, X const &x, Y const &y, M &&m)
Interface to the BLAS ger routine.