comparison src/expm.cc @ 1246:35950c102ac3

[project @ 1995-04-11 00:49:24 by jwe]
author jwe
date Tue, 11 Apr 1995 00:49:24 +0000
parents b6360f2d4fa6
children fa24599e3d2c
comparison
equal deleted inserted replaced
1245:85d1899047e1 1246:35950c102ac3
44 #include "help.h" 44 #include "help.h"
45 #include "defun-dld.h" 45 #include "defun-dld.h"
46 46
47 extern "C" 47 extern "C"
48 { 48 {
49 double F77_FCN (dlange) (const char*, const int*, const int*, 49 double F77_FCN (dlange) (const char*, const int&, const int&,
50 const double*, const int*, double*); 50 const double*, const int&, double*);
51 51
52 double F77_FCN (zlange) (const char*, const int*, const int*, 52 double F77_FCN (zlange) (const char*, const int&, const int&,
53 const Complex*, const int*, double*); 53 const Complex*, const int&, double*);
54 } 54 }
55 55
56 DEFUN_DLD_BUILTIN ("expm", Fexpm, Sexpm, 2, 1, 56 DEFUN_DLD_BUILTIN ("expm", Fexpm, Sexpm, 2, 1,
57 "expm (X): matrix exponential, e^A") 57 "expm (X): matrix exponential, e^A")
58 { 58 {
133 Matrix d = mbal.balancing_matrix (); 133 Matrix d = mbal.balancing_matrix ();
134 134
135 // Preconditioning step 3: scaling. 135 // Preconditioning step 3: scaling.
136 136
137 ColumnVector work(nc); 137 ColumnVector work(nc);
138 inf_norm = F77_FCN (dlange) ("I", &nc, &nc, 138 inf_norm = F77_FCN (dlange) ("I", nc, nc, m.fortran_vec (), nc,
139 m.fortran_vec (), &nc,
140 work.fortran_vec ()); 139 work.fortran_vec ());
141 140
142 sqpow = (int) (1.0 + log (inf_norm) / log (2.0)); 141 sqpow = (int) (1.0 + log (inf_norm) / log (2.0));
143 142
144 // Check whether we need to square at all. 143 // Check whether we need to square at all.
226 ComplexMatrix d = mbal.balancing_matrix (); 225 ComplexMatrix d = mbal.balancing_matrix ();
227 226
228 // Preconditioning step 3: scaling. 227 // Preconditioning step 3: scaling.
229 228
230 ColumnVector work (nc); 229 ColumnVector work (nc);
231 inf_norm = F77_FCN (zlange) ("I", &nc, &nc, m. 230 inf_norm = F77_FCN (zlange) ("I", nc, nc, m.fortran_vec (), nc,
232 fortran_vec (), &nc,
233 work.fortran_vec ()); 231 work.fortran_vec ());
234 232
235 sqpow = (int) (1.0 + log (inf_norm) / log (2.0)); 233 sqpow = (int) (1.0 + log (inf_norm) / log (2.0));
236 234
237 // Check whether we need to square at all. 235 // Check whether we need to square at all.