27namespace nda::lapack {
89 template <BlasArrayReal<2> A, BlasArrayFor<A, 2> B, BlasArrayFor<A, 1> AR, BlasArrayFor<A, 1> AI, BlasArrayFor<A, 1> B2, BlasArrayFor<A, 2> VL,
90 BlasArrayFor<A, 2> VR, BlasArrayFor<A, 1> W1 = vector_value_t<A>>
92 int ggev(A &&a, B &&b, AR &&alphar, AI &&alphai, B2 &&beta, VL &&vl, VR &&vr,
char jobvl =
'N',
char jobvr =
'V',
95 auto const [m, n] = a.shape();
97 EXPECTS(b.shape() == a.shape());
103 EXPECTS(jobvl ==
'V' or jobvl ==
'N');
104 EXPECTS(jobvr ==
'V' or jobvr ==
'N');
119 EXPECTS(a.indexmap().min_stride() == 1);
120 EXPECTS(b.indexmap().min_stride() == 1);
121 EXPECTS(alphar.indexmap().min_stride() == 1);
122 EXPECTS(alphai.indexmap().min_stride() == 1);
123 EXPECTS(beta.indexmap().min_stride() == 1);
124 EXPECTS(jobvl ==
'N' or vl.indexmap().min_stride() == 1);
125 EXPECTS(jobvr ==
'N' or vr.indexmap().min_stride() == 1);
130 lapack::f77::ggev(jobvl, jobvr, n, a.data(),
get_ld(a), b.data(),
get_ld(b), alphar.data(), alphai.data(), beta.data(), vl.data(), ldvl,
131 vr.data(), ldvr, &tmp_lwork, -1, info);
132 int lwork =
static_cast<int>(std::ceil(tmp_lwork));
138 lapack::f77::ggev(jobvl, jobvr, n, a.data(),
get_ld(a), b.data(),
get_ld(b), alphar.data(), alphai.data(), beta.data(), vl.data(), ldvl,
139 vr.data(), ldvr, work.data(), lwork, info);
199 template <BlasArrayCplx<2> A, BlasArrayFor<A, 2> B, BlasArrayFor<A, 1> A2, BlasArrayFor<A, 1> B2, BlasArrayFor<A, 2> VL, BlasArrayFor<A, 2> VR,
200 BlasArrayFor<A, 1> W1 = vector_value_t<A>, BlasArrayRealFor<A, 1> W2 = vector_fp_t<A>>
202 int ggev(A &&a, B &&b, A2 &&alpha, B2 &&beta, VL &&vl, VR &&vr,
char jobvl =
'N',
char jobvr =
'V',
205 auto const [m, n] = a.shape();
207 EXPECTS(b.shape() == a.shape());
213 EXPECTS(jobvl ==
'V' or jobvl ==
'N');
214 EXPECTS(jobvr ==
'V' or jobvr ==
'N');
229 EXPECTS(a.indexmap().min_stride() == 1);
230 EXPECTS(b.indexmap().min_stride() == 1);
231 EXPECTS(alpha.indexmap().min_stride() == 1);
232 EXPECTS(beta.indexmap().min_stride() == 1);
233 EXPECTS(jobvl ==
'N' or vl.indexmap().min_stride() == 1);
234 EXPECTS(jobvr ==
'N' or vr.indexmap().min_stride() == 1);
239 lapack::f77::ggev(jobvl, jobvr, n, a.data(),
get_ld(a), b.data(),
get_ld(b), alpha.data(), beta.data(), vl.data(), ldvl, vr.data(), ldvr,
240 &tmp_lwork, -1, rwork.data(), info);
241 int lwork =
static_cast<int>(std::ceil(std::real(tmp_lwork)));
247 lapack::f77::ggev(jobvl, jobvr, n, a.data(),
get_ld(a), b.data(),
get_ld(b), alpha.data(), beta.data(), vl.data(), ldvl, vr.data(), ldvr,
248 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.
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 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 ...
static constexpr bool has_F_layout
Constexpr variable that is true if all given nda::Array types have nda::F_layout.
int ggev(A &&a, B &&b, AR &&alphar, AI &&alphai, B2 &&beta, VL &&vl, VR &&vr, char jobvl='N', char jobvr='V', W1 &&work=vector_value_t< A >{})
Interface to the LAPACK ggev routine for real matrices.
static constexpr bool have_host_compatible_addr_space
Constexpr variable that is true if all given types have an address space compatible with Host.
Provides a C++ interface for various LAPACK routines.
Macros used in the nda library.
Provides type traits for the nda library.