39namespace nda::linalg {
73 template <MemoryMatrix A, MemoryArray B>
76 static_assert(
get_rank<B> == 1 ||
get_rank<B> == 2,
"Error in nda::linalg::solve_in_place: Right hand side must have rank 1 or 2");
82 EXPECTS_WITH_MESSAGE(a.shape()[0] == a.shape()[1],
"Error in nda::linalg::solve_in_place: Matrix A is not square");
83 EXPECTS_WITH_MESSAGE(a.shape()[0] == b.extent(0),
"Error in nda::linalg::solve_in_place: Dimension mismatch between matrix A and B");
90 if (info != 0) NDA_RUNTIME_ERROR <<
"Error in nda::linalg::solve_in_place: getrf returned a non-zero value: info = " << info;
94 if (info != 0) NDA_RUNTIME_ERROR <<
"Error in nda::linalg::solve_in_place: getrs returned a non-zero value: info = " << info;
124 template <Matrix A, Array B>
126 auto solve(A
const &a, B
const &b) {
128 using a_layout_policy = nda::detail::layout_to_policy<typename std::remove_cvref_t<A>::layout_t>::type;
134 using b_type = std::conditional_t<get_rank<B> == 1, vector_t, matrix_t>;
135 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 getrf routine.
Provides a generic interface to the LAPACK 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 the given nda::Array type has nda::F_layout.
int getrf(A &&a, IPIV &&ipiv)
Interface to the LAPACK getrf routine.
int getrs(A const &a, B &&b, IPIV const &ipiv)
Interface to the LAPACK getrs routine.
static constexpr bool have_compatible_addr_space
Constexpr variable that is true if all given types have compatible address spaces.
constexpr AddressSpace common_addr_space
Get common address space for a number of given nda::Array types.
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
Alias for nda::is_double_or_complex_v.
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.