26namespace nda::lapack {
62 template <BlasArrayReal<2> A, BlasArrayFor<A, 2> B, BlasArrayFor<A, 1> W, BlasArrayFor<A, 1> W1 = vector_value_t<A>>
66 auto const [m, n] = a.shape();
68 EXPECTS(m == b.shape()[0]);
69 EXPECTS(n == b.shape()[1]);
73 EXPECTS(a.indexmap().min_stride() == 1);
74 EXPECTS(b.indexmap().min_stride() == 1);
75 EXPECTS(w.indexmap().min_stride() == 1);
78 EXPECTS(itype == 1 or itype == 2 or itype == 3);
79 EXPECTS(jobz ==
'V' or jobz ==
'N');
84 lapack::f77::sygv(itype, jobz,
'U', n, a.data(),
get_ld(a), b.data(),
get_ld(b), w.data(), &tmp_lwork, -1, info);
85 int lwork =
static_cast<int>(std::ceil(tmp_lwork));
91 lapack::f77::sygv(itype, jobz,
'U', n, a.data(),
get_ld(a), b.data(),
get_ld(b), w.data(), work.data(), lwork, 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.
static constexpr bool has_F_layout
Constexpr variable that is true if all given nda::Array types have nda::F_layout.
int sygv(A &&a, B &&b, W &&w, char jobz='V', int itype=1, W1 &&work=vector_value_t< A >{})
Interface to the LAPACK sygv 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.
Provides a C++ interface for various LAPACK routines.
Macros used in the nda library.
Provides type traits for the nda library.