comparison liboctave/NLEqn.cc @ 4180:84fe3ca3a246

[project @ 2002-11-15 04:47:01 by jwe]
author jwe
date Fri, 15 Nov 2002 04:47:02 +0000
parents 87eb044020ae
children 5719210fff4c
comparison
equal deleted inserted replaced
4179:8734ba917fea 4180:84fe3ca3a246
30 30
31 #include "NLEqn.h" 31 #include "NLEqn.h"
32 #include "dMatrix.h" 32 #include "dMatrix.h"
33 #include "f77-fcn.h" 33 #include "f77-fcn.h"
34 #include "lo-error.h" 34 #include "lo-error.h"
35 #include "quit.h"
35 36
36 typedef int (*hybrd1_fcn_ptr) (int*, double*, double*, int*); 37 typedef int (*hybrd1_fcn_ptr) (int*, double*, double*, int*);
37 38
38 extern "C" 39 extern "C"
39 int F77_FUNC (hybrd1, HYBRD1) (hybrd1_fcn_ptr, const int&, double*, 40 int F77_FUNC (hybrd1, HYBRD1) (hybrd1_fcn_ptr, const int&, double*,
61 // Other operations 62 // Other operations
62 63
63 int 64 int
64 hybrd1_fcn (int *n, double *x, double *fvec, int *iflag) 65 hybrd1_fcn (int *n, double *x, double *fvec, int *iflag)
65 { 66 {
67 BEGIN_INTERRUPT_WITH_EXCEPTIONS;
68
66 int nn = *n; 69 int nn = *n;
67 ColumnVector tmp_f (nn); 70 ColumnVector tmp_f (nn);
68 ColumnVector tmp_x (nn); 71 ColumnVector tmp_x (nn);
69 72
70 for (int i = 0; i < nn; i++) 73 for (int i = 0; i < nn; i++)
78 { 81 {
79 for (int i = 0; i < nn; i++) 82 for (int i = 0; i < nn; i++)
80 fvec[i] = tmp_f.elem (i); 83 fvec[i] = tmp_f.elem (i);
81 } 84 }
82 85
86 END_INTERRUPT_WITH_EXCEPTIONS;
87
83 return 0; 88 return 0;
84 } 89 }
85 90
86 int 91 int
87 hybrj1_fcn (int *n, double *x, double *fvec, double *fjac, 92 hybrj1_fcn (int *n, double *x, double *fvec, double *fjac,
88 int *ldfjac, int *iflag) 93 int *ldfjac, int *iflag)
89 { 94 {
95 BEGIN_INTERRUPT_WITH_EXCEPTIONS;
96
90 int nn = *n; 97 int nn = *n;
91 ColumnVector tmp_x (nn); 98 ColumnVector tmp_x (nn);
92 99
93 for (int i = 0; i < nn; i++) 100 for (int i = 0; i < nn; i++)
94 tmp_x.elem (i) = x[i]; 101 tmp_x.elem (i) = x[i];
123 for (int i = 0; i < nn; i++) 130 for (int i = 0; i < nn; i++)
124 fjac[j*ld+i] = tmp_fj.elem (i, j); 131 fjac[j*ld+i] = tmp_fj.elem (i, j);
125 } 132 }
126 } 133 }
127 134
135 END_INTERRUPT_WITH_EXCEPTIONS;
136
128 return 0; 137 return 0;
129 } 138 }
130 139
131 ColumnVector 140 ColumnVector
132 NLEqn::solve (int& info) 141 NLEqn::solve (int& info)