TRIQS/nda
2.0.0
Multi-dimensional array library for C++
Toggle main menu visibility
Loading...
Searching...
No Matches
scal.hpp
Go to the documentation of this file.
1
// Copyright (c) 2023--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 "
./tools.hpp
"
15
#include "
../concepts.hpp
"
16
#include "
../mem/address_space.hpp
"
17
#include "
../traits.hpp
"
18
19
#ifndef NDA_HAVE_DEVICE
20
#include "
../device.hpp
"
21
#endif
// NDA_HAVE_DEVICE
22
23
namespace
nda::blas {
24
36
template
<MemoryVector X>
37
requires
(
is_blas_lapack_v<get_value_t<X>
>)
38
void
scal
(
get_value_t<X>
alpha, X &&x) {
// NOLINT (temporary views are allowed here)
39
if
constexpr
(
mem::have_device_compatible_addr_space<X>
) {
40
#if defined(NDA_HAVE_DEVICE)
41
device::scal(x.size(), alpha, x.data(), x.indexmap().strides()[0]);
42
#else
43
compile_error_no_gpu
();
44
#endif
45
}
else
{
46
f77::scal(x.size(), alpha, x.data(), x.indexmap().strides()[0]);
47
}
48
}
49
50
}
// 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::get_value_t
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.
Definition
traits.hpp:191
nda::blas::scal
void scal(get_value_t< X > alpha, X &&x)
Interface to the BLAS scal routine.
Definition
scal.hpp:38
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::compile_error_no_gpu
void compile_error_no_gpu()
Trigger a compilation error in case GPU specific functionality is used without configuring the projec...
Definition
device.hpp:36
nda::is_blas_lapack_v
constexpr bool is_blas_lapack_v
Alias for nda::is_double_or_complex_v.
Definition
traits.hpp:92
tools.hpp
Provides various traits and utilities for the BLAS interface.
traits.hpp
Provides type traits for the nda library.
nda
blas
scal.hpp
Generated by
1.17.0