comparison liboctave/NPSOL.cc @ 1253:bb67a902760b

[project @ 1995-04-11 16:35:23 by jwe]
author jwe
date Tue, 11 Apr 1995 16:35:23 +0000
parents 97eac19837dc
children f93b7fa5e113
comparison
equal deleted inserted replaced
1252:ccb22498f289 1253:bb67a902760b
38 #include "f77-uscore.h" 38 #include "f77-uscore.h"
39 #include "sun-utils.h" 39 #include "sun-utils.h"
40 40
41 extern "C" 41 extern "C"
42 { 42 {
43 int F77_FCN (npoptn) (const char*, long); 43 int F77_FCN (npoptn, NPOPTN) (const char*, long);
44 44
45 int F77_FCN (npsol) (int&, int&, int&, int&, int&, int&, double*, 45 int F77_FCN (npsol, NPSOL) (int&, int&, int&, int&, int&, int&,
46 double*, double*, 46 double*, double*, double*,
47 int (*)(int&, const int&, const int&, const 47 int (*)(int&, const int&, const int&,
48 int&, int*, double*, double*, double*, 48 const int&, int*, double*,
49 int*), 49 double*, double*, int*),
50 int (*)(int&, const int&, double*, double*, 50 int (*)(int&, const int&, double*,
51 double*, int*), 51 double*, double*, int*),
52 int&, int&, int*, double*, double*, double*, 52 int&, int&, int*, double*, double*,
53 double&, double*, double*, double*, int*, int&, 53 double*, double&, double*, double*,
54 double*, int&); 54 double*, int*, int&, double*, int&);
55 } 55 }
56 56
57 // XXX FIXME XXX -- would be nice to not have to have this global 57 // XXX FIXME XXX -- would be nice to not have to have this global
58 // variable. 58 // variable.
59 // Nonzero means an error occurred in the calculation of the objective 59 // Nonzero means an error occurred in the calculation of the objective
286 user_jac = nlc.jacobian_function (); 286 user_jac = nlc.jacobian_function ();
287 287
288 pass_options_to_npsol (); 288 pass_options_to_npsol ();
289 289
290 if (! user_jac && ! user_grad) 290 if (! user_jac && ! user_grad)
291 F77_FCN (npoptn) ("Derivative Level 0", 18L); 291 F77_FCN (npoptn, NPOPTN) ("Derivative Level 0", 18L);
292 else if (! user_jac && user_grad) 292 else if (! user_jac && user_grad)
293 F77_FCN (npoptn) ("Derivative Level 1", 18L); 293 F77_FCN (npoptn, NPOPTN) ("Derivative Level 1", 18L);
294 else if (user_jac && ! user_grad) 294 else if (user_jac && ! user_grad)
295 F77_FCN (npoptn) ("Derivative Level 2", 18L); 295 F77_FCN (npoptn, NPOPTN) ("Derivative Level 2", 18L);
296 else if (user_jac && user_grad) 296 else if (user_jac && user_grad)
297 F77_FCN (npoptn) ("Derivative Level 3", 18L); 297 F77_FCN (npoptn, NPOPTN) ("Derivative Level 3", 18L);
298 298
299 int attempt = 0; 299 int attempt = 0;
300 while (attempt++ < 5) 300 while (attempt++ < 5)
301 { 301 {
302 302
303 F77_FCN (npsol) (n, nclin, ncnln, nrowa, nrowj, nrowr, pclin, 303 F77_FCN (npsol, NPSOL) (n, nclin, ncnln, nrowa, nrowj, nrowr,
304 clow, cup, npsol_confun, npsol_objfun, inform, 304 pclin, clow, cup, npsol_confun,
305 iter, istate, c, cjac, pclambda, objf, objgrd, r, 305 npsol_objfun, inform, iter, istate, c,
306 px, iw, leniw, w, lenw); 306 cjac, pclambda, objf, objgrd, r, px, iw,
307 leniw, w, lenw);
307 308
308 if (inform == 6 || inform == 1) 309 if (inform == 6 || inform == 1)
309 continue; 310 continue;
310 else 311 else
311 break; 312 break;
690 } 691 }
691 692
692 void 693 void
693 NPSOL_options::pass_options_to_npsol (void) 694 NPSOL_options::pass_options_to_npsol (void)
694 { 695 {
695 F77_FCN (npoptn) ("Nolist", 6L); 696 F77_FCN (npoptn, NPOPTN) ("Nolist", 6L);
696 F77_FCN (npoptn) ("Defaults", 8L); 697 F77_FCN (npoptn, NPOPTN) ("Defaults", 8L);
697 698
698 if (x_central_difference_interval > 0.0) 699 if (x_central_difference_interval > 0.0)
699 set_option ("Central Difference", x_central_difference_interval); 700 set_option ("Central Difference", x_central_difference_interval);
700 701
701 set_option ("Crash Tolerance", x_crash_tolerance); 702 set_option ("Crash Tolerance", x_crash_tolerance);
747 { 748 {
748 ostrstream buf; 749 ostrstream buf;
749 buf << key << " " << opt << ends; 750 buf << key << " " << opt << ends;
750 char *command = buf.str (); 751 char *command = buf.str ();
751 size_t len = strlen (command); 752 size_t len = strlen (command);
752 F77_FCN (npoptn) (command, (long) len); 753 F77_FCN (npoptn, NPOPTN) (command, (long) len);
753 delete [] command; 754 delete [] command;
754 } 755 }
755 756
756 void 757 void
757 NPSOL_options::set_option (const char *key, double opt) 758 NPSOL_options::set_option (const char *key, double opt)
758 { 759 {
759 ostrstream buf; 760 ostrstream buf;
760 buf << key << " " << opt << ends; 761 buf << key << " " << opt << ends;
761 char *command = buf.str (); 762 char *command = buf.str ();
762 size_t len = strlen (command); 763 size_t len = strlen (command);
763 F77_FCN (npoptn) (command, (long) len); 764 F77_FCN (npoptn, NPOPTN) (command, (long) len);
764 delete [] command; 765 delete [] command;
765 } 766 }
766 767
767 #endif /* NPSOL_MISSING */ 768 #endif /* NPSOL_MISSING */
768 769