457
|
1 // -*- C++ -*- |
|
2 /* |
|
3 |
1011
|
4 Copyright (C) 1992, 1993, 1994, 1995 John W. Eaton |
457
|
5 |
|
6 This file is part of Octave. |
|
7 |
|
8 Octave is free software; you can redistribute it and/or modify it |
|
9 under the terms of the GNU General Public License as published by the |
|
10 Free Software Foundation; either version 2, or (at your option) any |
|
11 later version. |
|
12 |
|
13 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
16 for more details. |
|
17 |
|
18 You should have received a copy of the GNU General Public License |
|
19 along with Octave; see the file COPYING. If not, write to the Free |
1315
|
20 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
457
|
21 |
|
22 */ |
|
23 |
1296
|
24 #if defined (__GNUG__) |
|
25 #pragma implementation |
|
26 #endif |
|
27 |
457
|
28 #ifdef HAVE_CONFIG_H |
1192
|
29 #include <config.h> |
457
|
30 #endif |
|
31 |
|
32 #include "CmplxAEPBAL.h" |
|
33 #include "dMatrix.h" |
|
34 #include "f77-uscore.h" |
|
35 |
|
36 extern "C" |
|
37 { |
1253
|
38 int F77_FCN (zgebal, ZGEBAL) (const char*, const int&, Complex*, |
|
39 const int&, int&, int&, double*, int&, |
|
40 long, long); |
457
|
41 |
1253
|
42 int F77_FCN (zgebak, ZGEBAK) (const char*, const char*, const int&, |
|
43 const int&, const int&, double*, const |
|
44 int&, Complex*, const int&, int&, |
|
45 long, long); |
457
|
46 } |
|
47 |
|
48 int |
|
49 ComplexAEPBALANCE::init (const ComplexMatrix& a, const char *balance_job) |
|
50 { |
|
51 |
|
52 int n = a.cols (); |
|
53 |
1360
|
54 // Parameters for balance call. |
457
|
55 |
|
56 int info; |
|
57 int ilo; |
|
58 int ihi; |
|
59 double *scale = new double [n]; |
|
60 |
1360
|
61 // Copy matrix into local structure. |
457
|
62 |
|
63 balanced_mat = a; |
|
64 |
1253
|
65 F77_FCN (zgebal, ZGEBAL) (balance_job, n, |
|
66 balanced_mat.fortran_vec (), n, ilo, ihi, |
|
67 scale, info, 1L, 1L); |
457
|
68 |
1360
|
69 // Initialize balancing matrix to identity. |
457
|
70 |
|
71 balancing_mat = Matrix (n, n, 0.0); |
|
72 for (int i = 0; i < n; i++) |
|
73 balancing_mat (i, i) = 1.0; |
|
74 |
1253
|
75 F77_FCN (zgebak, ZGEBAK) (balance_job, "R", n, ilo, ihi, scale, n, |
|
76 balancing_mat.fortran_vec (), n, info, 1L, |
|
77 1L); |
457
|
78 |
|
79 delete [] scale; |
|
80 |
|
81 return info; |
|
82 } |
|
83 |
|
84 /* |
|
85 ;;; Local Variables: *** |
|
86 ;;; mode: C++ *** |
|
87 ;;; page-delimiter: "^/\\*" *** |
|
88 ;;; End: *** |
|
89 */ |