26namespace nda::lapack {
68 template <MemoryMatrix A, MemoryVector WR, MemoryVector WI, MemoryMatrix VL, MemoryMatrix VR>
71 int geev(A &&a, WR &&wr, WI &&wi, VL &&vl, VR &&vr,
char jobvl =
'N',
char jobvr =
'V') {
72 static_assert(
has_F_layout<A>,
"Error in nda::lapack::geev: A must have Fortran layout");
73 static_assert(
has_F_layout<VL>,
"Error in nda::lapack::geev: VL must have Fortran layout");
74 static_assert(
has_F_layout<VR>,
"Error in nda::lapack::geev: VR must have Fortran layout");
77 auto const [m, n] = a.shape();
83 EXPECTS(jobvl ==
'V' or jobvl ==
'N');
84 EXPECTS(jobvr ==
'V' or jobvr ==
'N');
99 EXPECTS(a.indexmap().min_stride() == 1);
100 EXPECTS(wr.indexmap().min_stride() == 1);
101 EXPECTS(wi.indexmap().min_stride() == 1);
102 EXPECTS(jobvl ==
'N' or vl.indexmap().min_stride() == 1);
103 EXPECTS(jobvr ==
'N' or vr.indexmap().min_stride() == 1);
108 lapack::f77::geev(jobvl, jobvr, n, a.data(),
get_ld(a), wr.data(), wi.data(), vl.data(), ldvl, vr.data(), ldvr, &tmp_lwork, -1, info);
109 int lwork =
static_cast<int>(std::ceil(tmp_lwork));
113 lapack::f77::geev(jobvl, jobvr, n, a.data(),
get_ld(a), wr.data(), wi.data(), vl.data(), ldvl, vr.data(), ldvr, work.
data(), lwork, info);
151 template <MemoryMatrix A, MemoryVector W, MemoryMatrix VL, MemoryMatrix VR>
154 int geev(A &&a, W &&w, VL &&vl, VR &&vr,
char jobvl =
'N',
char jobvr =
'V') {
155 static_assert(
has_F_layout<A>,
"Error in nda::lapack::geev: A must have Fortran layout");
156 static_assert(
has_F_layout<VL>,
"Error in nda::lapack::geev: VL must have Fortran layout");
157 static_assert(
has_F_layout<VR>,
"Error in nda::lapack::geev: VR must have Fortran layout");
160 auto const [m, n] = a.shape();
165 EXPECTS(jobvl ==
'V' or jobvl ==
'N');
166 EXPECTS(jobvr ==
'V' or jobvr ==
'N');
181 EXPECTS(a.indexmap().min_stride() == 1);
182 EXPECTS(w.indexmap().min_stride() == 1);
183 EXPECTS(jobvl ==
'N' or vl.indexmap().min_stride() == 1);
184 EXPECTS(jobvr ==
'N' or vr.indexmap().min_stride() == 1);
188 std::complex<double> tmp_lwork{};
190 lapack::f77::geev(jobvl, jobvr, n, a.data(),
get_ld(a), w.data(), vl.data(), ldvl, vr.data(), ldvr, &tmp_lwork, -1, rwork.
data(), info);
191 int lwork =
static_cast<int>(std::ceil(std::real(tmp_lwork)));
195 lapack::f77::geev(jobvl, jobvr, n, a.data(),
get_ld(a), w.data(), vl.data(), ldvl, vr.data(), ldvr, 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 geev(A &&a, WR &&wr, WI &&wi, VL &&vl, VR &&vr, char jobvl='N', char jobvr='V')
Interface to the LAPACK geev 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.
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.