35#ifndef NDA_HAVE_DEVICE
66 template <MemoryVector X, MemoryVector Y, MemoryMatrix 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>) {
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));
110 template <ArrayOrScalar A, ArrayOrScalar 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";
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);
Provides definitions and type traits involving the different memory address spaces supported by nda.
Provides utility functions for std::array.
Provides basic functions to create and manipulate arrays and views.
Provides a C++ interface for various BLAS routines.
Check if a given type is either an arithmetic or complex type.
Provides concepts for the nda library.
Provides GPU and non-GPU specific functionality.
Provides a custom runtime error class and macros to assert conditions and throw exceptions.
auto zeros(std::array< Int, Rank > const &shape)
Make an array of the given shape on the given address space and zero-initialize it.
auto transpose(A &&a)
Transpose the memory layout of an nda::MemoryArray or an nda::expr_call.
auto reshape(A &&a, std::array< Int, R > const &new_shape)
Reshape an nda::basic_array or nda::basic_array_view.
constexpr bool have_same_value_type_v
Constexpr variable that is true if all types in As have the same value type as A0.
std::decay_t< decltype(get_first_element(std::declval< A const >()))> get_value_t
Get the value type of an array/view or a scalar type.
auto outer_product(A const &a, B const &b)
Calculate the outer product of two contiguous arrays/views/scalars.
void ger(get_value_t< X > alpha, X const &x, Y const &y, M &&m)
Interface to the BLAS ger routine.
static constexpr bool have_compatible_addr_space
Constexpr variable that is true if all given types have compatible address spaces.
static constexpr bool have_device_compatible_addr_space
Constexpr variable that is true if all given types have an address space compatible with Device.
constexpr AddressSpace common_addr_space
Get common address space for a number of given nda::MemoryArray types.
void compile_error_no_gpu()
Trigger a compilation error in case GPU specific functionality is used without configuring the projec...
constexpr std::array< T, R1+R2 > join(std::array< T, R1 > const &a1, std::array< T, R2 > const &a2)
Make a new std::array by joining two existing std::array objects.
constexpr bool is_blas_lapack_v
Alias for nda::is_double_or_complex_v.
Macros used in the nda library.
Provides type traits for the nda library.