27namespace nda::lapack {
70 template <MemoryMatrix A, MemoryVector JPVT, MemoryVector TAU>
72 int geqp3(A &&a, JPVT &&jpvt, TAU &&tau) {
73 static_assert(std::is_same_v<get_value_t<JPVT>,
int>,
"Error in nda::lapack::geqp3: Pivoting array must have elements of type int");
74 static_assert(
has_F_layout<A>,
"Error in nda::lapack::geqp3: A must have Fortran layout");
77 auto const [m, n] = a.shape();
78 EXPECTS(jpvt.size() == n);
82 EXPECTS(a.indexmap().min_stride() == 1);
83 EXPECTS(jpvt.indexmap().min_stride() == 1);
84 EXPECTS(tau.indexmap().min_stride() == 1);
88 value_type tmp_lwork{};
91 lapack::f77::geqp3(m, n, a.data(),
get_ld(a), jpvt.data(), tau.data(), &tmp_lwork, -1, rwork.
data(), info);
92 int lwork =
static_cast<int>(std::ceil(std::real(tmp_lwork)));
96 lapack::f77::geqp3(m, n, a.data(),
get_ld(a), jpvt.data(), tau.data(), 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.
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...
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.
basic_array< ValueType, Rank, Layout, 'A', ContainerPolicy > array
Alias template of an nda::basic_array with an 'A' 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.
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.
constexpr bool is_blas_lapack_v
Alias for nda::is_double_or_complex_v.
Provides a C++ interface for various LAPACK routines.
int get_ld(A const &a)
Get the leading dimension of an nda::MemoryArray with rank 1 or 2 for BLAS/LAPACK calls.
static constexpr bool has_F_layout
Constexpr variable that is true if the given nda::Array type has nda::F_layout.
Macros used in the nda library.
Provides type traits for the nda library.