28namespace nda::linalg {
60 template <blas_lapack::BlasArray<2> A, blas_lapack::BlasArrayFor<A> B>
64 EXPECTS_WITH_MESSAGE(a.extent(0) == a.extent(1),
"Error in nda::linalg::solve_in_place: Matrix A is not square");
65 EXPECTS_WITH_MESSAGE(a.extent(0) == b.extent(0),
"Error in nda::linalg::solve_in_place: Dimension mismatch between matrix A and B");
72 if (info != 0) NDA_RUNTIME_ERROR <<
"Error in nda::linalg::solve_in_place: getrf returned a non-zero value: info = " << info;
76 if (info != 0) NDA_RUNTIME_ERROR <<
"Error in nda::linalg::solve_in_place: getrs returned a non-zero value: info = " << info;
99 template <Matrix A, Array B>
101 auto solve(A
const &a, B
const &b) {
103 using a_layout_policy = nda::detail::layout_to_policy<typename std::remove_cvref_t<A>::layout_t>::type;
109 using b_type = std::conditional_t<get_rank<B> == 1, vector_t, matrix_t>;
110 auto b_copy = b_type(b);
Provides definitions and type traits involving the different memory address spaces supported by nda.
Provides the generic class for arrays.
Provides concepts for the nda library.
Provides various convenient aliases and helper functions for nda::basic_array and nda::basic_array_vi...
Provides a custom runtime error class and macros to assert conditions and throw exceptions.
Provides a generic interface to the LAPACK/cuSOLVER getrf routine.
Provides a generic interface to the LAPACK/cuSOLVER getrs routine.
basic_array< ValueType, 1, C_layout, 'V', ContainerPolicy > vector
Alias template of an nda::basic_array with rank 1 and a 'V' algebra.
basic_array< ValueType, 2, Layout, 'M', ContainerPolicy > matrix
Alias template of an nda::basic_array with rank 2 and an 'M' algebra.
constexpr bool have_same_value_type_v
Constexpr variable that is true if all types in As have the same value type as A0.
constexpr int get_rank
Constexpr variable that specifies the rank of an nda::Array or of a contiguous 1-dimensional range.
static constexpr bool has_F_layout
Constexpr variable that is true if all given nda::Array types have nda::F_layout.
int getrf(A &&a, IPIV &&ipiv, W &&work=vector_value_t< A >{})
Interface to the LAPACK/cuSOLVER getrf routine.
int getrs(A const &a, B &&b, IPIV const &ipiv)
Interface to the LAPACK/cuSOLVER getrs routine.
void solve_in_place(A &&a, B &&b)
Solve a system of linear equations in place.
auto solve(A const &a, B const &b)
Solve a system of linear equations.
static constexpr bool have_compatible_addr_space
Constexpr variable that is true if all given types have compatible address spaces.
heap_basic< mem::mallocator< AdrSp > > heap
Alias template of the nda::heap_basic policy using an nda::mem::mallocator.
constexpr bool is_blas_lapack_v
Constexpr variable that is true if type T is either of type 'float', double, std::complex<float>' or ...
Provides definitions of various layout policies.
Macros used in the nda library.
Defines various memory handling policies.
Contiguous layout policy with Fortran-order (column-major order).
Provides type traits for the nda library.