diff liboctave/CmplxSCHUR.cc @ 10822:23d2378512a0

implement rsf2csf
author Jaroslav Hajek <highegg@gmail.com>
date Tue, 27 Jul 2010 11:26:43 +0200
parents f7501986e42d
children 8a5e980da6aa
line wrap: on
line diff
--- a/liboctave/CmplxSCHUR.cc	Mon Jul 26 21:25:36 2010 -0700
+++ b/liboctave/CmplxSCHUR.cc	Tue Jul 27 11:26:43 2010 +0200
@@ -28,6 +28,7 @@
 #include "CmplxSCHUR.h"
 #include "f77-fcn.h"
 #include "lo-error.h"
+#include "oct-locbuf.h"
 
 extern "C"
 {
@@ -43,6 +44,9 @@
                              F77_CHAR_ARG_LEN_DECL
                              F77_CHAR_ARG_LEN_DECL
                              F77_CHAR_ARG_LEN_DECL);
+  F77_RET_T
+  F77_FUNC (zrsf2csf, ZRSF2CSF) (const octave_idx_type&,
+                                 Complex *, Complex *, double *, double *);
 }
 
 static octave_idx_type
@@ -140,3 +144,27 @@
 
   return info;
 }
+
+ComplexSCHUR::ComplexSCHUR (const ComplexMatrix& s, 
+                            const ComplexMatrix& u)
+: schur_mat (s), unitary_mat (u)
+{
+  octave_idx_type n = s.rows ();
+  if (s.columns () != n || u.rows () != n || u.columns () != n)
+    (*current_liboctave_error_handler)
+      ("schur: inconsistent matrix dimensions");
+}
+
+ComplexSCHUR::ComplexSCHUR (const SCHUR& s)
+: schur_mat (s.schur_matrix ()), unitary_mat (s.unitary_matrix ())
+{
+  octave_idx_type n = schur_mat.rows ();
+  if (n > 0)
+    {
+      OCTAVE_LOCAL_BUFFER (double, c, n-1);
+      OCTAVE_LOCAL_BUFFER (double, sx, n-1);
+
+      F77_XFCN (zrsf2csf, ZRSF2CSF, (n, schur_mat.fortran_vec (),
+                                     unitary_mat.fortran_vec (), c, sx));
+    }
+}