TRIQS/nda 1.3.0
Multi-dimensional array library for C++
Loading...
Searching...
No Matches
gtsv.hpp
Go to the documentation of this file.
1// Copyright (c) 2021-2024 Simons Foundation
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0.txt
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Authors: Thomas Hahn, Nils Wentzell
16
22#pragma once
23
25#include "../concepts.hpp"
26#include "../macros.hpp"
28#include "../traits.hpp"
29
30namespace nda::lapack {
31
60 template <MemoryVector DL, MemoryVector D, MemoryVector DU, MemoryArray B>
62 int gtsv(DL &&dl, D &&d, DU &&du, B &&b) { // NOLINT (temporary views are allowed here)
63 static_assert((get_rank<B> == 1 or get_rank<B> == 2), "Error in nda::lapack::gtsv: B must be an matrix/array/view of rank 1 or 2");
64
65 // get and check dimensions of input arrays
66 EXPECTS(dl.extent(0) == d.extent(0) - 1); // "gtsv : dimension mismatch between sub-diagonal and diagonal vectors "
67 EXPECTS(du.extent(0) == d.extent(0) - 1); // "gtsv : dimension mismatch between super-diagonal and diagonal vectors "
68 EXPECTS(b.extent(0) == d.extent(0)); // "gtsv : dimension mismatch between diagonal vector and RHS matrix, "
69
70 // perform actual library call
71 int N = d.extent(0);
72 int NRHS = (get_rank<B> == 2 ? b.extent(1) : 1);
73 int info = 0;
74 f77::gtsv(N, NRHS, dl.data(), d.data(), du.data(), b.data(), N, info);
75 return info;
76 }
77
78} // namespace nda::lapack
Provides definitions and type traits involving the different memory address spaces supported by nda.
Provides concepts for the nda library.
constexpr bool have_same_value_type_v
Constexpr variable that is true if all types in As have the same value type as A0.
Definition traits.hpp:196
constexpr int get_rank
Constexpr variable that specifies the rank of an nda::Array or of a contiguous 1-dimensional range.
Definition traits.hpp:136
int gtsv(DL &&dl, D &&d, DU &&du, B &&b)
Interface to the LAPACK gtsv routine.
Definition gtsv.hpp:62
static constexpr bool on_host
Constexpr variable that is true if all given types have a Host address space.
constexpr bool is_blas_lapack_v
Alias for nda::is_double_or_complex_v.
Definition traits.hpp:102
Provides a C++ interface for various LAPACK routines.
Macros used in the nda library.
Provides type traits for the nda library.