TRIQS/nda
2.0.0
Multi-dimensional array library for C++
Toggle main menu visibility
Loading...
Searching...
No Matches
getrs.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
13
#include "
./interface/cxx_interface.hpp
"
14
#include "
../blas/tools.hpp
"
15
#include "
../concepts.hpp
"
16
#include "
../declarations.hpp
"
17
#include "
../device.hpp
"
18
#include "
../macros.hpp
"
19
#include "
../mem/address_space.hpp
"
20
#include "
../traits.hpp
"
21
22
#include <type_traits>
23
24
namespace
nda::lapack {
25
54
template
<BlasArrayOrConj<2> A, BlasArrayFor<A> B, PivotArrayFor<A, 1> IPIV>
55
requires
((
get_rank<B>
== 1 or
get_rank<B>
== 2) and
has_F_layout<B>
)
56
int
getrs
(A
const
&a, B &&b, IPIV
const
&ipiv) {
// NOLINT (temporary views are allowed here)
57
// get underlying matrix in case it is given as a lazy conjugate expression
58
auto
&a_mat =
get_array
(a);
59
60
// check the dimensions of the input/output arrays/views
61
EXPECTS(a_mat.extent(0) == a_mat.extent(1));
62
EXPECTS(b.extent(0) == a_mat.extent(0));
63
EXPECTS(ipiv.size() == a_mat.extent(0));
64
65
// arrays/views must be LAPACK compatible
66
EXPECTS(a_mat.indexmap().min_stride() == 1);
67
EXPECTS(b.indexmap().min_stride() == 1);
68
EXPECTS(ipiv.indexmap().min_stride() == 1);
69
70
// perform actual library call
71
int
info = 0;
72
if
constexpr
(
mem::have_device_compatible_addr_space<A, B, IPIV>
) {
73
device::getrs(
get_op<A>
,
get_ncols
(a_mat),
get_ncols
(b), a_mat.data(),
get_ld
(a_mat), ipiv.data(), b.data(),
get_ld
(b), info);
74
}
else
{
75
f77::getrs(
get_op<A>
,
get_ncols
(a_mat),
get_ncols
(b), a_mat.data(),
get_ld
(a_mat), ipiv.data(), b.data(),
get_ld
(b), info);
76
}
77
78
return
info;
79
}
80
81
}
// namespace nda::lapack
address_space.hpp
Provides definitions and type traits involving the different memory address spaces supported by nda.
tools.hpp
Provides various traits and utilities for the BLAS interface.
concepts.hpp
Provides concepts for the nda library.
declarations.hpp
Provides various convenient aliases and helper functions for nda::basic_array and nda::basic_array_vi...
device.hpp
Provides GPU and non-GPU specific functionality.
nda::get_rank
constexpr int get_rank
Constexpr variable that specifies the rank of an nda::Array or of a contiguous 1-dimensional range.
Definition
traits.hpp:147
nda::blas_lapack::get_array
MemoryArray decltype(auto) get_array(A &&a)
Get the underlying array of a conjugate lazy expression or return the array itself in case it is an n...
Definition
tools.hpp:68
nda::blas_lapack::get_op
static constexpr char get_op
Variable template that determines the BLAS matrix operation tag ('N','T','C') based on the given bool...
Definition
tools.hpp:104
nda::blas_lapack::get_ld
int get_ld(A const &a)
Get the leading dimension of an nda::MemoryArray with rank 1 or 2 for BLAS/LAPACK calls.
Definition
tools.hpp:128
nda::blas_lapack::get_ncols
int get_ncols(A const &a)
Get the number of columns of an nda::MemoryArray with rank 1 or 2 for BLAS/LAPACK calls.
Definition
tools.hpp:148
nda::blas_lapack::has_F_layout
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
nda::lapack::getrs
int getrs(A const &a, B &&b, IPIV const &ipiv)
Interface to the LAPACK/cuSOLVER getrs routine.
Definition
getrs.hpp:56
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
cxx_interface.hpp
Provides a C++ interface for various LAPACK routines.
macros.hpp
Macros used in the nda library.
traits.hpp
Provides type traits for the nda library.
nda
lapack
getrs.hpp
Generated by
1.17.0