17#if defined(NUMERICS_HAS_LAPACK)
19 const idx k = std::min(m, n);
22 std::vector<double> tau(k);
24 int info = LAPACKE_dgeqrf(LAPACK_ROW_MAJOR,
25 static_cast<lapack_int
>(m),
26 static_cast<lapack_int
>(n),
28 static_cast<lapack_int
>(n),
31 throw std::runtime_error(
"qr (lapack): dgeqrf failed, info="
32 + std::to_string(info));
36 for (
idx i = 1; i < m; ++i)
37 for (
idx j = 0; j < std::min(i, n); ++j)
42 for (
idx j = 0; j < k; ++j)
43 for (
idx i = 0; i < m; ++i)
46 info = LAPACKE_dorgqr(LAPACK_ROW_MAJOR,
47 static_cast<lapack_int
>(m),
48 static_cast<lapack_int
>(m),
49 static_cast<lapack_int
>(k),
51 static_cast<lapack_int
>(m),
54 throw std::runtime_error(
"qr (lapack): dorgqr failed, info="
55 + std::to_string(info));
57 return {std::move(Q), std::move(Rmat)};