~ubuntu-branches/ubuntu/karmic/scilab/karmic

« back to all changes in this revision

Viewing changes to routines/optim/n1gc2.f

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2002-03-21 16:57:43 UTC
  • Revision ID: james.westby@ubuntu.com-20020321165743-e9mv12c1tb1plztg
Tags: upstream-2.6
ImportĀ upstreamĀ versionĀ 2.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
      subroutine n1gc2 (simul,prosca,n,x,f,g,dxmin,df1,epsrel,imp,io,
 
2
     /                  mode,niter,nsim,rz,nrz,izs,rzs,dzs)
 
3
      implicit double precision (a-h,o-z)
 
4
c!but
 
5
c     minimisation sans contraintes par un algorithme de quasi-Newton
 
6
c     a memoire limitee
 
7
c!origine
 
8
c     c. lemarechal, inria, 1987
 
9
c     Copyright INRIA
 
10
c!commentaires
 
11
c le sous-programme n1gc2 (gradient conjugue a encombrement variable)
 
12
c est une interface entre le programme appelant et le sous-programme
 
13
c n1gc2a, minimiseur proprement dit.
 
14
c nrz est la dimension declaree pour le tableau de travail rz.
 
15
c rz est subdivise en 4 vecteurs de dimension n
 
16
c                     et un tableau de dimension memh.
 
17
c memh est la dimension allouee a la matrice de quasi newton h.
 
18
c pour l'usage de la liste d'appel : voir la documentation de n1qn1
 
19
c!
 
20
      double precision  zero, un
 
21
      parameter ( zero=0.0d+0 , un=1.0d+0 )
 
22
c declaration des tableaux
 
23
      double precision   x(n), g(n), rz(nrz), dzs(*)
 
24
      real rzs(*)
 
25
      integer izs(*)
 
26
c declaration des scalaires
 
27
      double precision   f, epsrel, dxmin, df1
 
28
      integer   n, nrz, imp, nsim, mode
 
29
      integer    id, ix, ig, iaux, ih, memh
 
30
c
 
31
      external    simul, prosca
 
32
c
 
33
      if (imp .gt. 0) write(io,1)n,nrz,niter,nsim,imp,
 
34
     / epsrel,df1,dxmin
 
35
1     format(19h entree dans n1gc2:,6x,22hdimension du probleme ,
 
36
     /i3/2x,4hnrz=,i4,4x,6hniter=,i3,4x,5hnsim=,i4,4x,4himp=,i3/2x,
 
37
     /7hepsrel=,d8.2,4x,4hdf1=,d8.2,4x,6hdxmin=,d8.2)
 
38
      if ( n.le.0 .or. niter.le.0 .or. nsim.le.0 .or.
 
39
     / dxmin.le.zero .or. df1.le.zero
 
40
     / .or. epsrel.le.zero .or. epsrel.gt.un ) then
 
41
      mode=2
 
42
      if (imp .gt. 0) write(io,3)
 
43
      return
 
44
      endif
 
45
c
 
46
c calculs des pointeurs destines a subdiviser le tableau rz
 
47
      id=1
 
48
      ix=id +n
 
49
      ig=ix +n
 
50
      iaux=ig +n
 
51
      ih=iaux + n
 
52
c
 
53
c calcul du nombre de places memoire affectees a h
 
54
      memh=nrz - 4*n
 
55
c
 
56
      if (memh .le. 0) then
 
57
      mode=3
 
58
      goto 100
 
59
      else
 
60
      continue
 
61
      endif
 
62
c
 
63
c appel du sous-programme n1gc2a qui effectue la reelle optimisation
 
64
      call n1gc2a(simul,prosca,n,x,f,g,dxmin,df1,epsrel,imp,io,
 
65
     /            niter,nsim,mode,memh,rz(id),rz(ix),rz(ig),
 
66
     /            rz(iaux),rz(ih),izs,rzs,dzs)
 
67
c
 
68
100   if (imp .gt. 0) then
 
69
      if (mode .eq. 3) then
 
70
      write(io,2)
 
71
      else if (mode .eq. 6) then
 
72
      write(io,4)
 
73
      else
 
74
      write(io,5)epsrel,niter,nsim
 
75
      endif
 
76
      endif
 
77
      return
 
78
2     format(/,38h n1gc2   rz insuffisamment dimensionne)
 
79
3     format(/,25h n1gc2   appel incoherent)
 
80
4     format(/,22h n1gc2   fin sur dxmin)
 
81
5     format(/,16h sortie de n1gc2,7x,12hnorme de g =,d15.9/9x,
 
82
     / 6hniter=,i4,4x,5hnsim=,i5)
 
83
      end