26 #if defined (HAVE_CONFIG_H)
47 select_ana (
const double& a,
const double&)
53 select_dig (
const double& a,
const double& b)
55 return (hypot (a, b) < 1.0);
59 select_ana (
const float& a,
const float&)
65 select_dig (
const float& a,
const float& b)
67 return (hypot (a, b) < 1.0);
76 return a.real () < 0.0;
83 return (abs (a) < 1.0);
90 return a.real () < 0.0;
97 return (abs (a) < 1.0);
109 (*current_liboctave_error_handler) (
"schur: requires square matrix");
113 m_schur_mat.clear ();
114 m_unitary_schur_mat.clear ();
130 char ord_char = (ord.empty () ?
'U' : ord[0]);
132 if (ord_char ==
'A' || ord_char ==
'D'
133 || ord_char ==
'a' || ord_char ==
'd')
137 if (ord_char ==
'A' || ord_char ==
'a')
138 selector = select_ana;
139 else if (ord_char ==
'D' || ord_char ==
'd')
140 selector = select_dig;
153 m_unitary_schur_mat.
clear (
n,
n);
155 double *s = m_schur_mat.fortran_vec ();
156 double *q = m_unitary_schur_mat.fortran_vec ();
159 double *pwr = wr.fortran_vec ();
162 double *pwi = wi.fortran_vec ();
165 double *pwork = work.fortran_vec ();
168 F77_INT ntmp = (ord_char ==
'N' || ord_char ==
'n') ? 0 :
n;
170 F77_INT *pbwork = bwork.fortran_vec ();
173 F77_INT *piwork = iwork.fortran_vec ();
175 F77_XFCN (dgeesx, DGEESX, (F77_CONST_CHAR_ARG2 (&jobvs, 1),
176 F77_CONST_CHAR_ARG2 (&sort, 1),
178 F77_CONST_CHAR_ARG2 (&sense, 1),
179 n, s,
n, sdim, pwr, pwi, q,
n, rconde, rcondv,
180 pwork, lwork, piwork, liwork, pbwork, info
183 F77_CHAR_ARG_LEN (1)));
197 (*current_liboctave_error_handler) (
"SCHUR requires square matrix");
201 m_schur_mat.clear ();
202 m_unitary_schur_mat.clear ();
218 char ord_char = (ord.empty () ?
'U' : ord[0]);
220 if (ord_char ==
'A' || ord_char ==
'D'
221 || ord_char ==
'a' || ord_char ==
'd')
225 if (ord_char ==
'A' || ord_char ==
'a')
226 selector = select_ana;
227 else if (ord_char ==
'D' || ord_char ==
'd')
228 selector = select_dig;
241 m_unitary_schur_mat.
clear (
n,
n);
243 float *s = m_schur_mat.fortran_vec ();
244 float *q = m_unitary_schur_mat.fortran_vec ();
247 float *pwr = wr.fortran_vec ();
250 float *pwi = wi.fortran_vec ();
253 float *pwork = work.fortran_vec ();
256 F77_INT ntmp = (ord_char ==
'N' || ord_char ==
'n') ? 0 :
n;
258 F77_INT *pbwork = bwork.fortran_vec ();
261 F77_INT *piwork = iwork.fortran_vec ();
263 F77_XFCN (sgeesx, SGEESX, (F77_CONST_CHAR_ARG2 (&jobvs, 1),
264 F77_CONST_CHAR_ARG2 (&sort, 1),
266 F77_CONST_CHAR_ARG2 (&sense, 1),
267 n, s,
n, sdim, pwr, pwi, q,
n, rconde, rcondv,
268 pwork, lwork, piwork, liwork, pbwork, info
271 F77_CHAR_ARG_LEN (1)));
285 (*current_liboctave_error_handler) (
"SCHUR requires square matrix");
289 m_schur_mat.clear ();
290 m_unitary_schur_mat.clear ();
306 char ord_char = (ord.empty () ?
'U' : ord[0]);
308 if (ord_char ==
'A' || ord_char ==
'D'
309 || ord_char ==
'a' || ord_char ==
'd')
313 if (ord_char ==
'A' || ord_char ==
'a')
314 selector = select_ana;
315 else if (ord_char ==
'D' || ord_char ==
'd')
316 selector = select_dig;
327 m_unitary_schur_mat.
clear (
n,
n);
329 Complex *s = m_schur_mat.fortran_vec ();
330 Complex *q = m_unitary_schur_mat.fortran_vec ();
342 F77_INT ntmp = (ord_char ==
'N' || ord_char ==
'n') ? 0 :
n;
347 (F77_CONST_CHAR_ARG2 (&jobvs, 1),
348 F77_CONST_CHAR_ARG2 (&sort, 1),
350 F77_CONST_CHAR_ARG2 (&sense, 1),
356 F77_CHAR_ARG_LEN (1)));
370 if (s.columns () !=
n || u.rows () !=
n || u.columns () !=
n)
371 (*current_liboctave_error_handler)
372 (
"rsf2csf: inconsistent matrix dimensions");
390 const std::string& ord,
bool calc_unitary)
396 (*current_liboctave_error_handler) (
"SCHUR requires square matrix");
400 m_schur_mat.clear ();
401 m_unitary_schur_mat.clear ();
417 char ord_char = (ord.empty () ?
'U' : ord[0]);
419 if (ord_char ==
'A' || ord_char ==
'D'
420 || ord_char ==
'a' || ord_char ==
'd')
424 if (ord_char ==
'A' || ord_char ==
'a')
425 selector = select_ana;
426 else if (ord_char ==
'D' || ord_char ==
'd')
427 selector = select_dig;
438 m_unitary_schur_mat.
clear (
n,
n);
453 F77_INT ntmp = (ord_char ==
'N' || ord_char ==
'n') ? 0 :
n;
458 (F77_CONST_CHAR_ARG2 (&jobvs, 1),
459 F77_CONST_CHAR_ARG2 (&sort, 1),
461 F77_CONST_CHAR_ARG2 (&sense, 1),
468 F77_CHAR_ARG_LEN (1)));
483 if (s.columns () !=
n || u.rows () !=
n || u.columns () !=
n)
484 (*current_liboctave_error_handler)
485 (
"rsf2csf: inconsistent matrix dimensions");
510 OCTAVE_END_NAMESPACE(math)
511 OCTAVE_END_NAMESPACE(
octave)
T * fortran_vec()
Size of the specified dimension.
octave_idx_type rows() const
octave_idx_type cols() const
Vector representing the dimensions (size) of an Array.
subroutine crsf2csf(n, t, u, c, s)
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
#define F77_DBLE_CMPLX_ARG(x)
#define F77_XFCN(f, F, args)
double _Complex F77_DBLE_CMPLX
octave_f77_int_type F77_INT
schur< FloatComplexMatrix > rsf2csf< FloatComplexMatrix, FloatMatrix >(const FloatMatrix &s_arg, const FloatMatrix &u_arg)
schur< ComplexMatrix > rsf2csf< ComplexMatrix, Matrix >(const Matrix &s_arg, const Matrix &u_arg)
F77_INT(* float_complex_selector)(const F77_CMPLX &)
F77_INT(* float_selector)(const F77_REAL &, const F77_REAL &)
F77_INT(* double_selector)(const F77_DBLE &, const F77_DBLE &)
F77_INT(* complex_selector)(const F77_DBLE_CMPLX &)
std::complex< double > w(std::complex< double > z, double relerr=0)
std::complex< double > Complex
std::complex< float > FloatComplex
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
subroutine zrsf2csf(n, t, u, c, s)