38namespace nda::lapack {
64 template <MemoryMatrix A, MemoryVector JPVT, MemoryVector TAU>
67 int geqp3(A &&a, JPVT &&jpvt, TAU &&tau) {
68 static_assert(has_F_layout<A>,
"Error in nda::lapack::geqp3: C order not supported");
69 static_assert(std::is_same_v<get_value_t<JPVT>,
int>,
"Error in nda::lapack::geqp3: Pivoting array must have elements of type int");
72 auto [m, n] = a.shape();
73 EXPECTS(tau.size() >= std::min(m, n));
76 EXPECTS(a.indexmap().min_stride() == 1);
77 EXPECTS(jpvt.indexmap().min_stride() == 1);
78 EXPECTS(tau.indexmap().min_stride() == 1);
82 value_type bufferSize_T{};
85 lapack::f77::geqp3(m, n, a.data(), get_ld(a), jpvt.data(), tau.data(), &bufferSize_T, -1, rwork.
data(), info);
86 int bufferSize =
static_cast<int>(std::ceil(std::real(bufferSize_T)));
90 lapack::f77::geqp3(m, n, a.data(), get_ld(a), jpvt.data(), tau.data(), work.
data(), bufferSize, rwork.
data(), info);
93 if (info) NDA_RUNTIME_ERROR <<
"Error in nda::lapack::geqp3: info = " << info;
Provides definitions and type traits involving the different memory address spaces supported by nda.
Provides the generic class for arrays.
A generic multi-dimensional array.
ValueType const * data() const noexcept
Get a pointer to the actual data (in general this is not the beginning of the memory block for a view...
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.
constexpr bool have_same_value_type_v
Constexpr variable that is true if all types in As have the same value type as A0.
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.
int geqp3(A &&a, JPVT &&jpvt, TAU &&tau)
Interface to the LAPACK geqp3 routine.
static constexpr bool have_host_compatible_addr_space
Constexpr variable that is true if all given types have an address space compatible with Host.
static constexpr bool have_compatible_addr_space
Constexpr variable that is true if all given types have compatible address spaces.
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.
Provides a C++ interface for various LAPACK routines.
Macros used in the nda library.
Provides type traits for the nda library.