Reorganization
Allan Cornet [Thu, 3 Aug 2006 14:10:50 +0000 (14:10 +0000)]
Optimization module

routines/optim --> modules/optimization/src
man/* --> modules/optimization/help/*
macros/optim --> modules/optimization/macros
routines/interf/matopt.f --> modules/optimization/sci_gateway/matopt.f

to do : rewrite matopt.f in C

177 files changed:
scilab/Scilab.sln
scilab/Scilab_f2c.sln
scilab/macros/buildmacros.sce
scilab/modules/optimization/changelog.txt [new file with mode: 0644]
scilab/modules/optimization/etc/optimization.quit [new file with mode: 0644]
scilab/modules/optimization/etc/optimization.start [new file with mode: 0644]
scilab/modules/optimization/help/eng/NDcost.xml [new file with mode: 0644]
scilab/modules/optimization/help/eng/bvode.xml [new file with mode: 0644]
scilab/modules/optimization/help/eng/bvodeS.xml [new file with mode: 0644]
scilab/modules/optimization/help/eng/datafit.xml [new file with mode: 0644]
scilab/modules/optimization/help/eng/fit_dat.xml [new file with mode: 0644]
scilab/modules/optimization/help/eng/fsolve.xml [new file with mode: 0644]
scilab/modules/optimization/help/eng/helpbuildereng.sce [new file with mode: 0644]
scilab/modules/optimization/help/eng/karmarkar.xml [new file with mode: 0644]
scilab/modules/optimization/help/eng/leastsq.xml [new file with mode: 0644]
scilab/modules/optimization/help/eng/linpro.xml [new file with mode: 0644]
scilab/modules/optimization/help/eng/lmisolver.xml [new file with mode: 0644]
scilab/modules/optimization/help/eng/lmitool.xml [new file with mode: 0644]
scilab/modules/optimization/help/eng/lsqrsolve.xml [new file with mode: 0644]
scilab/modules/optimization/help/eng/mps2linpro.xml [new file with mode: 0644]
scilab/modules/optimization/help/eng/numdiff.xml [new file with mode: 0644]
scilab/modules/optimization/help/eng/optim.xml [new file with mode: 0644]
scilab/modules/optimization/help/eng/qld.xml [new file with mode: 0644]
scilab/modules/optimization/help/eng/quapro.xml [new file with mode: 0644]
scilab/modules/optimization/help/eng/semidef.xml [new file with mode: 0644]
scilab/modules/optimization/help/fr/NDcost.xml [new file with mode: 0644]
scilab/modules/optimization/help/fr/bvodeS.xml [new file with mode: 0644]
scilab/modules/optimization/help/fr/datafit.xml [new file with mode: 0644]
scilab/modules/optimization/help/fr/fit_dat.xml [new file with mode: 0644]
scilab/modules/optimization/help/fr/fsolve.xml [new file with mode: 0644]
scilab/modules/optimization/help/fr/helpbuilderfr.sce [new file with mode: 0644]
scilab/modules/optimization/help/fr/karmarkar.xml [new file with mode: 0644]
scilab/modules/optimization/help/fr/leastsq.xml [new file with mode: 0644]
scilab/modules/optimization/help/fr/linpro.xml [new file with mode: 0644]
scilab/modules/optimization/help/fr/lmisolver.xml [new file with mode: 0644]
scilab/modules/optimization/help/fr/lmitool.xml [new file with mode: 0644]
scilab/modules/optimization/help/fr/lsqrsolve.xml [new file with mode: 0644]
scilab/modules/optimization/help/fr/mps2linpro.xml [new file with mode: 0644]
scilab/modules/optimization/help/fr/numdiff.xml [new file with mode: 0644]
scilab/modules/optimization/help/fr/optim.xml [new file with mode: 0644]
scilab/modules/optimization/help/fr/qld.xml [new file with mode: 0644]
scilab/modules/optimization/help/fr/quapro.xml [new file with mode: 0644]
scilab/modules/optimization/help/fr/semidef.xml [new file with mode: 0644]
scilab/modules/optimization/help/helpbuilder.sce [new file with mode: 0644]
scilab/modules/optimization/includes/spd.h [moved from scilab/routines/optim/spd.h with 97% similarity]
scilab/modules/optimization/licence.txt [new file with mode: 0644]
scilab/modules/optimization/macros/NDcost.sci [moved from scilab/macros/optim/NDcost.sci with 100% similarity]
scilab/modules/optimization/macros/aplat.sci [moved from scilab/macros/optim/aplat.sci with 100% similarity]
scilab/modules/optimization/macros/buildmacros.sce [moved from scilab/macros/optim/buildmacros.sce with 81% similarity]
scilab/modules/optimization/macros/bvodeS.sci [moved from scilab/macros/optim/bvodeS.sci with 100% similarity]
scilab/modules/optimization/macros/datafit.sci [moved from scilab/macros/optim/datafit.sci with 100% similarity]
scilab/modules/optimization/macros/fit_dat.sci [moved from scilab/macros/optim/fit_dat.sci with 100% similarity]
scilab/modules/optimization/macros/karmarkar.sci [moved from scilab/macros/optim/karmarkar.sci with 100% similarity]
scilab/modules/optimization/macros/leastsq.sci [moved from scilab/macros/optim/leastsq.sci with 100% similarity]
scilab/modules/optimization/macros/linpro.sci [moved from scilab/macros/optim/linpro.sci with 100% similarity]
scilab/modules/optimization/macros/list2vec.sci [moved from scilab/macros/optim/list2vec.sci with 100% similarity]
scilab/modules/optimization/macros/lmisolver.sci [moved from scilab/macros/optim/lmisolver.sci with 100% similarity]
scilab/modules/optimization/macros/lmitool.sci [moved from scilab/macros/optim/lmitool.sci with 100% similarity]
scilab/modules/optimization/macros/numdiff.sci [moved from scilab/macros/optim/numdiff.sci with 100% similarity]
scilab/modules/optimization/macros/pack.sci [moved from scilab/macros/optim/pack.sci with 100% similarity]
scilab/modules/optimization/macros/pencost.sci [moved from scilab/macros/optim/pencost.sci with 100% similarity]
scilab/modules/optimization/macros/quapro.sci [moved from scilab/macros/optim/quapro.sci with 100% similarity]
scilab/modules/optimization/macros/unpack.sci [moved from scilab/macros/optim/unpack.sci with 100% similarity]
scilab/modules/optimization/macros/vec2list.sci [moved from scilab/macros/optim/vec2list.sci with 100% similarity]
scilab/modules/optimization/readme.txt [new file with mode: 0644]
scilab/modules/optimization/sci_gateway/matopt.f [moved from scilab/routines/interf/matopt.f with 99% similarity]
scilab/modules/optimization/sci_gateway/optim.fundef [moved from scilab/routines/optim/optim.fundef with 100% similarity]
scilab/modules/optimization/src/Makefile [moved from scilab/routines/optim/Makefile with 100% similarity]
scilab/modules/optimization/src/c/optim.vcproj [moved from scilab/routines/optim/optim.vcproj with 78% similarity]
scilab/modules/optimization/src/c/sp.c [moved from scilab/routines/optim/sp.c with 100% similarity]
scilab/modules/optimization/src/fortran/ajour.f [moved from scilab/routines/optim/ajour.f with 100% similarity]
scilab/modules/optimization/src/fortran/anfm01.f [moved from scilab/routines/optim/anfm01.f with 100% similarity]
scilab/modules/optimization/src/fortran/anfm02.f [moved from scilab/routines/optim/anfm02.f with 100% similarity]
scilab/modules/optimization/src/fortran/anfm03.f [moved from scilab/routines/optim/anfm03.f with 100% similarity]
scilab/modules/optimization/src/fortran/anfm04.f [moved from scilab/routines/optim/anfm04.f with 100% similarity]
scilab/modules/optimization/src/fortran/anfm05.f [moved from scilab/routines/optim/anfm05.f with 100% similarity]
scilab/modules/optimization/src/fortran/anfm06.f [moved from scilab/routines/optim/anfm06.f with 100% similarity]
scilab/modules/optimization/src/fortran/anrs01.f [moved from scilab/routines/optim/anrs01.f with 100% similarity]
scilab/modules/optimization/src/fortran/anrs02.f [moved from scilab/routines/optim/anrs02.f with 100% similarity]
scilab/modules/optimization/src/fortran/aux003.f [moved from scilab/routines/optim/aux003.f with 100% similarity]
scilab/modules/optimization/src/fortran/auxo01.f [moved from scilab/routines/optim/auxo01.f with 100% similarity]
scilab/modules/optimization/src/fortran/bfgsd.f [moved from scilab/routines/optim/bfgsd.f with 100% similarity]
scilab/modules/optimization/src/fortran/calbx.f [moved from scilab/routines/optim/calbx.f with 100% similarity]
scilab/modules/optimization/src/fortran/calmaj.f [moved from scilab/routines/optim/calmaj.f with 100% similarity]
scilab/modules/optimization/src/fortran/ctcab.f [moved from scilab/routines/optim/ctcab.f with 100% similarity]
scilab/modules/optimization/src/fortran/ctonb.f [moved from scilab/routines/optim/ctonb.f with 100% similarity]
scilab/modules/optimization/src/fortran/dcube.f [moved from scilab/routines/optim/dcube.f with 100% similarity]
scilab/modules/optimization/src/fortran/ddd2.f [moved from scilab/routines/optim/ddd2.f with 100% similarity]
scilab/modules/optimization/src/fortran/desr03.f [moved from scilab/routines/optim/desr03.f with 100% similarity]
scilab/modules/optimization/src/fortran/dimp03.f [moved from scilab/routines/optim/dimp03.f with 100% similarity]
scilab/modules/optimization/src/fortran/dipvtf.f [moved from scilab/routines/optim/dipvtf.f with 100% similarity]
scilab/modules/optimization/src/fortran/dnrm0.f [moved from scilab/routines/optim/dnrm0.f with 100% similarity]
scilab/modules/optimization/src/fortran/dogleg.f [moved from scilab/routines/optim/dogleg.f with 100% similarity]
scilab/modules/optimization/src/fortran/dpmpar.f [moved from scilab/routines/optim/dpmpar.f with 100% similarity]
scilab/modules/optimization/src/fortran/enorm.f [moved from scilab/routines/optim/enorm.f with 100% similarity]
scilab/modules/optimization/src/fortran/fajc1.f [moved from scilab/routines/optim/fajc1.f with 100% similarity]
scilab/modules/optimization/src/fortran/fcomp1.f [moved from scilab/routines/optim/fcomp1.f with 100% similarity]
scilab/modules/optimization/src/fortran/fcube.f [moved from scilab/routines/optim/fcube.f with 100% similarity]
scilab/modules/optimization/src/fortran/fdjac1.f [moved from scilab/routines/optim/fdjac1.f with 100% similarity]
scilab/modules/optimization/src/fortran/fdjac2.f [moved from scilab/routines/optim/fdjac2.f with 100% similarity]
scilab/modules/optimization/src/fortran/ffinf1.f [moved from scilab/routines/optim/ffinf1.f with 100% similarity]
scilab/modules/optimization/src/fortran/fmani1.f [moved from scilab/routines/optim/fmani1.f with 100% similarity]
scilab/modules/optimization/src/fortran/fmc11a.f [moved from scilab/routines/optim/fmc11a.f with 100% similarity]
scilab/modules/optimization/src/fortran/fmc11b.f [moved from scilab/routines/optim/fmc11b.f with 100% similarity]
scilab/modules/optimization/src/fortran/fmc11e.f [moved from scilab/routines/optim/fmc11e.f with 100% similarity]
scilab/modules/optimization/src/fortran/fmc11z.f [moved from scilab/routines/optim/fmc11z.f with 100% similarity]
scilab/modules/optimization/src/fortran/fmlag1.f [moved from scilab/routines/optim/fmlag1.f with 100% similarity]
scilab/modules/optimization/src/fortran/fmulb1.f [moved from scilab/routines/optim/fmulb1.f with 100% similarity]
scilab/modules/optimization/src/fortran/fmuls1.f [moved from scilab/routines/optim/fmuls1.f with 100% similarity]
scilab/modules/optimization/src/fortran/fpq2.f [moved from scilab/routines/optim/fpq2.f with 100% similarity]
scilab/modules/optimization/src/fortran/fprf2.f [moved from scilab/routines/optim/fprf2.f with 100% similarity]
scilab/modules/optimization/src/fortran/frdf1.f [moved from scilab/routines/optim/frdf1.f with 100% similarity]
scilab/modules/optimization/src/fortran/fremf1.f [moved from scilab/routines/optim/fremf1.f with 100% similarity]
scilab/modules/optimization/src/fortran/fremf2.f [moved from scilab/routines/optim/fremf2.f with 100% similarity]
scilab/modules/optimization/src/fortran/fretc1.f [moved from scilab/routines/optim/fretc1.f with 100% similarity]
scilab/modules/optimization/src/fortran/fuclid.f [moved from scilab/routines/optim/fuclid.f with 100% similarity]
scilab/modules/optimization/src/fortran/gcbd.f [moved from scilab/routines/optim/gcbd.f with 100% similarity]
scilab/modules/optimization/src/fortran/gcp.f [moved from scilab/routines/optim/gcp.f with 100% similarity]
scilab/modules/optimization/src/fortran/hybrd.f [moved from scilab/routines/optim/hybrd.f with 100% similarity]
scilab/modules/optimization/src/fortran/hybrd1.f [moved from scilab/routines/optim/hybrd1.f with 100% similarity]
scilab/modules/optimization/src/fortran/hybrj.f [moved from scilab/routines/optim/hybrj.f with 100% similarity]
scilab/modules/optimization/src/fortran/hybrj1.f [moved from scilab/routines/optim/hybrj1.f with 100% similarity]
scilab/modules/optimization/src/fortran/icscof.f [moved from scilab/routines/optim/icscof.f with 100% similarity]
scilab/modules/optimization/src/fortran/icse.f [moved from scilab/routines/optim/icse.f with 100% similarity]
scilab/modules/optimization/src/fortran/icse0.f [moved from scilab/routines/optim/icse0.f with 100% similarity]
scilab/modules/optimization/src/fortran/icse1.f [moved from scilab/routines/optim/icse1.f with 100% similarity]
scilab/modules/optimization/src/fortran/icse2.f [moved from scilab/routines/optim/icse2.f with 100% similarity]
scilab/modules/optimization/src/fortran/icsec2.f [moved from scilab/routines/optim/icsec2.f with 100% similarity]
scilab/modules/optimization/src/fortran/icsei.f [moved from scilab/routines/optim/icsei.f with 100% similarity]
scilab/modules/optimization/src/fortran/lmder.f [moved from scilab/routines/optim/lmder.f with 100% similarity]
scilab/modules/optimization/src/fortran/lmdif.f [moved from scilab/routines/optim/lmdif.f with 100% similarity]
scilab/modules/optimization/src/fortran/lmpar.f [moved from scilab/routines/optim/lmpar.f with 100% similarity]
scilab/modules/optimization/src/fortran/majour.f [moved from scilab/routines/optim/majour.f with 100% similarity]
scilab/modules/optimization/src/fortran/majysa.f [moved from scilab/routines/optim/majysa.f with 100% similarity]
scilab/modules/optimization/src/fortran/majz.f [moved from scilab/routines/optim/majz.f with 100% similarity]
scilab/modules/optimization/src/fortran/n1fc1.f [moved from scilab/routines/optim/n1fc1.f with 100% similarity]
scilab/modules/optimization/src/fortran/n1fc1a.f [moved from scilab/routines/optim/n1fc1a.f with 100% similarity]
scilab/modules/optimization/src/fortran/n1fc1o.f [moved from scilab/routines/optim/n1fc1o.f with 100% similarity]
scilab/modules/optimization/src/fortran/n1gc2.f [moved from scilab/routines/optim/n1gc2.f with 100% similarity]
scilab/modules/optimization/src/fortran/n1gc2a.f [moved from scilab/routines/optim/n1gc2a.f with 100% similarity]
scilab/modules/optimization/src/fortran/n1gc2b.f [moved from scilab/routines/optim/n1gc2b.f with 100% similarity]
scilab/modules/optimization/src/fortran/n1qn1.f [moved from scilab/routines/optim/n1qn1.f with 100% similarity]
scilab/modules/optimization/src/fortran/n1qn1a.f [moved from scilab/routines/optim/n1qn1a.f with 100% similarity]
scilab/modules/optimization/src/fortran/n1qn2.f [moved from scilab/routines/optim/n1qn2.f with 100% similarity]
scilab/modules/optimization/src/fortran/n1qn2a.f [moved from scilab/routines/optim/n1qn2a.f with 100% similarity]
scilab/modules/optimization/src/fortran/n1qn3.f [moved from scilab/routines/optim/n1qn3.f with 100% similarity]
scilab/modules/optimization/src/fortran/n1qn3a.f [moved from scilab/routines/optim/n1qn3a.f with 100% similarity]
scilab/modules/optimization/src/fortran/nlis0.f [moved from scilab/routines/optim/nlis0.f with 100% similarity]
scilab/modules/optimization/src/fortran/nlis2.f [moved from scilab/routines/optim/nlis2.f with 100% similarity]
scilab/modules/optimization/src/fortran/nvkt03.f [moved from scilab/routines/optim/nvkt03.f with 100% similarity]
scilab/modules/optimization/src/fortran/optim_f.vfproj [new file with mode: 0644]
scilab/modules/optimization/src/fortran/optim_f2c.vcproj [moved from scilab/routines/optim/optim_f/optim_f2c.vcproj with 100% similarity]
scilab/modules/optimization/src/fortran/optr01.f [moved from scilab/routines/optim/optr01.f with 100% similarity]
scilab/modules/optimization/src/fortran/optr03.f [moved from scilab/routines/optim/optr03.f with 100% similarity]
scilab/modules/optimization/src/fortran/opvf03.f [moved from scilab/routines/optim/opvf03.f with 100% similarity]
scilab/modules/optimization/src/fortran/pasr03.f [moved from scilab/routines/optim/pasr03.f with 100% similarity]
scilab/modules/optimization/src/fortran/plcbas.f [moved from scilab/routines/optim/plcbas.f with 100% similarity]
scilab/modules/optimization/src/fortran/proj.f [moved from scilab/routines/optim/proj.f with 100% similarity]
scilab/modules/optimization/src/fortran/qform.f [moved from scilab/routines/optim/qform.f with 100% similarity]
scilab/modules/optimization/src/fortran/ql0001.f [moved from scilab/routines/optim/ql0001.f with 100% similarity]
scilab/modules/optimization/src/fortran/qnbd.f [moved from scilab/routines/optim/qnbd.f with 100% similarity]
scilab/modules/optimization/src/fortran/qrfac.f [moved from scilab/routines/optim/qrfac.f with 100% similarity]
scilab/modules/optimization/src/fortran/qrsolv.f [moved from scilab/routines/optim/qrsolv.f with 100% similarity]
scilab/modules/optimization/src/fortran/r1mpyq.f [moved from scilab/routines/optim/r1mpyq.f with 100% similarity]
scilab/modules/optimization/src/fortran/r1updt.f [moved from scilab/routines/optim/r1updt.f with 100% similarity]
scilab/modules/optimization/src/fortran/rednor.f [moved from scilab/routines/optim/rednor.f with 100% similarity]
scilab/modules/optimization/src/fortran/relvar.f [moved from scilab/routines/optim/relvar.f with 100% similarity]
scilab/modules/optimization/src/fortran/rlbd.f [moved from scilab/routines/optim/rlbd.f with 100% similarity]
scilab/modules/optimization/src/fortran/satur.f [moved from scilab/routines/optim/satur.f with 100% similarity]
scilab/modules/optimization/src/fortran/shanph.f [moved from scilab/routines/optim/shanph.f with 100% similarity]
scilab/modules/optimization/src/fortran/strang.f [moved from scilab/routines/optim/strang.f with 100% similarity]
scilab/modules/optimization/src/fortran/tol03.f [moved from scilab/routines/optim/tol03.f with 100% similarity]
scilab/modules/optimization/src/fortran/zgcbd.f [moved from scilab/routines/optim/zgcbd.f with 100% similarity]
scilab/modules/optimization/src/fortran/zqnbd.f [moved from scilab/routines/optim/zqnbd.f with 100% similarity]
scilab/modules/optimization/src/fortran/zthz.f [moved from scilab/routines/optim/zthz.f with 100% similarity]
scilab/routines/interf/interf_f/interf_f.vfproj
scilab/routines/optim/optim_f/optim_f.vfproj [deleted file]

index 2eecf47..f13daf0 100644 (file)
@@ -238,12 +238,12 @@ Project("{6989167D-11E4-40FE-8C1A-2192A86A7E90}") = "metanet_f", "modules\metane
                {3170E4C2-1173-4264-A222-7EE8CCB3DDF7} = {3170E4C2-1173-4264-A222-7EE8CCB3DDF7}\r
        EndProjectSection\r
 EndProject\r
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "optim", "routines\optim\optim.vcproj", "{425B887B-9FC5-4CD2-B632-DBFC000E3E25}"\r
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "optim", "modules\optimization\src\c\optim.vcproj", "{425B887B-9FC5-4CD2-B632-DBFC000E3E25}"\r
        ProjectSection(ProjectDependencies) = postProject\r
                {3170E4C2-1173-4264-A222-7EE8CCB3DDF7} = {3170E4C2-1173-4264-A222-7EE8CCB3DDF7}\r
        EndProjectSection\r
 EndProject\r
-Project("{6989167D-11E4-40FE-8C1A-2192A86A7E90}") = "optim_f", "routines\optim\optim_f\optim_f.vfproj", "{1D219098-007C-4F76-9AE6-271ABBB7D393}"\r
+Project("{6989167D-11E4-40FE-8C1A-2192A86A7E90}") = "optim_f", "modules\optimization\src\fortran\optim_f.vfproj", "{1D219098-007C-4F76-9AE6-271ABBB7D393}"\r
        ProjectSection(ProjectDependencies) = postProject\r
                {3170E4C2-1173-4264-A222-7EE8CCB3DDF7} = {3170E4C2-1173-4264-A222-7EE8CCB3DDF7}\r
        EndProjectSection\r
index 59d0931..f66fa02 100644 (file)
@@ -116,7 +116,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "metanet", "modules\metanet\
                {3170E4C2-1173-4264-A222-7EE8CCB3DDF7} = {3170E4C2-1173-4264-A222-7EE8CCB3DDF7}\r
        EndProjectSection\r
 EndProject\r
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "optim", "routines\optim\optim.vcproj", "{425B887B-9FC5-4CD2-B632-DBFC000E3E25}"\r
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "optim", "modules\optimization\src\c\optim.vcproj", "{425B887B-9FC5-4CD2-B632-DBFC000E3E25}"\r
        ProjectSection(ProjectDependencies) = postProject\r
                {3170E4C2-1173-4264-A222-7EE8CCB3DDF7} = {3170E4C2-1173-4264-A222-7EE8CCB3DDF7}\r
        EndProjectSection\r
@@ -283,7 +283,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MALLOC", "libs\MALLOC\MALLO
 EndProject\r
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "poly_f2c", "routines\poly\poly_f\poly_f2c.vcproj", "{3A72C3ED-98F7-49C7-B59C-2C6C47FF9390}"\r
 EndProject\r
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "optim_f2c", "routines\optim\optim_f\optim_f2c.vcproj", "{1D219098-007C-4F76-9AE6-271ABBB7D393}"\r
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "optim_f2c", "modules\optimization\src\fortran\optim_f2c.vcproj", "{1D219098-007C-4F76-9AE6-271ABBB7D393}"\r
 EndProject\r
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "metanet_f2c", "modules\metanet\src\fortran\metanet_f2c.vcproj", "{1D5E735D-176E-4C6D-B980-3C2EC7051F90}"\r
 EndProject\r
index ef2cac5..539503c 100644 (file)
@@ -10,17 +10,16 @@ CurrentDirectory=pwd();
  "calpol",
  "elem",
  "int",
- "optim",
  "robust",
  "sci2for",
  "signal",
  "statistics",
  "tdcs",
- "texmacs",
  "sparse",
  "gui",
   ];
   
+ Directories=[Directories;"SCI/modules/optimization/macros"];    
  Directories=[Directories;"SCI/modules/helptools/macros"];   
  Directories=[Directories;"SCI/modules/scipad/macros"];  
  Directories=[Directories;"SCI/modules/maple/macros"];
diff --git a/scilab/modules/optimization/changelog.txt b/scilab/modules/optimization/changelog.txt
new file mode 100644 (file)
index 0000000..a0b8790
--- /dev/null
@@ -0,0 +1 @@
+changelog optimization module
\ No newline at end of file
diff --git a/scilab/modules/optimization/etc/optimization.quit b/scilab/modules/optimization/etc/optimization.quit
new file mode 100644 (file)
index 0000000..f5cfbbc
--- /dev/null
@@ -0,0 +1,16 @@
+// ====================================================================\r
+// This file contains command to be executed at the end \r
+// of a scilab session for optimization module\r
+// Copyright INRIA 2006\r
+// ====================================================================\r
+// delete help chapter\r
+global LANGUAGE\r
+\r
+if LANGUAGE == 'fr' then\r
+       del_help_chapter("Optimisation et Simulation");\r
+elseif LANGUAGE == 'eng' then\r
+       del_help_chapter("Optimization and Simulation");\r
+end\r
+\r
+clear del_help_chapter LANGUAGE;\r
+// ====================================================================
\ No newline at end of file
diff --git a/scilab/modules/optimization/etc/optimization.start b/scilab/modules/optimization/etc/optimization.start
new file mode 100644 (file)
index 0000000..7627892
--- /dev/null
@@ -0,0 +1,23 @@
+// ====================================================================\r
+// optimization module initialisation file \r
+// Copyright INRIA 2006\r
+// ====================================================================\r
+//Load  functions librarie\r
+load('SCI/modules/optimization/macros/lib');\r
+// ====================================================================\r
+//add help chapter\r
+global LANGUAGE\r
+\r
+path = get_absolute_file_path('optimization.start');\r
+path = getshortpathname(path);\r
+\r
+if LANGUAGE == 'fr' then\r
+       path = pathconvert(part(path,1:(length(path)-5))+'/help/fr',%f,%f);\r
+       add_help_chapter("Optimisation et Simulation",path);\r
+elseif LANGUAGE == 'eng' then\r
+       path = pathconvert(part(path,1:(length(path)-5))+'/help/eng',%f,%f);\r
+       add_help_chapter("Optimization and Simulation",path);\r
+end\r
+\r
+clear path get_absolute_file_path add_help_chapter LANGUAGE;\r
+// ====================================================================\r
diff --git a/scilab/modules/optimization/help/eng/NDcost.xml b/scilab/modules/optimization/help/eng/NDcost.xml
new file mode 100644 (file)
index 0000000..03db7ad
--- /dev/null
@@ -0,0 +1,162 @@
+<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
+<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
+<MAN>
+  <LANGUAGE>eng</LANGUAGE>
+  <TITLE>NDcost</TITLE>
+  <TYPE>Scilab Function</TYPE>
+  <DATE>2002</DATE>
+  <SHORT_DESCRIPTION name="NDcost"> generic external for optim
+  computing gradient using finite differences</SHORT_DESCRIPTION>
+  <CALLING_SEQUENCE>
+    <CALLING_SEQUENCE_ITEM>[f,g,ind]=NDcost(x,ind,fun,varargin) </CALLING_SEQUENCE_ITEM>
+  </CALLING_SEQUENCE>
+  <PARAM>
+    <PARAM_INDENT>
+      <PARAM_ITEM>
+        <PARAM_NAME>x</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: real  vector or matrix</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>ind</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: integer parameter (see optim)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>fun</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: Scilab function with calling sequence <VERB>F=fun(x,varargin)</VERB>
+           varargin may be use to pass  parameters <VERB>p1,...pn</VERB></SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>f</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: criterion value  at point <VERB>x</VERB> (see optim)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>g</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: gradient value  at point <VERB>x</VERB> (see optim)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+    </PARAM_INDENT>
+  </PARAM>
+  <DESCRIPTION>
+    <P>
+  This function can be used as an external for <VERB>optim</VERB> to minimize
+   problem where gradient is too complicated to be programmed. only the
+   function <VERB>fun</VERB> which computes the criterion is required.</P>
+    <P>
+   This function should be used as follow:
+   <VERB>[f,xopt,gopt]=optim(list(NDcost,fun,p1,...pn),x0,...)</VERB></P>
+  </DESCRIPTION>
+  <EXAMPLE>
+<![CDATA[// example #1 (a simple one)
+//function to minimize
+function f=rosenbrock(x,varargin)
+   p=varargin(1)
+   f=1+sum( p*(x(2:$)-x(1:$-1)^2)^2 + (1-x(2:$))^2)
+endfunction
+
+x0=[1;2;3;4];
+[f,xopt,gopt]=optim(list(NDcost,rosenbrock,200),x0)
+
+// example #2: This example (by Rainer von Seggern) shows a quick (*) way to
+//             identify the parameters of a linear differential equation with 
+//             the help of scilab.
+//             The model is a simple damped (linear) oscillator:
+//
+//               x''(t) + c x'(t) + k x(t) = 0 ,
+// 
+// and we write it as a system of two differential equations of first
+// order with y(1) = x, and y(2) = x':
+//
+//     dy1/dt = y(2)
+//     dy2/dt = -c*y(2) -k*y(1).
+//
+// We suppose to have m measurements of x (that is y(1)) at different times 
+// t_obs(1), ..., t_obs(m) called x_obs(1), ..., x_obs(m)  (in this example
+// these measuresments will be simulated), and we want to identify the parameters
+// c and k by minimizing the sum of squared errors between x_obs and y1(t_obs,p).
+// 
+// (*) This method is not the most efficient but it is easy to implement.
+// 
+function dy = DEQ(t,y,p)
+   // The rhs of our first order differential equation system.
+   c =p(1);k=p(2)
+   dy=[y(2);-c*y(2)-k*y(1)]
+endfunction
+
+function y=uN(p, t, t0, y0)
+   // Numerical solution obtained with ode. (In this linear case an exact analytic
+   // solution can easily be found, but ode would also work for "any" system.)
+   // Note: the ode output must be an approximation of the solution at
+   //       times given in the vector t=[t(1),...,t($)]  
+   y = ode(y0,t0,t,list(DEQ,p))
+endfunction
+
+function r = cost_func(p, t_obs, x_obs, t0, y0) 
+   // This is the function to be minimized, that is the sum of the squared
+   // errors between what gives the model and the measuments.
+   sol = uN(p, t_obs, t0, y0)
+   e = sol(1,:) - x_obs
+   r = sum(e.*e) 
+endfunction
+
+// Data
+y0 = [10;0]; t0 = 0; // Initial conditions y0 for initial time t0. 
+T = 30;  // Final time for the measurements.
+
+// Here we simulate experimental data, (from which the parameters
+// should be identified).
+pe = [0.2;3];  // Exact parameters
+m = 80;  t_obs = linspace(t0+2,T,m); // Observation times
+// Noise: each measurement is supposed to have a (gaussian) random error
+// of mean 0 and std deviation proportional to the magnitude
+// of the value (sigma*|x_exact(t_obs(i))|).
+sigma = 0.1;  
+y_exact = uN(pe, t_obs, t0, y0);
+x_obs = y_exact(1,:) + grand(1,m,"nor",0, sigma).*abs(y_exact(1,:));
+
+// Initial guess parameters
+p0 = [0.5 ; 5];  
+
+// The value of the cost function before optimization:
+cost0 = cost_func(p0, t_obs, x_obs, t0, y0); 
+mprintf("\n\r The value of the cost function before optimization = %g \n\r",...
+                                                                       cost0)
+
+// Solution with optim
+[costopt,popt]=optim(list(NDcost,cost_func, t_obs, x_obs, t0, y0),p0,...
+                                                       'ar',40,40,1e-3);
+
+mprintf("\n\r The value of the cost function after optimization  = %g",costopt)
+mprintf("\n\r The identified values of the parameters: c = %g, k = %g \n\r",...
+                                                               popt(1),popt(2))
+
+// A small plot:
+t = linspace(0,T,400);
+y = uN(popt, t, t0, y0);
+clf();
+plot2d(t',y(1,:)',style=5)
+plot2d(t_obs',x_obs(1,:)',style=-5)
+legend(["model","measurements"]);
+xtitle("Least square fit to identify ode parameters")
+ ]]>
+  </EXAMPLE>
+  <SEE_ALSO>
+    <SEE_ALSO_ITEM>
+      <LINK>optim</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>external</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>derivative</LINK>
+    </SEE_ALSO_ITEM>
+  </SEE_ALSO>
+</MAN>
diff --git a/scilab/modules/optimization/help/eng/bvode.xml b/scilab/modules/optimization/help/eng/bvode.xml
new file mode 100644 (file)
index 0000000..96bf41e
--- /dev/null
@@ -0,0 +1,507 @@
+<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
+<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
+<MAN>
+  <LANGUAGE>eng</LANGUAGE>
+  <TITLE>bvode</TITLE>
+  <TYPE>Scilab Function</TYPE>
+  <DATE>June 1993</DATE>
+  <SHORT_DESCRIPTION name="bvode"> boundary value problems for ODE</SHORT_DESCRIPTION>
+  <CALLING_SEQUENCE>
+    <CALLING_SEQUENCE_ITEM>   [z]=bvode(points,ncomp,m,aleft,aright,zeta,ipar,ltol,tol,fixpnt,...  </CALLING_SEQUENCE_ITEM>
+    <CALLING_SEQUENCE_ITEM> fsub1,dfsub1,gsub1,dgsub1,guess1)  </CALLING_SEQUENCE_ITEM>
+  </CALLING_SEQUENCE>
+  <PARAM>
+    <PARAM_INDENT>
+      <PARAM_ITEM>
+        <PARAM_NAME>z</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>The solution of the ode evaluated on the mesh given by points</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>points</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>an array which gives the points for which we want the solution</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>ncomp</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>number of differential equations   (ncomp &lt;= 20)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>m</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>a vector of size <VERB>ncomp</VERB>. <VERB>m(j)</VERB> gives the  order of the j-th differential equation</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>aleft</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>left end of interval</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>aright</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>right end of interval</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>zeta</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP><VERB>zeta(j)</VERB> gives j-th side condition point (boundary point). must have</SP>
+          <P>
+            <VERB>zeta(j) &lt;= zeta(j+1)</VERB>
+          </P>
+          <P>
+    all side condition points must be mesh points in all meshes used, see description of <VERB>ipar(11)</VERB> and <VERB>fixpnt</VERB> below.
+  </P>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>ipar</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>an integer array dimensioned at least 11. a list of the parameters in <VERB>ipar</VERB> and their meaning follows some parameters are renamed in bvode; these new names are given in parentheses.</SP>
+          <PARAM_INDENT>
+            <PARAM_ITEM>
+              <PARAM_NAME>ipar(1)  </PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>0  if the problem is linear, 1 if the problem is nonlinear</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>ipar(2)  </PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>= number of collocation points per subinterval  (= k ) where</SP>
+                <P>
+                  <VERB>max m(i) &lt;=  k &lt;= 7 .</VERB>
+                </P>
+                <P>
+    if <VERB>ipar(2)=0</VERB> then bvode sets  
+  </P>
+                <P>
+                  <VERB>k = max ( max m(i)+1, 5-max m(i) )</VERB>
+                </P>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+
+            <PARAM_ITEM>
+              <PARAM_NAME>ipar(3)  </PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>= number of subintervals in the initial mesh  ( = n ). if <VERB>ipar(3) = 0</VERB> then bvode arbitrarily sets <VERB>n = 5</VERB>.</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>ipar(4)</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>= number of solution and derivative tolerances.  ( = ntol ) we require</SP>
+                <P>
+                  <VERB>0 &lt; ntol &lt;= mstar.</VERB>
+                </P>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+
+            <PARAM_ITEM>
+              <PARAM_NAME>ipar(5)</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>= dimension of <VERB>fspace</VERB> ( = ndimf ) a
+                real work array. its size provides a constraint on
+                nmax. choose ipar(5) according to the formula:</SP>
+                <P> <VERB>ipar(5)>=nmax*nsizef</VERB> </P>
+                <P>where</P>
+                <P> <VERB>nsizef=4+3*mstar+(5+kd)*kdm+(2*mstar-nrec)*2*mstar</VERB>.</P>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+
+            <PARAM_ITEM>
+              <PARAM_NAME>ipar(6)</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>= dimension of ispace ( = ndimi )an integer work
+                 array. its size provides a constraint on nmax, the
+                 maximum number of subintervals. choose
+                 <VERB>ipar(6)</VERB> according to the formula:</SP>
+                 <P> <VERB>ipar(6)>=nmax*nsizei</VERB></P>
+                  <P>where</P>
+                 <P><VERB>nsizei=3 + kdm</VERB> with
+                 <VERB>kdm=kd+mstar</VERB> ; <VERB>kd=k*ncomp </VERB>;
+                 <VERB>nrec</VERB>=number of right end boundary
+                 conditions.</P>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>ipar(7) </PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>output control ( = iprint )</SP>
+                <PARAM_INDENT>
+                  <PARAM_ITEM>
+                    <PARAM_NAME>= -1</PARAM_NAME>
+                    <PARAM_DESCRIPTION>
+                      <SP>for full diagnostic printout</SP>
+                    </PARAM_DESCRIPTION>
+                  </PARAM_ITEM>
+                  <PARAM_ITEM>
+                    <PARAM_NAME>= 0</PARAM_NAME>
+                    <PARAM_DESCRIPTION>
+                      <SP>for selected printout</SP>
+                    </PARAM_DESCRIPTION>
+                  </PARAM_ITEM>
+                  <PARAM_ITEM>
+                    <PARAM_NAME>= 1</PARAM_NAME>
+                    <PARAM_DESCRIPTION>
+                      <SP>for no printout</SP>
+                    </PARAM_DESCRIPTION>
+                  </PARAM_ITEM>
+                </PARAM_INDENT>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>ipar(8)  </PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>( = iread )</SP>
+                <PARAM_INDENT>
+                  <PARAM_ITEM>
+                    <PARAM_NAME>= 0</PARAM_NAME>
+                    <PARAM_DESCRIPTION>
+                      <SP>causes bvode to generate a uniform initial mesh.</SP>
+                    </PARAM_DESCRIPTION>
+                  </PARAM_ITEM>
+                  <PARAM_ITEM>
+                    <PARAM_NAME>= xx</PARAM_NAME>
+                    <PARAM_DESCRIPTION>
+                      <SP>Other values are not implemented yet in Scilab</SP>
+                      <PARAM_INDENT>
+                        <PARAM_ITEM>
+                          <PARAM_NAME>= 1</PARAM_NAME>
+                          <PARAM_DESCRIPTION>
+                            <SP>if the initial mesh is provided by the user.  it is defined in fspace as follows:  the mesh</SP>
+                            <P>
+    will occupy  <VERB>fspace(1), ..., fspace(n+1)</VERB>. the user needs to supply only the interior mesh points  <VERB>fspace(j) = x(j), j = 2, ..., n.</VERB>
+  </P>
+                          </PARAM_DESCRIPTION>
+                        </PARAM_ITEM>
+                        <PARAM_ITEM>
+                          <PARAM_NAME>= 2 if the initial mesh is supplied by the user</PARAM_NAME>
+                          <PARAM_DESCRIPTION>
+                            <SP>as with <VERB>ipar(8)=1</VERB>, and in addition no adaptive mesh selection is to be done.</SP>
+                          </PARAM_DESCRIPTION>
+                        </PARAM_ITEM>
+                      </PARAM_INDENT>
+                    </PARAM_DESCRIPTION>
+                  </PARAM_ITEM>
+                </PARAM_INDENT>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>ipar(9)  </PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>( = iguess )</SP>
+                <PARAM_INDENT>
+                  <PARAM_ITEM>
+                    <PARAM_NAME>= 0</PARAM_NAME>
+                    <PARAM_DESCRIPTION>
+                      <SP>if no initial guess for the solution is provided.</SP>
+                    </PARAM_DESCRIPTION>
+                  </PARAM_ITEM>
+                  <PARAM_ITEM>
+                    <PARAM_NAME>= 1</PARAM_NAME>
+                    <PARAM_DESCRIPTION>
+                      <SP>if an initial guess is provided by the user in subroutine  <VERB>guess</VERB>.</SP>
+                    </PARAM_DESCRIPTION>
+                  </PARAM_ITEM>
+                  <PARAM_ITEM>
+                    <PARAM_NAME>= 2</PARAM_NAME>
+                    <PARAM_DESCRIPTION>
+                      <SP>if an initial mesh and approximate solution coefficients are provided by the user in fspace. (the former and new mesh are the same).</SP>
+                    </PARAM_DESCRIPTION>
+                  </PARAM_ITEM>
+                  <PARAM_ITEM>
+                    <PARAM_NAME>= 3</PARAM_NAME>
+                    <PARAM_DESCRIPTION>
+                      <SP>if a former mesh and approximate solution coefficients are provided by the user in fspace, and the new mesh is to be taken twice as coarse; i.e.,every second point from the former mesh.</SP>
+                    </PARAM_DESCRIPTION>
+                  </PARAM_ITEM>
+                  <PARAM_ITEM>
+                    <PARAM_NAME>= 4</PARAM_NAME>
+                    <PARAM_DESCRIPTION>
+                      <SP>if in addition to a former initial mesh and approximate solution coefficients, a new mesh is provided in fspace as well. (see description of output for further details on iguess = 2, 3, and 4.)</SP>
+                    </PARAM_DESCRIPTION>
+                  </PARAM_ITEM>
+                </PARAM_INDENT>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>ipar(10)  </PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <PARAM_INDENT>
+                  <PARAM_ITEM>
+                    <PARAM_NAME>= 0</PARAM_NAME>
+                    <PARAM_DESCRIPTION>
+                      <SP>if the problem is regular</SP>
+                    </PARAM_DESCRIPTION>
+                  </PARAM_ITEM>
+                  <PARAM_ITEM>
+                    <PARAM_NAME>= 1</PARAM_NAME>
+                    <PARAM_DESCRIPTION>
+                      <SP>if the first relax factor is =rstart, and the nonlinear iteration does not rely on past covergence (use for an extra sensitive nonlinear problem only).</SP>
+                    </PARAM_DESCRIPTION>
+                  </PARAM_ITEM>
+                  <PARAM_ITEM>
+                    <PARAM_NAME>= 2</PARAM_NAME>
+                    <PARAM_DESCRIPTION>
+                      <SP>if we are to return immediately upon  (a) two successive nonconvergences, or  (b) after obtaining error estimate for the first time.</SP>
+                    </PARAM_DESCRIPTION>
+                  </PARAM_ITEM>
+                </PARAM_INDENT>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>ipar(11)  </PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>= number of fixed points in the mesh other than <VERB>aleft</VERB>
+  and <VERB>aright</VERB>. ( = nfxpnt , the dimension of
+  <VERB>fixpnt</VERB>) the code requires that all side condition
+  points other than <VERB>aleft</VERB> and <VERB>aright</VERB> (see
+  description of zeta ) be included as fixed points in
+  <VERB>fixpnt</VERB>.</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+          </PARAM_INDENT>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>ltol</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>an array of dimension <VERB>ipar(4)</VERB>.
+          <VERB>ltol(j) = l</VERB> specifies that the j-th tolerance
+          in tol controls the error in the l-th component of
+          <VERB>z(u)</VERB>.  also require that:</SP>
+          <P>
+          <VERB>1 &lt;= ltol(1) &lt; ltol(2) &lt; ... &lt; ltol(ntol) &lt;= mstar</VERB> 
+          </P>
+          
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>tol</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>an array of dimension
+          <VERB>ipar(4)</VERB>. <VERB>tol(j)</VERB> is the error
+          tolerance on the <VERB>ltol(j)</VERB> -th component of
+          <VERB>z(u)</VERB>. thus, the code attempts to satisfy for
+          <VERB>j=1:ntol</VERB>  on each subinterval</SP>
+<VERBATIM>
+        abs(z(v)-z(u))       &lt;=     tol(j)*abs(z(u))     +tol(j)
+                     ltol(j)                       ltol(j)
+</VERBATIM>
+          
+          <P>
+    if <VERB>v(x)</VERB> is the approximate solution vector.
+  </P>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>fixpnt</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>an array of dimension <VERB>ipar(11)</VERB>. it contains the points, other than <VERB>aleft</VERB> and <VERB>aright</VERB>, which are to be included in every mesh.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>externals</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>The function <VERB>fsub,dfsub,gsub,dgsub,guess</VERB> are Scilab
+  externals i.e. functions (see syntax below) or the name of a Fortran
+  subroutine (character string) with specified calling sequence or a
+  list. An external as a  character string refers to the name of a
+  Fortran subroutine. The Fortran coded function interface to bvode
+  are specified in the file <VERB>fcol.f</VERB>.</SP>
+          <PARAM_INDENT>
+            <PARAM_ITEM>
+              <PARAM_NAME>fsub</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>name of subroutine for evaluating</SP>
+<VERBATIM>
+                                                t
+                f(x,z(u(x))) =    (f ,...,f     )  
+                                    1      ncomp
+</VERBATIM>
+                <P>
+    at a point x in <VERB>(aleft,aright)</VERB>. it should have the heading  <VERB>[f]=fsub(x,z)</VERB>  where <VERB>f</VERB> is the vector containing the value of <VERB>fi(x,z(u))</VERB> in the i-th component and 
+  </P>
+ <VERBATIM>
+                                                    t
+                         z(u(x))=(z(1),...,z(mstar))
+</VERBATIM>
+                <P>
+    is defined as above under  purpose .
+  </P>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>dfsub</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>name of subroutine for evaluating the Jacobian of
+                <VERB>f(x,z(u))</VERB> at a point x.  it should have
+                the heading <VERB>[df]=dfsub (x , z )</VERB> where
+                <VERB>z(u(x))</VERB> is defined as for
+                <VERB>fsub</VERB> and the (<VERB>ncomp</VERB>) by
+                (<VERB>mstar</VERB>) array df should be filled by the
+                partial derivatives of  f, viz, for a particular call
+                one calculates</SP>
+
+ <VERBATIM>
+                    df(i,j) = dfi / dzj, i=1,...,ncomp
+                                         j=1,...,mstar.
+</VERBATIM>
+
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>gsub</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>name of subroutine for evaluating the i-th
+                component of
+                 <VERB>g(x,z(u(x))) = g (zeta(i),z(u(zeta(i)))) </VERB>
+                 at a point <VERB>x = zeta(i)</VERB> where
+                  <VERB>1&lt;=i&lt;=mstar.</VERB>
+                </SP>
+                <P>
+                it should have the heading<VERB>[g]=gsub (i , z)</VERB> where <VERB>z(u)</VERB> is as for
+                 <VERB>fsub</VERB>, and <VERB>i</VERB> and
+                 <VERB>g=gi</VERB> are as above. Note that in contrast
+                 to <VERB>f</VERB> in <VERB>fsub</VERB> , here only one value per
+                 call is returned in <VERB>g</VERB>.
+  </P>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>dgsub</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>name of subroutine for evaluating the i-th row of the Jacobian of
+  <VERB>g(x,u(x))</VERB>.  it should have the heading <VERB>[dg]=dgsub (i , z )</VERB> 
+  where <VERB>z(u)</VERB> is as for fsub, i as for
+  gsub and the mstar-vector  <VERB>dg</VERB> should be filled with the
+  partial derivatives of g, viz, for a particular call one calculates</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>guess</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>name of subroutine to evaluate the initial approximation for
+  <VERB>z(u(x))</VERB> and for <VERB>dmval(u(x))</VERB>= vector of the
+  mj-th derivatives of <VERB>u(x)</VERB>. it should have the heading
+  <VERB>[z,dmval]= guess (x )</VERB> note that this subroutine is used
+  only if  <VERB>ipar(9) = 1</VERB>, and then all  <VERB>mstar</VERB>
+  components of z and  ncomp  components of  dmval  should be
+  specified for any x,</SP>
+                <P>
+                  <VERB>aleft &lt;= x &lt;= aright .</VERB>
+                </P>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+          </PARAM_INDENT>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+    </PARAM_INDENT>
+  </PARAM>
+  <DESCRIPTION>
+    <P>
+    this package solves a multi-point boundary value
+    problem for a mixed order system of ode-s given by</P>
+<VERBATIM>
+       (m(i))
+       u       =  f  ( x; z(u(x)) )      i = 1, ... ,ncomp
+        i          i                     aleft &lt; x  &lt; aright,
+                                        
+</VERBATIM>
+
+<VERBATIM>
+       g  ( zeta(j); z(u(zeta(j))) ) = 0   j = 1, ... ,mstar
+        j
+      mstar = m(1)+m(2)+...+m(ncomp),
+</VERBATIM>
+<P> where</P>
+<VERBATIM>
+                                        t
+             u = (u , u , ... ,u     )   
+                   1   2        ncomp    
+</VERBATIM>
+<P>is the exact solution vector</P>
+<VERBATIM>
+              (mi)
+             u     is the mi=m(i) th  derivative of u
+              i                                      i
+</VERBATIM> 
+<VERBATIM>                                     
+
+                                (1)        (m1-1)       (mncomp-1)
+             z(u(x)) = ( u (x),u  (x),...,u    (x),...,u      (x) )
+                          1     1          1            ncomp
+</VERBATIM> 
+<VERBATIM>  
+              f (x,z(u))   
+               i
+</VERBATIM>
+    <P> is a (generally) nonlinear function of <VERB>z(u)=z(u(x))</VERB>.</P>
+<VERBATIM> 
+              g (zeta(j);z(u))  
+               j
+</VERBATIM>
+      <P>  is a (generally) nonlinear function   used to represent a boundary condition.</P>
+
+    <P> the boundary points satisfy</P>
+
+     <P><VERB>aleft &lt;= zeta(1)  &lt;= ..  &lt;= zeta(mstar)  &lt;= aright</VERB>. </P>
+    <P> the orders <VERB>mi</VERB> of the differential equations satisfy</P>
+    <P><VERB>1&lt;=m(i)&lt;=4</VERB>.</P>
+  </DESCRIPTION>
+  <EXAMPLE>
+<![CDATA[
+deff('df=dfsub(x,z)','df=[0,0,-6/x**2,-6/x]')
+deff('f=fsub(x,z)','f=(1 -6*x**2*z(4)-6*x*z(3))/x**3')
+deff('g=gsub(i,z)','g=[z(1),z(3),z(1),z(3)];g=g(i)')
+deff('dg=dgsub(i,z)',['dg=[1,0,0,0;0,0,1,0;1,0,0,0;0,0,1,0]';
+                      'dg=dg(i,:)'])
+deff('[z,mpar]=guess(x)','z=0;mpar=0')// unused here
+
+ //define trusol for testing purposes
+deff('u=trusol(x)',[ 
+   'u=0*ones(4,1)';
+   'u(1) =  0.25*(10*log(2)-3)*(1-x) + 0.5 *( 1/x   + (3+x)*log(x) - x)'
+   'u(2) = -0.25*(10*log(2)-3)       + 0.5 *(-1/x^2 + (3+x)/x      + log(x) - 1)'
+   'u(3) = 0.5*( 2/x^3 + 1/x   - 3/x^2)'
+   'u(4) = 0.5*(-6/x^4 - 1/x/x + 6/x^3)'])
+
+fixpnt=0;m=4;
+ncomp=1;aleft=1;aright=2;
+zeta=[1,1,2,2];
+ipar=zeros(1,11);
+ipar(3)=1;ipar(4)=2;ipar(5)=2000;ipar(6)=200;ipar(7)=1;
+ltol=[1,3];tol=[1.e-11,1.e-11];
+res=aleft:0.1:aright;
+z=bvode(res,ncomp,m,aleft,aright,zeta,ipar,ltol,tol,fixpnt,...
+ fsub,dfsub,gsub,dgsub,guess)
+z1=[];for x=res,z1=[z1,trusol(x)]; end;  
+z-z1
+ ]]>
+  </EXAMPLE>
+  <SEE_ALSO>
+    <SEE_ALSO_ITEM>
+      <LINK>fort</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>link</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>external</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>ode</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>dassl</LINK>
+    </SEE_ALSO_ITEM>
+  </SEE_ALSO>
+  <AUTHOR>u. ascher, department of computer science, university of british; columbia, vancouver, b. c., canada   v6t 1w5; g. bader, institut f. angewandte mathematik university of heidelberg; im neuenheimer feld 294d-6900 heidelberg 1 ; ; Fortran subroutine colnew.f</AUTHOR>
+</MAN>
diff --git a/scilab/modules/optimization/help/eng/bvodeS.xml b/scilab/modules/optimization/help/eng/bvodeS.xml
new file mode 100644 (file)
index 0000000..70bbda7
--- /dev/null
@@ -0,0 +1,325 @@
+<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
+<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
+<MAN>
+  <LANGUAGE>eng</LANGUAGE>
+  <TITLE>bvodeS</TITLE>
+  <TYPE>Scilab Function</TYPE>
+  <DATE>2005</DATE>
+  <SHORT_DESCRIPTION name="bvodeS">simplified call of bvode</SHORT_DESCRIPTION>
+  <CALLING_SEQUENCE>
+    <CALLING_SEQUENCE_ITEM>z=bvodeS(x,m,n,a,b,fsub,gsub,zeta,
+         [ystart,dfsub,dgsub,fixpnt,ndimf,ndimi,ltol,tol,ntol,nonlin,
+          collpnt,subint,iprint,ireg,ifail])
+    </CALLING_SEQUENCE_ITEM>
+  </CALLING_SEQUENCE>
+  <PARAM>
+    <PARAM_INDENT>
+      <PARAM_ITEM>
+        <PARAM_NAME>x</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>:  array of points at which approximations of the solution will be computed.
+    The points x(i) must be given in increasing order.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>m</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: array of orders for the differential equations given in <VERB>fsub</VERB>.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>n</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>:  number of differential equations, length of <VERB>m</VERB>.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>a</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: left end of solution interval, where a&lt;=x(1).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>b</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>:  right end of solution interval, where x($)&lt;=b.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>fsub</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>:  name of a Scilab function for evaluating the rhs of the differential 
+       equation system to be solved; fsub also may be a list for parameter transfer.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>gsub</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>:   name of a Scilab function for evaluating the boundary conditions for the
+       given differential equation system; gsub may also be a list as for fsub.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>zeta</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: array of points at which the boundary or side conditions are given in 
+       increasing order. Each point must occur as often as boundary or side 
+       conditions are given there. Each side condition point other than a or b must
+       be included in the array fixpnt.
+       The length of zeta should be sum(m).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>z</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>:  array of all derivatives of the solution functions up to the order
+    m(i)-1 for the i-th function. (See the examples below.) The length of z should
+    be sum(m).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>ystart,dfsub,dgsub,fixpnt,ndimf,ndimi,ltol,tol,ntol,nonlin,
+          collpnt,subint,iprint,ireg,ifail</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: These optional arguments may be called by name in any order in the
+form argument=name. The meaning of ystart to ireg is given in the <LINK>bvode</LINK> help page.
+The Scilab functions <VERB>dfsub</VERB> and <VERB>dgsub</VERB> for evaluating the Jacobians may also be lists
+for parameter transfer. The function <VERB>ystart</VERB> is called <VERB>guess</VERB> in bvode.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>ifail</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>:  if ifail=1, all parameters needed for the call of bvode are displayed.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+    </PARAM_INDENT>
+  </PARAM>
+
+  <DESCRIPTION>
+    <P>
+This interface program simplifies the call of <LINK>bvode</LINK>, a program for the numerical
+solution of multi-point boundary value problems for mixed order systems of ordinary
+differential equations. The Scilab program bvode is adapted from the fortran program
+colnew. See the paper by U. Asher, J. Christiansen, and R.D. Russel:
+Collocation software for boundary-value ODE's, ACM Trans. Math. Soft. 7:209-222, 1981.
+The following examples should demonstrate not only how such systems can be solved 
+with the help of bvodeS, but also should emphazise some important problems which occur 
+with boundary value problems for ordinary ode's.
+</P>
+  </DESCRIPTION>
+
+
+  <EXAMPLE>
+<![CDATA[// 1. Modified example from help bvode. 
+
+// DE:  y1''''(x)=(1-6*x*x*y1'''(x)-6*x*y1''(x))/(y2(x)^3)
+//         y2'(x)=1
+// z=[y1 ; y1' ; y1'' ; y1''' ; y2]
+// BV: y1(1)=0 y1''(1)=0 
+// BV: y1(2)=1 y1''(2)=0 y2(2)=2
+
+function RhS=fsub(x,z)
+  RhS=[(1-6*x*x*z(4)-6*x*z(3))/(z(5)^3);1]
+endfunction
+
+function g=gsub(i,z)
+  g=[z(1) z(3) z(1)-1 z(3) z(5)-2]
+  g=g(i)
+endfunction
+
+function [z,lhS]=ystart(x)
+  z=zeros(5,1);z(5)=1;
+  lhS=[0;1];
+endfunction
+
+n=2;
+m=[4 1];
+N=100;
+a=1; b=2;
+zeta=[a a b b b];
+x=linspace(a,b,N);
+
+ltol=4; // We want to change the default error for y1'''.
+tol=1e-12;
+tic()
+z=bvodeS(x,m,n,a,b,fsub,gsub,zeta,ltol=ltol,tol=tol,ystart=ystart);
+// Try tol=1e-14 etc.
+toc()
+
+function z=yex(x) // True solution
+  z=zeros(5,1);
+  z(1)=0.25*(10*log(2)-3)*(1-x)+0.5*(1/x+(3+x)*log(x)-x)+(x-1)
+  z(2)=-0.25*(10*log(2)-3)+0.5*(-1/x^2+(3+x)/x+log(x)-1)+1
+  z(3)=0.5*(2/x^3+1/x-3/x^2)
+  z(4)=0.5*(-6/x^4-1/x/x+6/x^3)
+  z(5)=x
+endfunction
+
+zex=[];for xx=x, zex=[zex yex(xx)]; end
+scf(0); clf();
+plot2d(x,abs(z-zex)',style=[1 2 3 5 6])
+xtitle('Absolute error','x',' ')
+legend(['z1(x)';'z2(x)';'z3(x)';'z4(x)';'z5(x)'])
+
+// example #2. An eigenvalue problem
+
+// y''(x)=-la*y(x)
+// BV: y(0)=y'(0); y(1)=0
+// Eigenfunctions and eigenvalues are y(x,n)=sin(s(n)*(1-x)), la(n)=s(n)^2,
+// where s(n) are the zeros of f(s,n)=s+atan(s)-(n+1)*pi, n=0,1,2,...
+// To get a third boundary condition, we choose y(0)=1
+// (With y(x) also c*y(x) is a solution for each constant c.)
+// We solve the following ode system:
+// y''=-la*y
+// la'=0
+// BV: y(0)=y'(0), y(0)=1; y(1)=0
+// z=[y(x) ; y'(x) ; la]
+
+function rhs=fsub(x,z)
+  rhs=[-z(3)*z(1);0]
+endfunction
+
+function g=gsub(i,z)
+  g=[z(1)-z(2) z(1)-1 z(1)]
+  g=g(i)
+endfunction
+
+// The following start function is good for the first 8 eigenfunctions.
+function [z,lhs]=ystart(x,z,la0)
+  z=[1;0;la0]
+  lhs=[0;0]
+endfunction
+
+a=0;b=1;
+m=[2;1];
+n=2;
+zeta=[a a b];
+N=101;
+x=linspace(a,b,N)';
+
+// We have s(n)-(n+1/2)*pi -> 0 for n to infinity.
+la0=input('n-th eigenvalue: n= ?');la0=(%pi/2+la0*%pi)^2;
+
+z=bvodeS(x,m,n,a,b,fsub,gsub,zeta,ystart=list(ystart,la0));
+
+clf()
+plot2d(x,[z(1,:)' z(2,:)'],style=[5 1],axesflag=5) 
+xtitle(['Startvalue =  '+string(la0);'Eigenvalue = '+string(z(3,1))],'x',' ')
+legend(['y(x)';'y''(x)'])
+
+
+// example #3. A boundary value problem with more than one solution.
+
+// DE: y''(x)=-exp(y(x))
+// BV: y(0)=0; y(1)=0
+// This boundary value problem has more than one solution.
+// It is demonstrated how to find two of them with the help of
+// some preinformation of the solutions y(x) to build the function ystart.
+// z=[y(x);y'(x)]
+
+a=0;b=1;m=2;n=1;
+zeta=[a b];
+N=101;
+tol=1e-8*[1 1];
+x=linspace(a,b,N);
+
+function rhs=fsub(x,z),rhs=-exp(z(1));endfunction
+
+function g=gsub(i,z)
+  g=[z(1) z(1)]
+  g=g(i)
+endfunction
+
+function [z,lhs]=ystart(x,z,M) 
+  //z=[4*x*(1-x)*M ; 4*(1-2*x)*M]
+  z=[M;0]
+  //lhs=[-exp(4*x*(1-x)*M)]
+  lhs=0
+endfunction
+
+for M=[1 4]
+   if M==1
+      z=bvodeS(x,m,n,a,b,fsub,gsub,zeta,ystart=list(ystart,M),tol=tol);
+   else
+      z1=bvodeS(x,m,n,a,b,fsub,gsub,zeta,ystart=list(ystart,M),tol=tol);
+   end
+end
+
+// Integrating the ode yield e.g. the two solutions yex and yex1. 
+
+function y=f(c),y=c.*(1-tanh(sqrt(c)/4).^2)-2;endfunction 
+c=fsolve(2,f);
+
+function y=yex(x,c)
+  y=log(c/2*(1-tanh(sqrt(c)*(1/4-x/2)).^2))
+endfunction 
+
+function y=f1(c1), y=2*c1^2+tanh(1/4/c1)^2-1;endfunction
+c1=fsolve(0.1,f1);
+
+function y=yex1(x,c1)
+  y=log((1-tanh((2*x-1)/4/c1).^2)/2/c1/c1)
+endfunction 
+
+disp(norm(z(1,:)-yex(x)),'norm(yex(x)-z(1,:))= ')
+disp(norm(z1(1,:)-yex1(x)),'norm(yex1(x)-z1(1,:))= ')
+
+clf();
+subplot(2,1,1)
+plot2d(x,z(1,:),style=[5])
+xtitle('Two different solutions','x',' ') 
+subplot(2,1,2)
+plot2d(x,z1(1,:),style=[5])
+xtitle(' ','x',' ')
+
+
+// example #4. A multi-point boundary value problem.
+
+// DE y'''(x)=1
+// z=[y(x);y'(x);y''(x)]
+// BV: y(-1)=2 y(1)=2
+// Side condition: y(0)=1 
+
+a=-1;b=1;c=0;
+// The side condition point c must be included in the array fixpnt.
+n=1;
+m=[3];
+
+function rhs=fsub(x,z)
+  rhs=1
+endfunction
+
+function g=gsub(i,z)
+  g=[z(1)-2 z(1)-1 z(1)-2]
+  g=g(i)
+endfunction
+
+N=10;
+zeta=[a c b];
+x=linspace(a,b,N);
+
+z=bvodeS(x,m,n,a,b,fsub,gsub,zeta,fixpnt=c);
+          
+function y=yex(x)
+y=x.^3/6+x.^2-x./6+1
+endfunction
+
+disp(norm(yex(x)-z(1,:)),'norm(yex(x)-z(1,:))= ')
+ ]]>
+  </EXAMPLE>
+  <SEE_ALSO>
+    <SEE_ALSO_ITEM>
+      <LINK>bvode</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>ode</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>dassl</LINK>
+    </SEE_ALSO_ITEM>
+  </SEE_ALSO>
+
+  <AUTHOR>Rainer von Seggern</AUTHOR>
+
+</MAN>
diff --git a/scilab/modules/optimization/help/eng/datafit.xml b/scilab/modules/optimization/help/eng/datafit.xml
new file mode 100644 (file)
index 0000000..fc478e9
--- /dev/null
@@ -0,0 +1,199 @@
+<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
+<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
+<MAN>
+  <LANGUAGE>eng</LANGUAGE>
+  <TITLE>datafit</TITLE>
+  <TYPE>Scilab Function</TYPE>
+  <DATE>Feb 1999</DATE>
+  <SHORT_DESCRIPTION name="datafit"> Parameter identification based on measured data</SHORT_DESCRIPTION>
+  <CALLING_SEQUENCE>
+    <CALLING_SEQUENCE_ITEM>[p,err]=datafit([imp,] G [,DG],Z [,W],[contr],p0,[algo],[df0,[mem]],  </CALLING_SEQUENCE_ITEM>
+    <CALLING_SEQUENCE_ITEM>     [work],[stop],['in'])  </CALLING_SEQUENCE_ITEM>
+  </CALLING_SEQUENCE>
+  <PARAM>
+    <PARAM_INDENT>
+      <PARAM_ITEM>
+        <PARAM_NAME>imp</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: scalar argument used to set the trace mode. <VERB>imp=0</VERB> nothing (execpt errors) is reported, <VERB>imp=1</VERB> initial and final reports, <VERB>imp=2</VERB> adds a report per iteration, <VERB>imp&gt;2</VERB> add reports on linear search. Warning, most of these reports are written on the Scilab standard output.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>G</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: function descriptor (e=G(p,z), e: ne x 1, p: np x 1, z: nz x 1)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>DG</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: partial of G wrt p function descriptor (optional; S=DG(p,z), S: ne x np)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>Z</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: matrix [z_1,z_2,...z_n] where z_i (nz x 1) is the ith measurement</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>W</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: weighting matrix of size ne x ne (optional; defaut no ponderation)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>contr</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: <VERB>'b',binf,bsup</VERB>  with <VERB>binf</VERB> and <VERB>bsup</VERB> real vectors with same dimension as <VERB>p0</VERB>. <VERB>binf</VERB> and <VERB>bsup</VERB> are lower and upper bounds on <VERB>p</VERB>.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>p0</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: initial guess (size np x 1)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>algo</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: <VERB>'qn'</VERB> or <VERB>'gc'</VERB> or <VERB>'nd'</VERB> . This string stands for quasi-Newton (default),  conjugate gradient or non-differentiable respectively.  Note that <VERB>'nd'</VERB> does not accept bounds on <VERB>x</VERB> ).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>df0</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: real scalar. Guessed decreasing of <VERB>f</VERB> at first iteration. (<VERB>df0=1</VERB> is the default value).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>mem :  </PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>integer, number of variables used to approximate the  Hessian, (<VERB>algo='gc' or 'nd'</VERB>). Default value is around 6.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>stop</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>:  sequence of optional parameters controlling the  convergence of the algorithm. <VERB> stop=  'ar',nap, [iter [,epsg [,epsf [,epsx]]]]</VERB></SP>
+          <PARAM_INDENT>
+            <PARAM_ITEM>
+              <PARAM_NAME>&quot;ar&quot;  </PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: reserved keyword for stopping rule selection defined as follows:</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>nap</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: maximum number of calls to <VERB>fun</VERB> allowed.</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>iter</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: maximum number of iterations allowed.</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>epsg</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: threshold on gradient norm.</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>epsf</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: threshold controlling decreasing of <VERB>f</VERB></SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>epsx</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: threshold controlling variation of <VERB>x</VERB>. This vector (possibly matrix) of same size as <VERB>x0</VERB> can be used to scale <VERB>x</VERB>.</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+          </PARAM_INDENT>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>&quot;in&quot;  </PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: reserved  keyword for initialization of parameters used when <VERB>fun</VERB> in given as a Fortran routine (see below).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>p</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: Column vector, optimal solution found</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>err</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: scalar, least square error.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+    </PARAM_INDENT>
+  </PARAM>
+  <DESCRIPTION>
+    <P><VERB>datafit</VERB> is used for fitting data to a model.
+    For a given function <VERB>G(p,z)</VERB>, this function finds the best vector 
+    of parameters <VERB>p</VERB> for approximating <VERB>G(p,z_i)=0</VERB> for a set of measurement
+    vectors <VERB>z_i</VERB>. Vector <VERB>p</VERB> is found by minimizing
+    <VERB>G(p,z_1)'WG(p,z_1)+G(p,z_2)'WG(p,z_2)+...+G(p,z_n)'WG(p,z_n)</VERB></P>
+    <P><VERB>datafit</VERB> is an improved version of <VERB>fit_dat</VERB>.</P>
+  </DESCRIPTION>
+  <EXAMPLE>
+<![CDATA[
+//generate the data
+function y=FF(x,p),y=p(1)*(x-p(2))+p(3)*x.*x,endfunction
+X=[];Y=[];
+pg=[34;12;14] //parameter used to generate data
+for x=0:.1:3, Y=[Y,FF(x,pg)+100*(rand()-.5)];X=[X,x];end
+Z=[Y;X];
+
+
+//The criterion function
+function e=G(p,z),
+   y=z(1),x=z(2);
+   e=y-FF(x,p),
+endfunction
+
+//Solve the problem
+p0=[3;5;10]    
+[p,err]=datafit(G,Z,p0);
+
+scf(0);clf()
+plot2d(X,FF(X,pg),5) //the curve without noise
+plot2d(X,Y,-1)  // the noisy data
+plot2d(X,FF(X,p),12) //the solution
+
+
+//the gradient of the criterion function
+function s=DG(p,z),
+   a=p(1),b=p(2),c=p(3),y=z(1),x=z(2),
+   s=-[x-b,-a,x*x]
+endfunction
+
+[p,err]=datafit(G,DG,Z,p0);
+scf(1);clf()
+plot2d(X,FF(X,pg),5) //the curve without noise
+plot2d(X,Y,-1)  // the noisy data
+plot2d(X,FF(X,p),12) //the solution
+
+
+ ]]>
+  </EXAMPLE>
+  <SEE_ALSO>
+   <SEE_ALSO_ITEM>
+      <LINK>lsqrsolve</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>optim</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>leastsq</LINK>
+    </SEE_ALSO_ITEM>
+  </SEE_ALSO>
+</MAN>
diff --git a/scilab/modules/optimization/help/eng/fit_dat.xml b/scilab/modules/optimization/help/eng/fit_dat.xml
new file mode 100644 (file)
index 0000000..8f9afc5
--- /dev/null
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
+<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
+<MAN>
+  <LANGUAGE>eng</LANGUAGE>
+  <TITLE>fit_dat</TITLE>
+  <TYPE>Scilab Function</TYPE>
+  <DATE>Feb 1998</DATE>
+  <SHORT_DESCRIPTION name="fit_dat"> Parameter identification based on measured data</SHORT_DESCRIPTION>
+  <CALLING_SEQUENCE>
+    <CALLING_SEQUENCE_ITEM>[p,err]=fit_dat(G,p0,Z [,W] [,pmin,pmax] [,DG])  </CALLING_SEQUENCE_ITEM>
+  </CALLING_SEQUENCE>
+  <PARAM>
+    <PARAM_INDENT>
+      <PARAM_ITEM>
+        <PARAM_NAME>G</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: Scilab function (e=G(p,z), e: nex1, p: npx1, z: nzx1)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>p0</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: initial guess (size npx1)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>Z</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: matrix [z_1,z_2,...z_n] where z_i (nzx1) is the ith measurement</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>W</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: weighting matrix of size nexne (optional; default 1)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>pmin</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: lower bound on p (optional; size npx1)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>pmax</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: upper bound on p (optional; size npx1)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>DG</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: partial of G wrt p (optional; S=DG(p,z), S: nexnp)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+    </PARAM_INDENT>
+  </PARAM>
+  <DESCRIPTION>
+    <P><VERB>fit_dat</VERB> is used for fitting data to a model.
+    For a given function G(p,z), this function finds the best vector 
+    of parameters p for approximating G(p,z_i)=0 for a set of measurement
+    vectors z_i. Vector p is found by minimizing
+    <VERB>G(p,z_1)'WG(p,z_1)+G(p,z_2)'WG(p,z_2)+...+G(p,z_n)'WG(p,z_n)</VERB></P>
+  </DESCRIPTION>
+  <EXAMPLE>
+<![CDATA[
+deff('y=FF(x)','y=a*(x-b)+c*x.*x')
+X=[];Y=[];
+a=34;b=12;c=14;for x=0:.1:3, Y=[Y,FF(x)+100*(rand()-.5)];X=[X,x];end
+Z=[Y;X];
+deff('e=G(p,z)','a=p(1),b=p(2),c=p(3),y=z(1),x=z(2),e=y-FF(x)')
+[p,err]=fit_dat(G,[3;5;10],Z)
+xset('window',0)
+xbasc();
+plot2d(X',Y',-1) 
+plot2d(X',FF(X)',5,'002')
+a=p(1),b=p(2),c=p(3);plot2d(X',FF(X)',12,'002')
+
+a=34;b=12;c=14;
+deff('s=DG(p,z)','y=z(1),x=z(2),s=-[x-p(2),-p(1),x*x]')
+[p,err]=fit_dat(G,[3;5;10],Z,DG)
+xset('window',1)
+xbasc();
+plot2d(X',Y',-1) 
+plot2d(X',FF(X)',5,'002')
+a=p(1),b=p(2),c=p(3);plot2d(X',FF(X)',12,'002')
+ ]]>
+  </EXAMPLE>
+  <SEE_ALSO>
+    <SEE_ALSO_ITEM>
+      <LINK>optim</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>datafit</LINK>
+    </SEE_ALSO_ITEM>
+  </SEE_ALSO>
+</MAN>
diff --git a/scilab/modules/optimization/help/eng/fsolve.xml b/scilab/modules/optimization/help/eng/fsolve.xml
new file mode 100644 (file)
index 0000000..d2dbcff
--- /dev/null
@@ -0,0 +1,171 @@
+<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
+<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
+<MAN>
+  <LANGUAGE>eng</LANGUAGE>
+  <TITLE>fsolve</TITLE>
+  <TYPE>Scilab Function</TYPE>
+  <DATE>August 1993</DATE>
+  <SHORT_DESCRIPTION name="fsolve"> find a zero of a system of n nonlinear functions</SHORT_DESCRIPTION>
+  <CALLING_SEQUENCE>
+    <CALLING_SEQUENCE_ITEM>[x [,v [,info]]]=fsolve(x0,fct [,fjac] [,tol])  </CALLING_SEQUENCE_ITEM>
+  </CALLING_SEQUENCE>
+  <PARAM>
+    <PARAM_INDENT>
+      <PARAM_ITEM>
+        <PARAM_NAME>x0</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: real vector (initial value of function argument).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>fct</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: external (i.e function or list or string).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>fjac</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: external (i.e function or list or string).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>tol</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: real scalar. precision tolerance: termination occurs when the algorithm estimates that the relative error between x and the solution is at most tol. (<VERB>tol=1.d-10</VERB> is the default value).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>x :  </PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>real vector (final value of function argument, estimated zero).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>v :  </PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>real vector (value of function at x).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>info</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>:  termination indicator</SP>
+          <PARAM_INDENT>
+            <PARAM_ITEM>
+              <PARAM_NAME>0</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: improper input parameters.</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>1</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: algorithm estimates that the relative error between x and the solution  is at most tol.</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>2</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: number of calls to fcn reached</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>3</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: tol is too small. No further improvement in the approximate solution  x is possible.</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>4</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: iteration is not making good progress.</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+          </PARAM_INDENT>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+    </PARAM_INDENT>
+  </PARAM>
+  <DESCRIPTION>
+    <P>
+    find a zero of a system of
+    n nonlinear functions in n variables by a modification
+    of the powell hybrid method. Jacobian may be provided.</P>
+    <VERBATIM>
+<![CDATA[
+0 = fct(x) w.r.t x.
+   ]]>
+    </VERBATIM>
+    <P><VERB>fct</VERB> is an &quot;external&quot;.
+    This external returns <VERB>v=fct(x)</VERB> given <VERB>x</VERB>.</P>
+    <P>
+    The simplest calling sequence for <VERB>fct</VERB> is:</P>
+    <VERBATIM>
+<![CDATA[
+[v]=fct(x).
+   ]]>
+    </VERBATIM>
+    <P>
+    If <VERB>fct</VERB> is a character string, it refers to a C or Fortran routine
+    which must be linked to Scilab. Fortran calling sequence must be</P>
+    <VERBATIM>
+<![CDATA[
+fct(n,x,v,iflag)
+integer n,iflag
+double precision x(n),v(n)
+   ]]>
+    </VERBATIM>
+    <P>
+    and C Calling sequence must be</P>
+    <VERBATIM>
+<![CDATA[
+fct(int *n, double x[],double v[],int *iflag)
+   ]]>
+    </VERBATIM>
+    <P>
+    Incremental  link is possible (help <VERB>link</VERB>).</P>
+    <P><VERB>jac</VERB> is an &quot;external&quot;.
+    This external returns <VERB>v=d(fct)/dx (x)</VERB> given <VERB>x</VERB>.</P>
+    <P>
+    The simplest calling sequence for <VERB>jac</VERB> is:</P>
+    <VERBATIM>
+<![CDATA[
+[v]=jac(x).
+   ]]>
+    </VERBATIM>
+    <P>
+    If <VERB>jac</VERB> is a character string, it refers to a to a C or Fortran routine
+    which must be linked to Scilab calling sequences are the same as those
+    for fct. Note however that v must be a nxn array.</P>
+  </DESCRIPTION>
+  <EXAMPLE>
+<![CDATA[
+// A simple example with fsolve 
+a=[1,7;2,8];b=[10;11];
+deff('[y]=fsol1(x)','y=a*x+b');
+deff('[y]=fsolj1(x)','y=a');
+[xres]=fsolve([100;100],fsol1);
+a*xres+b
+[xres]=fsolve([100;100],fsol1,fsolj1);
+a*xres+b
+// See routines/default/Ex-fsolve.f
+[xres]=fsolve([100;100],'fsol1','fsolj1',1.e-7);
+a*xres+b
+ ]]>
+  </EXAMPLE>
+  <SEE_ALSO>
+    <SEE_ALSO_ITEM>
+      <LINK>external</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>quapro</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>linpro</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>optim</LINK>
+    </SEE_ALSO_ITEM>
+  </SEE_ALSO>
+</MAN>
diff --git a/scilab/modules/optimization/help/eng/helpbuildereng.sce b/scilab/modules/optimization/help/eng/helpbuildereng.sce
new file mode 100644 (file)
index 0000000..de06804
--- /dev/null
@@ -0,0 +1,6 @@
+mode(-1); //force silent execution\r
+path=get_absolute_file_path('helpbuildereng.sce');//get the absolute path of this file\r
+add_help_chapter("Optimization and Simulation",path);//add help chapter\r
+xmltohtml(path,"Optimization and Simulation");\r
+//clear the variable stack\r
+clear path add_help_chapter get_absolute_file_path; 
\ No newline at end of file
diff --git a/scilab/modules/optimization/help/eng/karmarkar.xml b/scilab/modules/optimization/help/eng/karmarkar.xml
new file mode 100644 (file)
index 0000000..794c60b
--- /dev/null
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
+<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
+<MAN>
+  <LANGUAGE>eng</LANGUAGE>
+  <TITLE>karmarkar</TITLE>
+  <TYPE>Scilab Function</TYPE>
+  <DATE>April 1993</DATE>
+  <SHORT_DESCRIPTION name="karmarkar"> karmarkar algorithm</SHORT_DESCRIPTION>
+  <CALLING_SEQUENCE>
+    <CALLING_SEQUENCE_ITEM>[x1]=karmarkar(a,b,c,x0)  </CALLING_SEQUENCE_ITEM>
+  </CALLING_SEQUENCE>
+  <PARAM>
+    <PARAM_INDENT>
+      <PARAM_ITEM>
+        <PARAM_NAME>a</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: matrix (n,p)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>b</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>:  n - vector</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>c</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>:  p - vector</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>x0</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>:  initial vector</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>eps</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: threshold (default value : 1.d-5)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>gamma</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: descent step  <VERB>0&lt;gamma&lt;1</VERB> , default value : 1/4</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>x1</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: solution</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>crit</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: value of  c'*x1</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+    </PARAM_INDENT>
+  </PARAM>
+  <DESCRIPTION>
+    <P>
+    Computes <VERB>x</VERB> which minimizes</P>
+    <VERBATIM>
+<![CDATA[
+                        c'*x
+   ]]>
+    </VERBATIM>
+    <P>
+    under constraints:</P>
+    <VERBATIM>
+<![CDATA[
+                        a*x = b
+                        x>=0
+   ]]>
+    </VERBATIM>
+  </DESCRIPTION>
+  <EXAMPLE>
+<![CDATA[
+// n=10;p=20;
+// a=rand(n,p);c=rand(p,1);x0=abs(rand(p,1));b=a*x0;x1=karmarkar(a,b,c,x0);
+ ]]>
+  </EXAMPLE>
+</MAN>
diff --git a/scilab/modules/optimization/help/eng/leastsq.xml b/scilab/modules/optimization/help/eng/leastsq.xml
new file mode 100644 (file)
index 0000000..835a659
--- /dev/null
@@ -0,0 +1,413 @@
+<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
+<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
+<MAN>
+  <LANGUAGE>eng</LANGUAGE>
+  <TITLE>leastsq</TITLE>
+  <TYPE>Scilab Function</TYPE>
+  <DATE>April 1999</DATE>
+  <SHORT_DESCRIPTION name="leastsq"> 
+    Solves non-linear least squares problems  
+  </SHORT_DESCRIPTION>
+  <CALLING_SEQUENCE>
+    <CALLING_SEQUENCE_ITEM>[fopt,[xopt,[grdopt]]]=leastsq(fun, x0)</CALLING_SEQUENCE_ITEM>
+    <CALLING_SEQUENCE_ITEM>[fopt,[xopt,[grdopt]]]=leastsq(fun, dfun, x0)</CALLING_SEQUENCE_ITEM>
+    <CALLING_SEQUENCE_ITEM>[fopt,[xopt,[grdopt]]]=leastsq(fun, cstr, x0)</CALLING_SEQUENCE_ITEM>
+    <CALLING_SEQUENCE_ITEM>[fopt,[xopt,[grdopt]]]=leastsq(fun, dfun, cstr, x0)</CALLING_SEQUENCE_ITEM>
+    <CALLING_SEQUENCE_ITEM>[fopt,[xopt,[grdopt]]]=leastsq(fun, dfun, cstr, x0, algo)</CALLING_SEQUENCE_ITEM>
+    <CALLING_SEQUENCE_ITEM>[fopt,[xopt,[grdopt]]]=leastsq([imp], fun [,dfun] [,cstr],x0 [,algo],[df0,[mem]],[stop])</CALLING_SEQUENCE_ITEM>
+  </CALLING_SEQUENCE>
+  <PARAM>
+    <PARAM_INDENT>
+      <PARAM_ITEM>
+        <PARAM_NAME>fopt</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: value of the function <EM>f(x)=||fun(x)||^2</EM> at <VERB>xopt</VERB></SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>xopt</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: best value of <VERB>x</VERB> found to minimize <EM>||fun(x)||^2</EM></SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>grdopt</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: gradient of <EM>f</EM> at <VERB>xopt</VERB></SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+
+      <PARAM_ITEM>
+        <PARAM_NAME>fun</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>:  a scilab function or a list defining a function from <EM>R^n</EM> to <EM>R^m</EM> 
+                 (see more details in DESCRIPTION).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>x0</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: real vector (initial guess of the variable to be minimized).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>dfun</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>:  a scilab function or a string defining the Jacobian matrix of <VERB>fun</VERB>
+                 (see more details in DESCRIPTION).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>cstr</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: bound constraints on <VERB>x</VERB>. They must be introduced by the string keyword <TT>'b'</TT>
+                followed by the lower bound <TT>binf</TT> then by the upper bound <TT>bsup</TT> (so 
+                <VERB>cstr</VERB> appears as <VERB>'b',binf,bsup</VERB> in the calling sequence). Those bounds
+                are real vectors with same dimension than <VERB>x0</VERB> (-%inf and +%inf may be used for
+                dimension which are unrestricted).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>algo</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: a string with possible values: <TT>'qn'</TT> or <TT>'gc'</TT> or <TT>'nd'</TT>. 
+                These strings stand for quasi-Newton (default),  conjugate gradient or non-differentiable 
+                respectively. Note that <TT>'nd'</TT> does not accept bounds on <VERB>x</VERB>.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>imp</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: scalar argument used to set the trace mode. <VERB>imp=0</VERB> nothing (except errors) 
+                is reported, <VERB>imp=1</VERB> initial and final reports, <VERB>imp=2</VERB> adds a 
+                report per iteration, <VERB>imp&gt;2</VERB> add reports on linear search. Warning, most
+                of these reports are written on the Scilab standard output.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>df0</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: real scalar. Guessed decreasing of <EM>||fun||^2</EM> at first iteration. 
+                (<TT>df0=1</TT> is the default value).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>mem</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: integer, number of variables used to approximate the Hessean (second derivatives)
+                of <EM>f</EM> when <VERB>algo</VERB><TT>='qn'</TT>. Default value is around 6.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>stop</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>:  sequence of optional parameters controlling the  convergence of the algorithm. They 
+                 are introduced by the keyword <TT>'ar'</TT>, the sequence being of the form
+                 <VERB>'ar',nap, [iter [,epsg   [,epsf [,epsx]]]]</VERB></SP>
+          <PARAM_INDENT>
+            <PARAM_ITEM>
+              <PARAM_NAME>nap</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: maximum number of calls to <VERB>fun</VERB> allowed.</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>iter</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: maximum number of iterations allowed.</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>epsg</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: threshold on gradient norm.</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>epsf</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: threshold controlling decreasing of <VERB>f</VERB></SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>epsx</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: threshold controlling variation of <VERB>x</VERB>. This vector (possibly matrix) 
+                      of same size as <VERB>x0</VERB> can be used to scale <VERB>x</VERB>.</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+          </PARAM_INDENT>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+    </PARAM_INDENT>
+  </PARAM>
+
+
+  <DESCRIPTION>
+    <P>
+     <EM>fun</EM> being a function from <EM>R^n</EM> to <EM>R^m</EM> this routine tries to minimize w.r.t.
+     <EM>x</EM>, the function:
+   </P>
+        <VERBATIM><![CDATA[
+                           _m_     
+                      2    \      2
+     f(x) = ||fun(x)||  =  /   fun (x)
+                           ---    i
+                           i=1     
+          ]]></VERBATIM>
+    <SP> which is the sum of the squares of the components of <EM>fun</EM>. Bound constraints may be
+     imposed on <VERB>x</VERB>.</SP>
+  </DESCRIPTION>   
+
+  <SECTION label="How to provide fun and dfun">
+    <P><VERB>fun</VERB> can be either a usual scilab function (case 1) or a fortran or a C routine linked
+            to scilab (case 2). For most problems the definition of <EM>fun</EM> will need 
+            supplementary parameters and this can be done in both cases.</P>
+         <ITEMIZE>
+          <ITEM label="case 1:">
+            <SP> when <VERB>fun</VERB> is a Scilab function, its calling sequence must be:
+          <TT>y=fun(x [,opt_par1,opt_par2,...])</TT>. When <VERB>fun</VERB> needs optional parameters it
+           must appear as <TT>list(fun,opt_par1,opt_par2,...)</TT> in the calling sequence of
+           <VERB>leastsq</VERB>.</SP>
+          </ITEM>
+          <ITEM label="case 2:">
+            <SP> when <VERB>fun</VERB> is defined by a Fortran or C routine it must appear as
+                <TT>list(fun_name,m [,opt_par1,opt_par2,...])</TT> in the calling
+                sequence of <VERB>leastsq</VERB>, <TT>fun_name</TT> (a string) being the name 
+                of the routine which must be linked to Scilab (see <LINK>link</LINK>). The generic 
+                calling sequences for this routine are:</SP> 
+            <VERBATIM><![CDATA[
+In Fortran:    subroutine fun(m, n, x, params, y)
+               integer m,n
+               double precision x(n), params(*), y(m)
+
+In C:          void fun(int *m, int *n, double *x, double *params, double *y)
+         ]]></VERBATIM>
+            <SP>where <VERB>n</VERB> is the dimension of vector <VERB>x</VERB>, <VERB>m</VERB> the dimension of 
+            vector <VERB>y</VERB> (which must store the evaluation of <EM>fun</EM> 
+            at <EM>x</EM>) and <VERB>params</VERB> is a vector which contains the optional parameters 
+            <EM>opt_par1, opt_par2, ...</EM> (each parameter may be a vector, for instance if <EM>opt_par1</EM> 
+            has 3 components, the description of <EM>opt_par2</EM> begin from <TT>params(4)</TT> (fortran case),
+            and from  <TT>params[3]</TT> (C case), etc... Note that even if <VERB>fun</VERB> doesn't need
+            supplementary parameters you must anyway write the fortran code with a <TT>params</TT> argument
+            (which is then unused in the subroutine core).</SP>
+          </ITEM>
+         </ITEMIZE>
+
+        <P>In many cases it is adviced to provide the Jacobian matrix <VERB>dfun</VERB> (<EM>dfun(i,j)=dfi/dxj</EM>) 
+           to the optimizer (which uses a finite difference approximation otherwise) and as for <VERB>fun</VERB> it may 
+           be given as a usual scilab function or as a  fortran or a C routine linked to scilab.</P> 
+        <ITEMIZE>
+          <ITEM label="case 1:">
+            <SP> when <VERB>dfun</VERB> is a scilab function, its calling sequence must be:
+          <TT>y=dfun(x [, optional parameters])</TT> (notes that even if <VERB>dfun</VERB> needs optional 
+              parameters it must appear simply as <TT>dfun</TT> in the calling sequence of
+           <VERB>leastsq</VERB>).</SP>
+          </ITEM>
+          <ITEM label="case 2:">
+            <SP> when <VERB>dfun</VERB> is defined by a Fortran or C routine it must appear as
+                <TT>dfun_name</TT> (a string) in the calling sequence of <VERB>leastsq</VERB> 
+                (<TT>dfun_name</TT> being the name of the routine which must be linked to Scilab). 
+                The calling sequences for this routine are nearly the same than for <VERB>fun</VERB>:</SP> 
+            <VERBATIM><![CDATA[
+In Fortran:    subroutine dfun(m, n, x, params, y)
+               integer m,n
+               double precision x(n), params(*), y(m,n)
+
+In C:          void fun(int *m, int *n, double *x, double *params, double *y)
+         ]]></VERBATIM>
+            <SP>in the C case <EM>dfun(i,j)=dfi/dxj</EM> must be stored in <TT>y[m*(j-1)+i-1]</TT>.</SP>
+          </ITEM>
+        </ITEMIZE>
+
+  </SECTION>
+
+  <SECTION label="Remarks">
+    <P> Like <LINK>datafit</LINK>, <VERB>leastsq</VERB> is a front end onto the <LINK>optim</LINK>
+       function. If you want to try the Levenberg-Marquard method instead, use <LINK>lsqrsolve</LINK>.
+    </P>
+    <P> A least squares problem may be solved directly with the <LINK>optim</LINK> function ;
+        in this case the function <LINK>NDcost</LINK> may be useful to compute the derivatives
+        (see the <LINK>NDcost</LINK> help page which provides a simple example for parameters 
+        identification of a differential equation).
+    </P>
+  </SECTION>
+  <EXAMPLE>
+<![CDATA[// We will show different calling possibilities of leastsq on one (trivial) example
+// which is non linear but doesn't really need to be solved with leastsq (applying
+// log linearizes the model and the problem may be solved with linear algebra). 
+// In this example we look for the 2 parameters x(1) and x(2) of a simple
+// exponential decay model (x(1) being the unknow initial value and x(2) the
+// decay constant): 
+function y = yth(t, x)
+   y  = x(1)*exp(-x(2)*t) 
+endfunction  
+
+// we have the m measures (ti, yi):
+m = 10;
+tm = [0.25, 0.5, 0.75, 1.0, 1.25, 1.5, 1.75, 2.0, 2.25, 2.5]';
+ym = [0.79, 0.59, 0.47, 0.36, 0.29, 0.23, 0.17, 0.15, 0.12, 0.08]';
+wm = ones(m,1); // measure weights (here all equal to 1...)
+
+// and we want to find the parameters x such that the model fits the given 
+// datas in the least square sense:
+// 
+//  minimize  f(x) = sum_i  wm(i)^2 ( yth(tm(i),x) - ym(i) )^2   
+
+// initial parameters guess
+x0 = [1.5 ; 0.8];
+
+// in the first examples, we define the function fun and dfun 
+// in scilab language
+function e = myfun(x, tm, ym, wm)
+   e = wm.*( yth(tm, x) - ym )
+endfunction
+
+function g = mydfun(x, tm, ym, wm)
+   v = wm.*exp(-x(2)*tm)
+   g = [v , -x(1)*tm.*v]
+endfunction
+
+// now we could call leastsq:
+
+// 1- the simplest call
+[f,xopt, gropt] = leastsq(list(myfun,tm,ym,wm),x0)
+
+// 2- we provide the Jacobian
+[f,xopt, gropt] = leastsq(list(myfun,tm,ym,wm),mydfun,x0)
+
+// a small graphic (before showing other calling features)
+tt = linspace(0,1.1*max(tm),100)';
+yy = yth(tt, xopt);
+xbasc()
+plot2d(tm, ym, style=-2)
+plot2d(tt, yy, style = 2)
+legend(["measure points", "fitted curve"]);
+xtitle("a simple fit with leastsq")
+
+// 3- how to get some informations (we use imp=1)
+[f,xopt, gropt] = leastsq(1,list(myfun,tm,ym,wm),mydfun,x0)
+
+// 4- using the conjugate gradient (instead of quasi Newton)
+[f,xopt, gropt] = leastsq(1,list(myfun,tm,ym,wm),mydfun,x0,"gc")
+
+// 5- how to provide bound constraints (not useful here !)
+xinf = [-%inf,-%inf]; xsup = [%inf, %inf];
+[f,xopt, gropt] = leastsq(list(myfun,tm,ym,wm),"b",xinf,xsup,x0) // without Jacobian
+[f,xopt, gropt] = leastsq(list(myfun,tm,ym,wm),mydfun,"b",xinf,xsup,x0) // with Jacobian 
+
+// 6- playing with some stopping parameters of the algorithm
+//    (allows only 40 function calls, 8 iterations and set epsg=0.01, epsf=0.1)
+[f,xopt, gropt] = leastsq(1,list(myfun,tm,ym,wm),mydfun,x0,"ar",40,8,0.01,0.1)
+
+
+// 7 and 8: now we want to define fun and dfun in fortran then in C
+//          Note that the "compile and link to scilab" method used here
+//          is believed to be OS independant (but there are some requirements, 
+//          in particular you need a C and a fortran compiler, and they must 
+//          be compatible with the ones used to build your scilab binary).
+// 7- fun and dfun in fortran
+
+// 7-1/ Let 's Scilab write the fortran code (in the TMPDIR directory):
+f_code = [ ...
+"      subroutine myfun(m,n,x,param,f)"
+"*     param(i) = tm(i), param(m+i) = ym(i), param(2m+i) = wm(i)"
+"      implicit none"
+"      integer n,m"
+"      double precision x(n), param(*), f(m)"
+"      integer i"
+"      do i = 1,m"
+"         f(i) = param(2*m+i)*( x(1)*exp(-x(2)*param(i)) - param(m+i) )"
+"      enddo"
+"      end ! subroutine fun"
+""
+"      subroutine mydfun(m,n,x,param,df)"
+"*     param(i) = tm(i), param(m+i) = ym(i), param(2m+i) = wm(i)"
+"      implicit none"
+"      integer n,m"
+"      double precision x(n), param(*), df(m,n)"
+"      integer i"
+"      do i = 1,m"
+"         df(i,1) =  param(2*m+i)*exp(-x(2)*param(i))"
+"         df(i,2) = -x(1)*param(i)*df(i,1)"
+"      enddo"
+"      end ! subroutine dfun"];
+mputl(f_code,TMPDIR+'/myfun.f')
+
+// 7-2/ compiles it. You need a fortran compiler !
+names = ["myfun" "mydfun"]
+flibname = ilib_for_link(names,"myfun.o",[],"f",TMPDIR+"/Makefile");
+
+// 7-3/ link it to scilab (see link help page)
+link(flibname,names,"f") 
+
+// 7-4/ ready for the leastsq call: be carreful don't forget to
+//      give the dimension m after the routine name !
+[f,xopt, gropt] = leastsq(list("myfun",m,tm,ym,wm),x0)  // without Jacobian
+[f,xopt, gropt] = leastsq(list("myfun",m,tm,ym,wm),"mydfun",x0) // with Jacobian
+
+
+// 8- last example: fun and dfun in C
+
+// 8-1/ Let 's Scilab write the C code (in the TMPDIR directory):
+c_code = [...
+"#include <math.h>"
+"void myfunc(int *m,int *n, double *x, double *param, double *f)"
+"{"
+"  /*  param[i] = tm[i], param[m+i] = ym[i], param[2m+i] = wm[i] */"
+"  int i;"
+"  for ( i = 0 ; i < *m ; i++ )"
+"    f[i] = param[2*(*m)+i]*( x[0]*exp(-x[1]*param[i]) - param[(*m)+i] );"
+"  return;"
+"}"
+""
+"void mydfunc(int *m,int *n, double *x, double *param, double *df)"
+"{"
+"  /*  param[i] = tm[i], param[m+i] = ym[i], param[2m+i] = wm[i] */"
+"  int i;"
+"  for ( i = 0 ; i < *m ; i++ )"
+"    {"
+"      df[i] = param[2*(*m)+i]*exp(-x[1]*param[i]);"
+"      df[i+(*m)] = -x[0]*param[i]*df[i];"
+"    }"
+"  return;"
+"}"];
+mputl(c_code,TMPDIR+'/myfunc.c')
+
+// 8-2/ compiles it. You need a C compiler !
+names = ["myfunc" "mydfunc"]
+clibname = ilib_for_link(names,"myfunc.o",[],"c",TMPDIR+"/Makefile");
+
+// 8-3/ link it to scilab (see link help page)
+link(clibname,names,"c") 
+
+// 8-4/ ready for the leastsq call
+[f,xopt, gropt] = leastsq(list("myfunc",m,tm,ym,wm),"mydfunc",x0)
+   ]]>
+  </EXAMPLE>
+  <SEE_ALSO>
+    <SEE_ALSO_ITEM>
+      <LINK>lsqrsolve</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>optim</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>NDcost</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>datafit</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>external</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>quapro</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>linpro</LINK>
+    </SEE_ALSO_ITEM>
+  </SEE_ALSO>
+</MAN>
diff --git a/scilab/modules/optimization/help/eng/linpro.xml b/scilab/modules/optimization/help/eng/linpro.xml
new file mode 100644 (file)
index 0000000..9463946
--- /dev/null
@@ -0,0 +1,160 @@
+<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
+<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
+<MAN>
+  <LANGUAGE>eng</LANGUAGE>
+  <TITLE>linpro</TITLE>
+  <TYPE>Scilab Function</TYPE>
+  <DATE>April 1993</DATE>
+  <SHORT_DESCRIPTION name="linpro"> linear programming solver</SHORT_DESCRIPTION>
+  <CALLING_SEQUENCE>
+    <CALLING_SEQUENCE_ITEM>[x,lagr,f]=linpro(p,C,b [,x0])  </CALLING_SEQUENCE_ITEM>
+    <CALLING_SEQUENCE_ITEM>[x,lagr,f]=linpro(p,C,b,ci,cs [,x0])  </CALLING_SEQUENCE_ITEM>
+    <CALLING_SEQUENCE_ITEM>[x,lagr,f]=linpro(p,C,b,ci,cs,me [,x0])  </CALLING_SEQUENCE_ITEM>
+    <CALLING_SEQUENCE_ITEM>[x,lagr,f]=linpro(p,C,b,ci,cs,me,x0 [,imp])  </CALLING_SEQUENCE_ITEM>
+  </CALLING_SEQUENCE>
+  <PARAM>
+    <PARAM_INDENT>
+      <PARAM_ITEM>
+        <PARAM_NAME>p</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: real column vector (dimension <VERB> n</VERB>)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>C</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: real matrix (dimension <VERB> (me + md) x n</VERB>) (If no constraints are given, you can set <VERB>C = []</VERB>)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>b</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: RHS column vector (dimension <VERB>(me + md)</VERB>) (If no constraints are given, you can set <VERB>b = []</VERB>)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>ci</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: column vector of lower-bounds (dimension <VERB> n</VERB>). If there are no lower bound constraints, put <VERB>ci = []</VERB>. If some components of <VERB>x</VERB> are bounded from below, set the other (unconstrained) values of <VERB>ci</VERB> to a very  large negative  number (e.g. <VERB>ci(j) = -number_properties('huge')</VERB>.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>cs</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: column vector of upper-bounds. (Same remarks as above).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>me</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: number of equality constraints (i.e. <VERB>C(1:me,:)*x = b(1:me)</VERB>)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>x0</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: either an initial guess for <VERB>x</VERB>    or one of the character strings <VERB>'v'</VERB> or <VERB>'g'</VERB>. If <VERB>x0='v'</VERB> the calculated initial feasible point is a vertex. If <VERB>x0='g'</VERB> the calculated initial feasible point is arbitrary.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>imp</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: verbose option (optional parameter)  (Try <VERB>imp=7,8,...</VERB>) warning the message are output in the window where scilab has been started.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>x</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: optimal solution found.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>f</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: optimal value of the cost function (i.e. <VERB>f=p'*x</VERB>).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>lagr</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: vector of Lagrange multipliers.  If lower and upper-bounds <VERB>ci,cs</VERB> are provided, <VERB>lagr</VERB> has  <VERB>n + me + md</VERB> components and <VERB>lagr(1:n)</VERB> is the Lagrange  vector associated with the bound constraints and  <VERB>lagr (n+1 : n + me + md)</VERB> is the Lagrange vector associated  with the linear constraints. (If an upper-bound (resp. lower-bound) constraint <VERB>i</VERB> is active  <VERB>lagr(i)</VERB> is &gt; 0 (resp. &lt;0). If no bounds are provided, <VERB>lagr</VERB> has only <VERB>me + md</VERB> components.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+    </PARAM_INDENT>
+  </PARAM>
+  <DESCRIPTION>
+    <P><VERB>[x,lagr,f]=linpro(p,C,b [,x0])</VERB> Minimize <VERB>p'*x</VERB>
+    under the constraints  <VERB>C*x &lt;= b</VERB></P>
+    <P><VERB>[x,lagr,f]=linpro(p,C,b,ci,cs [,x0])</VERB> Minimize <VERB>p'*x</VERB> under the constraints  <VERB>C*x &lt;= b</VERB>, <VERB>ci &lt;= x &lt;= cs</VERB></P>
+    <P><VERB>[x,lagr,f]=linpro(p,C,b,ci,cs,me [,x0])</VERB> Minimize <VERB>p'*x</VERB>
+    under the constraints</P>
+    <VERBATIM>
+<![CDATA[
+ C(j,:) x = b(j),  j=1,...,me
+ C(j,:) x <= b(j), j=me+1,...,me+md
+ ci <= x <= cs
+   ]]>
+    </VERBATIM>
+    <P>
+    If no initial point is given the
+    program computes a feasible initial point
+    which is a vertex of the region of feasible points if
+    <VERB>x0='v'</VERB>.</P>
+    <P>
+    If <VERB>x0='g'</VERB>, the program computes a feasible initial 
+    point which is not necessarily a vertex. This mode is
+    advisable when the quadratic form is positive
+    definite and there are a few constraints in
+    the problem or when there are large bounds
+    on the variables that are security bounds and
+    very likely not active at the optimal solution.</P>
+  </DESCRIPTION>
+  <EXAMPLE>
+<![CDATA[
+//Find x in R^6 such that:
+//C1*x = b1  (3 equality constraints i.e me=3)
+C1= [1,-1,1,0,3,1;
+    -1,0,-3,-4,5,6;
+     2,5,3,0,1,0];
+b1=[1;2;3];
+//C2*x <= b2  (2 inequality constraints)
+C2=[0,1,0,1,2,-1;
+    -1,0,2,1,1,0];
+b2=[-1;2.5];
+//with  x between ci and cs:
+ci=[-1000;-10000;0;-1000;-1000;-1000];cs=[10000;100;1.5;100;100;1000];
+//and minimize p'*x with
+p=[1;2;3;4;5;6]
+//No initial point is given: x0='v';
+C=[C1;C2]; b=[b1;b2] ; me=3; x0='v';
+[x,lagr,f]=linpro(p,C,b,ci,cs,me,x0)
+// Lower bound constraints 3 and 4 are active and upper bound
+// constraint 5 is active --> lagr(3:4) < 0 and lagr(5) > 0.
+// Linear (equality) constraints 1 to 3 are active --> lagr(7:9) <> 0
+ ]]>
+  </EXAMPLE>
+  <SEE_ALSO>
+    <SEE_ALSO_ITEM>
+      <LINK>quapro</LINK>
+    </SEE_ALSO_ITEM>
+  </SEE_ALSO>
+  <AUTHORS>
+    <AUTHORS_ITEM label="Eduardo Casas  Renteria">, Universidad de Cantabria,</AUTHORS_ITEM>
+    <AUTHORS_ITEM label="Cecilia Pola Mendez"> , Universidad de Cantabria</AUTHORS_ITEM>
+  </AUTHORS>
+  <USED_FUNCTIONS>
+    <P>
+in routines/optim directory (authors E.Casas, C. Pola Mendez):</P>
+    <P>
+anfm01.f  anfm03.f  anfm05.f  anrs01.f  auxo01.f  dimp03.f  dnrm0.f   optr03.f  pasr03.f  zthz.f
+anfm02.f  anfm04.f  anfm06.f  anrs02.f  desr03.f  dipvtf.f  optr01.f
+opvf03.f  plcbas.f</P>
+    <P> From BLAS library</P>
+    <P>
+daxpy.f dcopy.f ddot.f dnrm2.f dscal.f dswap.f idamax.f</P>
+    <P> in routines/calelm directory (authors INRIA):</P>
+    <P>
+add.f ddif.f dmmul.f</P>
+    <P> From LAPACK library : dlamch.f</P>
+  </USED_FUNCTIONS>
+</MAN>
diff --git a/scilab/modules/optimization/help/eng/lmisolver.xml b/scilab/modules/optimization/help/eng/lmisolver.xml
new file mode 100644 (file)
index 0000000..093b064
--- /dev/null
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
+<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
+<MAN>
+  <LANGUAGE>eng</LANGUAGE>
+  <TITLE>lmisolver</TITLE>
+  <TYPE>Scilab Function</TYPE>
+  <DATE>April 1993</DATE>
+  <SHORT_DESCRIPTION name="lmisolver"> linear matrix inequation solver</SHORT_DESCRIPTION>
+  <CALLING_SEQUENCE>
+    <CALLING_SEQUENCE_ITEM>[XLISTF[,OPT]] = lmisolver(XLIST0,evalfunc [,options])  </CALLING_SEQUENCE_ITEM>
+  </CALLING_SEQUENCE>
+  <PARAM>
+    <PARAM_INDENT>
+      <PARAM_ITEM>
+        <PARAM_NAME>XLIST0</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: a list of containing initial guess (e.g. <VERB>XLIST0=list(X1,X2,..,Xn)</VERB>)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>evalfunc</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: a Scilab function (&quot;external&quot; function with specific
+    syntax)</SP>
+          <P>
+    The syntax the function <VERB>evalfunc</VERB> must be as follows:
+  </P>
+          <P><VERB>[LME,LMI,OBJ]=evalfunct(X)</VERB> where <VERB>X</VERB> is a list of matrices, <VERB>LME, LMI</VERB> are lists and <VERB>OBJ</VERB> a real scalar.
+  </P>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>XLISTF</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: a list of matrices (e.g. <VERB>XLIST0=list(X1,X2,..,Xn)</VERB>)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>options</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: optional parameter. If given, <VERB>options</VERB> is  a real row vector with 5 components <VERB>[Mbound,abstol,nu,maxiters,reltol]</VERB></SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+    </PARAM_INDENT>
+  </PARAM>
+  <DESCRIPTION>
+    <P><VERB>lmisolver</VERB> solves the following problem:</P>
+    <P>
+    minimize <VERB>f(X1,X2,...,Xn)</VERB> a linear function of Xi's</P>
+    <P>
+    under the linear constraints:
+    <VERB>Gi(X1,X2,...,Xn)=0</VERB> for i=1,...,p and LMI (linear matrix
+    inequalities) constraints:</P>
+    <P><VERB>Hj(X1,X2,...,Xn) &gt; 0</VERB> for j=1,...,q</P>
+    <P>
+    The functions f, G, H are coded in the Scilab function <VERB>evalfunc</VERB>
+    and the set of matrices Xi's in the list X (i.e.
+    <VERB>X=list(X1,...,Xn)</VERB>).</P>
+    <P>
+    The function <VERB>evalfun</VERB> must return in the list <VERB>LME</VERB> the matrices
+    <VERB>G1(X),...,Gp(X)</VERB> (i.e. <VERB>LME(i)=Gi(X1,...,Xn),</VERB> i=1,...,p).
+    <VERB>evalfun</VERB> must return in the list <VERB>LMI</VERB> the matrices
+    <VERB>H1(X0),...,Hq(X)</VERB> (i.e. <VERB>LMI(j)=Hj(X1,...,Xn)</VERB>, j=1,...,q). 
+    <VERB>evalfun</VERB> must return in <VERB>OBJ</VERB> the value of <VERB>f(X)</VERB>
+    (i.e. <VERB>OBJ=f(X1,...,Xn)</VERB>).</P>
+    <P><VERB>lmisolver</VERB>  returns in <VERB>XLISTF</VERB>, a list of real matrices,
+    i. e. <VERB>XLIST=list(X1,X2,..,Xn)</VERB> where the Xi's solve the LMI
+    problem:</P>
+    <P>
+    Defining <VERB>Y,Z</VERB> and <VERB>cost</VERB> by:</P>
+    <P><VERB>[Y,Z,cost]=evalfunc(XLIST)</VERB>, <VERB>Y</VERB> is a list of zero matrices, 
+    <VERB>Y=list(Y1,...,Yp)</VERB>, <VERB>Y1=0, Y2=0, ..., Yp=0</VERB>.</P>
+    <P><VERB> Z</VERB> is a list of square symmetric matrices, 
+    <VERB> Z=list(Z1,...,Zq) </VERB>, which are semi positive definite
+    <VERB> Z1&gt;0, Z2&gt;0, ..., Zq&gt;0</VERB> (i.e. <VERB>spec(Z(j))</VERB> &gt; 0),</P>
+    <P><VERB>cost</VERB> is minimized.</P>
+    <P><VERB>lmisolver</VERB> can also solve LMI problems in which the <VERB>Xi's</VERB> 
+    are not matrices but lists of matrices. More details are given in the 
+    documentation of LMITOOL.</P>
+  </DESCRIPTION>
+  <EXAMPLE>
+<![CDATA[
+//Find diagonal matrix X (i.e. X=diag(diag(X), p=1) such that
+//A1'*X+X*A1+Q1 < 0, A2'*X+X*A2+Q2 < 0 (q=2) and trace(X) is maximized 
+n=2;A1=rand(n,n);A2=rand(n,n);
+Xs=diag(1:n);Q1=-(A1'*Xs+Xs*A1+0.1*eye());
+Q2=-(A2'*Xs+Xs*A2+0.2*eye());
+deff('[LME,LMI,OBJ]=evalf(Xlist)','X=Xlist(1),LME=X-diag(diag(X));...
+LMI=list(-(A1''*X+X*A1+Q1),-(A2''*X+X*A2+Q2)),OBJ= -sum(diag(X))  ');
+X=lmisolver(list(zeros(A1)),evalf);X=X(1)
+[Y,Z,c]=evalf(X)
+ ]]>
+  </EXAMPLE>
+  <SEE_ALSO>
+    <SEE_ALSO_ITEM>
+      <LINK>lmitool</LINK>
+    </SEE_ALSO_ITEM>
+  </SEE_ALSO>
+</MAN>
diff --git a/scilab/modules/optimization/help/eng/lmitool.xml b/scilab/modules/optimization/help/eng/lmitool.xml
new file mode 100644 (file)
index 0000000..d0eb0ca
--- /dev/null
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
+<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
+<MAN>
+  <LANGUAGE>eng</LANGUAGE>
+  <TITLE>lmitool</TITLE>
+  <TYPE>Scilab Function</TYPE>
+  <DATE>April 1993</DATE>
+  <SHORT_DESCRIPTION name="lmitool"> tool for solving linear matrix inequations</SHORT_DESCRIPTION>
+  <CALLING_SEQUENCE>
+    <CALLING_SEQUENCE_ITEM>lmitool()  </CALLING_SEQUENCE_ITEM>
+    <CALLING_SEQUENCE_ITEM>  </CALLING_SEQUENCE_ITEM>
+    <CALLING_SEQUENCE_ITEM>lmitool(filename)  </CALLING_SEQUENCE_ITEM>
+    <CALLING_SEQUENCE_ITEM>  </CALLING_SEQUENCE_ITEM>
+    <CALLING_SEQUENCE_ITEM>txt=lmitool(probname,varlist,datalist)  </CALLING_SEQUENCE_ITEM>
+  </CALLING_SEQUENCE>
+  <PARAM>
+    <PARAM_INDENT>
+      <PARAM_ITEM>
+        <PARAM_NAME>filename</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: a string referring to a <VERB>.sci</VERB> function</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>probname</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: a string containing the name of the problem</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>varlist</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: a string containing the names of the unknown matrices (separated by commas if there are more than one)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>datalist</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>:  a string containing the names of  data matrices (separated by commas if there are more than one)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>txt</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: a string providing information on what the user should do next</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+    </PARAM_INDENT>
+  </PARAM>
+  <DESCRIPTION>
+    <P><VERB>lmitool()</VERB> or <VERB>lmitool(filename)</VERB> is used to define 
+    interactively a LMI problem.
+    In the non interactive mode,
+    <VERB>txt=lmitool(probname,varlist,datalist)</VERB>
+    generates a file in the current directory. The name of this file 
+    is obtained by adding <VERB>.sci</VERB> to the end of <VERB>probname</VERB>. 
+    This file is the skeleton of a solver function and the corresponding 
+    evaluation function needed by <VERB>lmisolver</VERB>.</P>
+  </DESCRIPTION>
+  <SEE_ALSO>
+    <SEE_ALSO_ITEM>
+      <LINK>lmisolver</LINK>
+    </SEE_ALSO_ITEM>
+  </SEE_ALSO>
+</MAN>
diff --git a/scilab/modules/optimization/help/eng/lsqrsolve.xml b/scilab/modules/optimization/help/eng/lsqrsolve.xml
new file mode 100644 (file)
index 0000000..5f1e0e7
--- /dev/null
@@ -0,0 +1,296 @@
+<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
+<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
+<MAN>
+  <LANGUAGE>eng</LANGUAGE>
+  <TITLE>lsqrsolve</TITLE>
+  <TYPE>Scilab Function</TYPE>
+  <DATE>August 1993</DATE>
+  <SHORT_DESCRIPTION name="lsqrsolve"> minimize the sum of the squares of
+nonlinear functions, levenberg-marquardt algorithm</SHORT_DESCRIPTION>
+  <CALLING_SEQUENCE>
+    <CALLING_SEQUENCE_ITEM>[x [,v [,info]]]=lsqrsolve(x0,fct,m [,stop [,diag]])</CALLING_SEQUENCE_ITEM>
+    <CALLING_SEQUENCE_ITEM>[x [,v [,info]]]=lsqrsolve(x0,fct,m ,fjac [,stop [,diag]])</CALLING_SEQUENCE_ITEM>
+  </CALLING_SEQUENCE>
+  <PARAM>
+    <PARAM_INDENT>
+      <PARAM_ITEM>
+        <PARAM_NAME>x0</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: real vector (initial value of functions argument).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>fct</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: external (i.e function or list or string).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+       <PARAM_ITEM>
+        <PARAM_NAME>m</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: integer, the number of functions.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>fjac</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: external (i.e function or list or string).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>stop</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: optional vector
+          <VERB>[ftol,xtol,gtol,maxfev,epsfcn,factor]</VERB> the
+          default value is <VERB>[1.d-8,1.d-8,1.d-5,1000,0,100]</VERB></SP>
+          <PARAM_INDENT>
+          <PARAM_ITEM>
+            <PARAM_NAME>ftol</PARAM_NAME>
+            <PARAM_DESCRIPTION>
+            <SP>: A positive real number,termination occurs when both
+                  the actual and predicted relative reductions in the
+                  sum of squares are at most ftol.  therefore, ftol
+                  measures the relative error desired in the sum of
+                  squares.</SP>
+           </PARAM_DESCRIPTION>
+          </PARAM_ITEM>
+          <PARAM_ITEM>
+            <PARAM_NAME>xtol</PARAM_NAME>
+            <PARAM_DESCRIPTION>
+            <SP>: A positive real number, termination occurs when the
+             relative error between two consecutive iterates is at
+             most xtol. therefore, xtol measures the relative error
+             desired in the approximate solution.</SP>
+           </PARAM_DESCRIPTION>
+          </PARAM_ITEM>
+          <PARAM_ITEM>
+            <PARAM_NAME>gtol</PARAM_NAME>
+            <PARAM_DESCRIPTION>
+            <SP>: A nonnegative input variable. termination
+                 occurs when the cosine of the angle between fct(x) and
+                 any column of the jacobian is at most gtol in absolute
+                 value. therefore, gtol measures the orthogonality
+                 desired between the function vector and the columns
+                 of the jacobian.</SP>
+           </PARAM_DESCRIPTION>
+          </PARAM_ITEM>
+          <PARAM_ITEM>
+            <PARAM_NAME>maxfev</PARAM_NAME>
+            <PARAM_DESCRIPTION>
+            <SP>: A positive integer, termination occurs when the
+             number of calls to fct is at least maxfev by the end of
+             an iteration.</SP>
+           </PARAM_DESCRIPTION>
+          </PARAM_ITEM>
+
+          <PARAM_ITEM>
+            <PARAM_NAME>epsfcn</PARAM_NAME>
+            <PARAM_DESCRIPTION>
+            <SP>: A positive real number, used in determining a
+             suitable step length for the forward-difference
+             approximation. this approximation assumes that the
+             relative errors in the functions are of the order of
+             epsfcn. if epsfcn is less than the machine precision, it
+             is assumed that the relative errors in the functions are
+             of the order of the machine precision.</SP>
+           </PARAM_DESCRIPTION>
+          </PARAM_ITEM>
+
+         <PARAM_ITEM>
+            <PARAM_NAME>factor</PARAM_NAME>
+            <PARAM_DESCRIPTION>
+            <SP>: A positive real number, used in determining the
+            initial step bound. this bound is set to the product of
+            factor and the euclidean norm of diag*x if nonzero, or
+            else to factor itself. in most cases factor should lie in
+            the interval (.1,100.). 100. is a generally recommended
+            value.</SP>
+           </PARAM_DESCRIPTION>
+          </PARAM_ITEM>
+          </PARAM_INDENT>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+
+      <PARAM_ITEM>
+        <PARAM_NAME>diag</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: is an array of length n.  diag
+         must contain positive entries that serve as
+         multiplicative scale factors for the variables.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+
+      <PARAM_ITEM>
+        <PARAM_NAME>x :  </PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>real vector (final value of function argument, estimated zero).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>v :  </PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>real vector (value of functions at x).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>info</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>:  termination indicator</SP>
+          <PARAM_INDENT>
+            <PARAM_ITEM>
+              <PARAM_NAME>0</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: improper input parameters.</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>1</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: algorithm estimates that the relative error between x and the solution  is at most tol.</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>2</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: number of calls to fcn reached</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>3</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: tol is too small. No further improvement in the approximate solution  x is possible.</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>4</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: iteration is not making good progress.</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+          </PARAM_INDENT>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+    </PARAM_INDENT>
+  </PARAM>
+
+  <DESCRIPTION>
+    <P>
+    minimize the sum of the squares of m nonlinear functions in n
+     variables by a modification of the levenberg-marquardt
+     algorithm. the user must provide a subroutine which calculates
+     the functions. the jacobian is then calculated by a
+     forward-difference approximation.</P>
+    <P>
+     minimize <VERB>sum(fct(x,m).^2)</VERB> where
+    <VERB>fct</VERB> is function from <VERB>R^n</VERB> to <VERB>R^m</VERB>
+    </P>
+    <P>
+    <VERB>fct</VERB> should be :
+    </P> 
+    <DESCRIPTION_INDENT>
+    <DESCRIPTION_ITEM>  
+    <SP>a Scilab function whose calling sequence is <VERB>v=fct(x,m)</VERB> given <VERB>x</VERB> and
+    <VERB>m</VERB>.</SP>
+    </DESCRIPTION_ITEM> 
+
+    <DESCRIPTION_ITEM> 
+     <SP>a character string which  refers to a C or Fortran routine  which must be linked to Scilab. </SP>
+
+    <P>
+    Fortran calling sequence should be
+   <VERB>fct(m,n,x,v,iflag)</VERB>  where <VERB>m</VERB>,
+    <VERB>n</VERB>, <VERB>iflag</VERB> are integers, <VERB>x</VERB> a
+    double precision vector of size  <VERB>n</VERB> and <VERB>v</VERB> a
+    double precision vector of size  <VERB>m</VERB>.
+    </P>
+    <P>  
+    C calling sequence should be
+    <VERB>fct(int *m, int *n, double x[],double v[],int *iflag)</VERB>
+    </P>
+
+    </DESCRIPTION_ITEM> 
+     </DESCRIPTION_INDENT>
+
+     <P>  <VERB>fjac</VERB> is an external which returns <VERB>v=d(fct)/dx (x)</VERB>.
+     it should be :</P>
+    <DESCRIPTION_INDENT>
+    <DESCRIPTION_ITEM label="a Scilab function"> <SP>whose calling
+    sequence is <VERB>J=fjac(x,m)</VERB> given <VERB>x</VERB> and
+    <VERB>m</VERB>.</SP>
+    </DESCRIPTION_ITEM> 
+    <DESCRIPTION_ITEM label="a character string">  <SP>it refers to a C or Fortran routine
+    which must be linked to Scilab. </SP>
+    <P>
+    Fortran calling sequence should be
+   <VERB>fjac(m,n,x,jac,iflag)</VERB>  where <VERB>m</VERB>,
+    <VERB>n</VERB>, <VERB>iflag</VERB> are integers, <VERB>x</VERB> a
+    double precision vector of size  <VERB>n</VERB> and <VERB>jac</VERB> a
+    double precision vector of size  <VERB>m*n</VERB>.
+    </P>
+    <P>  
+    C calling sequence should be
+    <VERB>fjac(int *m, int *n, double x[],double v[],int *iflag)</VERB>
+    </P>
+ </DESCRIPTION_ITEM> 
+ </DESCRIPTION_INDENT>
+   <P> return -1 in iflag to stop the algoritm if the function
+   or jacobian could not be evaluated.</P>
+  
+
+  </DESCRIPTION>
+  <EXAMPLE>
+<![CDATA[
+// A simple example with lsqrsolve 
+a=[1,7;
+   2,8
+   4 3];
+b=[10;11;-1];
+function y=f1(x,m),y=a*x+b;endfunction
+[xsol,v]=lsqrsolve([100;100],f1,3)
+xsol+a\b
+
+
+function y=fj1(x,m),y=a;endfunction
+[xsol,v]=lsqrsolve([100;100],f1,3,fj1)
+xsol+a\b
+
+// Data fitting problem
+// 1 build the data
+a=34;b=12;c=14;
+deff('y=FF(x)','y=a*(x-b)+c*x.*x');
+X=(0:.1:3)';Y=FF(X)+100*(rand()-.5);
+
+//solve
+function e=f1(abc,m)
+  a=abc(1);b=abc(2),c=abc(3),
+  e=Y-(a*(X-b)+c*X.*X);
+endfunction
+[abc,v]=lsqrsolve([10;10;10],f1,size(X,1));
+abc
+norm(v)
+
+ ]]>
+  </EXAMPLE>
+  <SEE_ALSO>
+    <SEE_ALSO_ITEM>
+      <LINK>external</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>quapro</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>linpro</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>optim</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>fsolve</LINK>
+    </SEE_ALSO_ITEM>
+  </SEE_ALSO>
+ <USED_FUNCTIONS>
+    <SP>lmdif, lmder from  minpack, Argonne National Laboratory.</SP>
+ </USED_FUNCTIONS>
+</MAN>
diff --git a/scilab/modules/optimization/help/eng/mps2linpro.xml b/scilab/modules/optimization/help/eng/mps2linpro.xml
new file mode 100644 (file)
index 0000000..411eb0e
--- /dev/null
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
+<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
+<MAN>
+  <LANGUAGE>eng</LANGUAGE>
+  <TITLE>mps2linpro</TITLE>
+  <TYPE>Scilab Function</TYPE>
+  <DATE>MAY 1998</DATE>
+  <SHORT_DESCRIPTION name="mps2linpro"> convert lp problem given in MPS format to linpro format</SHORT_DESCRIPTION>
+  <CALLING_SEQUENCE>
+    <CALLING_SEQUENCE_ITEM>lp = mps2linpro(mps)  </CALLING_SEQUENCE_ITEM>
+    <CALLING_SEQUENCE_ITEM>[p,C,b,ci,cs,mi] = mps2linpro(mps)  </CALLING_SEQUENCE_ITEM>
+  </CALLING_SEQUENCE>
+  <PARAM>
+    <PARAM_INDENT>
+      <PARAM_ITEM>
+        <PARAM_NAME>mps</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: either a character string, path of the MPS file, or an mps data structure returned by <VERB>readmps</VERB></SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>lp</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: a linpro data tlist with following fields:</SP>
+          <PARAM_INDENT>
+            <PARAM_ITEM>
+              <PARAM_NAME>p</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: real (column) vector (dimension <VERB> n</VERB>)</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>C</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: real matrix (dimension <VERB> (mi + md) x n</VERB>) (If no constraints are given, you can set <VERB>C = []</VERB>)</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>b</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: RHS vector (dimension <VERB>1 x (mi + md)</VERB>)</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>ci</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: (column) vector of lower-bounds (dimension <VERB> n</VERB>). If there are no lower bound constraints, put <VERB>ci = []</VERB>. If some components of <VERB>x</VERB> are bounded from below, set the other (unconstrained) values of <VERB>ci</VERB> to a very  large negative  number (e.g. <VERB>ci(j) = -(% eps)^(-1)</VERB>.</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>cs</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: (column) vector of upper-bounds. (Same remarks as above).</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>mi</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: number of equality constraints (i.e. <VERB>C(1:mi,:)*x = b(1:mi)</VERB>)</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+          </PARAM_INDENT>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+    </PARAM_INDENT>
+  </PARAM>
+  <DESCRIPTION>
+    <P>
+    mps2linpro forms Linear programing data compatible with linpro out of
+    MPS data format.</P>
+  </DESCRIPTION>
+  <SEE_ALSO>
+    <SEE_ALSO_ITEM>
+      <LINK>linpro</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>readmps</LINK>
+    </SEE_ALSO_ITEM>
+  </SEE_ALSO>
+</MAN>
diff --git a/scilab/modules/optimization/help/eng/numdiff.xml b/scilab/modules/optimization/help/eng/numdiff.xml
new file mode 100644 (file)
index 0000000..71102ba
--- /dev/null
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
+<MAN>
+  <LANGUAGE>eng</LANGUAGE>
+
+  <TITLE>numdiff</TITLE>
+
+  <TYPE>Scilab Function</TYPE>
+
+  <DATE>August 1993</DATE>
+
+  <SHORT_DESCRIPTION name="numdiff">numerical gradient
+  estimation</SHORT_DESCRIPTION>
+
+  <CALLING_SEQUENCE>
+    <CALLING_SEQUENCE_ITEM>g=numdiff(fun,x [,dx])</CALLING_SEQUENCE_ITEM>
+  </CALLING_SEQUENCE>
+
+  <PARAM>
+    <PARAM_INDENT>
+      <PARAM_ITEM>
+        <PARAM_NAME>fun</PARAM_NAME>
+
+        <PARAM_DESCRIPTION>
+          <SP>: an external, Scilab function or list. See below for calling
+          sequence, see also <LINK>external</LINK> for details about external
+          functions.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+
+      <PARAM_ITEM>
+        <PARAM_NAME>x</PARAM_NAME>
+
+        <PARAM_DESCRIPTION>
+          <SP>: vector, the argument of the function <VERB>fun</VERB></SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+
+      <PARAM_ITEM>
+        <PARAM_NAME>dx</PARAM_NAME>
+
+        <PARAM_DESCRIPTION>
+          <SP>: vector, the finite difference step. Default value is
+          <VERB>dx=sqrt(%eps)*(1+1d-3*abs(x))</VERB></SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+
+      <PARAM_ITEM>
+        <PARAM_NAME>g</PARAM_NAME>
+
+        <PARAM_DESCRIPTION>
+          <SP>: vector, the estimated gradient</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+    </PARAM_INDENT>
+  </PARAM>
+
+  <DESCRIPTION>
+    <P>given a function <VERB>fun(x)</VERB> from <VERB>R^n</VERB> to
+    <VERB>R^p</VERB> computes the matrix <VERB>g</VERB> such as</P>
+
+    <VERBATIM>[ d f ] [ i ] g = [ ---- ] ij [ d x ] [ j ]</VERBATIM>
+
+    <P>using finite difference methods.</P>
+
+    <P>Without parameters, the function fun calling sequence is
+    <VERB>y=fun(x)</VERB>, and numdiff can be called as
+    <VERB>g=numdiff(fun,x)</VERB>. Else the function fun calling sequence must
+    be <VERB>y=fun(x,param_1,pararm_2,..,param_q)</VERB>. If parameters
+    <VERB>param_1,param_2,..param_q</VERB> exist then <VERB>numdiff</VERB> can
+    be called as follow
+    <VERB>g=numdiff(list(fun,param_1,param_2,..param_q),x)</VERB>.</P>
+  </DESCRIPTION>
+
+  <EXAMPLE><![CDATA[
+// example 1 (without parameters)
+// myfun is a function from R^2 to R :   (x(1),x(2)) |--> myfun(x) 
+function f=myfun(x)
+f=x(1)*x(1)+x(1)*x(2)
+endfunction
+
+x=[5 8]
+g=numdiff(myfun,x)
+// The exact gradient (i.e derivate belong x(1) :first component and derivate belong x(2): second component) is  
+exact=[2*x(1)+x(2)  x(1)]
+
+
+//example 2 (with parameters)
+// myfun is a function from R to R:  x(1) |--> myfun(x) 
+// myfun contains 3 parameters, a, b, c
+function  f=myfun(x,a,b,c)
+f=(x+a)^c+b
+endfunction
+
+a=3; b=4; c=2;
+x=1
+g2=numdiff(list(myfun,a,b,c),x)
+// The exact gradient, i.e derivate belong x(1), is :
+exact2=c*(x+a)^(c-1)
+  ]]></EXAMPLE>
+
+  <SEE_ALSO>
+    <SEE_ALSO_ITEM>
+      <LINK>optim</LINK>
+    </SEE_ALSO_ITEM>
+
+    <SEE_ALSO_ITEM>
+      <LINK>external</LINK>
+    </SEE_ALSO_ITEM>
+  </SEE_ALSO>
+</MAN>
\ No newline at end of file
diff --git a/scilab/modules/optimization/help/eng/optim.xml b/scilab/modules/optimization/help/eng/optim.xml
new file mode 100644 (file)
index 0000000..22932e6
--- /dev/null
@@ -0,0 +1,372 @@
+<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
+<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
+<MAN>
+  <LANGUAGE>eng</LANGUAGE>
+  <TITLE>optim</TITLE>
+  <TYPE>Scilab Function</TYPE>
+  <DATE>April 1993</DATE>
+  <SHORT_DESCRIPTION name="optim"> non-linear optimization routine</SHORT_DESCRIPTION>
+  <CALLING_SEQUENCE>
+    <CALLING_SEQUENCE_ITEM>[f,xopt]=optim(costf,x0)  </CALLING_SEQUENCE_ITEM>
+    <CALLING_SEQUENCE_ITEM>[f [,xopt [,gradopt [,work]]]]=optim(costf [,&lt;contr&gt;],x0
+      [,algo] [,df0 [,mem]] [,work] [,&lt;stop&gt;] [,&lt;params&gt;] [,imp=iflag])  </CALLING_SEQUENCE_ITEM>
+  </CALLING_SEQUENCE>
+  <PARAM>
+    <PARAM_INDENT>
+      <PARAM_ITEM>
+        <PARAM_NAME>costf</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: external, i.e Scilab function list or string
+           (<VERB>costf</VERB> is the cost function: see below its calling
+           sequence (Scilab or Fortran)). See also external for details about
+           external functions.</SP> 
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>x0</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: real vector (initial value of variable to be minimized).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>f</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: value of optimal cost (<VERB>f=costf(xopt)</VERB>)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>xopt</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: best value of <VERB>x</VERB> found.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>&lt;contr&gt;</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: keyword representing the following sequence of arguments:
+           <VERB>'b',binf,bsup</VERB>  with <VERB>binf</VERB> and 
+           <VERB>bsup</VERB> are real vectors with same dimension as
+           <VERB>x0</VERB>. <VERB>binf</VERB> and <VERB>bsup</VERB> are lower
+           and upper bounds on <VERB>x</VERB>.</SP> 
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>algo</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: Character string used to sprecify the algorithm to use. The
+           possible values are <VERB>'qn'</VERB> for quasi-Newton (default) or
+           <VERB>'gc'</VERB> for conjugate gradient or <VERB>'nd'</VERB> for
+           non-differentiable.  Note that
+           <VERB>'nd'</VERB> does not accept bounds on <VERB>x</VERB>.</SP> 
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>df0</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: real scalar. Guessed decreasing of <VERB>f</VERB> at first
+           iteration. (<VERB>df0=1</VERB> is the default value).</SP> 
+        </PARAM_DESCRIPTION> 
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>mem :  </PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>integer, number of variables used to approximate the  Hessian,
+           (<VERB>algo='gc' or 'nd'</VERB>). Default value is around 6.</SP> 
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>&lt;stop&gt;</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>:  keyword representing the sequence of optional parameters
+           controlling the  convergence of the algorithm. 
+            <VERB>'ar',nap [,iter [,epsg [,epsf [,epsx]]]]</VERB></SP> 
+          <PARAM_INDENT>
+            <PARAM_ITEM>
+              <PARAM_NAME>&quot;ar&quot;  </PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: reserved keyword for stopping rule selection defined as
+                 follows:</SP> 
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>nap</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: maximum number of calls to <VERB>costf</VERB> allowed
+                 (default is 100).</SP> 
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>iter</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: maximum number of iterations allowed (default is 100).</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>epsg</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: threshold on gradient norm.</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>epsf</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: threshold controlling decreasing of <VERB>f</VERB></SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>epsx</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: threshold controlling variation of <VERB>x</VERB>. This
+                 vector (possibly matrix) of same size as <VERB>x0</VERB> can
+                 be used to scale <VERB>x</VERB>.</SP> 
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+          </PARAM_INDENT>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>&lt;params&gt; </PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: keyword representing the sequence of arguments: 
+          <VERB>'ti', valti ,'td', valtd</VERB> which can be used to pass argument to
+           an external written in C or Fortran (see below).</SP> 
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>&quot;imp=iflag&quot;  </PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: named argument used to set the trace mode. <VERB>iflag=0</VERB>
+           nothing (execpt errors) is reported, <VERB>iflag=1</VERB> initial
+           and final reports, <VERB>iflag=2</VERB> adds a report per
+           iteration, <VERB>iflag&gt;2</VERB> add reports on linear
+           search. Warning, most of these reports are written on the Scilab
+           standard output.</SP> 
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>gradopt</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>:  gradient of <VERB>costf</VERB> at <VERB>xopt</VERB></SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>work</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: working array for hot restart for quasi-Newton method. This
+           array is automatically initialized by <VERB>optim</VERB> when
+           <VERB>optim</VERB> is invoked. It can be used as input parameter to
+           speed-up the calculations.</SP> 
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+    </PARAM_INDENT>
+  </PARAM>
+  <DESCRIPTION>
+    <SP>
+      Non-linear optimization routine for programs without constraints or with
+      bound constraints:</SP> 
+    <VERBATIM>
+      <![CDATA[
+      min costf(x) w.r.t x.
+      ]]>
+    </VERBATIM>
+    <P><VERB>costf</VERB> is an &quot;external&quot; i.e a Scilab function, a
+      list or a string giving the name of a C or Fortran routine (see
+      &quot;external&quot;).
+      
+      This external must return the value <VERB>f</VERB> of the cost function
+      at the point <VERB>x</VERB> and the gradient <VERB>g</VERB> of the cost
+      function at the point <VERB>x</VERB>. 
+    </P>
+    <DESCRIPTION_INDENT>
+      <DESCRIPTION_ITEM label="- Scilab function case">
+       <P>If <VERB>costf</VERB> is a Scilab function, the calling sequence
+         for <VERB>costf</VERB> must be:
+         <VERB>[f,g,ind]=costf(x,ind)</VERB></P>
+
+       <SP>Here, <VERB>costf</VERB> is a function which returns <VERB>f</VERB>,
+         value (real number) of cost function at <VERB>x</VERB>, and
+         <VERB>g</VERB>, gradient vector of cost function at
+         <VERB>x</VERB>. The variable <VERB>ind</VERB>  is described below.</SP>
+      </DESCRIPTION_ITEM>
+      <DESCRIPTION_ITEM label="- List case">
+       <P>If <VERB>costf</VERB> is a list, it should be of the form:
+         <VERB>list(real_costf, arg1,...,argn)</VERB> with <VERB>real_costf</VERB>
+         a Scilab function with calling sequence :
+         <VERB>[f,g,ind]=costf(x,ind,arg1,... argn)</VERB>. The
+         <VERB>x</VERB>, <VERB>f</VERB>, <VERB>g</VERB>, <VERB>ind</VERB>
+         arguments have the same meaning that above. <VERB>argi</VERB>
+         arguments can be used to pass function parameters.</P>
+      </DESCRIPTION_ITEM>
+      <DESCRIPTION_ITEM label="- String case">
+       <P>If <VERB>costf</VERB> is a character string, it refers to the name
+         of a C or Fortran routine which must be linked to Scilab </P>
+       <DESCRIPTION_INDENT>
+         <DESCRIPTION_ITEM label="* Fortran case">
+           <P>The generic calling sequence for the Fortran subroutine is: 
+             <VERB>subroutine costf(ind,n,x,f,g,ti,tr,td)</VERB> with the
+             following declarations:</P>
+           <VERBATIM>
+             <![CDATA[
+             integer ind,n ti(*)
+             double precision x(n),f,g(n),td(*)
+             real tr(*)
+             ]]>
+           </VERBATIM>
+           <SP>The argument <VERB>ind</VERB> is described below.</SP>
+           <P>The Fortran subroutine <VERB>costf</VERB> must return <VERB>f</VERB>
+             and the vector <VERB>g</VERB>, given <VERB>x, ind, n, ti, tr,td</VERB>.</P>
+           <P> <VERB>ti,tr,td</VERB> can be used to initialize parameters. In
+             the calling sequence of <VERB>optim</VERB>, the keyword
+             <VERB>&lt;params&gt;'</VERB> can be replaced by <VERB>'ti', valti ,'td', valtd</VERB>
+               .  Then, the routine  <VERB>costf</VERB> is
+             evaluated with <VERB>ti=valti</VERB> and 
+             <VERB>td=valtd</VERB> whatever the value of
+             <VERB>ind</VERB>. Thus, the Scilab variables <VERB>valti</VERB>
+             and <VERB>valtd</VERB> (integer vector and real vector) are sent
+             to the routine <VERB>costf</VERB>.</P>  
+         </DESCRIPTION_ITEM>
+         <DESCRIPTION_ITEM label="* C case">
+           <P>The generic calling sequence for the C procedure is: 
+           <VERB>void costf(int *ind, int *n, double *x, double *f, double *g, int *ti, float *tr, double *td)</VERB>
+             with the following declarations:</P>
+
+           <P>The argument <VERB>ind</VERB> is described below.</P>
+           <P>The C procedure <VERB>costf</VERB> must return <VERB>f</VERB>
+             and the vector <VERB>g</VERB>, given <VERB>x, ind, n, ti, tr, td</VERB>.</P>
+               
+           <P> <VERB>ti,tr,td</VERB> can be used to initialize parameters. In
+             the calling sequence of <VERB>optim</VERB>, the string
+             <VERB>'in'</VERB> can be replaced by <VERB>'ti', valti ,'td', valtd</VERB>.  
+             Then, the procedure  <VERB>costf</VERB> is
+             evaluated with <VERB>ti=valti</VERB> and 
+             <VERB>td=valtd</VERB> whatever the value of
+             <VERB>ind</VERB>. Thus, the Scilab variables <VERB>valti</VERB>
+             and <VERB>valtd</VERB> (integer vector and real vector) are sent
+             to the procedure <VERB>costf</VERB>.</P>  
+         </DESCRIPTION_ITEM>
+       </DESCRIPTION_INDENT>
+      </DESCRIPTION_ITEM>
+    </DESCRIPTION_INDENT>
+    <P>If <VERB>ind=2</VERB> (resp. <VERB>3, 4</VERB>), <VERB>costf</VERB>
+      must provide <VERB>f</VERB> (resp. <VERB>g, f</VERB> and
+      <VERB>g</VERB>).</P> 
+    <P>If <VERB>ind=1</VERB> nothing is computed (used for display purposes
+      only).</P> 
+    <P> On output, <VERB>ind&lt;0</VERB>  means that <VERB>f</VERB> cannot
+      be evaluated at <VERB>x</VERB> and <VERB>ind=0</VERB> interrupts
+      the optimization.</P> 
+
+  </DESCRIPTION>
+  <EXAMPLE>
+    <![CDATA[
+    // External function written in Scilab
+    xref=[1;2;3];x0=[1;-1;1]
+    deff('[f,g,ind]=cost(x,ind)','f=0.5*norm(x-xref)^2,g=x-xref');
+    [f,xopt]=optim(cost,x0)      //Simplest call
+    [f,xopt,gopt]=optim(cost,x0,'gc')  // By conjugate gradient
+    [f,xopt,gopt]=optim(cost,x0,'nd')  //Seen as non differentiable
+    [f,xopt,gopt]=optim(cost,'b',[-1;0;2],[0.5;1;4],x0) //  Bounds on x
+    [f,xopt,gopt]=optim(cost,'b',[-1;0;2],[0.5;1;4],x0,'gc') //  Bounds on x
+    [f,xopt,gopt]=optim(cost,'b',[-1;0;2],[0.5;1;4],x0,'gc','ar',3)
+
+    // External function written in C (C compiler required)
+    // write down the C code (Rosenbrock problem)
+    C=['#include <math.h>'
+    'double sq(double x)'
+    '{ return x*x;}'
+    'void rosenc(int *ind, int *n, double *x, double *f, double *g, '
+    '                                int *ti, float *tr, double *td)'
+    '{'
+    '  double p;'
+    '  int i;'
+    '  p=td[0];'
+    '  if (*ind==2||*ind==4) {'
+    '    *f=1.0;'
+    '    for (i=1;i<*n;i++)'
+    '      *f+=p*sq(x[i]-sq(x[i-1]))+sq(1.0-x[i]);'
+    '  }'
+    '  if (*ind==3||*ind==4) {'
+    '    g[0]=-4.0*p*(x[1]-sq(x[0]))*x[0];'
+    '    for (i=1;i<*n-1;i++)'
+    '      g[i]=2.0*p*(x[i]-sq(x[i-1]))-4.0*p*(x[i+1]-sq(x[i]))*x[i]-2.0*(1.0-x[i]);'
+    '    g[*n-1]=2.0*p*(x[*n-1]-sq(x[*n-2]))-2.0*(1.0-x[*n-1]);'
+    '  }'
+    '}'];
+    mputl(C,TMPDIR+'/rosenc.c')
+    // compile the C code
+    l=ilib_for_link('rosenc','rosenc.o',[],'c',TMPDIR+'/Makefile');
+    // incremental linking
+    link(l,'rosenc','c')
+    //solve the problem
+    x0=[40;10;50];
+    p=100;
+    [f,xo,go]=optim('rosenc',x0,'td',p)
+
+    // External function written in Fortran (Fortran compiler required)
+    // write down the Fortran  code (Rosenbrock problem)
+ F=[ '      subroutine rosenf(ind, n, x, f, g, ti, tr, td)'
+     '      integer ind,n,ti(*)'
+     '      double precision x(n),f,g(n),td(*)'
+     '      real tr(*)'
+     'c'
+     '      double precision y,p'
+     '      p=td(1)'
+     '      if (ind.eq.2.or.ind.eq.4) then'
+     '        f=1.0d0'
+     '        do i=2,n'
+     '          f=f+p*(x(i)-x(i-1)**2)**2+(1.0d0-x(i))**2'
+     '        enddo'
+     '      endif'
+     '      if (ind.eq.3.or.ind.eq.4) then'
+     '        g(1)=-4.0d0*p*(x(2)-x(1)**2)*x(1)'
+     '        if(n.gt.2) then'
+     '          do i=2,n-1'
+     '            g(i)=2.0d0*p*(x(i)-x(i-1)**2)-4.0d0*p*(x(i+1)-x(i)**2)*x(i)'
+     '     &           -2.0d0*(1.0d0-x(i))'
+     '          enddo'
+     '        endif'
+     '        g(n)=2.0d0*p*(x(n)-x(n-1)**2)-2.0d0*(1.0d0-x(n))'
+     '      endif'
+     '      return'
+     '      end'];
+
+    mputl(F,TMPDIR+'/rosenf.f')
+    // compile the Fortran code
+    l=ilib_for_link('rosenf','rosenf.o',[],'f',TMPDIR+'/Makefile');
+    // incremental linking
+    link(l,'rosenf','f')
+    //solve the problem
+    x0=[40;10;50];
+    p=100;
+    [f,xo,go]=optim('rosenf',x0,'td',p)
+
+    ]]>
+  </EXAMPLE>
+  <SEE_ALSO>
+    <SEE_ALSO_ITEM>
+      <LINK>external</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>quapro</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>linpro</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>datafit</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>leastsq</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>numdiff</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>derivative</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>NDcost</LINK>
+    </SEE_ALSO_ITEM>
+  </SEE_ALSO>
+</MAN>
diff --git a/scilab/modules/optimization/help/eng/qld.xml b/scilab/modules/optimization/help/eng/qld.xml
new file mode 100644 (file)
index 0000000..0bfa345
--- /dev/null
@@ -0,0 +1,156 @@
+<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
+<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
+<MAN>
+  <LANGUAGE>eng</LANGUAGE>
+  <TITLE>qld</TITLE>
+  <TYPE>Scilab Function</TYPE>
+  <DATE>june 2005</DATE>
+  <SHORT_DESCRIPTION name="qld"> linear quadratic programming solver</SHORT_DESCRIPTION>
+  <CALLING_SEQUENCE>
+    <CALLING_SEQUENCE_ITEM>[x,lagr]=qld(Q,p,C,b,ci,cs,me [,tol])  </CALLING_SEQUENCE_ITEM>
+    <CALLING_SEQUENCE_ITEM>[x,lagr,info]=qld(Q,p,C,b,ci,cs,me [,tol])  </CALLING_SEQUENCE_ITEM>
+  </CALLING_SEQUENCE>
+  <PARAM>
+    <PARAM_INDENT>
+      <PARAM_ITEM>
+        <PARAM_NAME>Q</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: real positive definite symmetric matrix (dimension <VERB>n x n</VERB>).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>p</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: real (column) vector (dimension <VERB> n</VERB>)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>C</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: real matrix (dimension <VERB> (me + md) x n</VERB>) </SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>b</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: RHS column vector (dimension <VERB> (me + md)</VERB>)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>ci</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: column vector of lower-bounds (dimension <VERB>n</VERB>). If
+           there are no lower bound constraints, put <VERB>ci = []</VERB>. If
+           some components of <VERB>x</VERB> are bounded from below, set the
+           other (unconstrained) values of <VERB>ci</VERB> to a very  large
+           negative  number (e.g. <VERB>ci(j) =
+             -number_properties('huge')</VERB>.</SP> 
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>cs</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: column vector of upper-bounds. (Same remarks as above).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>me</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: number of equality constraints (i.e. <VERB>C(1:me,:)*x = b(1:me)</VERB>)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>tol</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>:Floatting point number, required précision.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>x</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: optimal solution found.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+   
+      <PARAM_ITEM>
+        <PARAM_NAME>lagr</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: vector of Lagrange multipliers.  If lower and upper-bounds
+           <VERB>ci,cs</VERB> are provided, <VERB>lagr</VERB> has  <VERB>n +
+             me + md</VERB> components and <VERB>lagr(1:n)</VERB> is the
+           Lagrange  vector associated with the bound constraints and
+           <VERB>lagr (n+1 : n + me + md)</VERB> is the Lagrange vector
+           associated  with the linear constraints. (If an upper-bound
+           (resp. lower-bound) constraint <VERB>i</VERB> is active
+           <VERB>lagr(i)</VERB> is &gt; 0 (resp. &lt;0). If no bounds are
+           provided, <VERB>lagr</VERB> has only <VERB>me + md</VERB>
+           components.</SP> 
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>info</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: integer, return the execution status instead of sending
+         errors.</SP>
+       <P>info==1 : Too many iterations needed</P>
+       <P>info==2 : Accuracy insufficient to statisfy convergence criterion</P>
+       <P>info==5 : Length of working array is too short</P>
+       <P>info==10: The constraints are inconsistent</P>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+    </PARAM_INDENT>
+  </PARAM>
+  <DESCRIPTION>
+    <P>Minimize <VERB> 0.5*x'*Q*x + p'*x</VERB></P>
+    <P>under the constraints</P>
+    <VERBATIM>
+<![CDATA[
+ C(j,:) x = b(j),  j=1,...,me
+ C(j,:) x <= b(j), j=me+1,...,me+md
+ ci <= x <= cs
+   ]]>
+    </VERBATIM>
+    <P>This function requires  <VERB>Q</VERB> to be positive definite, if it is
+      not the case, one may use the <LINK>quapro</LINK> function.</P>
+  </DESCRIPTION>
+  <EXAMPLE>
+<![CDATA[
+//Find x in R^6 such that:
+//C1*x = b1 (3 equality constraints i.e me=3)
+C1= [1,-1,1,0,3,1;
+    -1,0,-3,-4,5,6;
+     2,5,3,0,1,0];
+b1=[1;2;3];
+//C2*x <= b2 (2 inequality constraints)
+C2=[0,1,0,1,2,-1;
+    -1,0,2,1,1,0];
+b2=[-1;2.5];
+//with  x between ci and cs:
+ci=[-1000;-10000;0;-1000;-1000;-1000];cs=[10000;100;1.5;100;100;1000];
+//and minimize 0.5*x'*Q*x + p'*x with
+p=[1;2;3;4;5;6]; Q=eye(6,6);
+//No initial point is given;
+C=[C1;C2] ; //
+b=[b1;b2] ;  //
+me=3;
+[x,lagr]=qld(Q,p,C,b,ci,cs,me)
+//Only linear constraints (1 to 4) are active (lagr(1:6)=0):
+ ]]>
+  </EXAMPLE>
+  <SEE_ALSO>
+    <SEE_ALSO_ITEM>
+      <LINK>quapro</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>optim</LINK>
+    </SEE_ALSO_ITEM>
+  </SEE_ALSO>
+  <AUTHORS>
+    <AUTHORS_ITEM label="K.Schittkowski">, University of Bayreuth, Germany</AUTHORS_ITEM>
+    <AUTHORS_ITEM label=" A.L. Tits and J.L. Zhou"> , University of Maryland</AUTHORS_ITEM>
+  </AUTHORS>
+  <USED_FUNCTIONS>
+    <P>ql0001.f in routines/optim directory</P>
+  </USED_FUNCTIONS>
+
+</MAN>
diff --git a/scilab/modules/optimization/help/eng/quapro.xml b/scilab/modules/optimization/help/eng/quapro.xml
new file mode 100644 (file)
index 0000000..c94a219
--- /dev/null
@@ -0,0 +1,215 @@
+<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
+<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
+<MAN>
+  <LANGUAGE>eng</LANGUAGE>
+  <TITLE>quapro</TITLE>
+  <TYPE>Scilab Function</TYPE>
+  <DATE>April 1993</DATE>
+  <SHORT_DESCRIPTION name="quapro"> linear quadratic programming solver</SHORT_DESCRIPTION>
+  <CALLING_SEQUENCE>
+    <CALLING_SEQUENCE_ITEM>[x,lagr,f]=quapro(Q,p,C,b [,x0])  </CALLING_SEQUENCE_ITEM>
+    <CALLING_SEQUENCE_ITEM>[x,lagr,f]=quapro(Q,p,C,b,ci,cs [,x0])  </CALLING_SEQUENCE_ITEM>
+    <CALLING_SEQUENCE_ITEM>[x,lagr,f]=quapro(Q,p,C,b,ci,cs,me [,x0])  </CALLING_SEQUENCE_ITEM>
+    <CALLING_SEQUENCE_ITEM>[x,lagr,f]=quapro(Q,p,C,b,ci,cs,me,x0 [,imp])  </CALLING_SEQUENCE_ITEM>
+  </CALLING_SEQUENCE>
+  <PARAM>
+    <PARAM_INDENT>
+      <PARAM_ITEM>
+        <PARAM_NAME>Q</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: real symmetric matrix (dimension <VERB>n x n</VERB>).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>p</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: real (column) vector (dimension <VERB> n</VERB>)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>C</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: real matrix (dimension <VERB> (me + md) x n</VERB>) (If no
+           constraints are given, you can set <VERB>C = []</VERB>)</SP> 
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>b</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: RHS column vector (dimension <VERB> (me + md)</VERB>) (If no
+           constraints are given, you can set <VERB>b = []</VERB>)</SP> 
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>ci</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: column vector of lower-bounds (dimension <VERB>n</VERB>). If
+           there are no lower bound constraints, put <VERB>ci = []</VERB>. If
+           some components of <VERB>x</VERB> are bounded from below, set the
+           other (unconstrained) values of <VERB>ci</VERB> to a very  large
+           negative  number (e.g. <VERB>ci(j) =
+             -number_properties('huge')</VERB>.</SP> 
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>cs</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: column vector of upper-bounds. (Same remarks as above).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>me</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: number of equality constraints (i.e. <VERB>C(1:me,:)*x = b(1:me)</VERB>)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>x0</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: either an initial guess for <VERB>x</VERB>    or one of the
+           character strings <VERB>'v'</VERB> or <VERB>'g'</VERB>. If
+           <VERB>x0='v'</VERB> the calculated initial feasible point is a
+           vertex. If <VERB>x0='g'</VERB> the calculated initial feasible
+           point is arbitrary.</SP> 
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>imp</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: verbose option (optional parameter)   (Try
+           <VERB>imp=7,8,...</VERB>). warning the message are output in the
+           window where scilab has been started.</SP> 
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>x</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: optimal solution found.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>f</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: optimal value of the cost function (i.e. <VERB>f=0.5*x'*Q*x+p'</VERB>).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>lagr</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: vector of Lagrange multipliers.  If lower and upper-bounds
+           <VERB>ci,cs</VERB> are provided, <VERB>lagr</VERB> has  <VERB>n +
+             me + md</VERB> components and <VERB>lagr(1:n)</VERB> is the
+           Lagrange  vector associated with the bound constraints and
+           <VERB>lagr (n+1 : n + me + md)</VERB> is the Lagrange vector
+           associated  with the linear constraints. (If an upper-bound
+           (resp. lower-bound) constraint <VERB>i</VERB> is active
+           <VERB>lagr(i)</VERB> is &gt; 0 (resp. &lt;0). If no bounds are
+           provided, <VERB>lagr</VERB> has only <VERB>me + md</VERB>
+           components.</SP> 
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+    </PARAM_INDENT>
+  </PARAM>
+  <DESCRIPTION>
+    <P>
+    Minimize <VERB>0.5*x'*Q*x + p'*x</VERB></P>
+    <P>
+    under the constraint</P>
+    <VERBATIM>
+<![CDATA[
+C*x <= b
+   ]]>
+    </VERBATIM>
+    <P>
+    Minimize <VERB> 0.5*x'*Q*x + p'*x</VERB></P>
+    <P>
+    under the constraints</P>
+    <VERBATIM>
+<![CDATA[
+C*x <= b          ci <= x <= cs
+   ]]>
+    </VERBATIM>
+    <P>
+    Minimize <VERB> 0.5*x'*Q*x + p'*x</VERB></P>
+    <P>
+    under the constraints</P>
+    <VERBATIM>
+<![CDATA[
+ C(j,:) x = b(j),  j=1,...,me
+ C(j,:) x <= b(j), j=me+1,...,me+md
+ ci <= x <= cs
+   ]]>
+    </VERBATIM>
+    <P>
+    If no initial point is given the
+    program computes a feasible initial point
+    which is a vertex of the region of feasible points if
+    <VERB>x0='v'</VERB>.</P>
+    <P>
+    If <VERB>x0='g'</VERB>, the program computes a feasible initial 
+    point which is not necessarily a vertex. This mode is
+    advisable when the quadratic form is positive
+    definite and there are  few constraints in
+    the problem or when there are large bounds
+    on the variables that are just security bounds and
+    very likely not active at the optimal solution.</P>
+    <P>
+    Note that <VERB>Q</VERB> is not necessarily non-negative, i.e.
+    <VERB>Q</VERB> may have negative eigenvalues.</P>
+  </DESCRIPTION>
+  <EXAMPLE>
+<![CDATA[
+//Find x in R^6 such that:
+//C1*x = b1 (3 equality constraints i.e me=3)
+C1= [1,-1,1,0,3,1;
+    -1,0,-3,-4,5,6;
+     2,5,3,0,1,0];
+b1=[1;2;3];
+//C2*x <= b2 (2 inequality constraints)
+C2=[0,1,0,1,2,-1;
+    -1,0,2,1,1,0];
+b2=[-1;2.5];
+//with  x between ci and cs:
+ci=[-1000;-10000;0;-1000;-1000;-1000];cs=[10000;100;1.5;100;100;1000];
+//and minimize 0.5*x'*Q*x + p'*x with
+p=[1;2;3;4;5;6]; Q=eye(6,6);
+//No initial point is given;
+C=[C1;C2] ; //
+b=[b1;b2] ;  //
+me=3;
+[x,lagr,f]=quapro(Q,p,C,b,ci,cs,me)
+//Only linear constraints (1 to 4) are active (lagr(1:6)=0):
+[x,lagr,f]=quapro(Q,p,C,b,[],[],me)   //Same result as above
+ ]]>
+  </EXAMPLE>
+  <SEE_ALSO>
+    <SEE_ALSO_ITEM>
+      <LINK>qld</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>linpro</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>optim</LINK>
+    </SEE_ALSO_ITEM>
+  </SEE_ALSO>
+  <AUTHORS>
+    <AUTHORS_ITEM label="Eduardo Casas  Renteria">, Universidad de Cantabria,</AUTHORS_ITEM>
+    <AUTHORS_ITEM label="Cecilia Pola Mendez"> , Universidad de Cantabria</AUTHORS_ITEM>
+  </AUTHORS>
+  <USED_FUNCTIONS>
+    <P>
+in routines/optim directory (authors E.Casas, C. Pola Mendez):</P>
+    <P>
+anfm01.f  anfm03.f  anfm05.f  anrs01.f  auxo01.f  dimp03.f  dnrm0.f   optr03.f  pasr03.f  zthz.f
+anfm02.f  anfm04.f  anfm06.f  anrs02.f  desr03.f  dipvtf.f  optr01.f
+opvf03.f  plcbas.f</P>
+    <P> From BLAS library</P>
+    <P>
+daxpy.f dcopy.f ddot.f dnrm2.f dscal.f dswap.f idamax.f</P>
+    <P> in routines/calelm directory (authors INRIA):</P>
+    <P>
+add.f ddif.f dmmul.f</P>
+    <P> From LAPACK library : dlamch.f</P>
+  </USED_FUNCTIONS>
+</MAN>
diff --git a/scilab/modules/optimization/help/eng/semidef.xml b/scilab/modules/optimization/help/eng/semidef.xml
new file mode 100644 (file)
index 0000000..df359c4
--- /dev/null
@@ -0,0 +1,165 @@
+<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
+<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
+<MAN>
+  <LANGUAGE>eng</LANGUAGE>
+  <TITLE>semidef</TITLE>
+  <TYPE>Scilab Function</TYPE>
+  <DATE>April 1993</DATE>
+  <SHORT_DESCRIPTION name="semidef"> semidefinite programming</SHORT_DESCRIPTION>
+  <CALLING_SEQUENCE>
+    <CALLING_SEQUENCE_ITEM>[x,Z,ul,info]=semidef(x0,Z0,F,blck_szs,c,options)  </CALLING_SEQUENCE_ITEM>
+  </CALLING_SEQUENCE>
+  <PARAM>
+    <PARAM_INDENT>
+      <PARAM_ITEM>
+        <PARAM_NAME>x0</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: m x 1 real column vector (must be strictly primal feasible, see below)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>Z0</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: L x 1 real vector (compressed form of a strictly feasible dual matrix, see below)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>F</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: L x (m+1) real matrix</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>blck_szs</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>:  p x 2 integer matrix (sizes of the blocks) defining the dimensions  of the (square) diagonal blocks <VERB>size(Fi(j)=blck_szs(j) j=1,...,m+1</VERB>.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>c</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: m x 1 real vector</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>options</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: row vector with five entries <VERB>[nu,abstol,reltol,0,maxiters]</VERB></SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>ul</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: row vector with two entries</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+    </PARAM_INDENT>
+  </PARAM>
+  <DESCRIPTION>
+    <P><VERB>[x,Z,ul,info]=semidef(x0,Z0,F,blck_szs,c,options)</VERB>
+    solves semidefinite program:</P>
+    <VERBATIM>
+<![CDATA[
+
+    minimize    c'*x
+    subject to  F_0 + x_1*F_1 + ... + x_m*F_m  >= 0
+
+ and its dual
+    maximize    -Tr F_0 Z
+    subject to  Tr F_i Z = c_i, i=1,...,m
+                Z >= 0
+
+   ]]>
+    </VERBATIM>
+    <P>
+    exploiting block structure in the matrices <VERB>F_i</VERB>.</P>
+    <P>
+    It interfaces L. Vandenberghe and S. Boyd sp.c program.</P>
+    <P>
+    The <VERB>Fi's</VERB> matrices are stored columnwise in <VERB>F</VERB> in
+    compressed format: if <VERB>F_i^j</VERB>, i=0,..,m, j=1,...,L denote the jth 
+    (symmetric) diagonal block of <VERB>F_i</VERB>, then</P>
+    <VERBATIM>
+<![CDATA[
+    [ pack(F_0^1)  pack(F_1^1) ...  pack(F_m^1) ]
+    [ pack(F_0^2)  pack(F_1^2) ...  pack(F_m^2) ]
+F=  [   ...       ...          ...              ]
+    [ pack(F_0^L)  pack(F_1^L) ...  pack(F_m^L) ]
+   ]]>
+    </VERBATIM>
+    <P>
+    where <VERB>pack(M)</VERB>, for symmetric <VERB>M</VERB>, is the vector 
+    <VERB>[M(1,1);M(1,2);...;M(1,n);M(2,2);M(2,3);...;M(2,n);...;M(n,n)]</VERB>
+    (obtained by scanning columnwise the lower triangular part of <VERB>M</VERB>).</P>
+    <P><VERB>blck_szs</VERB> gives the size of block <VERB>j</VERB>, ie, 
+    <VERB>size(F_i^j)=blck_szs(j)</VERB>.</P>
+    <P>
+    Z is a block diagonal matrix with L blocks <VERB>Z^0, ..., Z^{L-1}</VERB>.
+    <VERB>Z^j</VERB> has size <VERB>blck_szs[j] times blck_szs[j]</VERB>.
+    Every block is stored using packed storage of the lower triangular part.</P>
+    <P>
+    The 2 vector <VERB>ul</VERB> contains the primal objective value <VERB>c'*x</VERB>
+    and the dual objective value <VERB>-Tr F_0*Z</VERB>.</P>
+    <P>
+    The entries of <VERB>options</VERB> are respectively:
+    <VERB>nu</VERB> = a real parameter which ntrols the rate of convergence.
+    <VERB>abstol</VERB> =   absolute tolerance.
+    <VERB>reltol</VERB> =  relative tolerance (has a special meaning when negative).
+    <VERB>tv</VERB>  target value, only referenced if <VERB>reltol &lt; 0</VERB>.
+    <VERB>iters</VERB> =  on entry: maximum number of iterations &gt;= 0, on exit: 
+    the number of iterations taken.</P>
+    <P><VERB>info</VERB>  returns 1 if maxiters exceeded,  2 if absolute accuracy
+    is reached, 3 if relative accuracy is reached, 4 if target value is
+    reached, 5 if target value is  not achievable;  negative values 
+    indicate errors.</P>
+    <P>
+    Convergence criterion:</P>
+    <VERBATIM>
+<![CDATA[
+ (1) maxiters is exceeded
+ (2) duality gap is less than abstol
+ (3) primal and dual objective are both positive and
+     duality gap is less than (reltol * dual objective)
+     or primal and dual objective are both negative and
+     duality gap is less than (reltol * minus the primal objective)
+ (4) reltol is negative and
+     primal objective is less than tv or dual objective is greater
+     than tv
+   ]]>
+    </VERBATIM>
+  </DESCRIPTION>
+  <EXAMPLE>
+<![CDATA[
+F0=[2,1,0,0;
+    1,2,0,0;
+    0,0,3,1
+    0,0,1,3];
+F1=[1,2,0,0;
+    2,1,0,0;
+    0,0,1,3;
+    0,0,3,1]
+F2=[2,2,0,0;
+    2,2,0,0;
+    0,0,3,4;
+    0,0,4,4];
+blck_szs=[2,2];
+F01=F0(1:2,1:2);F02=F0(3:4,3:4);
+F11=F1(1:2,1:2);F12=F1(3:4,3:4);
+F21=F2(1:2,1:2);F22=F2(3:4,3:4);
+x0=[0;0]
+Z0=2*F0;
+Z01=Z0(1:2,1:2);Z02=Z0(3:4,3:4);
+FF=[[F01(:);F02(:)],[F11(:);F12(:)],[F21(:);F22(:)]]
+ZZ0=[[Z01(:);Z02(:)]];
+c=[trace(F1*Z0);trace(F2*Z0)];
+options=[10,1.d-10,1.d-10,0,50];
+[x,Z,ul,info]=semidef(x0,pack(ZZ0),pack(FF),blck_szs,c,options)
+w=vec2list(unpack(Z,blck_szs),[blck_szs;blck_szs]);Z=sysdiag(w(1),w(2))
+c'*x+trace(F0*Z)
+spec(F0+F1*x(1)+F2*x(2))
+trace(F1*Z)-c(1)
+trace(F2*Z)-c(2)
+ ]]>
+  </EXAMPLE>
+</MAN>
diff --git a/scilab/modules/optimization/help/fr/NDcost.xml b/scilab/modules/optimization/help/fr/NDcost.xml
new file mode 100644 (file)
index 0000000..4161428
--- /dev/null
@@ -0,0 +1,155 @@
+<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
+<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
+<MAN>
+  <LANGUAGE>eng</LANGUAGE>
+  <TITLE>NDcost</TITLE>
+  <TYPE>Scilab Function</TYPE>
+  <DATE>2002</DATE>
+  <SHORT_DESCRIPTION name="NDcost"> generic external for optim
+  computing gradient using finite differences</SHORT_DESCRIPTION>
+  <CALLING_SEQUENCE>
+    <CALLING_SEQUENCE_ITEM>[f,g,ind]=NDcost(x,ind,fun,varargin) </CALLING_SEQUENCE_ITEM>
+  </CALLING_SEQUENCE>
+  <PARAM>
+    <PARAM_INDENT>
+      <PARAM_ITEM>
+        <PARAM_NAME>x</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: real  vector or matrix</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>ind</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: integer parameter (see optim)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>fun</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: Scilab function with calling sequence <VERB>F=fun(x,varargin)</VERB>
+           varargin may be use to pass  parameters <VERB>p1,...pn</VERB></SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>f</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: criterion value  at point <VERB>x</VERB> (see optim)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>g</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: gradient value  at point <VERB>x</VERB> (see optim)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+    </PARAM_INDENT>
+  </PARAM>
+  <DESCRIPTION>
+    <P>
+  This function can be used as an external for <VERB>optim</VERB> to minimize
+   problem where gradient is too complicated to be programmed. only the
+   function <VERB>fun</VERB> which computes the criterion is required.</P>
+    <P>
+   This function should be used as follow:
+   <VERB>[f,xopt,gopt]=optim(list(NDcost,fun,p1,...pn),x0,...)</VERB></P>
+  </DESCRIPTION>
+  <EXAMPLE>
+<![CDATA[// example #1 (a simple one)
+//function to minimize
+function f=rosenbrock(x,varargin)
+   p=varargin(1)
+   f=1+sum( p*(x(2:$)-x(1:$-1)^2)^2 + (1-x(2:$))^2)
+endfunction
+
+x0=[1;2;3;4];
+[f,xopt,gopt]=optim(list(NDcost,rosenbrock,200),x0)
+
+// example #2: this example (from Rainer von Seggern) shows a quick (*) scilab way
+//             to identify the parameters of a linear differential equation.
+//             The model is a simple damped (linear) oscillator:
+//
+//               x''(t) + c x'(t) + k x(t) = 0
+// 
+// and we write it as a system of (2) differential equations of first
+// order with y(1) = x, and y(2) = x':
+//
+//     dy1/dt = y(2)
+//     dy2/dt = -c*y(2) -k*y(1)
+//
+// We suppose to have m measures of x (that is y(1)) at different times 
+// t_obs(1), ..., t_obs(m) called x_obs(1), ..., x_obs(m)  (in this example
+// these measures will be simulated) and we want to find the parameters
+// c and k by minimizing the sum of square errors between x_obs and y1(t_obs,p) 
+// 
+// (*) This method is not the most efficient but is easy to implement.
+function dy = DEQ(t,y,p)
+   // the rhs of our first order differential equation system
+   c =p(1);k=p(2)
+   dy=[y(2);-c*y(2)-k*y(1)]
+endfunction
+
+function y=uN(p, t, t0, y0)
+   // Numerical solution get with ode (in this case an exact analytic
+   // solution is found easily but ode could work for any equations...)
+   // Note: the ode output must be an approximation of the solution at
+   //       times given in the vector t=[t(1),...,t($)]  
+   y = ode(y0,t0,t,list(DEQ,p))
+endfunction
+
+function r = cost_func(p, t_obs, x_obs, t0, y0) 
+   // the function to be minimized : this is the sum of the squared
+   // errors between what gives the model and the measuments
+   sol = uN(p, t_obs, t0, y0)
+   e = sol(1,:) - x_obs
+   r = sum(e.*e) 
+endfunction
+
+// Datas
+t0 = 0; y0 = [10;0]; // initial time and initial conditions 
+T = 30;  // final time for measurements
+
+// Here we simulate experimental datas (from which the parameters
+// should be found)
+pe = [0.2;3];  // exact parameters
+m = 60;  t_obs = linspace(t0+2,T,m); // observation times
+sigma = 2;   // noise level
+y_obs = uN(pe, t_obs, t0, y0);
+x_obs = y_obs(1,:) + grand(1,m,"nor",0, sigma);
+
+// initial guess parameters
+p0 = [0.5 ; 5];  
+
+// for information the cost function before optimization:
+cost0 = cost_func(p0, t_obs, x_obs, t0, y0); 
+mprintf("\n\r cost function before optimization = %g",cost0)
+
+// Solution with optim
+[costopt,popt]=optim(list(NDcost,cost_func, t_obs, x_obs, t0, y0),p0); //,'ar',40,40,1e-3);
+
+mprintf("\n\r cost function after optimization = %g",costopt)
+mprintf("\n\r values of the parameters found: c = %g, k = %g",popt(1),popt(2))
+
+// a small plot
+t = linspace(0,T,400);
+y = uN(popt, t, t0, y0);
+clf();
+plot2d(t',y(1,:)',style=2)
+plot2d(t_obs',y_obs(1,:)',style=-2)
+legend(["model","measures"]);
+xtitle("least square fit to identify ode parameters")
+ ]]>
+  </EXAMPLE>
+  <SEE_ALSO>
+    <SEE_ALSO_ITEM>
+      <LINK>optim</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>external</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>derivative</LINK>
+    </SEE_ALSO_ITEM>
+  </SEE_ALSO>
+</MAN>
diff --git a/scilab/modules/optimization/help/fr/bvodeS.xml b/scilab/modules/optimization/help/fr/bvodeS.xml
new file mode 100644 (file)
index 0000000..70bbda7
--- /dev/null
@@ -0,0 +1,325 @@
+<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
+<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
+<MAN>
+  <LANGUAGE>eng</LANGUAGE>
+  <TITLE>bvodeS</TITLE>
+  <TYPE>Scilab Function</TYPE>
+  <DATE>2005</DATE>
+  <SHORT_DESCRIPTION name="bvodeS">simplified call of bvode</SHORT_DESCRIPTION>
+  <CALLING_SEQUENCE>
+    <CALLING_SEQUENCE_ITEM>z=bvodeS(x,m,n,a,b,fsub,gsub,zeta,
+         [ystart,dfsub,dgsub,fixpnt,ndimf,ndimi,ltol,tol,ntol,nonlin,
+          collpnt,subint,iprint,ireg,ifail])
+    </CALLING_SEQUENCE_ITEM>
+  </CALLING_SEQUENCE>
+  <PARAM>
+    <PARAM_INDENT>
+      <PARAM_ITEM>
+        <PARAM_NAME>x</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>:  array of points at which approximations of the solution will be computed.
+    The points x(i) must be given in increasing order.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>m</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: array of orders for the differential equations given in <VERB>fsub</VERB>.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>n</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>:  number of differential equations, length of <VERB>m</VERB>.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>a</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: left end of solution interval, where a&lt;=x(1).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>b</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>:  right end of solution interval, where x($)&lt;=b.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>fsub</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>:  name of a Scilab function for evaluating the rhs of the differential 
+       equation system to be solved; fsub also may be a list for parameter transfer.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>gsub</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>:   name of a Scilab function for evaluating the boundary conditions for the
+       given differential equation system; gsub may also be a list as for fsub.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>zeta</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: array of points at which the boundary or side conditions are given in 
+       increasing order. Each point must occur as often as boundary or side 
+       conditions are given there. Each side condition point other than a or b must
+       be included in the array fixpnt.
+       The length of zeta should be sum(m).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>z</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>:  array of all derivatives of the solution functions up to the order
+    m(i)-1 for the i-th function. (See the examples below.) The length of z should
+    be sum(m).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>ystart,dfsub,dgsub,fixpnt,ndimf,ndimi,ltol,tol,ntol,nonlin,
+          collpnt,subint,iprint,ireg,ifail</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: These optional arguments may be called by name in any order in the
+form argument=name. The meaning of ystart to ireg is given in the <LINK>bvode</LINK> help page.
+The Scilab functions <VERB>dfsub</VERB> and <VERB>dgsub</VERB> for evaluating the Jacobians may also be lists
+for parameter transfer. The function <VERB>ystart</VERB> is called <VERB>guess</VERB> in bvode.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>ifail</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>:  if ifail=1, all parameters needed for the call of bvode are displayed.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+    </PARAM_INDENT>
+  </PARAM>
+
+  <DESCRIPTION>
+    <P>
+This interface program simplifies the call of <LINK>bvode</LINK>, a program for the numerical
+solution of multi-point boundary value problems for mixed order systems of ordinary
+differential equations. The Scilab program bvode is adapted from the fortran program
+colnew. See the paper by U. Asher, J. Christiansen, and R.D. Russel:
+Collocation software for boundary-value ODE's, ACM Trans. Math. Soft. 7:209-222, 1981.
+The following examples should demonstrate not only how such systems can be solved 
+with the help of bvodeS, but also should emphazise some important problems which occur 
+with boundary value problems for ordinary ode's.
+</P>
+  </DESCRIPTION>
+
+
+  <EXAMPLE>
+<![CDATA[// 1. Modified example from help bvode. 
+
+// DE:  y1''''(x)=(1-6*x*x*y1'''(x)-6*x*y1''(x))/(y2(x)^3)
+//         y2'(x)=1
+// z=[y1 ; y1' ; y1'' ; y1''' ; y2]
+// BV: y1(1)=0 y1''(1)=0 
+// BV: y1(2)=1 y1''(2)=0 y2(2)=2
+
+function RhS=fsub(x,z)
+  RhS=[(1-6*x*x*z(4)-6*x*z(3))/(z(5)^3);1]
+endfunction
+
+function g=gsub(i,z)
+  g=[z(1) z(3) z(1)-1 z(3) z(5)-2]
+  g=g(i)
+endfunction
+
+function [z,lhS]=ystart(x)
+  z=zeros(5,1);z(5)=1;
+  lhS=[0;1];
+endfunction
+
+n=2;
+m=[4 1];
+N=100;
+a=1; b=2;
+zeta=[a a b b b];
+x=linspace(a,b,N);
+
+ltol=4; // We want to change the default error for y1'''.
+tol=1e-12;
+tic()
+z=bvodeS(x,m,n,a,b,fsub,gsub,zeta,ltol=ltol,tol=tol,ystart=ystart);
+// Try tol=1e-14 etc.
+toc()
+
+function z=yex(x) // True solution
+  z=zeros(5,1);
+  z(1)=0.25*(10*log(2)-3)*(1-x)+0.5*(1/x+(3+x)*log(x)-x)+(x-1)
+  z(2)=-0.25*(10*log(2)-3)+0.5*(-1/x^2+(3+x)/x+log(x)-1)+1
+  z(3)=0.5*(2/x^3+1/x-3/x^2)
+  z(4)=0.5*(-6/x^4-1/x/x+6/x^3)
+  z(5)=x
+endfunction
+
+zex=[];for xx=x, zex=[zex yex(xx)]; end
+scf(0); clf();
+plot2d(x,abs(z-zex)',style=[1 2 3 5 6])
+xtitle('Absolute error','x',' ')
+legend(['z1(x)';'z2(x)';'z3(x)';'z4(x)';'z5(x)'])
+
+// example #2. An eigenvalue problem
+
+// y''(x)=-la*y(x)
+// BV: y(0)=y'(0); y(1)=0
+// Eigenfunctions and eigenvalues are y(x,n)=sin(s(n)*(1-x)), la(n)=s(n)^2,
+// where s(n) are the zeros of f(s,n)=s+atan(s)-(n+1)*pi, n=0,1,2,...
+// To get a third boundary condition, we choose y(0)=1
+// (With y(x) also c*y(x) is a solution for each constant c.)
+// We solve the following ode system:
+// y''=-la*y
+// la'=0
+// BV: y(0)=y'(0), y(0)=1; y(1)=0
+// z=[y(x) ; y'(x) ; la]
+
+function rhs=fsub(x,z)
+  rhs=[-z(3)*z(1);0]
+endfunction
+
+function g=gsub(i,z)
+  g=[z(1)-z(2) z(1)-1 z(1)]
+  g=g(i)
+endfunction
+
+// The following start function is good for the first 8 eigenfunctions.
+function [z,lhs]=ystart(x,z,la0)
+  z=[1;0;la0]
+  lhs=[0;0]
+endfunction
+
+a=0;b=1;
+m=[2;1];
+n=2;
+zeta=[a a b];
+N=101;
+x=linspace(a,b,N)';
+
+// We have s(n)-(n+1/2)*pi -> 0 for n to infinity.
+la0=input('n-th eigenvalue: n= ?');la0=(%pi/2+la0*%pi)^2;
+
+z=bvodeS(x,m,n,a,b,fsub,gsub,zeta,ystart=list(ystart,la0));
+
+clf()
+plot2d(x,[z(1,:)' z(2,:)'],style=[5 1],axesflag=5) 
+xtitle(['Startvalue =  '+string(la0);'Eigenvalue = '+string(z(3,1))],'x',' ')
+legend(['y(x)';'y''(x)'])
+
+
+// example #3. A boundary value problem with more than one solution.
+
+// DE: y''(x)=-exp(y(x))
+// BV: y(0)=0; y(1)=0
+// This boundary value problem has more than one solution.
+// It is demonstrated how to find two of them with the help of
+// some preinformation of the solutions y(x) to build the function ystart.
+// z=[y(x);y'(x)]
+
+a=0;b=1;m=2;n=1;
+zeta=[a b];
+N=101;
+tol=1e-8*[1 1];
+x=linspace(a,b,N);
+
+function rhs=fsub(x,z),rhs=-exp(z(1));endfunction
+
+function g=gsub(i,z)
+  g=[z(1) z(1)]
+  g=g(i)
+endfunction
+
+function [z,lhs]=ystart(x,z,M) 
+  //z=[4*x*(1-x)*M ; 4*(1-2*x)*M]
+  z=[M;0]
+  //lhs=[-exp(4*x*(1-x)*M)]
+  lhs=0
+endfunction
+
+for M=[1 4]
+   if M==1
+      z=bvodeS(x,m,n,a,b,fsub,gsub,zeta,ystart=list(ystart,M),tol=tol);
+   else
+      z1=bvodeS(x,m,n,a,b,fsub,gsub,zeta,ystart=list(ystart,M),tol=tol);
+   end
+end
+
+// Integrating the ode yield e.g. the two solutions yex and yex1. 
+
+function y=f(c),y=c.*(1-tanh(sqrt(c)/4).^2)-2;endfunction 
+c=fsolve(2,f);
+
+function y=yex(x,c)
+  y=log(c/2*(1-tanh(sqrt(c)*(1/4-x/2)).^2))
+endfunction 
+
+function y=f1(c1), y=2*c1^2+tanh(1/4/c1)^2-1;endfunction
+c1=fsolve(0.1,f1);
+
+function y=yex1(x,c1)
+  y=log((1-tanh((2*x-1)/4/c1).^2)/2/c1/c1)
+endfunction 
+
+disp(norm(z(1,:)-yex(x)),'norm(yex(x)-z(1,:))= ')
+disp(norm(z1(1,:)-yex1(x)),'norm(yex1(x)-z1(1,:))= ')
+
+clf();
+subplot(2,1,1)
+plot2d(x,z(1,:),style=[5])
+xtitle('Two different solutions','x',' ') 
+subplot(2,1,2)
+plot2d(x,z1(1,:),style=[5])
+xtitle(' ','x',' ')
+
+
+// example #4. A multi-point boundary value problem.
+
+// DE y'''(x)=1
+// z=[y(x);y'(x);y''(x)]
+// BV: y(-1)=2 y(1)=2
+// Side condition: y(0)=1 
+
+a=-1;b=1;c=0;
+// The side condition point c must be included in the array fixpnt.
+n=1;
+m=[3];
+
+function rhs=fsub(x,z)
+  rhs=1
+endfunction
+
+function g=gsub(i,z)
+  g=[z(1)-2 z(1)-1 z(1)-2]
+  g=g(i)
+endfunction
+
+N=10;
+zeta=[a c b];
+x=linspace(a,b,N);
+
+z=bvodeS(x,m,n,a,b,fsub,gsub,zeta,fixpnt=c);
+          
+function y=yex(x)
+y=x.^3/6+x.^2-x./6+1
+endfunction
+
+disp(norm(yex(x)-z(1,:)),'norm(yex(x)-z(1,:))= ')
+ ]]>
+  </EXAMPLE>
+  <SEE_ALSO>
+    <SEE_ALSO_ITEM>
+      <LINK>bvode</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>ode</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>dassl</LINK>
+    </SEE_ALSO_ITEM>
+  </SEE_ALSO>
+
+  <AUTHOR>Rainer von Seggern</AUTHOR>
+
+</MAN>
diff --git a/scilab/modules/optimization/help/fr/datafit.xml b/scilab/modules/optimization/help/fr/datafit.xml
new file mode 100644 (file)
index 0000000..fc478e9
--- /dev/null
@@ -0,0 +1,199 @@
+<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
+<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
+<MAN>
+  <LANGUAGE>eng</LANGUAGE>
+  <TITLE>datafit</TITLE>
+  <TYPE>Scilab Function</TYPE>
+  <DATE>Feb 1999</DATE>
+  <SHORT_DESCRIPTION name="datafit"> Parameter identification based on measured data</SHORT_DESCRIPTION>
+  <CALLING_SEQUENCE>
+    <CALLING_SEQUENCE_ITEM>[p,err]=datafit([imp,] G [,DG],Z [,W],[contr],p0,[algo],[df0,[mem]],  </CALLING_SEQUENCE_ITEM>
+    <CALLING_SEQUENCE_ITEM>     [work],[stop],['in'])  </CALLING_SEQUENCE_ITEM>
+  </CALLING_SEQUENCE>
+  <PARAM>
+    <PARAM_INDENT>
+      <PARAM_ITEM>
+        <PARAM_NAME>imp</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: scalar argument used to set the trace mode. <VERB>imp=0</VERB> nothing (execpt errors) is reported, <VERB>imp=1</VERB> initial and final reports, <VERB>imp=2</VERB> adds a report per iteration, <VERB>imp&gt;2</VERB> add reports on linear search. Warning, most of these reports are written on the Scilab standard output.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>G</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: function descriptor (e=G(p,z), e: ne x 1, p: np x 1, z: nz x 1)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>DG</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: partial of G wrt p function descriptor (optional; S=DG(p,z), S: ne x np)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>Z</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: matrix [z_1,z_2,...z_n] where z_i (nz x 1) is the ith measurement</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>W</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: weighting matrix of size ne x ne (optional; defaut no ponderation)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>contr</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: <VERB>'b',binf,bsup</VERB>  with <VERB>binf</VERB> and <VERB>bsup</VERB> real vectors with same dimension as <VERB>p0</VERB>. <VERB>binf</VERB> and <VERB>bsup</VERB> are lower and upper bounds on <VERB>p</VERB>.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>p0</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: initial guess (size np x 1)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>algo</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: <VERB>'qn'</VERB> or <VERB>'gc'</VERB> or <VERB>'nd'</VERB> . This string stands for quasi-Newton (default),  conjugate gradient or non-differentiable respectively.  Note that <VERB>'nd'</VERB> does not accept bounds on <VERB>x</VERB> ).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>df0</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: real scalar. Guessed decreasing of <VERB>f</VERB> at first iteration. (<VERB>df0=1</VERB> is the default value).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>mem :  </PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>integer, number of variables used to approximate the  Hessian, (<VERB>algo='gc' or 'nd'</VERB>). Default value is around 6.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>stop</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>:  sequence of optional parameters controlling the  convergence of the algorithm. <VERB> stop=  'ar',nap, [iter [,epsg [,epsf [,epsx]]]]</VERB></SP>
+          <PARAM_INDENT>
+            <PARAM_ITEM>
+              <PARAM_NAME>&quot;ar&quot;  </PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: reserved keyword for stopping rule selection defined as follows:</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>nap</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: maximum number of calls to <VERB>fun</VERB> allowed.</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>iter</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: maximum number of iterations allowed.</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>epsg</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: threshold on gradient norm.</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>epsf</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: threshold controlling decreasing of <VERB>f</VERB></SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>epsx</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: threshold controlling variation of <VERB>x</VERB>. This vector (possibly matrix) of same size as <VERB>x0</VERB> can be used to scale <VERB>x</VERB>.</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+          </PARAM_INDENT>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>&quot;in&quot;  </PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: reserved  keyword for initialization of parameters used when <VERB>fun</VERB> in given as a Fortran routine (see below).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>p</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: Column vector, optimal solution found</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>err</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: scalar, least square error.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+    </PARAM_INDENT>
+  </PARAM>
+  <DESCRIPTION>
+    <P><VERB>datafit</VERB> is used for fitting data to a model.
+    For a given function <VERB>G(p,z)</VERB>, this function finds the best vector 
+    of parameters <VERB>p</VERB> for approximating <VERB>G(p,z_i)=0</VERB> for a set of measurement
+    vectors <VERB>z_i</VERB>. Vector <VERB>p</VERB> is found by minimizing
+    <VERB>G(p,z_1)'WG(p,z_1)+G(p,z_2)'WG(p,z_2)+...+G(p,z_n)'WG(p,z_n)</VERB></P>
+    <P><VERB>datafit</VERB> is an improved version of <VERB>fit_dat</VERB>.</P>
+  </DESCRIPTION>
+  <EXAMPLE>
+<![CDATA[
+//generate the data
+function y=FF(x,p),y=p(1)*(x-p(2))+p(3)*x.*x,endfunction
+X=[];Y=[];
+pg=[34;12;14] //parameter used to generate data
+for x=0:.1:3, Y=[Y,FF(x,pg)+100*(rand()-.5)];X=[X,x];end
+Z=[Y;X];
+
+
+//The criterion function
+function e=G(p,z),
+   y=z(1),x=z(2);
+   e=y-FF(x,p),
+endfunction
+
+//Solve the problem
+p0=[3;5;10]    
+[p,err]=datafit(G,Z,p0);
+
+scf(0);clf()
+plot2d(X,FF(X,pg),5) //the curve without noise
+plot2d(X,Y,-1)  // the noisy data
+plot2d(X,FF(X,p),12) //the solution
+
+
+//the gradient of the criterion function
+function s=DG(p,z),
+   a=p(1),b=p(2),c=p(3),y=z(1),x=z(2),
+   s=-[x-b,-a,x*x]
+endfunction
+
+[p,err]=datafit(G,DG,Z,p0);
+scf(1);clf()
+plot2d(X,FF(X,pg),5) //the curve without noise
+plot2d(X,Y,-1)  // the noisy data
+plot2d(X,FF(X,p),12) //the solution
+
+
+ ]]>
+  </EXAMPLE>
+  <SEE_ALSO>
+   <SEE_ALSO_ITEM>
+      <LINK>lsqrsolve</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>optim</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>leastsq</LINK>
+    </SEE_ALSO_ITEM>
+  </SEE_ALSO>
+</MAN>
diff --git a/scilab/modules/optimization/help/fr/fit_dat.xml b/scilab/modules/optimization/help/fr/fit_dat.xml
new file mode 100644 (file)
index 0000000..8f9afc5
--- /dev/null
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
+<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
+<MAN>
+  <LANGUAGE>eng</LANGUAGE>
+  <TITLE>fit_dat</TITLE>
+  <TYPE>Scilab Function</TYPE>
+  <DATE>Feb 1998</DATE>
+  <SHORT_DESCRIPTION name="fit_dat"> Parameter identification based on measured data</SHORT_DESCRIPTION>
+  <CALLING_SEQUENCE>
+    <CALLING_SEQUENCE_ITEM>[p,err]=fit_dat(G,p0,Z [,W] [,pmin,pmax] [,DG])  </CALLING_SEQUENCE_ITEM>
+  </CALLING_SEQUENCE>
+  <PARAM>
+    <PARAM_INDENT>
+      <PARAM_ITEM>
+        <PARAM_NAME>G</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: Scilab function (e=G(p,z), e: nex1, p: npx1, z: nzx1)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>p0</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: initial guess (size npx1)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>Z</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: matrix [z_1,z_2,...z_n] where z_i (nzx1) is the ith measurement</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>W</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: weighting matrix of size nexne (optional; default 1)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>pmin</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: lower bound on p (optional; size npx1)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>pmax</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: upper bound on p (optional; size npx1)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>DG</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: partial of G wrt p (optional; S=DG(p,z), S: nexnp)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+    </PARAM_INDENT>
+  </PARAM>
+  <DESCRIPTION>
+    <P><VERB>fit_dat</VERB> is used for fitting data to a model.
+    For a given function G(p,z), this function finds the best vector 
+    of parameters p for approximating G(p,z_i)=0 for a set of measurement
+    vectors z_i. Vector p is found by minimizing
+    <VERB>G(p,z_1)'WG(p,z_1)+G(p,z_2)'WG(p,z_2)+...+G(p,z_n)'WG(p,z_n)</VERB></P>
+  </DESCRIPTION>
+  <EXAMPLE>
+<![CDATA[
+deff('y=FF(x)','y=a*(x-b)+c*x.*x')
+X=[];Y=[];
+a=34;b=12;c=14;for x=0:.1:3, Y=[Y,FF(x)+100*(rand()-.5)];X=[X,x];end
+Z=[Y;X];
+deff('e=G(p,z)','a=p(1),b=p(2),c=p(3),y=z(1),x=z(2),e=y-FF(x)')
+[p,err]=fit_dat(G,[3;5;10],Z)
+xset('window',0)
+xbasc();
+plot2d(X',Y',-1) 
+plot2d(X',FF(X)',5,'002')
+a=p(1),b=p(2),c=p(3);plot2d(X',FF(X)',12,'002')
+
+a=34;b=12;c=14;
+deff('s=DG(p,z)','y=z(1),x=z(2),s=-[x-p(2),-p(1),x*x]')
+[p,err]=fit_dat(G,[3;5;10],Z,DG)
+xset('window',1)
+xbasc();
+plot2d(X',Y',-1) 
+plot2d(X',FF(X)',5,'002')
+a=p(1),b=p(2),c=p(3);plot2d(X',FF(X)',12,'002')
+ ]]>
+  </EXAMPLE>
+  <SEE_ALSO>
+    <SEE_ALSO_ITEM>
+      <LINK>optim</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>datafit</LINK>
+    </SEE_ALSO_ITEM>
+  </SEE_ALSO>
+</MAN>
diff --git a/scilab/modules/optimization/help/fr/fsolve.xml b/scilab/modules/optimization/help/fr/fsolve.xml
new file mode 100644 (file)
index 0000000..21738f1
--- /dev/null
@@ -0,0 +1,186 @@
+<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?> 
+<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
+<MAN>
+  <LANGUAGE>fr</LANGUAGE>
+  <TITLE>fsolve  </TITLE>
+  <TYPE>Scilab Function  </TYPE>
+  <DATE>August 1993  </DATE>
+  <SHORT_DESCRIPTION name="fsolve"> résout un système d&apos;équations non-linéaires  </SHORT_DESCRIPTION>
+  <CALLING_SEQUENCE>
+    <CALLING_SEQUENCE_ITEM>[x [,v [,info]]]=fsolve(x0,fct [,fjac] [,tol])  </CALLING_SEQUENCE_ITEM>
+  </CALLING_SEQUENCE>
+  <PARAM>
+    <PARAM_INDENT>
+      <PARAM_ITEM>
+       <PARAM_NAME>x0  </PARAM_NAME>
+       <PARAM_DESCRIPTION>
+         <SP>
+           : vecteur réel (vecteur initial).
+         </SP>
+       </PARAM_DESCRIPTION> 
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+       <PARAM_NAME>fct  </PARAM_NAME>
+       <PARAM_DESCRIPTION>
+         <SP>
+           : fonction externe (fonction Scilab ou chaîne de caractères ou liste).
+         </SP>
+       </PARAM_DESCRIPTION> 
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+       <PARAM_NAME>fjac  </PARAM_NAME>
+       <PARAM_DESCRIPTION>
+         <SP>
+           : fonction externe (fonction Scilab ou chaîne de caractères ou liste).
+         </SP>
+       </PARAM_DESCRIPTION> 
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+       <PARAM_NAME>tol  </PARAM_NAME>
+       <PARAM_DESCRIPTION>
+         <SP>
+           : scalaire. Tolérance : l&apos;algorithme s&apos;arrête lorsque l&apos;erreur relative estimée entre x et la solution est inférieure à tol (<VERB>tol=1.d-10</VERB> par défaut).
+         </SP>
+       </PARAM_DESCRIPTION> 
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+       <PARAM_NAME>x :  </PARAM_NAME>
+       <PARAM_DESCRIPTION>
+         <SP>
+           vecteur réel (solution estimée).
+         </SP>
+       </PARAM_DESCRIPTION> 
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+       <PARAM_NAME>v :  </PARAM_NAME>
+       <PARAM_DESCRIPTION>
+         <SP>
+           vecteur réel (valeur de la fonction en x).
+         </SP>
+       </PARAM_DESCRIPTION> 
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+       <PARAM_NAME>info  </PARAM_NAME>
+       <PARAM_DESCRIPTION>
+         <SP>
+           : indicateur d&apos;arrêt de l&apos;algorithme
+         </SP>
+
+         <PARAM_INDENT>
+           <PARAM_ITEM>
+             <PARAM_NAME>0  </PARAM_NAME>
+             <PARAM_DESCRIPTION>
+               <SP>
+                 : paramètres d&apos;entrée incorrects
+               </SP>
+             </PARAM_DESCRIPTION> 
+           </PARAM_ITEM>
+           <PARAM_ITEM>
+             <PARAM_NAME>1  </PARAM_NAME>
+             <PARAM_DESCRIPTION>
+               <SP>
+                 : l&apos;erreur relative estimée entre x et la solution est inférieure à tol
+               </SP>
+             </PARAM_DESCRIPTION> 
+           </PARAM_ITEM>
+           <PARAM_ITEM>
+             <PARAM_NAME>2  </PARAM_NAME>
+             <PARAM_DESCRIPTION>
+               <SP>
+                 : nombre d&apos;appels à fct
+               </SP>
+             </PARAM_DESCRIPTION> 
+           </PARAM_ITEM>
+           <PARAM_ITEM>
+             <PARAM_NAME>3  </PARAM_NAME>
+             <PARAM_DESCRIPTION>
+               <SP>
+                 : tol est trop petit. L&apos;algorithme stationne.
+               </SP>
+             </PARAM_DESCRIPTION> 
+           </PARAM_ITEM>
+           <PARAM_ITEM>
+             <PARAM_NAME>4  </PARAM_NAME>
+             <PARAM_DESCRIPTION>
+               <SP>
+                 : les itérations n&apos;améliorent pas assez la solution.
+               </SP>
+             </PARAM_DESCRIPTION> 
+           </PARAM_ITEM>
+
+         </PARAM_INDENT>
+       </PARAM_DESCRIPTION> 
+      </PARAM_ITEM>
+    </PARAM_INDENT>
+  </PARAM>
+  <DESCRIPTION>
+    <P>
+      Résout un système de n équations non linéaires à n inconnues avec un algorithme du type
+      méthode hybride de Powell. La Jacobienne peut être fournie (c&apos;est fortement conseillé).
+    </P>
+    <VERBATIM><![CDATA[
+      0 = fct(x) 
+      ]]></VERBATIM>
+    <P>
+      <VERB>fct</VERB> est une fonction &quot;externe&quot;
+      Cette fonction renvoie <VERB>v=fct(x)</VERB> pour <VERB>x</VERB> donné.
+    </P>
+    <P>
+      La séquence d&apos;appel de <VERB>fct</VERB> est :
+    </P>
+    <VERBATIM><![CDATA[
+      [v]=fct(x).
+      ]]></VERBATIM>
+    <P>
+      Si <VERB>fct</VERB> est une chaîne de caractères, elle désigne le nom d&apos;une subroutine Fortran ou C liée dynamiquement à Scilab, avec comme liste d&apos;appel Fortran :
+    </P>
+    <VERBATIM><![CDATA[
+      fct(n,x,v,iflag)
+      integer n,iflag
+      double precision x(n),v(n)
+      ]]></VERBATIM>
+    <P>
+      ou alors pour une routine C : 
+    </P>
+    <VERBATIM><![CDATA[
+      fct(int *n, double x[],double v[],int *iflag)
+      ]]></VERBATIM>
+    <P>
+    </P>
+    <P>
+      (voir <VERB>link</VERB>).
+    </P>
+    <P>
+      <VERB>jac</VERB> est une fonction &quot;externe&quot; aussi.
+      Cette fonction renvoie <VERB>v=d(fct)/dx (x)</VERB> pour <VERB>x</VERB> donné.
+    </P>
+    <P>
+      La séquence d&apos;appel de <VERB>jac</VERB> est :
+    </P>
+    <VERBATIM><![CDATA[
+      [v]=jac(x).
+      ]]></VERBATIM>
+    <P>
+      Si <VERB>jac</VERB> est une chaîne de caractères, elle désigne le nom d&apos;une subroutine Fortran ou C liée dynamiquement à Scilab. Les séquences d&apos;appel sont les mêmes que pour fct (attention v doit être un tableau n x n).
+    </P>
+  </DESCRIPTION>
+  <EXAMPLE><![CDATA[
+    // un exemple simple
+    a=[1,7;2,8];b=[10;11];
+    deff('[y]=fsol1(x)','y=a*x+b');
+    deff('[y]=fsolj1(x)','y=a');
+    [xres]=fsolve([100;100],fsol1);
+    a*xres+b
+    [xres]=fsolve([100;100],fsol1,fsolj1);
+    a*xres+b
+    // voir routines/default/Ex-fsolve.f
+    [xres]=fsolve([100;100],'fsol1','fsolj1',1.e-7);
+    a*xres+b
+    ]]></EXAMPLE>
+  <SEE_ALSO>
+    <SEE_ALSO_ITEM> <LINK>external</LINK> </SEE_ALSO_ITEM> 
+    <SEE_ALSO_ITEM> <LINK>quapro</LINK> </SEE_ALSO_ITEM> 
+    <SEE_ALSO_ITEM> <LINK>linpro</LINK> </SEE_ALSO_ITEM> 
+    <SEE_ALSO_ITEM> <LINK>optim</LINK> </SEE_ALSO_ITEM>
+  </SEE_ALSO>
+</MAN>
diff --git a/scilab/modules/optimization/help/fr/helpbuilderfr.sce b/scilab/modules/optimization/help/fr/helpbuilderfr.sce
new file mode 100644 (file)
index 0000000..f36a58c
--- /dev/null
@@ -0,0 +1,6 @@
+mode(-1); //force silent execution\r
+path=get_absolute_file_path('helpbuilderfr.sce');//get the absolute path of this file\r
+add_help_chapter("Optimisation et Simulation",path);//add help chapter\r
+xmltohtml(path,"Optimisation et Simulation",'html-rev.xsl');\r
+//clear the variable stack\r
+clear path add_help_chapter get_absolute_file_path; 
\ No newline at end of file
diff --git a/scilab/modules/optimization/help/fr/karmarkar.xml b/scilab/modules/optimization/help/fr/karmarkar.xml
new file mode 100644 (file)
index 0000000..794c60b
--- /dev/null
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
+<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
+<MAN>
+  <LANGUAGE>eng</LANGUAGE>
+  <TITLE>karmarkar</TITLE>
+  <TYPE>Scilab Function</TYPE>
+  <DATE>April 1993</DATE>
+  <SHORT_DESCRIPTION name="karmarkar"> karmarkar algorithm</SHORT_DESCRIPTION>
+  <CALLING_SEQUENCE>
+    <CALLING_SEQUENCE_ITEM>[x1]=karmarkar(a,b,c,x0)  </CALLING_SEQUENCE_ITEM>
+  </CALLING_SEQUENCE>
+  <PARAM>
+    <PARAM_INDENT>
+      <PARAM_ITEM>
+        <PARAM_NAME>a</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: matrix (n,p)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>b</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>:  n - vector</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>c</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>:  p - vector</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>x0</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>:  initial vector</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>eps</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: threshold (default value : 1.d-5)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>gamma</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: descent step  <VERB>0&lt;gamma&lt;1</VERB> , default value : 1/4</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>x1</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: solution</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>crit</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: value of  c'*x1</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+    </PARAM_INDENT>
+  </PARAM>
+  <DESCRIPTION>
+    <P>
+    Computes <VERB>x</VERB> which minimizes</P>
+    <VERBATIM>
+<![CDATA[
+                        c'*x
+   ]]>
+    </VERBATIM>
+    <P>
+    under constraints:</P>
+    <VERBATIM>
+<![CDATA[
+                        a*x = b
+                        x>=0
+   ]]>
+    </VERBATIM>
+  </DESCRIPTION>
+  <EXAMPLE>
+<![CDATA[
+// n=10;p=20;
+// a=rand(n,p);c=rand(p,1);x0=abs(rand(p,1));b=a*x0;x1=karmarkar(a,b,c,x0);
+ ]]>
+  </EXAMPLE>
+</MAN>
diff --git a/scilab/modules/optimization/help/fr/leastsq.xml b/scilab/modules/optimization/help/fr/leastsq.xml
new file mode 100644 (file)
index 0000000..835a659
--- /dev/null
@@ -0,0 +1,413 @@
+<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
+<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
+<MAN>
+  <LANGUAGE>eng</LANGUAGE>
+  <TITLE>leastsq</TITLE>
+  <TYPE>Scilab Function</TYPE>
+  <DATE>April 1999</DATE>
+  <SHORT_DESCRIPTION name="leastsq"> 
+    Solves non-linear least squares problems  
+  </SHORT_DESCRIPTION>
+  <CALLING_SEQUENCE>
+    <CALLING_SEQUENCE_ITEM>[fopt,[xopt,[grdopt]]]=leastsq(fun, x0)</CALLING_SEQUENCE_ITEM>
+    <CALLING_SEQUENCE_ITEM>[fopt,[xopt,[grdopt]]]=leastsq(fun, dfun, x0)</CALLING_SEQUENCE_ITEM>
+    <CALLING_SEQUENCE_ITEM>[fopt,[xopt,[grdopt]]]=leastsq(fun, cstr, x0)</CALLING_SEQUENCE_ITEM>
+    <CALLING_SEQUENCE_ITEM>[fopt,[xopt,[grdopt]]]=leastsq(fun, dfun, cstr, x0)</CALLING_SEQUENCE_ITEM>
+    <CALLING_SEQUENCE_ITEM>[fopt,[xopt,[grdopt]]]=leastsq(fun, dfun, cstr, x0, algo)</CALLING_SEQUENCE_ITEM>
+    <CALLING_SEQUENCE_ITEM>[fopt,[xopt,[grdopt]]]=leastsq([imp], fun [,dfun] [,cstr],x0 [,algo],[df0,[mem]],[stop])</CALLING_SEQUENCE_ITEM>
+  </CALLING_SEQUENCE>
+  <PARAM>
+    <PARAM_INDENT>
+      <PARAM_ITEM>
+        <PARAM_NAME>fopt</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: value of the function <EM>f(x)=||fun(x)||^2</EM> at <VERB>xopt</VERB></SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>xopt</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: best value of <VERB>x</VERB> found to minimize <EM>||fun(x)||^2</EM></SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>grdopt</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: gradient of <EM>f</EM> at <VERB>xopt</VERB></SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+
+      <PARAM_ITEM>
+        <PARAM_NAME>fun</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>:  a scilab function or a list defining a function from <EM>R^n</EM> to <EM>R^m</EM> 
+                 (see more details in DESCRIPTION).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>x0</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: real vector (initial guess of the variable to be minimized).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>dfun</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>:  a scilab function or a string defining the Jacobian matrix of <VERB>fun</VERB>
+                 (see more details in DESCRIPTION).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>cstr</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: bound constraints on <VERB>x</VERB>. They must be introduced by the string keyword <TT>'b'</TT>
+                followed by the lower bound <TT>binf</TT> then by the upper bound <TT>bsup</TT> (so 
+                <VERB>cstr</VERB> appears as <VERB>'b',binf,bsup</VERB> in the calling sequence). Those bounds
+                are real vectors with same dimension than <VERB>x0</VERB> (-%inf and +%inf may be used for
+                dimension which are unrestricted).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>algo</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: a string with possible values: <TT>'qn'</TT> or <TT>'gc'</TT> or <TT>'nd'</TT>. 
+                These strings stand for quasi-Newton (default),  conjugate gradient or non-differentiable 
+                respectively. Note that <TT>'nd'</TT> does not accept bounds on <VERB>x</VERB>.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>imp</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: scalar argument used to set the trace mode. <VERB>imp=0</VERB> nothing (except errors) 
+                is reported, <VERB>imp=1</VERB> initial and final reports, <VERB>imp=2</VERB> adds a 
+                report per iteration, <VERB>imp&gt;2</VERB> add reports on linear search. Warning, most
+                of these reports are written on the Scilab standard output.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>df0</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: real scalar. Guessed decreasing of <EM>||fun||^2</EM> at first iteration. 
+                (<TT>df0=1</TT> is the default value).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>mem</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: integer, number of variables used to approximate the Hessean (second derivatives)
+                of <EM>f</EM> when <VERB>algo</VERB><TT>='qn'</TT>. Default value is around 6.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>stop</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>:  sequence of optional parameters controlling the  convergence of the algorithm. They 
+                 are introduced by the keyword <TT>'ar'</TT>, the sequence being of the form
+                 <VERB>'ar',nap, [iter [,epsg   [,epsf [,epsx]]]]</VERB></SP>
+          <PARAM_INDENT>
+            <PARAM_ITEM>
+              <PARAM_NAME>nap</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: maximum number of calls to <VERB>fun</VERB> allowed.</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>iter</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: maximum number of iterations allowed.</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>epsg</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: threshold on gradient norm.</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>epsf</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: threshold controlling decreasing of <VERB>f</VERB></SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>epsx</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: threshold controlling variation of <VERB>x</VERB>. This vector (possibly matrix) 
+                      of same size as <VERB>x0</VERB> can be used to scale <VERB>x</VERB>.</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+          </PARAM_INDENT>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+    </PARAM_INDENT>
+  </PARAM>
+
+
+  <DESCRIPTION>
+    <P>
+     <EM>fun</EM> being a function from <EM>R^n</EM> to <EM>R^m</EM> this routine tries to minimize w.r.t.
+     <EM>x</EM>, the function:
+   </P>
+        <VERBATIM><![CDATA[
+                           _m_     
+                      2    \      2
+     f(x) = ||fun(x)||  =  /   fun (x)
+                           ---    i
+                           i=1     
+          ]]></VERBATIM>
+    <SP> which is the sum of the squares of the components of <EM>fun</EM>. Bound constraints may be
+     imposed on <VERB>x</VERB>.</SP>
+  </DESCRIPTION>   
+
+  <SECTION label="How to provide fun and dfun">
+    <P><VERB>fun</VERB> can be either a usual scilab function (case 1) or a fortran or a C routine linked
+            to scilab (case 2). For most problems the definition of <EM>fun</EM> will need 
+            supplementary parameters and this can be done in both cases.</P>
+         <ITEMIZE>
+          <ITEM label="case 1:">
+            <SP> when <VERB>fun</VERB> is a Scilab function, its calling sequence must be:
+          <TT>y=fun(x [,opt_par1,opt_par2,...])</TT>. When <VERB>fun</VERB> needs optional parameters it
+           must appear as <TT>list(fun,opt_par1,opt_par2,...)</TT> in the calling sequence of
+           <VERB>leastsq</VERB>.</SP>
+          </ITEM>
+          <ITEM label="case 2:">
+            <SP> when <VERB>fun</VERB> is defined by a Fortran or C routine it must appear as
+                <TT>list(fun_name,m [,opt_par1,opt_par2,...])</TT> in the calling
+                sequence of <VERB>leastsq</VERB>, <TT>fun_name</TT> (a string) being the name 
+                of the routine which must be linked to Scilab (see <LINK>link</LINK>). The generic 
+                calling sequences for this routine are:</SP> 
+            <VERBATIM><![CDATA[
+In Fortran:    subroutine fun(m, n, x, params, y)
+               integer m,n
+               double precision x(n), params(*), y(m)
+
+In C:          void fun(int *m, int *n, double *x, double *params, double *y)
+         ]]></VERBATIM>
+            <SP>where <VERB>n</VERB> is the dimension of vector <VERB>x</VERB>, <VERB>m</VERB> the dimension of 
+            vector <VERB>y</VERB> (which must store the evaluation of <EM>fun</EM> 
+            at <EM>x</EM>) and <VERB>params</VERB> is a vector which contains the optional parameters 
+            <EM>opt_par1, opt_par2, ...</EM> (each parameter may be a vector, for instance if <EM>opt_par1</EM> 
+            has 3 components, the description of <EM>opt_par2</EM> begin from <TT>params(4)</TT> (fortran case),
+            and from  <TT>params[3]</TT> (C case), etc... Note that even if <VERB>fun</VERB> doesn't need
+            supplementary parameters you must anyway write the fortran code with a <TT>params</TT> argument
+            (which is then unused in the subroutine core).</SP>
+          </ITEM>
+         </ITEMIZE>
+
+        <P>In many cases it is adviced to provide the Jacobian matrix <VERB>dfun</VERB> (<EM>dfun(i,j)=dfi/dxj</EM>) 
+           to the optimizer (which uses a finite difference approximation otherwise) and as for <VERB>fun</VERB> it may 
+           be given as a usual scilab function or as a  fortran or a C routine linked to scilab.</P> 
+        <ITEMIZE>
+          <ITEM label="case 1:">
+            <SP> when <VERB>dfun</VERB> is a scilab function, its calling sequence must be:
+          <TT>y=dfun(x [, optional parameters])</TT> (notes that even if <VERB>dfun</VERB> needs optional 
+              parameters it must appear simply as <TT>dfun</TT> in the calling sequence of
+           <VERB>leastsq</VERB>).</SP>
+          </ITEM>
+          <ITEM label="case 2:">
+            <SP> when <VERB>dfun</VERB> is defined by a Fortran or C routine it must appear as
+                <TT>dfun_name</TT> (a string) in the calling sequence of <VERB>leastsq</VERB> 
+                (<TT>dfun_name</TT> being the name of the routine which must be linked to Scilab). 
+                The calling sequences for this routine are nearly the same than for <VERB>fun</VERB>:</SP> 
+            <VERBATIM><![CDATA[
+In Fortran:    subroutine dfun(m, n, x, params, y)
+               integer m,n
+               double precision x(n), params(*), y(m,n)
+
+In C:          void fun(int *m, int *n, double *x, double *params, double *y)
+         ]]></VERBATIM>
+            <SP>in the C case <EM>dfun(i,j)=dfi/dxj</EM> must be stored in <TT>y[m*(j-1)+i-1]</TT>.</SP>
+          </ITEM>
+        </ITEMIZE>
+
+  </SECTION>
+
+  <SECTION label="Remarks">
+    <P> Like <LINK>datafit</LINK>, <VERB>leastsq</VERB> is a front end onto the <LINK>optim</LINK>
+       function. If you want to try the Levenberg-Marquard method instead, use <LINK>lsqrsolve</LINK>.
+    </P>
+    <P> A least squares problem may be solved directly with the <LINK>optim</LINK> function ;
+        in this case the function <LINK>NDcost</LINK> may be useful to compute the derivatives
+        (see the <LINK>NDcost</LINK> help page which provides a simple example for parameters 
+        identification of a differential equation).
+    </P>
+  </SECTION>
+  <EXAMPLE>
+<![CDATA[// We will show different calling possibilities of leastsq on one (trivial) example
+// which is non linear but doesn't really need to be solved with leastsq (applying
+// log linearizes the model and the problem may be solved with linear algebra). 
+// In this example we look for the 2 parameters x(1) and x(2) of a simple
+// exponential decay model (x(1) being the unknow initial value and x(2) the
+// decay constant): 
+function y = yth(t, x)
+   y  = x(1)*exp(-x(2)*t) 
+endfunction  
+
+// we have the m measures (ti, yi):
+m = 10;
+tm = [0.25, 0.5, 0.75, 1.0, 1.25, 1.5, 1.75, 2.0, 2.25, 2.5]';
+ym = [0.79, 0.59, 0.47, 0.36, 0.29, 0.23, 0.17, 0.15, 0.12, 0.08]';
+wm = ones(m,1); // measure weights (here all equal to 1...)
+
+// and we want to find the parameters x such that the model fits the given 
+// datas in the least square sense:
+// 
+//  minimize  f(x) = sum_i  wm(i)^2 ( yth(tm(i),x) - ym(i) )^2   
+
+// initial parameters guess
+x0 = [1.5 ; 0.8];
+
+// in the first examples, we define the function fun and dfun 
+// in scilab language
+function e = myfun(x, tm, ym, wm)
+   e = wm.*( yth(tm, x) - ym )
+endfunction
+
+function g = mydfun(x, tm, ym, wm)
+   v = wm.*exp(-x(2)*tm)
+   g = [v , -x(1)*tm.*v]
+endfunction
+
+// now we could call leastsq:
+
+// 1- the simplest call
+[f,xopt, gropt] = leastsq(list(myfun,tm,ym,wm),x0)
+
+// 2- we provide the Jacobian
+[f,xopt, gropt] = leastsq(list(myfun,tm,ym,wm),mydfun,x0)
+
+// a small graphic (before showing other calling features)
+tt = linspace(0,1.1*max(tm),100)';
+yy = yth(tt, xopt);
+xbasc()
+plot2d(tm, ym, style=-2)
+plot2d(tt, yy, style = 2)
+legend(["measure points", "fitted curve"]);
+xtitle("a simple fit with leastsq")
+
+// 3- how to get some informations (we use imp=1)
+[f,xopt, gropt] = leastsq(1,list(myfun,tm,ym,wm),mydfun,x0)
+
+// 4- using the conjugate gradient (instead of quasi Newton)
+[f,xopt, gropt] = leastsq(1,list(myfun,tm,ym,wm),mydfun,x0,"gc")
+
+// 5- how to provide bound constraints (not useful here !)
+xinf = [-%inf,-%inf]; xsup = [%inf, %inf];
+[f,xopt, gropt] = leastsq(list(myfun,tm,ym,wm),"b",xinf,xsup,x0) // without Jacobian
+[f,xopt, gropt] = leastsq(list(myfun,tm,ym,wm),mydfun,"b",xinf,xsup,x0) // with Jacobian 
+
+// 6- playing with some stopping parameters of the algorithm
+//    (allows only 40 function calls, 8 iterations and set epsg=0.01, epsf=0.1)
+[f,xopt, gropt] = leastsq(1,list(myfun,tm,ym,wm),mydfun,x0,"ar",40,8,0.01,0.1)
+
+
+// 7 and 8: now we want to define fun and dfun in fortran then in C
+//          Note that the "compile and link to scilab" method used here
+//          is believed to be OS independant (but there are some requirements, 
+//          in particular you need a C and a fortran compiler, and they must 
+//          be compatible with the ones used to build your scilab binary).
+// 7- fun and dfun in fortran
+
+// 7-1/ Let 's Scilab write the fortran code (in the TMPDIR directory):
+f_code = [ ...
+"      subroutine myfun(m,n,x,param,f)"
+"*     param(i) = tm(i), param(m+i) = ym(i), param(2m+i) = wm(i)"
+"      implicit none"
+"      integer n,m"
+"      double precision x(n), param(*), f(m)"
+"      integer i"
+"      do i = 1,m"
+"         f(i) = param(2*m+i)*( x(1)*exp(-x(2)*param(i)) - param(m+i) )"
+"      enddo"
+"      end ! subroutine fun"
+""
+"      subroutine mydfun(m,n,x,param,df)"
+"*     param(i) = tm(i), param(m+i) = ym(i), param(2m+i) = wm(i)"
+"      implicit none"
+"      integer n,m"
+"      double precision x(n), param(*), df(m,n)"
+"      integer i"
+"      do i = 1,m"
+"         df(i,1) =  param(2*m+i)*exp(-x(2)*param(i))"
+"         df(i,2) = -x(1)*param(i)*df(i,1)"
+"      enddo"
+"      end ! subroutine dfun"];
+mputl(f_code,TMPDIR+'/myfun.f')
+
+// 7-2/ compiles it. You need a fortran compiler !
+names = ["myfun" "mydfun"]
+flibname = ilib_for_link(names,"myfun.o",[],"f",TMPDIR+"/Makefile");
+
+// 7-3/ link it to scilab (see link help page)
+link(flibname,names,"f") 
+
+// 7-4/ ready for the leastsq call: be carreful don't forget to
+//      give the dimension m after the routine name !
+[f,xopt, gropt] = leastsq(list("myfun",m,tm,ym,wm),x0)  // without Jacobian
+[f,xopt, gropt] = leastsq(list("myfun",m,tm,ym,wm),"mydfun",x0) // with Jacobian
+
+
+// 8- last example: fun and dfun in C
+
+// 8-1/ Let 's Scilab write the C code (in the TMPDIR directory):
+c_code = [...
+"#include <math.h>"
+"void myfunc(int *m,int *n, double *x, double *param, double *f)"
+"{"
+"  /*  param[i] = tm[i], param[m+i] = ym[i], param[2m+i] = wm[i] */"
+"  int i;"
+"  for ( i = 0 ; i < *m ; i++ )"
+"    f[i] = param[2*(*m)+i]*( x[0]*exp(-x[1]*param[i]) - param[(*m)+i] );"
+"  return;"
+"}"
+""
+"void mydfunc(int *m,int *n, double *x, double *param, double *df)"
+"{"
+"  /*  param[i] = tm[i], param[m+i] = ym[i], param[2m+i] = wm[i] */"
+"  int i;"
+"  for ( i = 0 ; i < *m ; i++ )"
+"    {"
+"      df[i] = param[2*(*m)+i]*exp(-x[1]*param[i]);"
+"      df[i+(*m)] = -x[0]*param[i]*df[i];"
+"    }"
+"  return;"
+"}"];
+mputl(c_code,TMPDIR+'/myfunc.c')
+
+// 8-2/ compiles it. You need a C compiler !
+names = ["myfunc" "mydfunc"]
+clibname = ilib_for_link(names,"myfunc.o",[],"c",TMPDIR+"/Makefile");
+
+// 8-3/ link it to scilab (see link help page)
+link(clibname,names,"c") 
+
+// 8-4/ ready for the leastsq call
+[f,xopt, gropt] = leastsq(list("myfunc",m,tm,ym,wm),"mydfunc",x0)
+   ]]>
+  </EXAMPLE>
+  <SEE_ALSO>
+    <SEE_ALSO_ITEM>
+      <LINK>lsqrsolve</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>optim</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>NDcost</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>datafit</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>external</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>quapro</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>linpro</LINK>
+    </SEE_ALSO_ITEM>
+  </SEE_ALSO>
+</MAN>
diff --git a/scilab/modules/optimization/help/fr/linpro.xml b/scilab/modules/optimization/help/fr/linpro.xml
new file mode 100644 (file)
index 0000000..9463946
--- /dev/null
@@ -0,0 +1,160 @@
+<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
+<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
+<MAN>
+  <LANGUAGE>eng</LANGUAGE>
+  <TITLE>linpro</TITLE>
+  <TYPE>Scilab Function</TYPE>
+  <DATE>April 1993</DATE>
+  <SHORT_DESCRIPTION name="linpro"> linear programming solver</SHORT_DESCRIPTION>
+  <CALLING_SEQUENCE>
+    <CALLING_SEQUENCE_ITEM>[x,lagr,f]=linpro(p,C,b [,x0])  </CALLING_SEQUENCE_ITEM>
+    <CALLING_SEQUENCE_ITEM>[x,lagr,f]=linpro(p,C,b,ci,cs [,x0])  </CALLING_SEQUENCE_ITEM>
+    <CALLING_SEQUENCE_ITEM>[x,lagr,f]=linpro(p,C,b,ci,cs,me [,x0])  </CALLING_SEQUENCE_ITEM>
+    <CALLING_SEQUENCE_ITEM>[x,lagr,f]=linpro(p,C,b,ci,cs,me,x0 [,imp])  </CALLING_SEQUENCE_ITEM>
+  </CALLING_SEQUENCE>
+  <PARAM>
+    <PARAM_INDENT>
+      <PARAM_ITEM>
+        <PARAM_NAME>p</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: real column vector (dimension <VERB> n</VERB>)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>C</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: real matrix (dimension <VERB> (me + md) x n</VERB>) (If no constraints are given, you can set <VERB>C = []</VERB>)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>b</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: RHS column vector (dimension <VERB>(me + md)</VERB>) (If no constraints are given, you can set <VERB>b = []</VERB>)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>ci</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: column vector of lower-bounds (dimension <VERB> n</VERB>). If there are no lower bound constraints, put <VERB>ci = []</VERB>. If some components of <VERB>x</VERB> are bounded from below, set the other (unconstrained) values of <VERB>ci</VERB> to a very  large negative  number (e.g. <VERB>ci(j) = -number_properties('huge')</VERB>.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>cs</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: column vector of upper-bounds. (Same remarks as above).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>me</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: number of equality constraints (i.e. <VERB>C(1:me,:)*x = b(1:me)</VERB>)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>x0</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: either an initial guess for <VERB>x</VERB>    or one of the character strings <VERB>'v'</VERB> or <VERB>'g'</VERB>. If <VERB>x0='v'</VERB> the calculated initial feasible point is a vertex. If <VERB>x0='g'</VERB> the calculated initial feasible point is arbitrary.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>imp</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: verbose option (optional parameter)  (Try <VERB>imp=7,8,...</VERB>) warning the message are output in the window where scilab has been started.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>x</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: optimal solution found.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>f</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: optimal value of the cost function (i.e. <VERB>f=p'*x</VERB>).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>lagr</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: vector of Lagrange multipliers.  If lower and upper-bounds <VERB>ci,cs</VERB> are provided, <VERB>lagr</VERB> has  <VERB>n + me + md</VERB> components and <VERB>lagr(1:n)</VERB> is the Lagrange  vector associated with the bound constraints and  <VERB>lagr (n+1 : n + me + md)</VERB> is the Lagrange vector associated  with the linear constraints. (If an upper-bound (resp. lower-bound) constraint <VERB>i</VERB> is active  <VERB>lagr(i)</VERB> is &gt; 0 (resp. &lt;0). If no bounds are provided, <VERB>lagr</VERB> has only <VERB>me + md</VERB> components.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+    </PARAM_INDENT>
+  </PARAM>
+  <DESCRIPTION>
+    <P><VERB>[x,lagr,f]=linpro(p,C,b [,x0])</VERB> Minimize <VERB>p'*x</VERB>
+    under the constraints  <VERB>C*x &lt;= b</VERB></P>
+    <P><VERB>[x,lagr,f]=linpro(p,C,b,ci,cs [,x0])</VERB> Minimize <VERB>p'*x</VERB> under the constraints  <VERB>C*x &lt;= b</VERB>, <VERB>ci &lt;= x &lt;= cs</VERB></P>
+    <P><VERB>[x,lagr,f]=linpro(p,C,b,ci,cs,me [,x0])</VERB> Minimize <VERB>p'*x</VERB>
+    under the constraints</P>
+    <VERBATIM>
+<![CDATA[
+ C(j,:) x = b(j),  j=1,...,me
+ C(j,:) x <= b(j), j=me+1,...,me+md
+ ci <= x <= cs
+   ]]>
+    </VERBATIM>
+    <P>
+    If no initial point is given the
+    program computes a feasible initial point
+    which is a vertex of the region of feasible points if
+    <VERB>x0='v'</VERB>.</P>
+    <P>
+    If <VERB>x0='g'</VERB>, the program computes a feasible initial 
+    point which is not necessarily a vertex. This mode is
+    advisable when the quadratic form is positive
+    definite and there are a few constraints in
+    the problem or when there are large bounds
+    on the variables that are security bounds and
+    very likely not active at the optimal solution.</P>
+  </DESCRIPTION>
+  <EXAMPLE>
+<![CDATA[
+//Find x in R^6 such that:
+//C1*x = b1  (3 equality constraints i.e me=3)
+C1= [1,-1,1,0,3,1;
+    -1,0,-3,-4,5,6;
+     2,5,3,0,1,0];
+b1=[1;2;3];
+//C2*x <= b2  (2 inequality constraints)
+C2=[0,1,0,1,2,-1;
+    -1,0,2,1,1,0];
+b2=[-1;2.5];
+//with  x between ci and cs:
+ci=[-1000;-10000;0;-1000;-1000;-1000];cs=[10000;100;1.5;100;100;1000];
+//and minimize p'*x with
+p=[1;2;3;4;5;6]
+//No initial point is given: x0='v';
+C=[C1;C2]; b=[b1;b2] ; me=3; x0='v';
+[x,lagr,f]=linpro(p,C,b,ci,cs,me,x0)
+// Lower bound constraints 3 and 4 are active and upper bound
+// constraint 5 is active --> lagr(3:4) < 0 and lagr(5) > 0.
+// Linear (equality) constraints 1 to 3 are active --> lagr(7:9) <> 0
+ ]]>
+  </EXAMPLE>
+  <SEE_ALSO>
+    <SEE_ALSO_ITEM>
+      <LINK>quapro</LINK>
+    </SEE_ALSO_ITEM>
+  </SEE_ALSO>
+  <AUTHORS>
+    <AUTHORS_ITEM label="Eduardo Casas  Renteria">, Universidad de Cantabria,</AUTHORS_ITEM>
+    <AUTHORS_ITEM label="Cecilia Pola Mendez"> , Universidad de Cantabria</AUTHORS_ITEM>
+  </AUTHORS>
+  <USED_FUNCTIONS>
+    <P>
+in routines/optim directory (authors E.Casas, C. Pola Mendez):</P>
+    <P>
+anfm01.f  anfm03.f  anfm05.f  anrs01.f  auxo01.f  dimp03.f  dnrm0.f   optr03.f  pasr03.f  zthz.f
+anfm02.f  anfm04.f  anfm06.f  anrs02.f  desr03.f  dipvtf.f  optr01.f
+opvf03.f  plcbas.f</P>
+    <P> From BLAS library</P>
+    <P>
+daxpy.f dcopy.f ddot.f dnrm2.f dscal.f dswap.f idamax.f</P>
+    <P> in routines/calelm directory (authors INRIA):</P>
+    <P>
+add.f ddif.f dmmul.f</P>
+    <P> From LAPACK library : dlamch.f</P>
+  </USED_FUNCTIONS>
+</MAN>
diff --git a/scilab/modules/optimization/help/fr/lmisolver.xml b/scilab/modules/optimization/help/fr/lmisolver.xml
new file mode 100644 (file)
index 0000000..093b064
--- /dev/null
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
+<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
+<MAN>
+  <LANGUAGE>eng</LANGUAGE>
+  <TITLE>lmisolver</TITLE>
+  <TYPE>Scilab Function</TYPE>
+  <DATE>April 1993</DATE>
+  <SHORT_DESCRIPTION name="lmisolver"> linear matrix inequation solver</SHORT_DESCRIPTION>
+  <CALLING_SEQUENCE>
+    <CALLING_SEQUENCE_ITEM>[XLISTF[,OPT]] = lmisolver(XLIST0,evalfunc [,options])  </CALLING_SEQUENCE_ITEM>
+  </CALLING_SEQUENCE>
+  <PARAM>
+    <PARAM_INDENT>
+      <PARAM_ITEM>
+        <PARAM_NAME>XLIST0</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: a list of containing initial guess (e.g. <VERB>XLIST0=list(X1,X2,..,Xn)</VERB>)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>evalfunc</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: a Scilab function (&quot;external&quot; function with specific
+    syntax)</SP>
+          <P>
+    The syntax the function <VERB>evalfunc</VERB> must be as follows:
+  </P>
+          <P><VERB>[LME,LMI,OBJ]=evalfunct(X)</VERB> where <VERB>X</VERB> is a list of matrices, <VERB>LME, LMI</VERB> are lists and <VERB>OBJ</VERB> a real scalar.
+  </P>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>XLISTF</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: a list of matrices (e.g. <VERB>XLIST0=list(X1,X2,..,Xn)</VERB>)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>options</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: optional parameter. If given, <VERB>options</VERB> is  a real row vector with 5 components <VERB>[Mbound,abstol,nu,maxiters,reltol]</VERB></SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+    </PARAM_INDENT>
+  </PARAM>
+  <DESCRIPTION>
+    <P><VERB>lmisolver</VERB> solves the following problem:</P>
+    <P>
+    minimize <VERB>f(X1,X2,...,Xn)</VERB> a linear function of Xi's</P>
+    <P>
+    under the linear constraints:
+    <VERB>Gi(X1,X2,...,Xn)=0</VERB> for i=1,...,p and LMI (linear matrix
+    inequalities) constraints:</P>
+    <P><VERB>Hj(X1,X2,...,Xn) &gt; 0</VERB> for j=1,...,q</P>
+    <P>
+    The functions f, G, H are coded in the Scilab function <VERB>evalfunc</VERB>
+    and the set of matrices Xi's in the list X (i.e.
+    <VERB>X=list(X1,...,Xn)</VERB>).</P>
+    <P>
+    The function <VERB>evalfun</VERB> must return in the list <VERB>LME</VERB> the matrices
+    <VERB>G1(X),...,Gp(X)</VERB> (i.e. <VERB>LME(i)=Gi(X1,...,Xn),</VERB> i=1,...,p).
+    <VERB>evalfun</VERB> must return in the list <VERB>LMI</VERB> the matrices
+    <VERB>H1(X0),...,Hq(X)</VERB> (i.e. <VERB>LMI(j)=Hj(X1,...,Xn)</VERB>, j=1,...,q). 
+    <VERB>evalfun</VERB> must return in <VERB>OBJ</VERB> the value of <VERB>f(X)</VERB>
+    (i.e. <VERB>OBJ=f(X1,...,Xn)</VERB>).</P>
+    <P><VERB>lmisolver</VERB>  returns in <VERB>XLISTF</VERB>, a list of real matrices,
+    i. e. <VERB>XLIST=list(X1,X2,..,Xn)</VERB> where the Xi's solve the LMI
+    problem:</P>
+    <P>
+    Defining <VERB>Y,Z</VERB> and <VERB>cost</VERB> by:</P>
+    <P><VERB>[Y,Z,cost]=evalfunc(XLIST)</VERB>, <VERB>Y</VERB> is a list of zero matrices, 
+    <VERB>Y=list(Y1,...,Yp)</VERB>, <VERB>Y1=0, Y2=0, ..., Yp=0</VERB>.</P>
+    <P><VERB> Z</VERB> is a list of square symmetric matrices, 
+    <VERB> Z=list(Z1,...,Zq) </VERB>, which are semi positive definite
+    <VERB> Z1&gt;0, Z2&gt;0, ..., Zq&gt;0</VERB> (i.e. <VERB>spec(Z(j))</VERB> &gt; 0),</P>
+    <P><VERB>cost</VERB> is minimized.</P>
+    <P><VERB>lmisolver</VERB> can also solve LMI problems in which the <VERB>Xi's</VERB> 
+    are not matrices but lists of matrices. More details are given in the 
+    documentation of LMITOOL.</P>
+  </DESCRIPTION>
+  <EXAMPLE>
+<![CDATA[
+//Find diagonal matrix X (i.e. X=diag(diag(X), p=1) such that
+//A1'*X+X*A1+Q1 < 0, A2'*X+X*A2+Q2 < 0 (q=2) and trace(X) is maximized 
+n=2;A1=rand(n,n);A2=rand(n,n);
+Xs=diag(1:n);Q1=-(A1'*Xs+Xs*A1+0.1*eye());
+Q2=-(A2'*Xs+Xs*A2+0.2*eye());
+deff('[LME,LMI,OBJ]=evalf(Xlist)','X=Xlist(1),LME=X-diag(diag(X));...
+LMI=list(-(A1''*X+X*A1+Q1),-(A2''*X+X*A2+Q2)),OBJ= -sum(diag(X))  ');
+X=lmisolver(list(zeros(A1)),evalf);X=X(1)
+[Y,Z,c]=evalf(X)
+ ]]>
+  </EXAMPLE>
+  <SEE_ALSO>
+    <SEE_ALSO_ITEM>
+      <LINK>lmitool</LINK>
+    </SEE_ALSO_ITEM>
+  </SEE_ALSO>
+</MAN>
diff --git a/scilab/modules/optimization/help/fr/lmitool.xml b/scilab/modules/optimization/help/fr/lmitool.xml
new file mode 100644 (file)
index 0000000..d0eb0ca
--- /dev/null
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
+<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
+<MAN>
+  <LANGUAGE>eng</LANGUAGE>
+  <TITLE>lmitool</TITLE>
+  <TYPE>Scilab Function</TYPE>
+  <DATE>April 1993</DATE>
+  <SHORT_DESCRIPTION name="lmitool"> tool for solving linear matrix inequations</SHORT_DESCRIPTION>
+  <CALLING_SEQUENCE>
+    <CALLING_SEQUENCE_ITEM>lmitool()  </CALLING_SEQUENCE_ITEM>
+    <CALLING_SEQUENCE_ITEM>  </CALLING_SEQUENCE_ITEM>
+    <CALLING_SEQUENCE_ITEM>lmitool(filename)  </CALLING_SEQUENCE_ITEM>
+    <CALLING_SEQUENCE_ITEM>  </CALLING_SEQUENCE_ITEM>
+    <CALLING_SEQUENCE_ITEM>txt=lmitool(probname,varlist,datalist)  </CALLING_SEQUENCE_ITEM>
+  </CALLING_SEQUENCE>
+  <PARAM>
+    <PARAM_INDENT>
+      <PARAM_ITEM>
+        <PARAM_NAME>filename</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: a string referring to a <VERB>.sci</VERB> function</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>probname</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: a string containing the name of the problem</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>varlist</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: a string containing the names of the unknown matrices (separated by commas if there are more than one)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>datalist</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>:  a string containing the names of  data matrices (separated by commas if there are more than one)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>txt</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: a string providing information on what the user should do next</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+    </PARAM_INDENT>
+  </PARAM>
+  <DESCRIPTION>
+    <P><VERB>lmitool()</VERB> or <VERB>lmitool(filename)</VERB> is used to define 
+    interactively a LMI problem.
+    In the non interactive mode,
+    <VERB>txt=lmitool(probname,varlist,datalist)</VERB>
+    generates a file in the current directory. The name of this file 
+    is obtained by adding <VERB>.sci</VERB> to the end of <VERB>probname</VERB>. 
+    This file is the skeleton of a solver function and the corresponding 
+    evaluation function needed by <VERB>lmisolver</VERB>.</P>
+  </DESCRIPTION>
+  <SEE_ALSO>
+    <SEE_ALSO_ITEM>
+      <LINK>lmisolver</LINK>
+    </SEE_ALSO_ITEM>
+  </SEE_ALSO>
+</MAN>
diff --git a/scilab/modules/optimization/help/fr/lsqrsolve.xml b/scilab/modules/optimization/help/fr/lsqrsolve.xml
new file mode 100644 (file)
index 0000000..5f1e0e7
--- /dev/null
@@ -0,0 +1,296 @@
+<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
+<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
+<MAN>
+  <LANGUAGE>eng</LANGUAGE>
+  <TITLE>lsqrsolve</TITLE>
+  <TYPE>Scilab Function</TYPE>
+  <DATE>August 1993</DATE>
+  <SHORT_DESCRIPTION name="lsqrsolve"> minimize the sum of the squares of
+nonlinear functions, levenberg-marquardt algorithm</SHORT_DESCRIPTION>
+  <CALLING_SEQUENCE>
+    <CALLING_SEQUENCE_ITEM>[x [,v [,info]]]=lsqrsolve(x0,fct,m [,stop [,diag]])</CALLING_SEQUENCE_ITEM>
+    <CALLING_SEQUENCE_ITEM>[x [,v [,info]]]=lsqrsolve(x0,fct,m ,fjac [,stop [,diag]])</CALLING_SEQUENCE_ITEM>
+  </CALLING_SEQUENCE>
+  <PARAM>
+    <PARAM_INDENT>
+      <PARAM_ITEM>
+        <PARAM_NAME>x0</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: real vector (initial value of functions argument).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>fct</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: external (i.e function or list or string).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+       <PARAM_ITEM>
+        <PARAM_NAME>m</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: integer, the number of functions.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>fjac</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: external (i.e function or list or string).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>stop</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: optional vector
+          <VERB>[ftol,xtol,gtol,maxfev,epsfcn,factor]</VERB> the
+          default value is <VERB>[1.d-8,1.d-8,1.d-5,1000,0,100]</VERB></SP>
+          <PARAM_INDENT>
+          <PARAM_ITEM>
+            <PARAM_NAME>ftol</PARAM_NAME>
+            <PARAM_DESCRIPTION>
+            <SP>: A positive real number,termination occurs when both
+                  the actual and predicted relative reductions in the
+                  sum of squares are at most ftol.  therefore, ftol
+                  measures the relative error desired in the sum of
+                  squares.</SP>
+           </PARAM_DESCRIPTION>
+          </PARAM_ITEM>
+          <PARAM_ITEM>
+            <PARAM_NAME>xtol</PARAM_NAME>
+            <PARAM_DESCRIPTION>
+            <SP>: A positive real number, termination occurs when the
+             relative error between two consecutive iterates is at
+             most xtol. therefore, xtol measures the relative error
+             desired in the approximate solution.</SP>
+           </PARAM_DESCRIPTION>
+          </PARAM_ITEM>
+          <PARAM_ITEM>
+            <PARAM_NAME>gtol</PARAM_NAME>
+            <PARAM_DESCRIPTION>
+            <SP>: A nonnegative input variable. termination
+                 occurs when the cosine of the angle between fct(x) and
+                 any column of the jacobian is at most gtol in absolute
+                 value. therefore, gtol measures the orthogonality
+                 desired between the function vector and the columns
+                 of the jacobian.</SP>
+           </PARAM_DESCRIPTION>
+          </PARAM_ITEM>
+          <PARAM_ITEM>
+            <PARAM_NAME>maxfev</PARAM_NAME>
+            <PARAM_DESCRIPTION>
+            <SP>: A positive integer, termination occurs when the
+             number of calls to fct is at least maxfev by the end of
+             an iteration.</SP>
+           </PARAM_DESCRIPTION>
+          </PARAM_ITEM>
+
+          <PARAM_ITEM>
+            <PARAM_NAME>epsfcn</PARAM_NAME>
+            <PARAM_DESCRIPTION>
+            <SP>: A positive real number, used in determining a
+             suitable step length for the forward-difference
+             approximation. this approximation assumes that the
+             relative errors in the functions are of the order of
+             epsfcn. if epsfcn is less than the machine precision, it
+             is assumed that the relative errors in the functions are
+             of the order of the machine precision.</SP>
+           </PARAM_DESCRIPTION>
+          </PARAM_ITEM>
+
+         <PARAM_ITEM>
+            <PARAM_NAME>factor</PARAM_NAME>
+            <PARAM_DESCRIPTION>
+            <SP>: A positive real number, used in determining the
+            initial step bound. this bound is set to the product of
+            factor and the euclidean norm of diag*x if nonzero, or
+            else to factor itself. in most cases factor should lie in
+            the interval (.1,100.). 100. is a generally recommended
+            value.</SP>
+           </PARAM_DESCRIPTION>
+          </PARAM_ITEM>
+          </PARAM_INDENT>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+
+      <PARAM_ITEM>
+        <PARAM_NAME>diag</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: is an array of length n.  diag
+         must contain positive entries that serve as
+         multiplicative scale factors for the variables.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+
+      <PARAM_ITEM>
+        <PARAM_NAME>x :  </PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>real vector (final value of function argument, estimated zero).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>v :  </PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>real vector (value of functions at x).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>info</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>:  termination indicator</SP>
+          <PARAM_INDENT>
+            <PARAM_ITEM>
+              <PARAM_NAME>0</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: improper input parameters.</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>1</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: algorithm estimates that the relative error between x and the solution  is at most tol.</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>2</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: number of calls to fcn reached</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>3</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: tol is too small. No further improvement in the approximate solution  x is possible.</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>4</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: iteration is not making good progress.</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+          </PARAM_INDENT>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+    </PARAM_INDENT>
+  </PARAM>
+
+  <DESCRIPTION>
+    <P>
+    minimize the sum of the squares of m nonlinear functions in n
+     variables by a modification of the levenberg-marquardt
+     algorithm. the user must provide a subroutine which calculates
+     the functions. the jacobian is then calculated by a
+     forward-difference approximation.</P>
+    <P>
+     minimize <VERB>sum(fct(x,m).^2)</VERB> where
+    <VERB>fct</VERB> is function from <VERB>R^n</VERB> to <VERB>R^m</VERB>
+    </P>
+    <P>
+    <VERB>fct</VERB> should be :
+    </P> 
+    <DESCRIPTION_INDENT>
+    <DESCRIPTION_ITEM>  
+    <SP>a Scilab function whose calling sequence is <VERB>v=fct(x,m)</VERB> given <VERB>x</VERB> and
+    <VERB>m</VERB>.</SP>
+    </DESCRIPTION_ITEM> 
+
+    <DESCRIPTION_ITEM> 
+     <SP>a character string which  refers to a C or Fortran routine  which must be linked to Scilab. </SP>
+
+    <P>
+    Fortran calling sequence should be
+   <VERB>fct(m,n,x,v,iflag)</VERB>  where <VERB>m</VERB>,
+    <VERB>n</VERB>, <VERB>iflag</VERB> are integers, <VERB>x</VERB> a
+    double precision vector of size  <VERB>n</VERB> and <VERB>v</VERB> a
+    double precision vector of size  <VERB>m</VERB>.
+    </P>
+    <P>  
+    C calling sequence should be
+    <VERB>fct(int *m, int *n, double x[],double v[],int *iflag)</VERB>
+    </P>
+
+    </DESCRIPTION_ITEM> 
+     </DESCRIPTION_INDENT>
+
+     <P>  <VERB>fjac</VERB> is an external which returns <VERB>v=d(fct)/dx (x)</VERB>.
+     it should be :</P>
+    <DESCRIPTION_INDENT>
+    <DESCRIPTION_ITEM label="a Scilab function"> <SP>whose calling
+    sequence is <VERB>J=fjac(x,m)</VERB> given <VERB>x</VERB> and
+    <VERB>m</VERB>.</SP>
+    </DESCRIPTION_ITEM> 
+    <DESCRIPTION_ITEM label="a character string">  <SP>it refers to a C or Fortran routine
+    which must be linked to Scilab. </SP>
+    <P>
+    Fortran calling sequence should be
+   <VERB>fjac(m,n,x,jac,iflag)</VERB>  where <VERB>m</VERB>,
+    <VERB>n</VERB>, <VERB>iflag</VERB> are integers, <VERB>x</VERB> a
+    double precision vector of size  <VERB>n</VERB> and <VERB>jac</VERB> a
+    double precision vector of size  <VERB>m*n</VERB>.
+    </P>
+    <P>  
+    C calling sequence should be
+    <VERB>fjac(int *m, int *n, double x[],double v[],int *iflag)</VERB>
+    </P>
+ </DESCRIPTION_ITEM> 
+ </DESCRIPTION_INDENT>
+   <P> return -1 in iflag to stop the algoritm if the function
+   or jacobian could not be evaluated.</P>
+  
+
+  </DESCRIPTION>
+  <EXAMPLE>
+<![CDATA[
+// A simple example with lsqrsolve 
+a=[1,7;
+   2,8
+   4 3];
+b=[10;11;-1];
+function y=f1(x,m),y=a*x+b;endfunction
+[xsol,v]=lsqrsolve([100;100],f1,3)
+xsol+a\b
+
+
+function y=fj1(x,m),y=a;endfunction
+[xsol,v]=lsqrsolve([100;100],f1,3,fj1)
+xsol+a\b
+
+// Data fitting problem
+// 1 build the data
+a=34;b=12;c=14;
+deff('y=FF(x)','y=a*(x-b)+c*x.*x');
+X=(0:.1:3)';Y=FF(X)+100*(rand()-.5);
+
+//solve
+function e=f1(abc,m)
+  a=abc(1);b=abc(2),c=abc(3),
+  e=Y-(a*(X-b)+c*X.*X);
+endfunction
+[abc,v]=lsqrsolve([10;10;10],f1,size(X,1));
+abc
+norm(v)
+
+ ]]>
+  </EXAMPLE>
+  <SEE_ALSO>
+    <SEE_ALSO_ITEM>
+      <LINK>external</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>quapro</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>linpro</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>optim</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>fsolve</LINK>
+    </SEE_ALSO_ITEM>
+  </SEE_ALSO>
+ <USED_FUNCTIONS>
+    <SP>lmdif, lmder from  minpack, Argonne National Laboratory.</SP>
+ </USED_FUNCTIONS>
+</MAN>
diff --git a/scilab/modules/optimization/help/fr/mps2linpro.xml b/scilab/modules/optimization/help/fr/mps2linpro.xml
new file mode 100644 (file)
index 0000000..411eb0e
--- /dev/null
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
+<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
+<MAN>
+  <LANGUAGE>eng</LANGUAGE>
+  <TITLE>mps2linpro</TITLE>
+  <TYPE>Scilab Function</TYPE>
+  <DATE>MAY 1998</DATE>
+  <SHORT_DESCRIPTION name="mps2linpro"> convert lp problem given in MPS format to linpro format</SHORT_DESCRIPTION>
+  <CALLING_SEQUENCE>
+    <CALLING_SEQUENCE_ITEM>lp = mps2linpro(mps)  </CALLING_SEQUENCE_ITEM>
+    <CALLING_SEQUENCE_ITEM>[p,C,b,ci,cs,mi] = mps2linpro(mps)  </CALLING_SEQUENCE_ITEM>
+  </CALLING_SEQUENCE>
+  <PARAM>
+    <PARAM_INDENT>
+      <PARAM_ITEM>
+        <PARAM_NAME>mps</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: either a character string, path of the MPS file, or an mps data structure returned by <VERB>readmps</VERB></SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>lp</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: a linpro data tlist with following fields:</SP>
+          <PARAM_INDENT>
+            <PARAM_ITEM>
+              <PARAM_NAME>p</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: real (column) vector (dimension <VERB> n</VERB>)</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>C</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: real matrix (dimension <VERB> (mi + md) x n</VERB>) (If no constraints are given, you can set <VERB>C = []</VERB>)</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>b</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: RHS vector (dimension <VERB>1 x (mi + md)</VERB>)</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>ci</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: (column) vector of lower-bounds (dimension <VERB> n</VERB>). If there are no lower bound constraints, put <VERB>ci = []</VERB>. If some components of <VERB>x</VERB> are bounded from below, set the other (unconstrained) values of <VERB>ci</VERB> to a very  large negative  number (e.g. <VERB>ci(j) = -(% eps)^(-1)</VERB>.</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>cs</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: (column) vector of upper-bounds. (Same remarks as above).</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>mi</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: number of equality constraints (i.e. <VERB>C(1:mi,:)*x = b(1:mi)</VERB>)</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+          </PARAM_INDENT>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+    </PARAM_INDENT>
+  </PARAM>
+  <DESCRIPTION>
+    <P>
+    mps2linpro forms Linear programing data compatible with linpro out of
+    MPS data format.</P>
+  </DESCRIPTION>
+  <SEE_ALSO>
+    <SEE_ALSO_ITEM>
+      <LINK>linpro</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>readmps</LINK>
+    </SEE_ALSO_ITEM>
+  </SEE_ALSO>
+</MAN>
diff --git a/scilab/modules/optimization/help/fr/numdiff.xml b/scilab/modules/optimization/help/fr/numdiff.xml
new file mode 100644 (file)
index 0000000..5f903d4
--- /dev/null
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
+<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
+<MAN>
+  <LANGUAGE>eng</LANGUAGE>
+
+  <TITLE>numdiff</TITLE>
+
+  <TYPE>Scilab Function</TYPE>
+
+  <DATE>August 1993</DATE>
+
+  <SHORT_DESCRIPTION name="numdiff">numerical gradient
+  estimation</SHORT_DESCRIPTION>
+
+  <CALLING_SEQUENCE>
+    <CALLING_SEQUENCE_ITEM>g=numdiff(fun,x [,dx])</CALLING_SEQUENCE_ITEM>
+  </CALLING_SEQUENCE>
+
+  <PARAM>
+    <PARAM_INDENT>
+      <PARAM_ITEM>
+        <PARAM_NAME>fun</PARAM_NAME>
+
+        <PARAM_DESCRIPTION>
+          <SP>: an external, Scilab function or list. See below for calling
+          sequence, see also <LINK>external</LINK> for details about external
+          functions.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+
+      <PARAM_ITEM>
+        <PARAM_NAME>x</PARAM_NAME>
+
+        <PARAM_DESCRIPTION>
+          <SP>: vector, the argument of the function <VERB>fun</VERB></SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+
+      <PARAM_ITEM>
+        <PARAM_NAME>dx</PARAM_NAME>
+
+        <PARAM_DESCRIPTION>
+          <SP>: vector, the finite difference step. Default value is
+          <VERB>dx=sqrt(%eps)*(1+1d-3*abs(x))</VERB></SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+
+      <PARAM_ITEM>
+        <PARAM_NAME>g</PARAM_NAME>
+
+        <PARAM_DESCRIPTION>
+          <SP>: vector, the estimated gradient</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+    </PARAM_INDENT>
+  </PARAM>
+
+  <DESCRIPTION>
+    <P>given a function <VERB>fun(x)</VERB> from <VERB>R^n</VERB> to
+    <VERB>R^p</VERB> computes the matrix <VERB>g</VERB> such as</P>
+
+    <VERBATIM>[ d f ] [ i ] g = [ ---- ] ij [ d x ] [ j ]</VERBATIM>
+
+    <P>using finite difference methods.</P>
+
+    <P>Without parameters, the function fun calling sequence is
+    <VERB>y=fun(x)</VERB>, and numdiff can be called as
+    <VERB>g=numdiff(fun,x)</VERB>. Else the function fun calling sequence must
+    be <VERB>y=fun(x,param_1,pararm_2,..,param_q)</VERB>. If parameters
+    <VERB>param_1,param_2,..param_q</VERB> exist then <VERB>numdiff</VERB> can
+    be called as follow
+    <VERB>g=numdiff(list(fun,param_1,param_2,..param_q),x)</VERB>.</P>
+  </DESCRIPTION>
+
+  <EXAMPLE><![CDATA[
+// example 1 (without parameters)
+// myfun is a function from R^2 to R :   (x(1),x(2)) |--> myfun(x) 
+function f=myfun(x)
+f=x(1)*x(1)+x(1)*x(2)
+endfunction
+
+x=[5 8]
+g=numdiff(myfun,x)
+// The exact gradient (i.e derivate belong x(1) :first component and derivate belong x(2): second component) is  
+exact=[2*x(1)+x(2)  x(1)]
+
+
+//example 2 (with parameters)
+// myfun is a function from R to R:  x(1) |--> myfun(x) 
+// myfun contains 3 parameters, a, b, c
+function  f=myfun(x,a,b,c)
+f=(x+a)^c+b
+endfunction
+
+a=3; b=4; c=2;
+x=1
+g2=numdiff(list(myfun,a,b,c),x)
+// The exact gradient, i.e derivate belong x(1), is :
+exact2=c*(x+a)^(c-1)
+  ]]></EXAMPLE>
+
+  <SEE_ALSO>
+    <SEE_ALSO_ITEM>
+      <LINK>optim</LINK>
+    </SEE_ALSO_ITEM>
+
+    <SEE_ALSO_ITEM>
+      <LINK>external</LINK>
+    </SEE_ALSO_ITEM>
+  </SEE_ALSO>
+</MAN>
\ No newline at end of file
diff --git a/scilab/modules/optimization/help/fr/optim.xml b/scilab/modules/optimization/help/fr/optim.xml
new file mode 100644 (file)
index 0000000..71fca82
--- /dev/null
@@ -0,0 +1,373 @@
+<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
+<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
+<MAN>
+  <LANGUAGE>eng</LANGUAGE>
+  <TITLE>optim</TITLE>
+  <TYPE>Scilab Function</TYPE>
+  <DATE>April 1993</DATE>
+  <SHORT_DESCRIPTION name="optim"> non-linear optimization routine</SHORT_DESCRIPTION>
+  <CALLING_SEQUENCE>
+    <CALLING_SEQUENCE_ITEM>[f,xopt]=optim(costf,x0)  </CALLING_SEQUENCE_ITEM>
+    <CALLING_SEQUENCE_ITEM>[f [,xopt [,gradopt [,work]]]]=optim(costf [,&lt;contr&gt;],x0
+      [,algo] [,df0 [,mem]] [,work] [,&lt;stop&gt;] [,&lt;params&gt;] [,imp=iflag])  </CALLING_SEQUENCE_ITEM>
+  </CALLING_SEQUENCE>
+  <PARAM>
+    <PARAM_INDENT>
+      <PARAM_ITEM>
+        <PARAM_NAME>costf</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: external, i.e Scilab function list or string
+           (<VERB>costf</VERB> is the cost function: see below its calling
+           sequence (Scilab or Fortran)). See also external for details about
+           external functions.</SP> 
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>x0</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: real vector (initial value of variable to be minimized).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>f</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: value of optimal cost (<VERB>f=costf(xopt)</VERB>)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>xopt</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: best value of <VERB>x</VERB> found.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>&lt;contr&gt;</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: keyword representing the following sequence of arguments:
+           <VERB>'b',binf,bsup</VERB>  with <VERB>binf</VERB> and 
+           <VERB>bsup</VERB> are real vectors with same dimension as
+           <VERB>x0</VERB>. <VERB>binf</VERB> and <VERB>bsup</VERB> are lower
+           and upper bounds on <VERB>x</VERB>.</SP> 
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>algo</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: Character string used to sprecify the algorithm to use. The
+           possible values are <VERB>'qn'</VERB> for quasi-Newton (default) or
+           <VERB>'gc'</VERB> for conjugate gradient or <VERB>'nd'</VERB> for
+           non-differentiable.  Note that
+           <VERB>'nd'</VERB> does not accept bounds on <VERB>x</VERB>.</SP> 
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>df0</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: real scalar. Guessed decreasing of <VERB>f</VERB> at first
+           iteration. (<VERB>df0=1</VERB> is the default value).</SP> 
+        </PARAM_DESCRIPTION> 
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>mem :  </PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>integer, number of variables used to approximate the  Hessian,
+           (<VERB>algo='gc' or 'nd'</VERB>). Default value is around 6.</SP> 
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>&lt;stop&gt;</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>:  keyword representing the sequence of optional parameters
+           controlling the  convergence of the algorithm. <VERB>'ar',nap [,iter [,epsg
+             [,epsf [,epsx]]]]</VERB></SP> 
+          <PARAM_INDENT>
+            <PARAM_ITEM>
+              <PARAM_NAME>&quot;ar&quot;  </PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: reserved keyword for stopping rule selection defined as
+                 follows:</SP> 
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>nap</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: maximum number of calls to <VERB>costf</VERB> allowed
+                 (default is 100).</SP> 
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>iter</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: maximum number of iterations allowed (default is 100).</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>epsg</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: threshold on gradient norm.</SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>epsf</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: threshold controlling decreasing of <VERB>f</VERB></SP>
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+            <PARAM_ITEM>
+              <PARAM_NAME>epsx</PARAM_NAME>
+              <PARAM_DESCRIPTION>
+                <SP>: threshold controlling variation of <VERB>x</VERB>. This
+                 vector (possibly matrix) of same size as <VERB>x0</VERB> can
+                 be used to scale <VERB>x</VERB>.</SP> 
+              </PARAM_DESCRIPTION>
+            </PARAM_ITEM>
+          </PARAM_INDENT>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>&lt;params&gt; </PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: keyword representing the sequence of arguments: <VERB>'ti',
+             valti ,'td', valtd</VERB> which can be used to pass argument to
+           an external written in C or Fortran (see below).</SP> 
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>&quot;imp=iflag&quot;  </PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: named argument used to set the trace mode. <VERB>iflag=0</VERB>
+           nothing (execpt errors) is reported, <VERB>iflag=1</VERB> initial
+           and final reports, <VERB>iflag=2</VERB> adds a report per
+           iteration, <VERB>iflag&gt;2</VERB> add reports on linear
+           search. Warning, most of these reports are written on the Scilab
+           standard output.</SP> 
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>gradopt</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>:  gradient of <VERB>costf</VERB> at <VERB>xopt</VERB></SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>work</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: working array for hot restart for quasi-Newton method. This
+           array is automatically initialized by <VERB>optim</VERB> when
+           <VERB>optim</VERB> is invoked. It can be used as input parameter to
+           speed-up the calculations.</SP> 
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+    </PARAM_INDENT>
+  </PARAM>
+  <DESCRIPTION>
+    <SP>
+      Non-linear optimization routine for programs without constraints or with
+      bound constraints:</SP> 
+    <VERBATIM>
+      <![CDATA[
+      min costf(x) w.r.t x.
+      ]]>
+    </VERBATIM>
+    <P><VERB>costf</VERB> is an &quot;external&quot; i.e a Scilab function, a
+      list or a string giving the name of a C or Fortran routine (see
+      &quot;external&quot;).
+      
+      This external must return the value <VERB>f</VERB> of the cost function
+      at the point <VERB>x</VERB> and the gradient <VERB>g</VERB> of the cost
+      function at the point <VERB>x</VERB>. 
+    </P>
+    <DESCRIPTION_INDENT>
+      <DESCRIPTION_ITEM label="- Scilab function case">
+       <P>If <VERB>costf</VERB> is a Scilab function, the calling sequence
+         for <VERB>costf</VERB> must be:
+         <VERB>[f,g,ind]=costf(x,ind)</VERB></P>
+
+       <SP>Here, <VERB>costf</VERB> is a function which returns <VERB>f</VERB>,
+         value (real number) of cost function at <VERB>x</VERB>, and
+         <VERB>g</VERB>, gradient vector of cost function at
+         <VERB>x</VERB>. The variable <VERB>ind</VERB>  is described below.</SP>
+      </DESCRIPTION_ITEM>
+      <DESCRIPTION_ITEM label="- List case">
+       <P>If <VERB>costf</VERB> is a list, it should be of the form:
+         <VERB>list(real_costf, arg1,...,argn)</VERB> with <VERB>real_costf</VERB>
+         a Scilab function with calling sequence :
+         <VERB>[f,g,ind]=costf(x,ind,arg1,... argn)</VERB>. The
+         <VERB>x</VERB>, <VERB>f</VERB>, <VERB>g</VERB>, <VERB>ind</VERB>
+         arguments have the same meaning that above. <VERB>argi</VERB>
+         arguments can be used to pass function parameters.</P>
+      </DESCRIPTION_ITEM>
+      <DESCRIPTION_ITEM label="- String case">
+       <P>If <VERB>costf</VERB> is a character string, it refers to the name
+         of a C or Fortran routine which must be linked to Scilab </P>
+       <DESCRIPTION_INDENT>
+         <DESCRIPTION_ITEM label="* Fortran case">
+           <P>The generic calling sequence for the Fortran subroutine is: 
+             <VERB>subroutine costf(ind,n,x,f,g,ti,tr,td)</VERB> with the
+             following declarations:</P>
+           <VERBATIM>
+             <![CDATA[
+             integer ind,n ti(*)
+             double precision x(n),f,g(n),td(*)
+             real tr(*)
+             ]]>
+           </VERBATIM>
+           <SP>The argument <VERB>ind</VERB> is described below.</SP>
+           <P>The Fortran subroutine <VERB>costf</VERB> must return <VERB>f</VERB>
+             and the vector <VERB>g</VERB>, given <VERB>x, ind, n, ti, tr,td</VERB>.</P>
+           <P> <VERB>ti,tr,td</VERB> can be used to initialize parameters. In
+             the calling sequence of <VERB>optim</VERB>, the keyword
+             <VERB>&lt;params&gt;'</VERB> can be replaced by <VERB>'ti', valti ,'td', valtd</VERB>
+               .  Then, the routine  <VERB>costf</VERB> is
+             evaluated with <VERB>ti=valti</VERB> and 
+             <VERB>td=valtd</VERB> whatever the value of
+             <VERB>ind</VERB>. Thus, the Scilab variables <VERB>valti</VERB>
+             and <VERB>valtd</VERB> (integer vector and real vector) are sent
+             to the routine <VERB>costf</VERB>.</P>  
+         </DESCRIPTION_ITEM>
+         <DESCRIPTION_ITEM label="* C case">
+           <P>The generic calling sequence for the C procedure is: 
+             <VERB>void costf(int *ind, int *n, double *x, double *f, double
+               *g, int *ti, float *tr, double *td)</VERB> with the
+             following declarations:</P>
+
+           <P>The argument <VERB>ind</VERB> is described below.</P>
+           <P>The C procedure <VERB>costf</VERB> must return <VERB>f</VERB>
+             and the vector <VERB>g</VERB>, given <VERB>x, ind, n, ti, tr, td</VERB>.</P>
+               
+           <P> <VERB>ti,tr,td</VERB> can be used to initialize parameters. In
+             the calling sequence of <VERB>optim</VERB>, the string
+             <VERB>'in'</VERB> can be replaced by <VERB>'ti', valti ,'td', valtd</VERB>.  
+             Then, the procedure  <VERB>costf</VERB> is
+             evaluated with <VERB>ti=valti</VERB> and 
+             <VERB>td=valtd</VERB> whatever the value of
+             <VERB>ind</VERB>. Thus, the Scilab variables <VERB>valti</VERB>
+             and <VERB>valtd</VERB> (integer vector and real vector) are sent
+             to the procedure <VERB>costf</VERB>.</P>  
+         </DESCRIPTION_ITEM>
+       </DESCRIPTION_INDENT>
+      </DESCRIPTION_ITEM>
+    </DESCRIPTION_INDENT>
+    <P>If <VERB>ind=2</VERB> (resp. <VERB>3, 4</VERB>), <VERB>costf</VERB>
+      must provide <VERB>f</VERB> (resp. <VERB>g, f</VERB> and
+      <VERB>g</VERB>).</P> 
+    <P>If <VERB>ind=1</VERB> nothing is computed (used for display purposes
+      only).</P> 
+    <P> On output, <VERB>ind&lt;0</VERB>  means that <VERB>f</VERB> cannot
+      be evaluated at <VERB>x</VERB> and <VERB>ind=0</VERB> interrupts
+      the optimization.</P> 
+
+  </DESCRIPTION>
+  <EXAMPLE>
+    <![CDATA[
+    // External function written in Scilab
+    xref=[1;2;3];x0=[1;-1;1]
+    deff('[f,g,ind]=cost(x,ind)','f=0.5*norm(x-xref)^2,g=x-xref');
+    [f,xopt]=optim(cost,x0)      //Simplest call
+    [f,xopt,gopt]=optim(cost,x0,'gc')  // By conjugate gradient
+    [f,xopt,gopt]=optim(cost,x0,'nd')  //Seen as non differentiable
+    [f,xopt,gopt]=optim(cost,'b',[-1;0;2],[0.5;1;4],x0) //  Bounds on x
+    [f,xopt,gopt]=optim(cost,'b',[-1;0;2],[0.5;1;4],x0,'gc') //  Bounds on x
+    [f,xopt,gopt]=optim(cost,'b',[-1;0;2],[0.5;1;4],x0,'gc','ar',3)
+
+    // External function written in C (C compiler required)
+    // write down the C code (Rosenbrock problem)
+    C=['#include <math.h>'
+    'double sq(double x)'
+    '{ return x*x;}'
+    'void rosenc(int *ind, int *n, double *x, double *f, double *g, '
+    '                                int *ti, float *tr, double *td)'
+    '{'
+    '  double p;'
+    '  int i;'
+    '  p=td[0];'
+    '  if (*ind==2||*ind==4) {'
+    '    *f=1.0;'
+    '    for (i=1;i<*n;i++)'
+    '      *f+=p*sq(x[i]-sq(x[i-1]))+sq(1.0-x[i]);'
+    '  }'
+    '  if (*ind==3||*ind==4) {'
+    '    g[0]=-4.0*p*(x[1]-sq(x[0]))*x[0];'
+    '    for (i=1;i<*n-1;i++)'
+    '      g[i]=2.0*p*(x[i]-sq(x[i-1]))-4.0*p*(x[i+1]-sq(x[i]))*x[i]-2.0*(1.0-x[i]);'
+    '    g[*n-1]=2.0*p*(x[*n-1]-sq(x[*n-2]))-2.0*(1.0-x[*n-1]);'
+    '  }'
+    '}'];
+    mputl(C,TMPDIR+'/rosenc.c')
+    // compile the C code
+    l=ilib_for_link('rosenc','rosenc.o',[],'c',TMPDIR+'/Makefile');
+    // incremental linking
+    link(l,'rosenc','c')
+    //solve the problem
+    x0=[40;10;50];
+    p=100;
+    [f,xo,go]=optim('rosenc',x0,'td',p)
+
+    // External function written in Fortran (Fortran compiler required)
+    // write down the Fortran  code (Rosenbrock problem)
+ F=[ '      subroutine rosenf(ind, n, x, f, g, ti, tr, td)'
+     '      integer ind,n,ti(*)'
+     '      double precision x(n),f,g(n),td(*)'
+     '      real tr(*)'
+     'c'
+     '      double precision y,p'
+     '      p=td(1)'
+     '      if (ind.eq.2.or.ind.eq.4) then'
+     '        f=1.0d0'
+     '        do i=2,n'
+     '          f=f+p*(x(i)-x(i-1)**2)**2+(1.0d0-x(i))**2'
+     '        enddo'
+     '      endif'
+     '      if (ind.eq.3.or.ind.eq.4) then'
+     '        g(1)=-4.0d0*p*(x(2)-x(1)**2)*x(1)'
+     '        if(n.gt.2) then'
+     '          do i=2,n-1'
+     '            g(i)=2.0d0*p*(x(i)-x(i-1)**2)-4.0d0*p*(x(i+1)-x(i)**2)*x(i)'
+     '     &           -2.0d0*(1.0d0-x(i))'
+     '          enddo'
+     '        endif'
+     '        g(n)=2.0d0*p*(x(n)-x(n-1)**2)-2.0d0*(1.0d0-x(n))'
+     '      endif'
+     '      return'
+     '      end'];
+
+    mputl(F,TMPDIR+'/rosenf.f')
+    // compile the Fortran code
+    l=ilib_for_link('rosenf','rosenf.o',[],'f',TMPDIR+'/Makefile');
+    // incremental linking
+    link(l,'rosenf','f')
+    //solve the problem
+    x0=[40;10;50];
+    p=100;
+    [f,xo,go]=optim('rosenf',x0,'td',p)
+
+    ]]>
+  </EXAMPLE>
+  <SEE_ALSO>
+    <SEE_ALSO_ITEM>
+      <LINK>external</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>quapro</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>linpro</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>datafit</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>leastsq</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>numdiff</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>derivative</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>NDcost</LINK>
+    </SEE_ALSO_ITEM>
+  </SEE_ALSO>
+</MAN>
diff --git a/scilab/modules/optimization/help/fr/qld.xml b/scilab/modules/optimization/help/fr/qld.xml
new file mode 100644 (file)
index 0000000..0bfa345
--- /dev/null
@@ -0,0 +1,156 @@
+<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
+<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
+<MAN>
+  <LANGUAGE>eng</LANGUAGE>
+  <TITLE>qld</TITLE>
+  <TYPE>Scilab Function</TYPE>
+  <DATE>june 2005</DATE>
+  <SHORT_DESCRIPTION name="qld"> linear quadratic programming solver</SHORT_DESCRIPTION>
+  <CALLING_SEQUENCE>
+    <CALLING_SEQUENCE_ITEM>[x,lagr]=qld(Q,p,C,b,ci,cs,me [,tol])  </CALLING_SEQUENCE_ITEM>
+    <CALLING_SEQUENCE_ITEM>[x,lagr,info]=qld(Q,p,C,b,ci,cs,me [,tol])  </CALLING_SEQUENCE_ITEM>
+  </CALLING_SEQUENCE>
+  <PARAM>
+    <PARAM_INDENT>
+      <PARAM_ITEM>
+        <PARAM_NAME>Q</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: real positive definite symmetric matrix (dimension <VERB>n x n</VERB>).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>p</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: real (column) vector (dimension <VERB> n</VERB>)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>C</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: real matrix (dimension <VERB> (me + md) x n</VERB>) </SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>b</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: RHS column vector (dimension <VERB> (me + md)</VERB>)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>ci</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: column vector of lower-bounds (dimension <VERB>n</VERB>). If
+           there are no lower bound constraints, put <VERB>ci = []</VERB>. If
+           some components of <VERB>x</VERB> are bounded from below, set the
+           other (unconstrained) values of <VERB>ci</VERB> to a very  large
+           negative  number (e.g. <VERB>ci(j) =
+             -number_properties('huge')</VERB>.</SP> 
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>cs</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: column vector of upper-bounds. (Same remarks as above).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>me</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: number of equality constraints (i.e. <VERB>C(1:me,:)*x = b(1:me)</VERB>)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>tol</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>:Floatting point number, required précision.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>x</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: optimal solution found.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+   
+      <PARAM_ITEM>
+        <PARAM_NAME>lagr</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: vector of Lagrange multipliers.  If lower and upper-bounds
+           <VERB>ci,cs</VERB> are provided, <VERB>lagr</VERB> has  <VERB>n +
+             me + md</VERB> components and <VERB>lagr(1:n)</VERB> is the
+           Lagrange  vector associated with the bound constraints and
+           <VERB>lagr (n+1 : n + me + md)</VERB> is the Lagrange vector
+           associated  with the linear constraints. (If an upper-bound
+           (resp. lower-bound) constraint <VERB>i</VERB> is active
+           <VERB>lagr(i)</VERB> is &gt; 0 (resp. &lt;0). If no bounds are
+           provided, <VERB>lagr</VERB> has only <VERB>me + md</VERB>
+           components.</SP> 
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>info</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: integer, return the execution status instead of sending
+         errors.</SP>
+       <P>info==1 : Too many iterations needed</P>
+       <P>info==2 : Accuracy insufficient to statisfy convergence criterion</P>
+       <P>info==5 : Length of working array is too short</P>
+       <P>info==10: The constraints are inconsistent</P>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+    </PARAM_INDENT>
+  </PARAM>
+  <DESCRIPTION>
+    <P>Minimize <VERB> 0.5*x'*Q*x + p'*x</VERB></P>
+    <P>under the constraints</P>
+    <VERBATIM>
+<![CDATA[
+ C(j,:) x = b(j),  j=1,...,me
+ C(j,:) x <= b(j), j=me+1,...,me+md
+ ci <= x <= cs
+   ]]>
+    </VERBATIM>
+    <P>This function requires  <VERB>Q</VERB> to be positive definite, if it is
+      not the case, one may use the <LINK>quapro</LINK> function.</P>
+  </DESCRIPTION>
+  <EXAMPLE>
+<![CDATA[
+//Find x in R^6 such that:
+//C1*x = b1 (3 equality constraints i.e me=3)
+C1= [1,-1,1,0,3,1;
+    -1,0,-3,-4,5,6;
+     2,5,3,0,1,0];
+b1=[1;2;3];
+//C2*x <= b2 (2 inequality constraints)
+C2=[0,1,0,1,2,-1;
+    -1,0,2,1,1,0];
+b2=[-1;2.5];
+//with  x between ci and cs:
+ci=[-1000;-10000;0;-1000;-1000;-1000];cs=[10000;100;1.5;100;100;1000];
+//and minimize 0.5*x'*Q*x + p'*x with
+p=[1;2;3;4;5;6]; Q=eye(6,6);
+//No initial point is given;
+C=[C1;C2] ; //
+b=[b1;b2] ;  //
+me=3;
+[x,lagr]=qld(Q,p,C,b,ci,cs,me)
+//Only linear constraints (1 to 4) are active (lagr(1:6)=0):
+ ]]>
+  </EXAMPLE>
+  <SEE_ALSO>
+    <SEE_ALSO_ITEM>
+      <LINK>quapro</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>optim</LINK>
+    </SEE_ALSO_ITEM>
+  </SEE_ALSO>
+  <AUTHORS>
+    <AUTHORS_ITEM label="K.Schittkowski">, University of Bayreuth, Germany</AUTHORS_ITEM>
+    <AUTHORS_ITEM label=" A.L. Tits and J.L. Zhou"> , University of Maryland</AUTHORS_ITEM>
+  </AUTHORS>
+  <USED_FUNCTIONS>
+    <P>ql0001.f in routines/optim directory</P>
+  </USED_FUNCTIONS>
+
+</MAN>
diff --git a/scilab/modules/optimization/help/fr/quapro.xml b/scilab/modules/optimization/help/fr/quapro.xml
new file mode 100644 (file)
index 0000000..c94a219
--- /dev/null
@@ -0,0 +1,215 @@
+<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
+<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
+<MAN>
+  <LANGUAGE>eng</LANGUAGE>
+  <TITLE>quapro</TITLE>
+  <TYPE>Scilab Function</TYPE>
+  <DATE>April 1993</DATE>
+  <SHORT_DESCRIPTION name="quapro"> linear quadratic programming solver</SHORT_DESCRIPTION>
+  <CALLING_SEQUENCE>
+    <CALLING_SEQUENCE_ITEM>[x,lagr,f]=quapro(Q,p,C,b [,x0])  </CALLING_SEQUENCE_ITEM>
+    <CALLING_SEQUENCE_ITEM>[x,lagr,f]=quapro(Q,p,C,b,ci,cs [,x0])  </CALLING_SEQUENCE_ITEM>
+    <CALLING_SEQUENCE_ITEM>[x,lagr,f]=quapro(Q,p,C,b,ci,cs,me [,x0])  </CALLING_SEQUENCE_ITEM>
+    <CALLING_SEQUENCE_ITEM>[x,lagr,f]=quapro(Q,p,C,b,ci,cs,me,x0 [,imp])  </CALLING_SEQUENCE_ITEM>
+  </CALLING_SEQUENCE>
+  <PARAM>
+    <PARAM_INDENT>
+      <PARAM_ITEM>
+        <PARAM_NAME>Q</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: real symmetric matrix (dimension <VERB>n x n</VERB>).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>p</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: real (column) vector (dimension <VERB> n</VERB>)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>C</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: real matrix (dimension <VERB> (me + md) x n</VERB>) (If no
+           constraints are given, you can set <VERB>C = []</VERB>)</SP> 
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>b</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: RHS column vector (dimension <VERB> (me + md)</VERB>) (If no
+           constraints are given, you can set <VERB>b = []</VERB>)</SP> 
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>ci</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: column vector of lower-bounds (dimension <VERB>n</VERB>). If
+           there are no lower bound constraints, put <VERB>ci = []</VERB>. If
+           some components of <VERB>x</VERB> are bounded from below, set the
+           other (unconstrained) values of <VERB>ci</VERB> to a very  large
+           negative  number (e.g. <VERB>ci(j) =
+             -number_properties('huge')</VERB>.</SP> 
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>cs</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: column vector of upper-bounds. (Same remarks as above).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>me</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: number of equality constraints (i.e. <VERB>C(1:me,:)*x = b(1:me)</VERB>)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>x0</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: either an initial guess for <VERB>x</VERB>    or one of the
+           character strings <VERB>'v'</VERB> or <VERB>'g'</VERB>. If
+           <VERB>x0='v'</VERB> the calculated initial feasible point is a
+           vertex. If <VERB>x0='g'</VERB> the calculated initial feasible
+           point is arbitrary.</SP> 
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>imp</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: verbose option (optional parameter)   (Try
+           <VERB>imp=7,8,...</VERB>). warning the message are output in the
+           window where scilab has been started.</SP> 
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>x</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: optimal solution found.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>f</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: optimal value of the cost function (i.e. <VERB>f=0.5*x'*Q*x+p'</VERB>).</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>lagr</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: vector of Lagrange multipliers.  If lower and upper-bounds
+           <VERB>ci,cs</VERB> are provided, <VERB>lagr</VERB> has  <VERB>n +
+             me + md</VERB> components and <VERB>lagr(1:n)</VERB> is the
+           Lagrange  vector associated with the bound constraints and
+           <VERB>lagr (n+1 : n + me + md)</VERB> is the Lagrange vector
+           associated  with the linear constraints. (If an upper-bound
+           (resp. lower-bound) constraint <VERB>i</VERB> is active
+           <VERB>lagr(i)</VERB> is &gt; 0 (resp. &lt;0). If no bounds are
+           provided, <VERB>lagr</VERB> has only <VERB>me + md</VERB>
+           components.</SP> 
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+    </PARAM_INDENT>
+  </PARAM>
+  <DESCRIPTION>
+    <P>
+    Minimize <VERB>0.5*x'*Q*x + p'*x</VERB></P>
+    <P>
+    under the constraint</P>
+    <VERBATIM>
+<![CDATA[
+C*x <= b
+   ]]>
+    </VERBATIM>
+    <P>
+    Minimize <VERB> 0.5*x'*Q*x + p'*x</VERB></P>
+    <P>
+    under the constraints</P>
+    <VERBATIM>
+<![CDATA[
+C*x <= b          ci <= x <= cs
+   ]]>
+    </VERBATIM>
+    <P>
+    Minimize <VERB> 0.5*x'*Q*x + p'*x</VERB></P>
+    <P>
+    under the constraints</P>
+    <VERBATIM>
+<![CDATA[
+ C(j,:) x = b(j),  j=1,...,me
+ C(j,:) x <= b(j), j=me+1,...,me+md
+ ci <= x <= cs
+   ]]>
+    </VERBATIM>
+    <P>
+    If no initial point is given the
+    program computes a feasible initial point
+    which is a vertex of the region of feasible points if
+    <VERB>x0='v'</VERB>.</P>
+    <P>
+    If <VERB>x0='g'</VERB>, the program computes a feasible initial 
+    point which is not necessarily a vertex. This mode is
+    advisable when the quadratic form is positive
+    definite and there are  few constraints in
+    the problem or when there are large bounds
+    on the variables that are just security bounds and
+    very likely not active at the optimal solution.</P>
+    <P>
+    Note that <VERB>Q</VERB> is not necessarily non-negative, i.e.
+    <VERB>Q</VERB> may have negative eigenvalues.</P>
+  </DESCRIPTION>
+  <EXAMPLE>
+<![CDATA[
+//Find x in R^6 such that:
+//C1*x = b1 (3 equality constraints i.e me=3)
+C1= [1,-1,1,0,3,1;
+    -1,0,-3,-4,5,6;
+     2,5,3,0,1,0];
+b1=[1;2;3];
+//C2*x <= b2 (2 inequality constraints)
+C2=[0,1,0,1,2,-1;
+    -1,0,2,1,1,0];
+b2=[-1;2.5];
+//with  x between ci and cs:
+ci=[-1000;-10000;0;-1000;-1000;-1000];cs=[10000;100;1.5;100;100;1000];
+//and minimize 0.5*x'*Q*x + p'*x with
+p=[1;2;3;4;5;6]; Q=eye(6,6);
+//No initial point is given;
+C=[C1;C2] ; //
+b=[b1;b2] ;  //
+me=3;
+[x,lagr,f]=quapro(Q,p,C,b,ci,cs,me)
+//Only linear constraints (1 to 4) are active (lagr(1:6)=0):
+[x,lagr,f]=quapro(Q,p,C,b,[],[],me)   //Same result as above
+ ]]>
+  </EXAMPLE>
+  <SEE_ALSO>
+    <SEE_ALSO_ITEM>
+      <LINK>qld</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>linpro</LINK>
+    </SEE_ALSO_ITEM>
+    <SEE_ALSO_ITEM>
+      <LINK>optim</LINK>
+    </SEE_ALSO_ITEM>
+  </SEE_ALSO>
+  <AUTHORS>
+    <AUTHORS_ITEM label="Eduardo Casas  Renteria">, Universidad de Cantabria,</AUTHORS_ITEM>
+    <AUTHORS_ITEM label="Cecilia Pola Mendez"> , Universidad de Cantabria</AUTHORS_ITEM>
+  </AUTHORS>
+  <USED_FUNCTIONS>
+    <P>
+in routines/optim directory (authors E.Casas, C. Pola Mendez):</P>
+    <P>
+anfm01.f  anfm03.f  anfm05.f  anrs01.f  auxo01.f  dimp03.f  dnrm0.f   optr03.f  pasr03.f  zthz.f
+anfm02.f  anfm04.f  anfm06.f  anrs02.f  desr03.f  dipvtf.f  optr01.f
+opvf03.f  plcbas.f</P>
+    <P> From BLAS library</P>
+    <P>
+daxpy.f dcopy.f ddot.f dnrm2.f dscal.f dswap.f idamax.f</P>
+    <P> in routines/calelm directory (authors INRIA):</P>
+    <P>
+add.f ddif.f dmmul.f</P>
+    <P> From LAPACK library : dlamch.f</P>
+  </USED_FUNCTIONS>
+</MAN>
diff --git a/scilab/modules/optimization/help/fr/semidef.xml b/scilab/modules/optimization/help/fr/semidef.xml
new file mode 100644 (file)
index 0000000..7dea877
--- /dev/null
@@ -0,0 +1,165 @@
+<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
+<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
+<MAN>
+  <LANGUAGE>eng</LANGUAGE>
+  <TITLE>semidef</TITLE>
+  <TYPE>Scilab Function</TYPE>
+  <DATE>April 1993</DATE>
+  <SHORT_DESCRIPTION name="semidef"> semidefinite programming</SHORT_DESCRIPTION>
+  <CALLING_SEQUENCE>
+    <CALLING_SEQUENCE_ITEM>[x,Z,ul,info]=semidef(x0,Z0,F,blck_szs,c,options)  </CALLING_SEQUENCE_ITEM>
+  </CALLING_SEQUENCE>
+  <PARAM>
+    <PARAM_INDENT>
+      <PARAM_ITEM>
+        <PARAM_NAME>x0</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: m x 1 real column vector (must be strictly primal feasible, see below)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>Z0</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: L x 1 real vector (compressed form of a strictly feasible dual matrix, see below)</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>F</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: L x (m+1) real matrix</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>blck_szs</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>:  p x 2 integer matrix (sizes of the blocks) defining the dimensions  of the (square) diagonal blocks <VERB>size(Fi(j)=blck_szs(j) j=1,...,m+1</VERB>.</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>c</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: m x 1 real vector</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>options</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: row vector with five entries <VERB>[nu,abstol,reltol,0,maxiters]</VERB></SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+      <PARAM_ITEM>
+        <PARAM_NAME>ul</PARAM_NAME>
+        <PARAM_DESCRIPTION>
+          <SP>: row vector with two entries</SP>
+        </PARAM_DESCRIPTION>
+      </PARAM_ITEM>
+    </PARAM_INDENT>
+  </PARAM>
+  <DESCRIPTION>
+    <P><VERB>[x,Z,ul,info]=semidef(x0,Z0,F,blck_szs,c,options)</VERB>
+    solves semidefinite program:</P>
+    <VERBATIM>
+<![CDATA[
+
+    minimize    c'*x
+    subject to  F_0 + x_1*F_1 + ... + x_m*F_m  >= 0
+
+ and its dual
+    maximize    -Tr F_0 Z
+    subject to  Tr F_i Z = c_i, i=1,...,m
+                Z >= 0
+
+   ]]>
+    </VERBATIM>
+    <P>
+    exploiting block structure in the matrices F_i.</P>
+    <P>
+    It interfaces L. Vandenberghe and S. Boyd sp.c program.</P>
+    <P>
+    The <VERB>Fi's</VERB> matrices are stored columnwise in <VERB>F</VERB> in
+    compressed format: if F_i^j, i=0,..,m, j=1,...,L denote the jth 
+    (symmetric) diagonal block of F_i, then</P>
+    <VERBATIM>
+<![CDATA[
+    [ pack(F_0^1)  pack(F_1^1) ...  pack(F_m^1) ]
+    [ pack(F_0^2)  pack(F_1^2) ...  pack(F_m^2) ]
+F=  [   ...       ...          ...              ]
+    [ pack(F_0^L)  pack(F_1^L) ...  pack(F_m^L) ]
+   ]]>
+    </VERBATIM>
+    <P>
+    where <VERB>pack(M)</VERB>, for symmetric <VERB>M</VERB>, is the vector 
+    <VERB>[M(1,1);M(1,2);...;M(1,n);M(2,2);M(2,3);...;M(2,n);...;M(n,n)]</VERB>
+    (obtained by scanning columnwise the lower triangular part of <VERB>M</VERB>).</P>
+    <P><VERB>blck_szs</VERB> gives the size of block <VERB>j</VERB>, ie, 
+    <VERB>size(F_i^j)=blck_szs(j)</VERB>.</P>
+    <P>
+    Z is a block diagonal matrix with L blocks <VERB>Z^0, ..., Z^{L-1}</VERB>.
+    <VERB>Z^j</VERB> has size <VERB>blck_szs[j] times blck_szs[j]</VERB>.
+    Every block is stored using packed storage of the lower triangular part.</P>
+    <P>
+    The 2 vector <VERB>ul</VERB> contains the primal objective value <VERB>c'*x</VERB>
+    and the dual objective value <VERB>-Tr F_0*Z</VERB>.</P>
+    <P>
+    The entries of <VERB>options</VERB> are respectively:
+    <VERB>nu</VERB> = a real parameter which ntrols the rate of convergence.
+    <VERB>abstol</VERB> =   absolute tolerance.
+    <VERB>reltol</VERB> =  relative tolerance (has a special meaning when negative).
+    <VERB>tv</VERB>  target value, only referenced if <VERB>reltol &lt; 0</VERB>.
+    <VERB>iters</VERB> =  on entry: maximum number of iterations &gt;= 0, on exit: 
+    the number of iterations taken.</P>
+    <P><VERB>info</VERB>  returns 1 if maxiters exceeded,  2 if absolute accuracy
+    is reached, 3 if relative accuracy is reached, 4 if target value is
+    reached, 5 if target value is  not achievable;  negative values 
+    indicate errors.</P>
+    <P>
+    Convergence criterion:</P>
+    <VERBATIM>
+<![CDATA[
+ (1) maxiters is exceeded
+ (2) duality gap is less than abstol
+ (3) primal and dual objective are both positive and
+     duality gap is less than (reltol * dual objective)
+     or primal and dual objective are both negative and
+     duality gap is less than (reltol * minus the primal objective)
+ (4) reltol is negative and
+     primal objective is less than tv or dual objective is greater
+     than tv
+   ]]>
+    </VERBATIM>
+  </DESCRIPTION>
+  <EXAMPLE>
+<![CDATA[
+F0=[2,1,0,0;
+    1,2,0,0;
+    0,0,3,1
+    0,0,1,3];
+F1=[1,2,0,0;
+    2,1,0,0;
+    0,0,1,3;
+    0,0,3,1]
+F2=[2,2,0,0;
+    2,2,0,0;
+    0,0,3,4;
+    0,0,4,4];
+blck_szs=[2,2];
+F01=F0(1:2,1:2);F02=F0(3:4,3:4);
+F11=F1(1:2,1:2);F12=F1(3:4,3:4);
+F21=F2(1:2,1:2);F22=F2(3:4,3:4);
+x0=[0;0]
+Z0=2*F0;
+Z01=Z0(1:2,1:2);Z02=Z0(3:4,3:4);
+FF=[[F01(:);F02(:)],[F11(:);F12(:)],[F21(:);F22(:)]]
+ZZ0=[[Z01(:);Z02(:)]];
+c=[trace(F1*Z0);trace(F2*Z0)];
+options=[10,1.d-10,1.d-10,0,50];
+[x,Z,ul,info]=semidef(x0,pack(ZZ0),pack(FF),blck_szs,c,options)
+w=vec2list(unpack(Z,blck_szs),[blck_szs;blck_szs]);Z=sysdiag(w(1),w(2))
+c'*x+trace(F0*Z)
+spec(F0+F1*x(1)+F2*x(2))
+trace(F1*Z)-c(1)
+trace(F2*Z)-c(2)
+ ]]>
+  </EXAMPLE>
+</MAN>
diff --git a/scilab/modules/optimization/help/helpbuilder.sce b/scilab/modules/optimization/help/helpbuilder.sce
new file mode 100644 (file)
index 0000000..9350242
--- /dev/null
@@ -0,0 +1,9 @@
+mode(-1) //force silent execution\r
+\r
+cd 'eng'\r
+exec helpbuildereng.sce\r
+cd '..'\r
+\r
+cd 'fr'\r
+exec helpbuilderfr.sce\r
+cd '..'\r
similarity index 97%
rename from scilab/routines/optim/spd.h
rename to scilab/modules/optimization/includes/spd.h
index 896a59f..6699e05 100644 (file)
@@ -2,7 +2,7 @@
 #ifndef __SPD_H__
 #define __SPD_H__
 
-#include "../machine.h"
+#include "machine.h"
 
 #define SQR(x) ((x)*(x))
 #define MAX(x,y)  ((x) > (y) ? (x) : (y))
diff --git a/scilab/modules/optimization/licence.txt b/scilab/modules/optimization/licence.txt
new file mode 100644 (file)
index 0000000..ca94c89
--- /dev/null
@@ -0,0 +1,3 @@
+licence file\r
+\r
+INRIA 2006
\ No newline at end of file
similarity index 81%
rename from scilab/macros/optim/buildmacros.sce
rename to scilab/modules/optimization/macros/buildmacros.sce
index 240e8f8..961a81f 100644 (file)
@@ -4,5 +4,5 @@
 SCI=getenv('SCI'); 
 TMPDIR=getenv('TMPDIR');
 //------------------------------------
-genlib('optlib','SCI/macros/optim');
+genlib('optlib','SCI/modules/optimization/macros');
 //------------------------------------
diff --git a/scilab/modules/optimization/readme.txt b/scilab/modules/optimization/readme.txt
new file mode 100644 (file)
index 0000000..d8752ca
--- /dev/null
@@ -0,0 +1 @@
+readme.txt about optimization module
\ No newline at end of file
similarity index 99%
rename from scilab/routines/interf/matopt.f
rename to scilab/modules/optimization/sci_gateway/matopt.f
index a4ebf6a..b7bf815 100644 (file)
@@ -1,6 +1,6 @@
       subroutine matopt
 c     Copyright INRIA
-      INCLUDE '../stack.h'
+      INCLUDE 'stack.h'
 c     
       double precision zero,df0,zng,dxmin
       double precision epsg,epsg1,epsf,dzs
@@ -1549,7 +1549,7 @@ c     Scilab fsolve function
 c     ---------------------------
       character*(*) fname
 c      implicit undefined (a-z)
-      include '../stack.h'
+      include 'stack.h'
       integer topk,kres,kjac,kx,m1,n1,lr1,lr,lw,gettype
       logical checklhs,checkrhs,getrmat,getexternal,cremat,jac
       logical type,getscalar
similarity index 78%
rename from scilab/routines/optim/optim.vcproj
rename to scilab/modules/optimization/src/c/optim.vcproj
index d625afc..f66a876 100644 (file)
@@ -40,7 +40,7 @@
                        <Tool\r
                                Name="VCCLCompilerTool"\r
                                Optimization="0"\r
-                               AdditionalIncludeDirectories=""\r
+                               AdditionalIncludeDirectories="../../includes;../../../core/includes;"\r
                                PreprocessorDefinitions="_LIB;STRICT;_DEBUG;_CRT_SECURE_NO_DEPRECATE"\r
                                BasicRuntimeChecks="3"\r
                                RuntimeLibrary="1"\r
@@ -67,7 +67,7 @@
                        />\r
                        <Tool\r
                                Name="VCLibrarianTool"\r
-                               OutputFile="../../libs/optim.lib"\r
+                               OutputFile="../../../../libs/optim.lib"\r
                                SuppressStartupBanner="true"\r
                        />\r
                        <Tool\r