22namespace nda::linalg {
43 template <
bool star = false, Vector X, Vector Y>
47 EXPECTS(x.size() == y.size());
50 auto cond_conj = [](
auto z) __attribute__((always_inline)) {
59 long const N = x.size();
60 if (N == 0)
return decltype(cond_conj(x(0)) * y(0)){0};
65 auto *__restrict px = x.data();
66 auto *__restrict py = y.data();
67 auto res = cond_conj(px[0]) * py[0];
68 for (
size_t i = 1; i < N; ++i) res += cond_conj(px[i]) * py[i];
76 auto res = cond_conj(x(0)) * y(0);
77 for (
long i = 1; i < N; ++i) res += cond_conj(x(i)) * y(i);
102 template <
typename X,
typename Y>
104 auto dot(X
const &x, Y
const &y) {
133 template <
typename X,
typename Y>
135 auto dotc(X
const &x, Y
const &y) {
Provides definitions and type traits involving the different memory address spaces supported by nda.
Provides a generic interface to the BLAS dot, dotu and dotc routine.
Check if a given type is either an arithmetic or complex type.
Check if a given type is a vector, i.e. an nda::ArrayOfRank<1>.
Provides concepts for the nda library.
constexpr bool is_regular_or_view_v
Constexpr variable that is true if type A is either a regular array or a view.
constexpr bool has_layout_smallest_stride_is_one
Constexpr variable that is true if type A has the smallest_stride_is_one nda::layout_prop_e guarantee...
auto dot(X const &x, Y const &y)
Interface to the BLAS dot and dotu routine.
auto dotc(X const &x, Y const &y)
Interface to the BLAS dotc routine.
static constexpr bool have_host_compatible_addr_space
Constexpr variable that is true if all given types have an address space compatible with Host.
constexpr bool is_complex_v
Constexpr variable that is true if type T is a std::complex type.
Macros used in the nda library.
A small wrapper around a single long integer to be used as a linear index.
Provides type traits for the nda library.