File: fsolvf.f

package info (click to toggle)
scilab 2.2-4
  • links: PTS
  • area: non-free
  • in suites: hamm
  • size: 31,472 kB
  • ctags: 21,963
  • sloc: fortran: 110,983; ansic: 89,717; makefile: 3,016; sh: 1,892; csh: 150; cpp: 101
file content (58 lines) | stat: -rw-r--r-- 1,647 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
      subroutine fsolvf(n,x,fvec,iflag)
c interface for fsolve fortran external
      include '../stack.h'
      integer n,iflag
      double precision x(n),fvec(n)
      character*6 namef,namej,name
      common/csolve/namef,namej
c
      call majmin(6,namef,name)
c INSERT CALL TO YOUR OWN ROUTINE HERE 
c The routine myprog is an example: it is called when the
c string 'myprog' is given as a parameter 
c in the calling sequence of scilab's fsolve built-in
c function 

c+
      if(name.eq.'myprog') then
c         call myprog(n,x,fvec,iflag)
         return
      endif
c+
c     dynamic link
      call tlink(name,0,it1)
      if(it1.le.0) goto 2000
      call dyncall(it1-1,n,x,fvec,iflag)
cc    fin
      return
c
 2000 indsim=0
      buf=name
      call error(50)
      return
      end

c         subroutine myprog(n,x,fvec,iflag)
c         integer n,iflag
c         double precision x(n),fvec(n)
c         ----------
c         calculate the functions at x and
c         return this vector in fvec.
c         ---------
c         return
c         end
c
c         the value of iflag should not be changed by fcn unless
c         the user wants to terminate execution of hybrd.
c         in this case set iflag to a negative integer.
c
c       n is a positive integer input variable set to the number
c         of functions and variables.
c
c       x is an array of length n. on input x must contain
c         an initial estimate of the solution vector. on output x
c         contains the final estimate of the solution vector.
c
c       fvec is an output array of length n which contains
c         the functions evaluated at the output x.