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--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 "../concepts.hpp"
15#include "../macros.hpp"
17#include "../traits.hpp"
18
19namespace nda::lapack {
20
49 template <MemoryVector DL, MemoryVector D, MemoryVector DU, MemoryArray B>
51 int gtsv(DL &&dl, D &&d, DU &&du, B &&b) { // NOLINT (temporary views are allowed here)
52 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");
53
54 // get and check dimensions of input arrays
55 EXPECTS(dl.extent(0) == d.extent(0) - 1); // "gtsv : dimension mismatch between sub-diagonal and diagonal vectors "
56 EXPECTS(du.extent(0) == d.extent(0) - 1); // "gtsv : dimension mismatch between super-diagonal and diagonal vectors "
57 EXPECTS(b.extent(0) == d.extent(0)); // "gtsv : dimension mismatch between diagonal vector and RHS matrix, "
58
59 // perform actual library call
60 int N = d.extent(0);
61 int NRHS = (get_rank<B> == 2 ? b.extent(1) : 1);
62 int info = 0;
63 f77::gtsv(N, NRHS, dl.data(), d.data(), du.data(), b.data(), N, info);
64 return info;
65 }
66
67} // 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:185
constexpr int get_rank
Constexpr variable that specifies the rank of an nda::Array or of a contiguous 1-dimensional range.
Definition traits.hpp:125
int gtsv(DL &&dl, D &&d, DU &&du, B &&b)
Interface to the LAPACK gtsv routine.
Definition gtsv.hpp:51
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:91
Provides a C++ interface for various LAPACK routines.
Macros used in the nda library.
Provides type traits for the nda library.