TRIQS/nda 2.0.0
Multi-dimensional array library for C++
Loading...
Searching...
No Matches
gqr.hpp
Go to the documentation of this file.
1// Copyright (c) 2024--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 "./orgqr.hpp"
14#include "./orgqr_batch.hpp"
15#include "./ungqr.hpp"
16#include "./ungqr_batch.hpp"
17#include "../blas/tools.hpp"
18#include "../traits.hpp"
19
20#include <type_traits>
21#include <utility>
22
23namespace nda::lapack {
24
29 template <BlasArray<2> A, BlasArrayFor<A, 1> TAU, BlasArrayFor<A, 1> W = vector_value_t<A>>
30 requires(has_F_layout<A>)
31 int gqr(A &&a, TAU &&tau, W &&work = vector_value_t<A>{}) { // NOLINT (temporary views are allowed here)
32 using value_type = get_value_t<A>;
33 if constexpr (std::is_same_v<value_type, float> or std::is_same_v<value_type, double>) {
34 return orgqr(std::forward<A>(a), std::forward<TAU>(tau), std::forward<W>(work));
35 } else {
36 return ungqr(std::forward<A>(a), std::forward<TAU>(tau), std::forward<W>(work));
37 }
38 }
39
45 template <BlasArray<3> A, BlasArrayFor<A, 2> TAU, BlasArrayFor<A, 1> W = vector_value_t<A>>
46 requires(has_F_layout<A, TAU>)
47 int gqr(A &&a, TAU &&tau, W &&work = vector_value_t<A>{}) { // NOLINT (temporary views are allowed here)
48 using value_type = get_value_t<A>;
49 if constexpr (std::is_same_v<value_type, float> or std::is_same_v<value_type, double>) {
50 return orgqr_batch(std::forward<A>(a), std::forward<TAU>(tau), std::forward<W>(work));
51 } else {
52 return ungqr_batch(std::forward<A>(a), std::forward<TAU>(tau), std::forward<W>(work));
53 }
54 }
55
56} // namespace nda::lapack
Provides various traits and utilities for the BLAS interface.
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:212
vector< get_value_t< A >, heap< mem::get_addr_space< A > > > vector_value_t
Alias for an nda::vector with the same value type and address space as the given type.
Definition tools.hpp:161
static constexpr bool has_F_layout
Constexpr variable that is true if all given nda::Array types have nda::F_layout.
Definition tools.hpp:79
int ungqr(A &&a, TAU &&tau, W &&work=vector_value_t< A >{})
Interface to the LAPACK/cuSOLVER ungqr routine.
Definition ungqr.hpp:67
int orgqr_batch(A &&a, TAU &&tau, W &&work=vector_value_t< A >{})
Interface to batched versions of the LAPACK/cuSOLVER orgqr routine.
int orgqr(A &&a, TAU &&tau, W &&work=vector_value_t< A >{})
Interface to the LAPACK/cuSOLVER orgqr routine.
Definition orgqr.hpp:66
int ungqr_batch(A &&a, TAU &&tau, W &&work=vector_value_t< A >{})
Interface to batched versions of the LAPACK/cuSOLVER ungqr routine.
int gqr(A &&a, TAU &&tau, W &&work=vector_value_t< A >{})
Dispatcher to nda::lapack::orgqr for real value types and to nda::lapack::ungqr for complex value typ...
Definition gqr.hpp:31
Provides a generic interface to the LAPACK/cuSOLVER orgqr routine.
Provides a generic interface to batched versions of the LAPACK/cuSOLVER orgqr routine.
Provides type traits for the nda library.
Provides a generic interface to the LAPACK/cuSOLVER ungqr routine.
Provides a generic interface to batched versions of the LAPACK/cuSOLVER ungqr routine.