Mercurial > octave
comparison src/syl.cc @ 1245:85d1899047e1
[project @ 1995-04-11 00:45:35 by jwe]
author | jwe |
---|---|
date | Tue, 11 Apr 1995 00:45:35 +0000 |
parents | b6360f2d4fa6 |
children | fa24599e3d2c |
comparison
equal
deleted
inserted
replaced
1244:f0ad21c0b3a6 | 1245:85d1899047e1 |
---|---|
41 #include "help.h" | 41 #include "help.h" |
42 #include "defun-dld.h" | 42 #include "defun-dld.h" |
43 | 43 |
44 extern "C" | 44 extern "C" |
45 { | 45 { |
46 int F77_FCN (dtrsyl) (const char*, const char*, const int*, | 46 int F77_FCN (dtrsyl) (const char*, const char*, const int&, |
47 const int*, const int*, const double*, | 47 const int&, const int&, const double*, |
48 const int*, const double*, const int*, | 48 const int&, const double*, const int&, |
49 const double*, const int*, double*, int*, | 49 const double*, const int&, double&, int&, |
50 long, long); | 50 long, long); |
51 | 51 |
52 int F77_FCN (ztrsyl) (const char*, const char*, const int*, | 52 int F77_FCN (ztrsyl) (const char*, const char*, const int&, |
53 const int*, const int*, const Complex*, | 53 const int&, const int&, const Complex*, |
54 const int*, const Complex*, const int*, | 54 const int&, const Complex*, const int&, |
55 const Complex*, const int*, double*, int*, | 55 const Complex*, const int&, double&, int&, |
56 long, long); | 56 long, long); |
57 } | 57 } |
58 | 58 |
59 DEFUN_DLD_BUILTIN ("syl", Fsyl, Ssyl, 4, 1, | 59 DEFUN_DLD_BUILTIN ("syl", Fsyl, Ssyl, 4, 1, |
60 "X = syl (A, B, C): solve the Sylvester equation A X + X B + C = 0") | 60 "X = syl (A, B, C): solve the Sylvester equation A X + X B + C = 0") |
144 | 144 |
145 // Solve the sylvester equation, back-transform, and return the solution. | 145 // Solve the sylvester equation, back-transform, and return the solution. |
146 | 146 |
147 double scale; | 147 double scale; |
148 int info; | 148 int info; |
149 int one = 1; | 149 |
150 | 150 F77_FCN (ztrsyl) ("N", "N", 1, a_nr, b_nr, |
151 F77_FCN (ztrsyl) ("N", "N", &one, &a_nr, &b_nr, | 151 sch_a.fortran_vec (), a_nr, |
152 sch_a.fortran_vec (), &a_nr, | 152 sch_b.fortran_vec (), b_nr, |
153 sch_b.fortran_vec (), &b_nr, | 153 cx.fortran_vec (), a_nr, scale, info, |
154 cx.fortran_vec (), &a_nr, &scale, &info, | |
155 1L, 1L); | 154 1L, 1L); |
156 | 155 |
157 cx = -ua * cx * ub.hermitian (); | 156 cx = -ua * cx * ub.hermitian (); |
158 | 157 |
159 retval = cx; | 158 retval = cx; |
194 | 193 |
195 // Solve the sylvester equation, back-transform, and return the solution. | 194 // Solve the sylvester equation, back-transform, and return the solution. |
196 | 195 |
197 double scale; | 196 double scale; |
198 int info; | 197 int info; |
199 int one = 1; | 198 |
200 | 199 F77_FCN (dtrsyl) ("N", "N", 1, a_nr, b_nr, |
201 F77_FCN (dtrsyl) ("N", "N", &one, &a_nr, &b_nr, | 200 sch_a.fortran_vec (), a_nr, |
202 sch_a.fortran_vec (), &a_nr, | 201 sch_b.fortran_vec (), b_nr, |
203 sch_b.fortran_vec (), &b_nr, | 202 cx.fortran_vec (), a_nr, scale, info, |
204 cx.fortran_vec (), &a_nr, &scale, &info, | |
205 1L, 1L); | 203 1L, 1L); |
206 | 204 |
207 if (info) | 205 if (info) |
208 error ("syl: trouble in dtrsyl info = %d", info); | 206 error ("syl: trouble in dtrsyl info = %d", info); |
209 | 207 |