24 #if defined (HAVE_CONFIG_H)
39 (
"EIG: matrix contains Inf or NaN values");
87 F77_XFCN (sgeevx, SGEEVX, (F77_CONST_CHAR_ARG2 (balance ?
"B" :
"N", 1),
88 F77_CONST_CHAR_ARG2 (
"N", 1),
89 F77_CONST_CHAR_ARG2 (calc_rev ?
"V" :
"N", 1),
90 F77_CONST_CHAR_ARG2 (
"N", 1),
91 n, tmp_data, n, pwr, pwi,
93 ilo, ihi, pscale, abnrm, prconde, prcondv,
94 &dummy_work, lwork, &dummy_iwork, info
98 F77_CHAR_ARG_LEN (1)));
101 (*current_liboctave_error_handler) (
"sgeevx workspace query failed");
107 F77_XFCN (sgeevx, SGEEVX, (F77_CONST_CHAR_ARG2 (balance ?
"B" :
"N", 1),
108 F77_CONST_CHAR_ARG2 (
"N", 1),
109 F77_CONST_CHAR_ARG2 (calc_rev ?
"V" :
"N", 1),
110 F77_CONST_CHAR_ARG2 (
"N", 1),
111 n, tmp_data, n, pwr, pwi,
113 ilo, ihi, pscale, abnrm, prconde, prcondv,
114 pwork, lwork, &dummy_iwork, info
118 F77_CHAR_ARG_LEN (1)));
121 (*current_liboctave_error_handler) (
"unrecoverable error in sgeevx");
124 (*current_liboctave_error_handler) (
"sgeevx failed to converge");
132 if (wi.
elem (j) == 0.0)
144 (*current_liboctave_error_handler) (
"EIG: internal error");
151 float real_part = vr.
elem (
i, j);
152 float imag_part = vr.
elem (
i, j+1);
158 float real_part = vl.
elem (
i, j);
159 float imag_part = vl.
elem (
i, j+1);
189 F77_XFCN (ssyev, SSYEV, (F77_CONST_CHAR_ARG2 (calc_rev ?
"V" :
"N", 1),
190 F77_CONST_CHAR_ARG2 (
"U", 1),
191 n, tmp_data, n, pwr, &dummy_work, lwork, info
193 F77_CHAR_ARG_LEN (1)));
196 (*current_liboctave_error_handler) (
"ssyev workspace query failed");
202 F77_XFCN (ssyev, SSYEV, (F77_CONST_CHAR_ARG2 (calc_rev ?
"V" :
"N", 1),
203 F77_CONST_CHAR_ARG2 (
"U", 1),
204 n, tmp_data, n, pwr, pwork, lwork, info
206 F77_CHAR_ARG_LEN (1)));
209 (*current_liboctave_error_handler) (
"unrecoverable error in ssyev");
212 (*current_liboctave_error_handler) (
"ssyev failed to converge");
227 (
"EIG: matrix contains Inf or NaN values");
274 F77_XFCN (cgeevx, CGEEVX, (F77_CONST_CHAR_ARG2 (balance ?
"B" :
"N", 1),
275 F77_CONST_CHAR_ARG2 (calc_lev ?
"V" :
"N", 1),
276 F77_CONST_CHAR_ARG2 (calc_rev ?
"V" :
"N", 1),
277 F77_CONST_CHAR_ARG2 (
"N", 1),
280 ilo, ihi, pscale, abnrm, prconde, prcondv,
285 F77_CHAR_ARG_LEN (1)));
288 (*current_liboctave_error_handler) (
"cgeevx workspace query failed");
294 F77_XFCN (cgeevx, CGEEVX, (F77_CONST_CHAR_ARG2 (balance ?
"B" :
"N", 1),
295 F77_CONST_CHAR_ARG2 (calc_lev ?
"V" :
"N", 1),
296 F77_CONST_CHAR_ARG2 (calc_rev ?
"V" :
"N", 1),
297 F77_CONST_CHAR_ARG2 (
"N", 1),
300 ilo, ihi, pscale, abnrm, prconde, prcondv,
305 F77_CHAR_ARG_LEN (1)));
308 (*current_liboctave_error_handler) (
"unrecoverable error in cgeevx");
311 (*current_liboctave_error_handler) (
"cgeevx failed to converge");
344 F77_XFCN (cheev, CHEEV, (F77_CONST_CHAR_ARG2 (calc_rev ?
"V" :
"N", 1),
345 F77_CONST_CHAR_ARG2 (
"U", 1),
350 F77_CHAR_ARG_LEN (1)));
353 (*current_liboctave_error_handler) (
"cheev workspace query failed");
359 F77_XFCN (cheev, CHEEV, (F77_CONST_CHAR_ARG2 (calc_rev ?
"V" :
"N", 1),
360 F77_CONST_CHAR_ARG2 (
"U", 1),
364 F77_CHAR_ARG_LEN (1)));
367 (*current_liboctave_error_handler) (
"unrecoverable error in cheev");
370 (*current_liboctave_error_handler) (
"cheev failed to converge");
381 bool calc_lev,
bool force_qz)
385 (
"EIG: matrix contains Inf or NaN values");
390 if (n != a.
cols () || nb != b.
cols ())
394 (*current_liboctave_error_handler) (
"EIG requires same size matrices");
402 F77_XFCN (spotrf, SPOTRF, (F77_CONST_CHAR_ARG2 (
"L", 1),
405 F77_CHAR_ARG_LEN (1)));
437 F77_XFCN (sggev, SGGEV, (F77_CONST_CHAR_ARG2 (calc_lev ?
"V" :
"N", 1),
438 F77_CONST_CHAR_ARG2 (calc_rev ?
"V" :
"N", 1),
439 n, atmp_data, n, btmp_data, n,
442 &dummy_work, lwork, info
444 F77_CHAR_ARG_LEN (1)));
447 (*current_liboctave_error_handler) (
"sggev workspace query failed");
453 F77_XFCN (sggev, SGGEV, (F77_CONST_CHAR_ARG2 (calc_lev ?
"V" :
"N", 1),
454 F77_CONST_CHAR_ARG2 (calc_rev ?
"V" :
"N", 1),
455 n, atmp_data, n, btmp_data, n,
460 F77_CHAR_ARG_LEN (1)));
463 (*current_liboctave_error_handler) (
"unrecoverable error in sggev");
466 (*current_liboctave_error_handler) (
"sggev failed to converge");
475 if (ai.
elem (j) == 0.0)
487 (*current_liboctave_error_handler) (
"EIG: internal error");
496 float real_part = vr.
elem (
i, j);
497 float imag_part = vr.
elem (
i, j+1);
503 float real_part = vl.
elem (
i, j);
504 float imag_part = vl.
elem (
i, j+1);
517 bool calc_rev,
bool calc_lev)
522 if (n != a.
cols () || nb != b.
cols ())
526 (*current_liboctave_error_handler) (
"EIG requires same size matrices");
542 F77_XFCN (ssygv, SSYGV, (1, F77_CONST_CHAR_ARG2 (calc_rev ?
"V" :
"N", 1),
543 F77_CONST_CHAR_ARG2 (
"U", 1),
546 pwr, &dummy_work, lwork, info
548 F77_CHAR_ARG_LEN (1)));
551 (*current_liboctave_error_handler) (
"ssygv workspace query failed");
557 F77_XFCN (ssygv, SSYGV, (1, F77_CONST_CHAR_ARG2 (calc_rev ?
"V" :
"N", 1),
558 F77_CONST_CHAR_ARG2 (
"U", 1),
561 pwr, pwork, lwork, info
563 F77_CHAR_ARG_LEN (1)));
566 (*current_liboctave_error_handler) (
"unrecoverable error in ssygv");
569 (*current_liboctave_error_handler) (
"ssygv failed to converge");
580 bool calc_rev,
bool calc_lev,
bool force_qz)
584 (
"EIG: matrix contains Inf or NaN values");
589 if (n != a.
cols () || nb != b.
cols ())
593 (*current_liboctave_error_handler) (
"EIG requires same size matrices");
602 F77_XFCN (cpotrf, CPOTRF, (F77_CONST_CHAR_ARG2 (
"L", 1),
605 F77_CHAR_ARG_LEN (1)));
638 F77_XFCN (cggev, CGGEV, (F77_CONST_CHAR_ARG2 (calc_lev ?
"V" :
"N", 1),
639 F77_CONST_CHAR_ARG2 (calc_rev ?
"V" :
"N", 1),
646 F77_CHAR_ARG_LEN (1)));
649 (*current_liboctave_error_handler) (
"cggev workspace query failed");
655 F77_XFCN (cggev, CGGEV, (F77_CONST_CHAR_ARG2 (calc_lev ?
"V" :
"N", 1),
656 F77_CONST_CHAR_ARG2 (calc_rev ?
"V" :
"N", 1),
663 F77_CHAR_ARG_LEN (1)));
666 (*current_liboctave_error_handler) (
"unrecoverable error in cggev");
669 (*current_liboctave_error_handler) (
"cggev failed to converge");
685 bool calc_rev,
bool calc_lev)
690 if (n != a.
cols () || nb != b.
cols ())
694 (*current_liboctave_error_handler) (
"EIG requires same size matrices");
714 F77_XFCN (chegv, CHEGV, (1, F77_CONST_CHAR_ARG2 (calc_rev ?
"V" :
"N", 1),
715 F77_CONST_CHAR_ARG2 (
"U", 1),
721 F77_CHAR_ARG_LEN (1)));
724 (*current_liboctave_error_handler) (
"zhegv workspace query failed");
730 F77_XFCN (chegv, CHEGV, (1, F77_CONST_CHAR_ARG2 (calc_rev ?
"V" :
"N", 1),
731 F77_CONST_CHAR_ARG2 (
"U", 1),
736 F77_CHAR_ARG_LEN (1)));
739 (*current_liboctave_error_handler) (
"unrecoverable error in zhegv");
742 (*current_liboctave_error_handler) (
"zhegv failed to converge");
void resize(octave_idx_type nr, octave_idx_type nc, const FloatComplex &rfv=FloatComplex(0))
void resize(octave_idx_type n, const FloatComplex &rfv=FloatComplex(0))
OCTAVE_NORETURN liboctave_error_handler current_liboctave_error_handler
T & elem(octave_idx_type n)
bool is_symmetric(void) const
bool any_element_is_inf_or_nan(void) const
#define F77_XFCN(f, F, args)
bool is_hermitian(void) const
octave_idx_type rows(void) const
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
octave_idx_type init(const FloatMatrix &a, bool calc_rev, bool calc_lev, bool balance)
FloatComplexColumnVector lambda
friend class FloatComplexMatrix
octave_idx_type hermitian_init(const FloatComplexMatrix &a, bool calc_rev, bool calc_lev)
bool any_element_is_inf_or_nan(void) const
octave_idx_type symmetric_init(const FloatMatrix &a, bool calc_rev, bool calc_lev)
=val(i)}if ode{val(i)}occurs in table i
void scale(Matrix &m, double x, double y, double z)
std::complex< float > FloatComplex
const T * fortran_vec(void) const
octave_idx_type cols(void) const
Vector representing the dimensions (size) of an Array.