28namespace nda::lapack {
74 template <BlasArray<2> A, BlasArrayFor<A> B, BlasArrayRealFor<A, 1> S, BlasArrayFor<A, 1> W1 = vector_value_t<A>,
75 BlasArrayRealFor<A, 1> W2 = vector_fp_t<A>>
76 requires(mem::have_host_compatible_addr_space<A> and (
get_rank<B> == 1 or
get_rank<B> == 2) and has_F_layout<A, B>)
79 auto const [m, n] = a.shape();
80 auto const k = std::min(m, n);
83 EXPECTS(b.extent(0) >= std::max(m, n));
86 EXPECTS(a.indexmap().min_stride() == 1);
87 EXPECTS(b.indexmap().min_stride() == 1);
88 EXPECTS(s.indexmap().min_stride() == 1);
94 f77::gelss(m, n, nrhs, a.data(),
get_ld(a), b.data(),
get_ld(b), s.data(), rcond, rank, &tmp_lwork, -1, rwork.data(), info);
95 int lwork =
static_cast<int>(std::ceil(std::real(tmp_lwork)));
101 f77::gelss(m, n, nrhs, a.data(),
get_ld(a), b.data(),
get_ld(b), s.data(), rcond, rank, work.data(), lwork, rwork.data(), info);
Provides definitions and type traits involving the different memory address spaces supported by nda.
Provides the generic class for arrays.
Provides basic functions to create and manipulate arrays and views.
Provides concepts for the nda library.
Provides various convenient aliases and helper functions for nda::basic_array and nda::basic_array_vi...
void resize_or_check_if_view(A &a, std::array< long, A::rank > const &sha)
Resize a given regular array to the given shape or check if a given view as the correct shape.
constexpr int get_rank
Constexpr variable that specifies the rank of an nda::Array or of a contiguous 1-dimensional range.
std::decay_t< decltype(get_first_element(std::declval< A const >()))> get_value_t
Get the value type of an array/view or a scalar type.
typename remove_complex< get_value_t< A > >::type get_fp_t
Get the floating-point type associated with the value type of an array/view/scalar type.
int get_ld(A const &a)
Get the leading dimension of an nda::MemoryArray with rank 1 or 2 for BLAS/LAPACK calls.
void resize_or_check_work_buffer(A &a, long min_size)
Resize or check the size of a 1D array/view.
vector< get_value_t< A >, heap< mem::get_addr_space< A > > > vector_value_t
Alias for an nda::vector with the same value type and address space as the given type.
vector< get_fp_t< A >, heap< mem::get_addr_space< A > > > vector_fp_t
Alias for an nda::vector with the same address space as the given type and its value type determined ...
int gelss(A &&a, B &&b, S &&s, get_fp_t< A > rcond, int &rank, W1 &&work=vector_value_t< A >{}, W2 &&rwork=vector_fp_t< A >{})
Interface to the LAPACK gelss routine.
Provides a C++ interface for various LAPACK routines.
Macros used in the nda library.
Provides type traits for the nda library.