TRIQS/nda
2.0.0
Multi-dimensional array library for C++
Toggle main menu visibility
Loading...
Searching...
No Matches
dot.hpp
Go to the documentation of this file.
1
// Copyright (c) 2019--present, The Simons Foundation
2
// This file is part of TRIQS/nda and is licensed under the Apache License, Version 2.0.
3
// SPDX-License-Identifier: Apache-2.0
4
// See LICENSE in the root of this distribution for details.
5
10
11
#pragma once
12
13
#include "
./interface/cxx_interface.hpp
"
14
#include "
../concepts.hpp
"
15
#include "
../device.hpp
"
16
#include "
../macros.hpp
"
17
#include "
../mem/address_space.hpp
"
18
#include "
../traits.hpp
"
19
20
namespace
nda::blas {
21
26
43
template
<BlasArray<1> X, BlasArrayFor<X, 1> Y>
44
auto
dot
(X
const
&x, Y
const
&y) {
45
// check the dimensions of the input/output arrays/views
46
EXPECTS(x.size() == y.size());
47
48
// perform actual library call
49
if
constexpr
(
mem::have_device_compatible_addr_space<X, Y>
) {
50
return
device::dot(x.size(), x.data(), x.indexmap().strides()[0], y.data(), y.indexmap().strides()[0]);
51
}
else
{
52
return
f77::dot(x.size(), x.data(), x.indexmap().strides()[0], y.data(), y.indexmap().strides()[0]);
53
}
54
}
55
71
template
<BlasArray<1> X, BlasArrayFor<X, 1> Y>
72
auto
dotc
(X
const
&x, Y
const
&y) {
73
// check the dimensions of the input/output arrays/views
74
EXPECTS(x.size() == y.size());
75
76
// perform actual library call
77
if
constexpr
(!
is_complex_v<get_value_t<X>
>) {
78
return
dot
(x, y);
79
}
else
if
constexpr
(
mem::have_device_compatible_addr_space<X, Y>
) {
80
return
device::dotc(x.size(), x.data(), x.indexmap().strides()[0], y.data(), y.indexmap().strides()[0]);
81
}
else
{
82
return
f77::dotc(x.size(), x.data(), x.indexmap().strides()[0], y.data(), y.indexmap().strides()[0]);
83
}
84
}
85
87
88
}
// namespace nda::blas
address_space.hpp
Provides definitions and type traits involving the different memory address spaces supported by nda.
cxx_interface.hpp
Provides a C++ interface for various BLAS routines.
concepts.hpp
Provides concepts for the nda library.
device.hpp
Provides GPU and non-GPU specific functionality.
nda::blas::dotc
auto dotc(X const &x, Y const &y)
Interface to the BLAS/cuBLAS dotc routine.
Definition
dot.hpp:72
nda::blas::dot
auto dot(X const &x, Y const &y)
Interface to the BLAS/cuBLAS dot and dotu routines.
Definition
dot.hpp:44
nda::mem::have_device_compatible_addr_space
static constexpr bool have_device_compatible_addr_space
Constexpr variable that is true if all given types have an address space compatible with Device.
Definition
address_space.hpp:177
nda::is_complex_v
constexpr bool is_complex_v
Constexpr variable that is true if type T is a std::complex type.
Definition
traits.hpp:65
macros.hpp
Macros used in the nda library.
traits.hpp
Provides type traits for the nda library.
nda
blas
dot.hpp
Generated by
1.17.0