TRIQS/nda 1.3.0
Multi-dimensional array library for C++
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
14#include "./tools.hpp"
15#include "../concepts.hpp"
17#include "../traits.hpp"
18
19#ifndef NDA_HAVE_DEVICE
20#include "../device.hpp"
21#endif // NDA_HAVE_DEVICE
22
23namespace nda::blas {
24
36 template <MemoryVector X>
38 void scal(get_value_t<X> alpha, X &&x) { // NOLINT (temporary views are allowed here)
40#if defined(NDA_HAVE_DEVICE)
41 device::scal(x.size(), alpha, x.data(), x.indexmap().strides()[0]);
42#else
44#endif
45 } else {
46 f77::scal(x.size(), alpha, x.data(), x.indexmap().strides()[0]);
47 }
48 }
49
50} // namespace nda::blas
Provides definitions and type traits involving the different memory address spaces supported by nda.
Provides a C++ interface for various BLAS routines.
Provides concepts for the nda library.
Provides GPU and non-GPU specific functionality.
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:182
void scal(get_value_t< X > alpha, X &&x)
Interface to the BLAS scal routine.
Definition scal.hpp:38
static constexpr bool have_device_compatible_addr_space
Constexpr variable that is true if all given types have an address space compatible with Device.
void compile_error_no_gpu()
Trigger a compilation error in case GPU specific functionality is used without configuring the projec...
Definition device.hpp:36
constexpr bool is_blas_lapack_v
Alias for nda::is_double_or_complex_v.
Definition traits.hpp:92
Provides various traits and utilities for the BLAS interface.
Provides type traits for the nda library.