summaryrefslogtreecommitdiff
path: root/modules/optimization/sci_gateway
diff options
context:
space:
mode:
authorShashank2017-05-29 12:40:26 +0530
committerShashank2017-05-29 12:40:26 +0530
commit0345245e860375a32c9a437c4a9d9cae807134e9 (patch)
treead51ecbfa7bcd3cc5f09834f1bb8c08feaa526a4 /modules/optimization/sci_gateway
downloadscilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.tar.gz
scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.tar.bz2
scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.zip
CMSCOPE changed
Diffstat (limited to 'modules/optimization/sci_gateway')
-rwxr-xr-xmodules/optimization/sci_gateway/c/.deps/.dirstamp0
-rwxr-xr-xmodules/optimization/sci_gateway/c/.deps/libscioptimization_la-gw_optimization.Plo275
-rwxr-xr-xmodules/optimization/sci_gateway/c/.deps/libscioptimization_la-sci_fsolv.Plo12
-rwxr-xr-xmodules/optimization/sci_gateway/c/.deps/libscioptimization_la-sci_optim.Plo12
-rwxr-xr-xmodules/optimization/sci_gateway/c/.deps/libscioptimization_la-sci_qld.Plo285
-rwxr-xr-xmodules/optimization/sci_gateway/c/.deps/libscioptimization_la-sci_qp_solve.Plo301
-rwxr-xr-xmodules/optimization/sci_gateway/c/.deps/libscioptimization_la-sci_readmps.Plo12
-rwxr-xr-xmodules/optimization/sci_gateway/c/.deps/libscioptimization_la-sci_semidef.Plo12
-rwxr-xr-xmodules/optimization/sci_gateway/c/.deps/libscioptimization_la-sci_sqrsolve.Plo12
-rwxr-xr-xmodules/optimization/sci_gateway/c/.dirstamp0
-rwxr-xr-xmodules/optimization/sci_gateway/c/.libs/libscioptimization_la-gw_optimization.obin0 -> 6872 bytes
-rwxr-xr-xmodules/optimization/sci_gateway/c/.libs/libscioptimization_la-sci_fsolv.obin0 -> 3592 bytes
-rwxr-xr-xmodules/optimization/sci_gateway/c/.libs/libscioptimization_la-sci_optim.obin0 -> 3592 bytes
-rwxr-xr-xmodules/optimization/sci_gateway/c/.libs/libscioptimization_la-sci_qld.obin0 -> 26136 bytes
-rwxr-xr-xmodules/optimization/sci_gateway/c/.libs/libscioptimization_la-sci_qp_solve.obin0 -> 25696 bytes
-rwxr-xr-xmodules/optimization/sci_gateway/c/.libs/libscioptimization_la-sci_readmps.obin0 -> 3840 bytes
-rwxr-xr-xmodules/optimization/sci_gateway/c/.libs/libscioptimization_la-sci_semidef.obin0 -> 3608 bytes
-rwxr-xr-xmodules/optimization/sci_gateway/c/.libs/libscioptimization_la-sci_sqrsolve.obin0 -> 3624 bytes
-rwxr-xr-xmodules/optimization/sci_gateway/c/gw_optimization.c43
-rwxr-xr-xmodules/optimization/sci_gateway/c/libscioptimization_la-gw_optimization.lo12
-rwxr-xr-xmodules/optimization/sci_gateway/c/libscioptimization_la-sci_fsolv.lo12
-rwxr-xr-xmodules/optimization/sci_gateway/c/libscioptimization_la-sci_optim.lo12
-rwxr-xr-xmodules/optimization/sci_gateway/c/libscioptimization_la-sci_qld.lo12
-rwxr-xr-xmodules/optimization/sci_gateway/c/libscioptimization_la-sci_qp_solve.lo12
-rwxr-xr-xmodules/optimization/sci_gateway/c/libscioptimization_la-sci_readmps.lo12
-rwxr-xr-xmodules/optimization/sci_gateway/c/libscioptimization_la-sci_semidef.lo12
-rwxr-xr-xmodules/optimization/sci_gateway/c/libscioptimization_la-sci_sqrsolve.lo12
-rwxr-xr-xmodules/optimization/sci_gateway/c/sci_fsolv.c40
-rwxr-xr-xmodules/optimization/sci_gateway/c/sci_optim.c43
-rwxr-xr-xmodules/optimization/sci_gateway/c/sci_qld.c417
-rwxr-xr-xmodules/optimization/sci_gateway/c/sci_qp_solve.c391
-rwxr-xr-xmodules/optimization/sci_gateway/c/sci_readmps.c24
-rwxr-xr-xmodules/optimization/sci_gateway/c/sci_semidef.c23
-rwxr-xr-xmodules/optimization/sci_gateway/c/sci_sqrsolve.c32
-rwxr-xr-xmodules/optimization/sci_gateway/fortran/.deps/.dirstamp0
-rwxr-xr-xmodules/optimization/sci_gateway/fortran/.dirstamp0
-rwxr-xr-xmodules/optimization/sci_gateway/fortran/.libs/Ex-fsolve.obin0 -> 5856 bytes
-rwxr-xr-xmodules/optimization/sci_gateway/fortran/.libs/Ex-lsqrsolve.obin0 -> 6008 bytes
-rwxr-xr-xmodules/optimization/sci_gateway/fortran/.libs/Ex-optim.obin0 -> 10168 bytes
-rwxr-xr-xmodules/optimization/sci_gateway/fortran/.libs/bjlsqrsolv.obin0 -> 30056 bytes
-rwxr-xr-xmodules/optimization/sci_gateway/fortran/.libs/bjsolv.obin0 -> 31240 bytes
-rwxr-xr-xmodules/optimization/sci_gateway/fortran/.libs/blsqrsolv.obin0 -> 28416 bytes
-rwxr-xr-xmodules/optimization/sci_gateway/fortran/.libs/boptim.obin0 -> 26832 bytes
-rwxr-xr-xmodules/optimization/sci_gateway/fortran/.libs/bsolv.obin0 -> 28288 bytes
-rwxr-xr-xmodules/optimization/sci_gateway/fortran/.libs/intlsqrsolve.obin0 -> 26840 bytes
-rwxr-xr-xmodules/optimization/sci_gateway/fortran/.libs/sci_f_fsolve.obin0 -> 20488 bytes
-rwxr-xr-xmodules/optimization/sci_gateway/fortran/.libs/sci_f_optim.obin0 -> 87800 bytes
-rwxr-xr-xmodules/optimization/sci_gateway/fortran/.libs/sci_f_semidef.obin0 -> 27104 bytes
-rwxr-xr-xmodules/optimization/sci_gateway/fortran/Ex-fsolve.f70
-rwxr-xr-xmodules/optimization/sci_gateway/fortran/Ex-fsolve.lo12
-rwxr-xr-xmodules/optimization/sci_gateway/fortran/Ex-lsqrsolve.f70
-rwxr-xr-xmodules/optimization/sci_gateway/fortran/Ex-lsqrsolve.lo12
-rwxr-xr-xmodules/optimization/sci_gateway/fortran/Ex-optim.f132
-rwxr-xr-xmodules/optimization/sci_gateway/fortran/Ex-optim.lo12
-rwxr-xr-xmodules/optimization/sci_gateway/fortran/bjlsqrsolv.f162
-rwxr-xr-xmodules/optimization/sci_gateway/fortran/bjlsqrsolv.lo12
-rwxr-xr-xmodules/optimization/sci_gateway/fortran/bjsolv.f159
-rwxr-xr-xmodules/optimization/sci_gateway/fortran/bjsolv.lo12
-rwxr-xr-xmodules/optimization/sci_gateway/fortran/blsqrsolv.f165
-rwxr-xr-xmodules/optimization/sci_gateway/fortran/blsqrsolv.lo12
-rwxr-xr-xmodules/optimization/sci_gateway/fortran/boptim.f146
-rwxr-xr-xmodules/optimization/sci_gateway/fortran/boptim.lo12
-rwxr-xr-xmodules/optimization/sci_gateway/fortran/bsolv.f151
-rwxr-xr-xmodules/optimization/sci_gateway/fortran/bsolv.lo12
-rwxr-xr-xmodules/optimization/sci_gateway/fortran/intlsqrsolve.f221
-rwxr-xr-xmodules/optimization/sci_gateway/fortran/intlsqrsolve.lo12
-rwxr-xr-xmodules/optimization/sci_gateway/fortran/sci_f_fsolve.f141
-rwxr-xr-xmodules/optimization/sci_gateway/fortran/sci_f_fsolve.lo12
-rwxr-xr-xmodules/optimization/sci_gateway/fortran/sci_f_optim.f1061
-rwxr-xr-xmodules/optimization/sci_gateway/fortran/sci_f_optim.lo12
-rwxr-xr-xmodules/optimization/sci_gateway/fortran/sci_f_semidef.f214
-rwxr-xr-xmodules/optimization/sci_gateway/fortran/sci_f_semidef.lo12
-rwxr-xr-xmodules/optimization/sci_gateway/optimization_gateway.xml41
73 files changed, 4907 insertions, 0 deletions
diff --git a/modules/optimization/sci_gateway/c/.deps/.dirstamp b/modules/optimization/sci_gateway/c/.deps/.dirstamp
new file mode 100755
index 000000000..e69de29bb
--- /dev/null
+++ b/modules/optimization/sci_gateway/c/.deps/.dirstamp
diff --git a/modules/optimization/sci_gateway/c/.deps/libscioptimization_la-gw_optimization.Plo b/modules/optimization/sci_gateway/c/.deps/libscioptimization_la-gw_optimization.Plo
new file mode 100755
index 000000000..c0cc6ffe0
--- /dev/null
+++ b/modules/optimization/sci_gateway/c/.deps/libscioptimization_la-gw_optimization.Plo
@@ -0,0 +1,275 @@
+sci_gateway/c/libscioptimization_la-gw_optimization.lo: \
+ sci_gateway/c/gw_optimization.c /usr/include/stdc-predef.h \
+ /usr/include/string.h /usr/include/features.h \
+ /usr/include/x86_64-linux-gnu/sys/cdefs.h \
+ /usr/include/x86_64-linux-gnu/bits/wordsize.h \
+ /usr/include/x86_64-linux-gnu/gnu/stubs.h \
+ /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h /usr/include/xlocale.h \
+ /usr/include/x86_64-linux-gnu/bits/string.h \
+ /usr/include/x86_64-linux-gnu/bits/string2.h /usr/include/endian.h \
+ /usr/include/x86_64-linux-gnu/bits/endian.h \
+ /usr/include/x86_64-linux-gnu/bits/byteswap.h \
+ /usr/include/x86_64-linux-gnu/bits/types.h \
+ /usr/include/x86_64-linux-gnu/bits/typesizes.h \
+ /usr/include/x86_64-linux-gnu/bits/byteswap-16.h /usr/include/stdlib.h \
+ /usr/include/x86_64-linux-gnu/bits/string3.h includes/gw_optimization.h \
+ includes/dynlib_optimization.h \
+ ../../modules/api_scilab/includes/api_scilab.h \
+ ../../modules/core/includes/stack-c.h \
+ ../../modules/core/includes/core_math.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h \
+ /usr/include/limits.h /usr/include/x86_64-linux-gnu/bits/posix1_lim.h \
+ /usr/include/x86_64-linux-gnu/bits/local_lim.h \
+ /usr/include/linux/limits.h \
+ /usr/include/x86_64-linux-gnu/bits/posix2_lim.h /usr/include/math.h \
+ /usr/include/x86_64-linux-gnu/bits/math-vector.h \
+ /usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h \
+ /usr/include/x86_64-linux-gnu/bits/huge_val.h \
+ /usr/include/x86_64-linux-gnu/bits/huge_valf.h \
+ /usr/include/x86_64-linux-gnu/bits/huge_vall.h \
+ /usr/include/x86_64-linux-gnu/bits/inf.h \
+ /usr/include/x86_64-linux-gnu/bits/nan.h \
+ /usr/include/x86_64-linux-gnu/bits/mathdef.h \
+ /usr/include/x86_64-linux-gnu/bits/mathcalls.h \
+ /usr/include/x86_64-linux-gnu/bits/mathinline.h \
+ /usr/include/x86_64-linux-gnu/bits/waitflags.h \
+ /usr/include/x86_64-linux-gnu/bits/waitstatus.h \
+ /usr/include/x86_64-linux-gnu/sys/types.h /usr/include/time.h \
+ /usr/include/x86_64-linux-gnu/sys/select.h \
+ /usr/include/x86_64-linux-gnu/bits/select.h \
+ /usr/include/x86_64-linux-gnu/bits/sigset.h \
+ /usr/include/x86_64-linux-gnu/bits/time.h \
+ /usr/include/x86_64-linux-gnu/bits/select2.h \
+ /usr/include/x86_64-linux-gnu/sys/sysmacros.h \
+ /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h /usr/include/alloca.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib.h \
+ ../../modules/core/includes/stack-def.h \
+ ../../modules/core/includes/machine.h \
+ ../../modules/core/includes/stackTypeVariable.h \
+ ../../modules/core/includes/BOOL.h \
+ ../../modules/core/includes/doublecomplex.h \
+ ../../modules/core/includes/stack1.h \
+ ../../modules/core/includes/scisparse.h \
+ ../../modules/core/includes/stack2.h \
+ ../../modules/core/includes/stack3.h \
+ ../../modules/core/includes/stack-optional.h \
+ ../../modules/core/includes/sci_types.h \
+ ../../modules/api_scilab/includes/api_common.h \
+ ../../modules/api_scilab/includes/api_scilab.h \
+ ../../modules/api_scilab/includes/api_double.h \
+ ../../modules/core/includes/doublecomplex.h \
+ ../../modules/api_scilab/includes/api_string.h /usr/include/wchar.h \
+ /usr/include/stdio.h /usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h \
+ /usr/include/x86_64-linux-gnu/bits/wchar.h \
+ /usr/include/x86_64-linux-gnu/bits/wchar2.h \
+ ../../modules/api_scilab/includes/api_int.h \
+ ../../modules/api_scilab/includes/api_poly.h \
+ ../../modules/api_scilab/includes/api_sparse.h \
+ ../../modules/api_scilab/includes/api_boolean.h \
+ ../../modules/api_scilab/includes/api_boolean_sparse.h \
+ ../../modules/api_scilab/includes/api_pointer.h \
+ ../../modules/api_scilab/includes/api_list.h \
+ ../../modules/api_scilab/includes/api_error.h \
+ ../../modules/api_scilab/includes/api_handle.h \
+ ../../modules/api_scilab/includes/api_optional.h \
+ ../../modules/core/includes/stack-optional.h \
+ ../../modules/api_scilab/includes/api_hypermat.h \
+ ../../modules/core/includes/core_math.h \
+ ../../modules/core/includes/sci_types.h \
+ ../../modules/core/includes/MALLOC.h \
+ ../../modules/core/includes/sci_mem_alloc.h \
+ ../../modules/core/includes/callFunctionFromGateway.h
+
+/usr/include/stdc-predef.h:
+
+/usr/include/string.h:
+
+/usr/include/features.h:
+
+/usr/include/x86_64-linux-gnu/sys/cdefs.h:
+
+/usr/include/x86_64-linux-gnu/bits/wordsize.h:
+
+/usr/include/x86_64-linux-gnu/gnu/stubs.h:
+
+/usr/include/x86_64-linux-gnu/gnu/stubs-64.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h:
+
+/usr/include/xlocale.h:
+
+/usr/include/x86_64-linux-gnu/bits/string.h:
+
+/usr/include/x86_64-linux-gnu/bits/string2.h:
+
+/usr/include/endian.h:
+
+/usr/include/x86_64-linux-gnu/bits/endian.h:
+
+/usr/include/x86_64-linux-gnu/bits/byteswap.h:
+
+/usr/include/x86_64-linux-gnu/bits/types.h:
+
+/usr/include/x86_64-linux-gnu/bits/typesizes.h:
+
+/usr/include/x86_64-linux-gnu/bits/byteswap-16.h:
+
+/usr/include/stdlib.h:
+
+/usr/include/x86_64-linux-gnu/bits/string3.h:
+
+includes/gw_optimization.h:
+
+includes/dynlib_optimization.h:
+
+../../modules/api_scilab/includes/api_scilab.h:
+
+../../modules/core/includes/stack-c.h:
+
+../../modules/core/includes/core_math.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h:
+
+/usr/include/limits.h:
+
+/usr/include/x86_64-linux-gnu/bits/posix1_lim.h:
+
+/usr/include/x86_64-linux-gnu/bits/local_lim.h:
+
+/usr/include/linux/limits.h:
+
+/usr/include/x86_64-linux-gnu/bits/posix2_lim.h:
+
+/usr/include/math.h:
+
+/usr/include/x86_64-linux-gnu/bits/math-vector.h:
+
+/usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h:
+
+/usr/include/x86_64-linux-gnu/bits/huge_val.h:
+
+/usr/include/x86_64-linux-gnu/bits/huge_valf.h:
+
+/usr/include/x86_64-linux-gnu/bits/huge_vall.h:
+
+/usr/include/x86_64-linux-gnu/bits/inf.h:
+
+/usr/include/x86_64-linux-gnu/bits/nan.h:
+
+/usr/include/x86_64-linux-gnu/bits/mathdef.h:
+
+/usr/include/x86_64-linux-gnu/bits/mathcalls.h:
+
+/usr/include/x86_64-linux-gnu/bits/mathinline.h:
+
+/usr/include/x86_64-linux-gnu/bits/waitflags.h:
+
+/usr/include/x86_64-linux-gnu/bits/waitstatus.h:
+
+/usr/include/x86_64-linux-gnu/sys/types.h:
+
+/usr/include/time.h:
+
+/usr/include/x86_64-linux-gnu/sys/select.h:
+
+/usr/include/x86_64-linux-gnu/bits/select.h:
+
+/usr/include/x86_64-linux-gnu/bits/sigset.h:
+
+/usr/include/x86_64-linux-gnu/bits/time.h:
+
+/usr/include/x86_64-linux-gnu/bits/select2.h:
+
+/usr/include/x86_64-linux-gnu/sys/sysmacros.h:
+
+/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h:
+
+/usr/include/alloca.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib-float.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib.h:
+
+../../modules/core/includes/stack-def.h:
+
+../../modules/core/includes/machine.h:
+
+../../modules/core/includes/stackTypeVariable.h:
+
+../../modules/core/includes/BOOL.h:
+
+../../modules/core/includes/doublecomplex.h:
+
+../../modules/core/includes/stack1.h:
+
+../../modules/core/includes/scisparse.h:
+
+../../modules/core/includes/stack2.h:
+
+../../modules/core/includes/stack3.h:
+
+../../modules/core/includes/stack-optional.h:
+
+../../modules/core/includes/sci_types.h:
+
+../../modules/api_scilab/includes/api_common.h:
+
+../../modules/api_scilab/includes/api_scilab.h:
+
+../../modules/api_scilab/includes/api_double.h:
+
+../../modules/core/includes/doublecomplex.h:
+
+../../modules/api_scilab/includes/api_string.h:
+
+/usr/include/wchar.h:
+
+/usr/include/stdio.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h:
+
+/usr/include/x86_64-linux-gnu/bits/wchar.h:
+
+/usr/include/x86_64-linux-gnu/bits/wchar2.h:
+
+../../modules/api_scilab/includes/api_int.h:
+
+../../modules/api_scilab/includes/api_poly.h:
+
+../../modules/api_scilab/includes/api_sparse.h:
+
+../../modules/api_scilab/includes/api_boolean.h:
+
+../../modules/api_scilab/includes/api_boolean_sparse.h:
+
+../../modules/api_scilab/includes/api_pointer.h:
+
+../../modules/api_scilab/includes/api_list.h:
+
+../../modules/api_scilab/includes/api_error.h:
+
+../../modules/api_scilab/includes/api_handle.h:
+
+../../modules/api_scilab/includes/api_optional.h:
+
+../../modules/core/includes/stack-optional.h:
+
+../../modules/api_scilab/includes/api_hypermat.h:
+
+../../modules/core/includes/core_math.h:
+
+../../modules/core/includes/sci_types.h:
+
+../../modules/core/includes/MALLOC.h:
+
+../../modules/core/includes/sci_mem_alloc.h:
+
+../../modules/core/includes/callFunctionFromGateway.h:
diff --git a/modules/optimization/sci_gateway/c/.deps/libscioptimization_la-sci_fsolv.Plo b/modules/optimization/sci_gateway/c/.deps/libscioptimization_la-sci_fsolv.Plo
new file mode 100755
index 000000000..48157a421
--- /dev/null
+++ b/modules/optimization/sci_gateway/c/.deps/libscioptimization_la-sci_fsolv.Plo
@@ -0,0 +1,12 @@
+sci_gateway/c/libscioptimization_la-sci_fsolv.lo: \
+ sci_gateway/c/sci_fsolv.c /usr/include/stdc-predef.h \
+ includes/gw_optimization.h includes/dynlib_optimization.h \
+ ../../modules/core/includes/machine.h
+
+/usr/include/stdc-predef.h:
+
+includes/gw_optimization.h:
+
+includes/dynlib_optimization.h:
+
+../../modules/core/includes/machine.h:
diff --git a/modules/optimization/sci_gateway/c/.deps/libscioptimization_la-sci_optim.Plo b/modules/optimization/sci_gateway/c/.deps/libscioptimization_la-sci_optim.Plo
new file mode 100755
index 000000000..237652376
--- /dev/null
+++ b/modules/optimization/sci_gateway/c/.deps/libscioptimization_la-sci_optim.Plo
@@ -0,0 +1,12 @@
+sci_gateway/c/libscioptimization_la-sci_optim.lo: \
+ sci_gateway/c/sci_optim.c /usr/include/stdc-predef.h \
+ includes/gw_optimization.h includes/dynlib_optimization.h \
+ ../../modules/core/includes/machine.h
+
+/usr/include/stdc-predef.h:
+
+includes/gw_optimization.h:
+
+includes/dynlib_optimization.h:
+
+../../modules/core/includes/machine.h:
diff --git a/modules/optimization/sci_gateway/c/.deps/libscioptimization_la-sci_qld.Plo b/modules/optimization/sci_gateway/c/.deps/libscioptimization_la-sci_qld.Plo
new file mode 100755
index 000000000..683ebd048
--- /dev/null
+++ b/modules/optimization/sci_gateway/c/.deps/libscioptimization_la-sci_qld.Plo
@@ -0,0 +1,285 @@
+sci_gateway/c/libscioptimization_la-sci_qld.lo: sci_gateway/c/sci_qld.c \
+ /usr/include/stdc-predef.h /usr/include/string.h /usr/include/features.h \
+ /usr/include/x86_64-linux-gnu/sys/cdefs.h \
+ /usr/include/x86_64-linux-gnu/bits/wordsize.h \
+ /usr/include/x86_64-linux-gnu/gnu/stubs.h \
+ /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h /usr/include/xlocale.h \
+ /usr/include/x86_64-linux-gnu/bits/string.h \
+ /usr/include/x86_64-linux-gnu/bits/string2.h /usr/include/endian.h \
+ /usr/include/x86_64-linux-gnu/bits/endian.h \
+ /usr/include/x86_64-linux-gnu/bits/byteswap.h \
+ /usr/include/x86_64-linux-gnu/bits/types.h \
+ /usr/include/x86_64-linux-gnu/bits/typesizes.h \
+ /usr/include/x86_64-linux-gnu/bits/byteswap-16.h /usr/include/stdlib.h \
+ /usr/include/x86_64-linux-gnu/bits/string3.h includes/gw_optimization.h \
+ includes/dynlib_optimization.h \
+ ../../modules/api_scilab/includes/api_scilab.h \
+ ../../modules/core/includes/stack-c.h \
+ ../../modules/core/includes/core_math.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h \
+ /usr/include/limits.h /usr/include/x86_64-linux-gnu/bits/posix1_lim.h \
+ /usr/include/x86_64-linux-gnu/bits/local_lim.h \
+ /usr/include/linux/limits.h \
+ /usr/include/x86_64-linux-gnu/bits/posix2_lim.h /usr/include/math.h \
+ /usr/include/x86_64-linux-gnu/bits/math-vector.h \
+ /usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h \
+ /usr/include/x86_64-linux-gnu/bits/huge_val.h \
+ /usr/include/x86_64-linux-gnu/bits/huge_valf.h \
+ /usr/include/x86_64-linux-gnu/bits/huge_vall.h \
+ /usr/include/x86_64-linux-gnu/bits/inf.h \
+ /usr/include/x86_64-linux-gnu/bits/nan.h \
+ /usr/include/x86_64-linux-gnu/bits/mathdef.h \
+ /usr/include/x86_64-linux-gnu/bits/mathcalls.h \
+ /usr/include/x86_64-linux-gnu/bits/mathinline.h \
+ /usr/include/x86_64-linux-gnu/bits/waitflags.h \
+ /usr/include/x86_64-linux-gnu/bits/waitstatus.h \
+ /usr/include/x86_64-linux-gnu/sys/types.h /usr/include/time.h \
+ /usr/include/x86_64-linux-gnu/sys/select.h \
+ /usr/include/x86_64-linux-gnu/bits/select.h \
+ /usr/include/x86_64-linux-gnu/bits/sigset.h \
+ /usr/include/x86_64-linux-gnu/bits/time.h \
+ /usr/include/x86_64-linux-gnu/bits/select2.h \
+ /usr/include/x86_64-linux-gnu/sys/sysmacros.h \
+ /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h /usr/include/alloca.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib.h \
+ ../../modules/core/includes/stack-def.h \
+ ../../modules/core/includes/machine.h \
+ ../../modules/core/includes/stackTypeVariable.h \
+ ../../modules/core/includes/BOOL.h \
+ ../../modules/core/includes/doublecomplex.h \
+ ../../modules/core/includes/stack1.h \
+ ../../modules/core/includes/scisparse.h \
+ ../../modules/core/includes/stack2.h \
+ ../../modules/core/includes/stack3.h \
+ ../../modules/core/includes/stack-optional.h \
+ ../../modules/core/includes/sci_types.h \
+ ../../modules/api_scilab/includes/api_common.h \
+ ../../modules/api_scilab/includes/api_scilab.h \
+ ../../modules/api_scilab/includes/api_double.h \
+ ../../modules/core/includes/doublecomplex.h \
+ ../../modules/api_scilab/includes/api_string.h /usr/include/wchar.h \
+ /usr/include/stdio.h /usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h \
+ /usr/include/x86_64-linux-gnu/bits/wchar.h \
+ /usr/include/x86_64-linux-gnu/bits/wchar2.h \
+ ../../modules/api_scilab/includes/api_int.h \
+ ../../modules/api_scilab/includes/api_poly.h \
+ ../../modules/api_scilab/includes/api_sparse.h \
+ ../../modules/api_scilab/includes/api_boolean.h \
+ ../../modules/api_scilab/includes/api_boolean_sparse.h \
+ ../../modules/api_scilab/includes/api_pointer.h \
+ ../../modules/api_scilab/includes/api_list.h \
+ ../../modules/api_scilab/includes/api_error.h \
+ ../../modules/api_scilab/includes/api_handle.h \
+ ../../modules/api_scilab/includes/api_optional.h \
+ ../../modules/core/includes/stack-optional.h \
+ ../../modules/api_scilab/includes/api_hypermat.h \
+ ../../modules/core/includes/core_math.h \
+ ../../modules/core/includes/sci_types.h \
+ ../../modules/output_stream/includes/Scierror.h \
+ ../../modules/output_stream/includes/do_error_number.h \
+ ../../modules/core/includes/machine.h \
+ ../../modules/localization/includes/localization.h \
+ /usr/include/libintl.h /usr/include/locale.h \
+ /usr/include/x86_64-linux-gnu/bits/locale.h
+
+/usr/include/stdc-predef.h:
+
+/usr/include/string.h:
+
+/usr/include/features.h:
+
+/usr/include/x86_64-linux-gnu/sys/cdefs.h:
+
+/usr/include/x86_64-linux-gnu/bits/wordsize.h:
+
+/usr/include/x86_64-linux-gnu/gnu/stubs.h:
+
+/usr/include/x86_64-linux-gnu/gnu/stubs-64.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h:
+
+/usr/include/xlocale.h:
+
+/usr/include/x86_64-linux-gnu/bits/string.h:
+
+/usr/include/x86_64-linux-gnu/bits/string2.h:
+
+/usr/include/endian.h:
+
+/usr/include/x86_64-linux-gnu/bits/endian.h:
+
+/usr/include/x86_64-linux-gnu/bits/byteswap.h:
+
+/usr/include/x86_64-linux-gnu/bits/types.h:
+
+/usr/include/x86_64-linux-gnu/bits/typesizes.h:
+
+/usr/include/x86_64-linux-gnu/bits/byteswap-16.h:
+
+/usr/include/stdlib.h:
+
+/usr/include/x86_64-linux-gnu/bits/string3.h:
+
+includes/gw_optimization.h:
+
+includes/dynlib_optimization.h:
+
+../../modules/api_scilab/includes/api_scilab.h:
+
+../../modules/core/includes/stack-c.h:
+
+../../modules/core/includes/core_math.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h:
+
+/usr/include/limits.h:
+
+/usr/include/x86_64-linux-gnu/bits/posix1_lim.h:
+
+/usr/include/x86_64-linux-gnu/bits/local_lim.h:
+
+/usr/include/linux/limits.h:
+
+/usr/include/x86_64-linux-gnu/bits/posix2_lim.h:
+
+/usr/include/math.h:
+
+/usr/include/x86_64-linux-gnu/bits/math-vector.h:
+
+/usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h:
+
+/usr/include/x86_64-linux-gnu/bits/huge_val.h:
+
+/usr/include/x86_64-linux-gnu/bits/huge_valf.h:
+
+/usr/include/x86_64-linux-gnu/bits/huge_vall.h:
+
+/usr/include/x86_64-linux-gnu/bits/inf.h:
+
+/usr/include/x86_64-linux-gnu/bits/nan.h:
+
+/usr/include/x86_64-linux-gnu/bits/mathdef.h:
+
+/usr/include/x86_64-linux-gnu/bits/mathcalls.h:
+
+/usr/include/x86_64-linux-gnu/bits/mathinline.h:
+
+/usr/include/x86_64-linux-gnu/bits/waitflags.h:
+
+/usr/include/x86_64-linux-gnu/bits/waitstatus.h:
+
+/usr/include/x86_64-linux-gnu/sys/types.h:
+
+/usr/include/time.h:
+
+/usr/include/x86_64-linux-gnu/sys/select.h:
+
+/usr/include/x86_64-linux-gnu/bits/select.h:
+
+/usr/include/x86_64-linux-gnu/bits/sigset.h:
+
+/usr/include/x86_64-linux-gnu/bits/time.h:
+
+/usr/include/x86_64-linux-gnu/bits/select2.h:
+
+/usr/include/x86_64-linux-gnu/sys/sysmacros.h:
+
+/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h:
+
+/usr/include/alloca.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib-float.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib.h:
+
+../../modules/core/includes/stack-def.h:
+
+../../modules/core/includes/machine.h:
+
+../../modules/core/includes/stackTypeVariable.h:
+
+../../modules/core/includes/BOOL.h:
+
+../../modules/core/includes/doublecomplex.h:
+
+../../modules/core/includes/stack1.h:
+
+../../modules/core/includes/scisparse.h:
+
+../../modules/core/includes/stack2.h:
+
+../../modules/core/includes/stack3.h:
+
+../../modules/core/includes/stack-optional.h:
+
+../../modules/core/includes/sci_types.h:
+
+../../modules/api_scilab/includes/api_common.h:
+
+../../modules/api_scilab/includes/api_scilab.h:
+
+../../modules/api_scilab/includes/api_double.h:
+
+../../modules/core/includes/doublecomplex.h:
+
+../../modules/api_scilab/includes/api_string.h:
+
+/usr/include/wchar.h:
+
+/usr/include/stdio.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h:
+
+/usr/include/x86_64-linux-gnu/bits/wchar.h:
+
+/usr/include/x86_64-linux-gnu/bits/wchar2.h:
+
+../../modules/api_scilab/includes/api_int.h:
+
+../../modules/api_scilab/includes/api_poly.h:
+
+../../modules/api_scilab/includes/api_sparse.h:
+
+../../modules/api_scilab/includes/api_boolean.h:
+
+../../modules/api_scilab/includes/api_boolean_sparse.h:
+
+../../modules/api_scilab/includes/api_pointer.h:
+
+../../modules/api_scilab/includes/api_list.h:
+
+../../modules/api_scilab/includes/api_error.h:
+
+../../modules/api_scilab/includes/api_handle.h:
+
+../../modules/api_scilab/includes/api_optional.h:
+
+../../modules/core/includes/stack-optional.h:
+
+../../modules/api_scilab/includes/api_hypermat.h:
+
+../../modules/core/includes/core_math.h:
+
+../../modules/core/includes/sci_types.h:
+
+../../modules/output_stream/includes/Scierror.h:
+
+../../modules/output_stream/includes/do_error_number.h:
+
+../../modules/core/includes/machine.h:
+
+../../modules/localization/includes/localization.h:
+
+/usr/include/libintl.h:
+
+/usr/include/locale.h:
+
+/usr/include/x86_64-linux-gnu/bits/locale.h:
diff --git a/modules/optimization/sci_gateway/c/.deps/libscioptimization_la-sci_qp_solve.Plo b/modules/optimization/sci_gateway/c/.deps/libscioptimization_la-sci_qp_solve.Plo
new file mode 100755
index 000000000..5add2dca4
--- /dev/null
+++ b/modules/optimization/sci_gateway/c/.deps/libscioptimization_la-sci_qp_solve.Plo
@@ -0,0 +1,301 @@
+sci_gateway/c/libscioptimization_la-sci_qp_solve.lo: \
+ sci_gateway/c/sci_qp_solve.c /usr/include/stdc-predef.h \
+ /usr/include/string.h /usr/include/features.h \
+ /usr/include/x86_64-linux-gnu/sys/cdefs.h \
+ /usr/include/x86_64-linux-gnu/bits/wordsize.h \
+ /usr/include/x86_64-linux-gnu/gnu/stubs.h \
+ /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h /usr/include/xlocale.h \
+ /usr/include/x86_64-linux-gnu/bits/string.h \
+ /usr/include/x86_64-linux-gnu/bits/string2.h /usr/include/endian.h \
+ /usr/include/x86_64-linux-gnu/bits/endian.h \
+ /usr/include/x86_64-linux-gnu/bits/byteswap.h \
+ /usr/include/x86_64-linux-gnu/bits/types.h \
+ /usr/include/x86_64-linux-gnu/bits/typesizes.h \
+ /usr/include/x86_64-linux-gnu/bits/byteswap-16.h /usr/include/stdlib.h \
+ /usr/include/x86_64-linux-gnu/bits/string3.h includes/gw_optimization.h \
+ includes/dynlib_optimization.h \
+ ../../modules/api_scilab/includes/api_scilab.h \
+ ../../modules/core/includes/stack-c.h \
+ ../../modules/core/includes/core_math.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h \
+ /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h \
+ /usr/include/limits.h /usr/include/x86_64-linux-gnu/bits/posix1_lim.h \
+ /usr/include/x86_64-linux-gnu/bits/local_lim.h \
+ /usr/include/linux/limits.h \
+ /usr/include/x86_64-linux-gnu/bits/posix2_lim.h /usr/include/math.h \
+ /usr/include/x86_64-linux-gnu/bits/math-vector.h \
+ /usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h \
+ /usr/include/x86_64-linux-gnu/bits/huge_val.h \
+ /usr/include/x86_64-linux-gnu/bits/huge_valf.h \
+ /usr/include/x86_64-linux-gnu/bits/huge_vall.h \
+ /usr/include/x86_64-linux-gnu/bits/inf.h \
+ /usr/include/x86_64-linux-gnu/bits/nan.h \
+ /usr/include/x86_64-linux-gnu/bits/mathdef.h \
+ /usr/include/x86_64-linux-gnu/bits/mathcalls.h \
+ /usr/include/x86_64-linux-gnu/bits/mathinline.h \
+ /usr/include/x86_64-linux-gnu/bits/waitflags.h \
+ /usr/include/x86_64-linux-gnu/bits/waitstatus.h \
+ /usr/include/x86_64-linux-gnu/sys/types.h /usr/include/time.h \
+ /usr/include/x86_64-linux-gnu/sys/select.h \
+ /usr/include/x86_64-linux-gnu/bits/select.h \
+ /usr/include/x86_64-linux-gnu/bits/sigset.h \
+ /usr/include/x86_64-linux-gnu/bits/time.h \
+ /usr/include/x86_64-linux-gnu/bits/select2.h \
+ /usr/include/x86_64-linux-gnu/sys/sysmacros.h \
+ /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h /usr/include/alloca.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \
+ /usr/include/x86_64-linux-gnu/bits/stdlib.h \
+ ../../modules/core/includes/stack-def.h \
+ ../../modules/core/includes/machine.h \
+ ../../modules/core/includes/stackTypeVariable.h \
+ ../../modules/core/includes/BOOL.h \
+ ../../modules/core/includes/doublecomplex.h \
+ ../../modules/core/includes/stack1.h \
+ ../../modules/core/includes/scisparse.h \
+ ../../modules/core/includes/stack2.h \
+ ../../modules/core/includes/stack3.h \
+ ../../modules/core/includes/stack-optional.h \
+ ../../modules/core/includes/sci_types.h \
+ ../../modules/api_scilab/includes/api_common.h \
+ ../../modules/api_scilab/includes/api_scilab.h \
+ ../../modules/api_scilab/includes/api_double.h \
+ ../../modules/core/includes/doublecomplex.h \
+ ../../modules/api_scilab/includes/api_string.h /usr/include/wchar.h \
+ /usr/include/stdio.h /usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h \
+ /usr/include/x86_64-linux-gnu/bits/wchar.h \
+ /usr/include/x86_64-linux-gnu/bits/wchar2.h \
+ ../../modules/api_scilab/includes/api_int.h \
+ ../../modules/api_scilab/includes/api_poly.h \
+ ../../modules/api_scilab/includes/api_sparse.h \
+ ../../modules/api_scilab/includes/api_boolean.h \
+ ../../modules/api_scilab/includes/api_boolean_sparse.h \
+ ../../modules/api_scilab/includes/api_pointer.h \
+ ../../modules/api_scilab/includes/api_list.h \
+ ../../modules/api_scilab/includes/api_error.h \
+ ../../modules/api_scilab/includes/api_handle.h \
+ ../../modules/api_scilab/includes/api_optional.h \
+ ../../modules/core/includes/stack-optional.h \
+ ../../modules/api_scilab/includes/api_hypermat.h \
+ ../../modules/core/includes/core_math.h \
+ ../../modules/core/includes/sci_types.h \
+ ../../modules/core/includes/MALLOC.h \
+ ../../modules/core/includes/sci_mem_alloc.h \
+ ../../modules/output_stream/includes/Scierror.h \
+ ../../modules/output_stream/includes/do_error_number.h \
+ ../../modules/core/includes/machine.h \
+ ../../modules/output_stream/includes/sciprint.h \
+ ../../modules/core/includes/BOOL.h \
+ ../../modules/core/includes/warningmode.h \
+ ../../modules/localization/includes/localization.h \
+ /usr/include/libintl.h /usr/include/locale.h \
+ /usr/include/x86_64-linux-gnu/bits/locale.h
+
+/usr/include/stdc-predef.h:
+
+/usr/include/string.h:
+
+/usr/include/features.h:
+
+/usr/include/x86_64-linux-gnu/sys/cdefs.h:
+
+/usr/include/x86_64-linux-gnu/bits/wordsize.h:
+
+/usr/include/x86_64-linux-gnu/gnu/stubs.h:
+
+/usr/include/x86_64-linux-gnu/gnu/stubs-64.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h:
+
+/usr/include/xlocale.h:
+
+/usr/include/x86_64-linux-gnu/bits/string.h:
+
+/usr/include/x86_64-linux-gnu/bits/string2.h:
+
+/usr/include/endian.h:
+
+/usr/include/x86_64-linux-gnu/bits/endian.h:
+
+/usr/include/x86_64-linux-gnu/bits/byteswap.h:
+
+/usr/include/x86_64-linux-gnu/bits/types.h:
+
+/usr/include/x86_64-linux-gnu/bits/typesizes.h:
+
+/usr/include/x86_64-linux-gnu/bits/byteswap-16.h:
+
+/usr/include/stdlib.h:
+
+/usr/include/x86_64-linux-gnu/bits/string3.h:
+
+includes/gw_optimization.h:
+
+includes/dynlib_optimization.h:
+
+../../modules/api_scilab/includes/api_scilab.h:
+
+../../modules/core/includes/stack-c.h:
+
+../../modules/core/includes/core_math.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h:
+
+/usr/include/limits.h:
+
+/usr/include/x86_64-linux-gnu/bits/posix1_lim.h:
+
+/usr/include/x86_64-linux-gnu/bits/local_lim.h:
+
+/usr/include/linux/limits.h:
+
+/usr/include/x86_64-linux-gnu/bits/posix2_lim.h:
+
+/usr/include/math.h:
+
+/usr/include/x86_64-linux-gnu/bits/math-vector.h:
+
+/usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h:
+
+/usr/include/x86_64-linux-gnu/bits/huge_val.h:
+
+/usr/include/x86_64-linux-gnu/bits/huge_valf.h:
+
+/usr/include/x86_64-linux-gnu/bits/huge_vall.h:
+
+/usr/include/x86_64-linux-gnu/bits/inf.h:
+
+/usr/include/x86_64-linux-gnu/bits/nan.h:
+
+/usr/include/x86_64-linux-gnu/bits/mathdef.h:
+
+/usr/include/x86_64-linux-gnu/bits/mathcalls.h:
+
+/usr/include/x86_64-linux-gnu/bits/mathinline.h:
+
+/usr/include/x86_64-linux-gnu/bits/waitflags.h:
+
+/usr/include/x86_64-linux-gnu/bits/waitstatus.h:
+
+/usr/include/x86_64-linux-gnu/sys/types.h:
+
+/usr/include/time.h:
+
+/usr/include/x86_64-linux-gnu/sys/select.h:
+
+/usr/include/x86_64-linux-gnu/bits/select.h:
+
+/usr/include/x86_64-linux-gnu/bits/sigset.h:
+
+/usr/include/x86_64-linux-gnu/bits/time.h:
+
+/usr/include/x86_64-linux-gnu/bits/select2.h:
+
+/usr/include/x86_64-linux-gnu/sys/sysmacros.h:
+
+/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h:
+
+/usr/include/alloca.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib-float.h:
+
+/usr/include/x86_64-linux-gnu/bits/stdlib.h:
+
+../../modules/core/includes/stack-def.h:
+
+../../modules/core/includes/machine.h:
+
+../../modules/core/includes/stackTypeVariable.h:
+
+../../modules/core/includes/BOOL.h:
+
+../../modules/core/includes/doublecomplex.h:
+
+../../modules/core/includes/stack1.h:
+
+../../modules/core/includes/scisparse.h:
+
+../../modules/core/includes/stack2.h:
+
+../../modules/core/includes/stack3.h:
+
+../../modules/core/includes/stack-optional.h:
+
+../../modules/core/includes/sci_types.h:
+
+../../modules/api_scilab/includes/api_common.h:
+
+../../modules/api_scilab/includes/api_scilab.h:
+
+../../modules/api_scilab/includes/api_double.h:
+
+../../modules/core/includes/doublecomplex.h:
+
+../../modules/api_scilab/includes/api_string.h:
+
+/usr/include/wchar.h:
+
+/usr/include/stdio.h:
+
+/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h:
+
+/usr/include/x86_64-linux-gnu/bits/wchar.h:
+
+/usr/include/x86_64-linux-gnu/bits/wchar2.h:
+
+../../modules/api_scilab/includes/api_int.h:
+
+../../modules/api_scilab/includes/api_poly.h:
+
+../../modules/api_scilab/includes/api_sparse.h:
+
+../../modules/api_scilab/includes/api_boolean.h:
+
+../../modules/api_scilab/includes/api_boolean_sparse.h:
+
+../../modules/api_scilab/includes/api_pointer.h:
+
+../../modules/api_scilab/includes/api_list.h:
+
+../../modules/api_scilab/includes/api_error.h:
+
+../../modules/api_scilab/includes/api_handle.h:
+
+../../modules/api_scilab/includes/api_optional.h:
+
+../../modules/core/includes/stack-optional.h:
+
+../../modules/api_scilab/includes/api_hypermat.h:
+
+../../modules/core/includes/core_math.h:
+
+../../modules/core/includes/sci_types.h:
+
+../../modules/core/includes/MALLOC.h:
+
+../../modules/core/includes/sci_mem_alloc.h:
+
+../../modules/output_stream/includes/Scierror.h:
+
+../../modules/output_stream/includes/do_error_number.h:
+
+../../modules/core/includes/machine.h:
+
+../../modules/output_stream/includes/sciprint.h:
+
+../../modules/core/includes/BOOL.h:
+
+../../modules/core/includes/warningmode.h:
+
+../../modules/localization/includes/localization.h:
+
+/usr/include/libintl.h:
+
+/usr/include/locale.h:
+
+/usr/include/x86_64-linux-gnu/bits/locale.h:
diff --git a/modules/optimization/sci_gateway/c/.deps/libscioptimization_la-sci_readmps.Plo b/modules/optimization/sci_gateway/c/.deps/libscioptimization_la-sci_readmps.Plo
new file mode 100755
index 000000000..91a234bbb
--- /dev/null
+++ b/modules/optimization/sci_gateway/c/.deps/libscioptimization_la-sci_readmps.Plo
@@ -0,0 +1,12 @@
+sci_gateway/c/libscioptimization_la-sci_readmps.lo: \
+ sci_gateway/c/sci_readmps.c /usr/include/stdc-predef.h \
+ includes/gw_optimization.h includes/dynlib_optimization.h \
+ ../../modules/core/includes/machine.h
+
+/usr/include/stdc-predef.h:
+
+includes/gw_optimization.h:
+
+includes/dynlib_optimization.h:
+
+../../modules/core/includes/machine.h:
diff --git a/modules/optimization/sci_gateway/c/.deps/libscioptimization_la-sci_semidef.Plo b/modules/optimization/sci_gateway/c/.deps/libscioptimization_la-sci_semidef.Plo
new file mode 100755
index 000000000..582685fd1
--- /dev/null
+++ b/modules/optimization/sci_gateway/c/.deps/libscioptimization_la-sci_semidef.Plo
@@ -0,0 +1,12 @@
+sci_gateway/c/libscioptimization_la-sci_semidef.lo: \
+ sci_gateway/c/sci_semidef.c /usr/include/stdc-predef.h \
+ includes/gw_optimization.h includes/dynlib_optimization.h \
+ ../../modules/core/includes/machine.h
+
+/usr/include/stdc-predef.h:
+
+includes/gw_optimization.h:
+
+includes/dynlib_optimization.h:
+
+../../modules/core/includes/machine.h:
diff --git a/modules/optimization/sci_gateway/c/.deps/libscioptimization_la-sci_sqrsolve.Plo b/modules/optimization/sci_gateway/c/.deps/libscioptimization_la-sci_sqrsolve.Plo
new file mode 100755
index 000000000..0b86d2db9
--- /dev/null
+++ b/modules/optimization/sci_gateway/c/.deps/libscioptimization_la-sci_sqrsolve.Plo
@@ -0,0 +1,12 @@
+sci_gateway/c/libscioptimization_la-sci_sqrsolve.lo: \
+ sci_gateway/c/sci_sqrsolve.c /usr/include/stdc-predef.h \
+ includes/gw_optimization.h includes/dynlib_optimization.h \
+ ../../modules/core/includes/machine.h
+
+/usr/include/stdc-predef.h:
+
+includes/gw_optimization.h:
+
+includes/dynlib_optimization.h:
+
+../../modules/core/includes/machine.h:
diff --git a/modules/optimization/sci_gateway/c/.dirstamp b/modules/optimization/sci_gateway/c/.dirstamp
new file mode 100755
index 000000000..e69de29bb
--- /dev/null
+++ b/modules/optimization/sci_gateway/c/.dirstamp
diff --git a/modules/optimization/sci_gateway/c/.libs/libscioptimization_la-gw_optimization.o b/modules/optimization/sci_gateway/c/.libs/libscioptimization_la-gw_optimization.o
new file mode 100755
index 000000000..56f48f697
--- /dev/null
+++ b/modules/optimization/sci_gateway/c/.libs/libscioptimization_la-gw_optimization.o
Binary files differ
diff --git a/modules/optimization/sci_gateway/c/.libs/libscioptimization_la-sci_fsolv.o b/modules/optimization/sci_gateway/c/.libs/libscioptimization_la-sci_fsolv.o
new file mode 100755
index 000000000..e162542a9
--- /dev/null
+++ b/modules/optimization/sci_gateway/c/.libs/libscioptimization_la-sci_fsolv.o
Binary files differ
diff --git a/modules/optimization/sci_gateway/c/.libs/libscioptimization_la-sci_optim.o b/modules/optimization/sci_gateway/c/.libs/libscioptimization_la-sci_optim.o
new file mode 100755
index 000000000..53dce0c2a
--- /dev/null
+++ b/modules/optimization/sci_gateway/c/.libs/libscioptimization_la-sci_optim.o
Binary files differ
diff --git a/modules/optimization/sci_gateway/c/.libs/libscioptimization_la-sci_qld.o b/modules/optimization/sci_gateway/c/.libs/libscioptimization_la-sci_qld.o
new file mode 100755
index 000000000..5f1b0a36a
--- /dev/null
+++ b/modules/optimization/sci_gateway/c/.libs/libscioptimization_la-sci_qld.o
Binary files differ
diff --git a/modules/optimization/sci_gateway/c/.libs/libscioptimization_la-sci_qp_solve.o b/modules/optimization/sci_gateway/c/.libs/libscioptimization_la-sci_qp_solve.o
new file mode 100755
index 000000000..5c254346c
--- /dev/null
+++ b/modules/optimization/sci_gateway/c/.libs/libscioptimization_la-sci_qp_solve.o
Binary files differ
diff --git a/modules/optimization/sci_gateway/c/.libs/libscioptimization_la-sci_readmps.o b/modules/optimization/sci_gateway/c/.libs/libscioptimization_la-sci_readmps.o
new file mode 100755
index 000000000..2b519d5f9
--- /dev/null
+++ b/modules/optimization/sci_gateway/c/.libs/libscioptimization_la-sci_readmps.o
Binary files differ
diff --git a/modules/optimization/sci_gateway/c/.libs/libscioptimization_la-sci_semidef.o b/modules/optimization/sci_gateway/c/.libs/libscioptimization_la-sci_semidef.o
new file mode 100755
index 000000000..faf15bb08
--- /dev/null
+++ b/modules/optimization/sci_gateway/c/.libs/libscioptimization_la-sci_semidef.o
Binary files differ
diff --git a/modules/optimization/sci_gateway/c/.libs/libscioptimization_la-sci_sqrsolve.o b/modules/optimization/sci_gateway/c/.libs/libscioptimization_la-sci_sqrsolve.o
new file mode 100755
index 000000000..2fddb0ed3
--- /dev/null
+++ b/modules/optimization/sci_gateway/c/.libs/libscioptimization_la-sci_sqrsolve.o
Binary files differ
diff --git a/modules/optimization/sci_gateway/c/gw_optimization.c b/modules/optimization/sci_gateway/c/gw_optimization.c
new file mode 100755
index 000000000..1965b6c32
--- /dev/null
+++ b/modules/optimization/sci_gateway/c/gw_optimization.c
@@ -0,0 +1,43 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2006 - INRIA - Allan CORNET
+ *
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+ *
+ */
+/*--------------------------------------------------------------------------*/
+#include <string.h>
+#include "gw_optimization.h"
+#include "api_scilab.h"
+#include "MALLOC.h"
+#include "callFunctionFromGateway.h"
+/*--------------------------------------------------------------------------*/
+static gw_generic_table Tab[] =
+{
+ {sci_optim, "optim"},
+ {sci_semidef, "semidef"},
+ {sci_fsolve, "fsolve"},
+ {sci_sqrsolve, "sqrsolve"},
+ {sci_qld, "qld"},
+ {sci_qp_solve, "qp_solve"},
+ {sci_readmps, "readmps"}
+};
+/*--------------------------------------------------------------------------*/
+int gw_optimization(void)
+{
+ Rhs = Max(0, Rhs);
+
+ if (pvApiCtx == NULL)
+ {
+ pvApiCtx = (StrCtx*)MALLOC(sizeof(StrCtx));
+ }
+
+ pvApiCtx->pstName = (char*)Tab[Fin - 1].name;
+ callFunctionFromGateway(Tab, SIZE_CURRENT_GENERIC_TABLE(Tab));
+ return 0;
+}
+/*--------------------------------------------------------------------------*/
diff --git a/modules/optimization/sci_gateway/c/libscioptimization_la-gw_optimization.lo b/modules/optimization/sci_gateway/c/libscioptimization_la-gw_optimization.lo
new file mode 100755
index 000000000..2d2ba7635
--- /dev/null
+++ b/modules/optimization/sci_gateway/c/libscioptimization_la-gw_optimization.lo
@@ -0,0 +1,12 @@
+# sci_gateway/c/libscioptimization_la-gw_optimization.lo - a libtool object file
+# Generated by libtool (GNU libtool) 2.4.2
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/libscioptimization_la-gw_optimization.o'
+
+# Name of the non-PIC object
+non_pic_object=none
+
diff --git a/modules/optimization/sci_gateway/c/libscioptimization_la-sci_fsolv.lo b/modules/optimization/sci_gateway/c/libscioptimization_la-sci_fsolv.lo
new file mode 100755
index 000000000..cc2b2ad32
--- /dev/null
+++ b/modules/optimization/sci_gateway/c/libscioptimization_la-sci_fsolv.lo
@@ -0,0 +1,12 @@
+# sci_gateway/c/libscioptimization_la-sci_fsolv.lo - a libtool object file
+# Generated by libtool (GNU libtool) 2.4.2
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/libscioptimization_la-sci_fsolv.o'
+
+# Name of the non-PIC object
+non_pic_object=none
+
diff --git a/modules/optimization/sci_gateway/c/libscioptimization_la-sci_optim.lo b/modules/optimization/sci_gateway/c/libscioptimization_la-sci_optim.lo
new file mode 100755
index 000000000..e767f946e
--- /dev/null
+++ b/modules/optimization/sci_gateway/c/libscioptimization_la-sci_optim.lo
@@ -0,0 +1,12 @@
+# sci_gateway/c/libscioptimization_la-sci_optim.lo - a libtool object file
+# Generated by libtool (GNU libtool) 2.4.2
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/libscioptimization_la-sci_optim.o'
+
+# Name of the non-PIC object
+non_pic_object=none
+
diff --git a/modules/optimization/sci_gateway/c/libscioptimization_la-sci_qld.lo b/modules/optimization/sci_gateway/c/libscioptimization_la-sci_qld.lo
new file mode 100755
index 000000000..3b3996996
--- /dev/null
+++ b/modules/optimization/sci_gateway/c/libscioptimization_la-sci_qld.lo
@@ -0,0 +1,12 @@
+# sci_gateway/c/libscioptimization_la-sci_qld.lo - a libtool object file
+# Generated by libtool (GNU libtool) 2.4.2
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/libscioptimization_la-sci_qld.o'
+
+# Name of the non-PIC object
+non_pic_object=none
+
diff --git a/modules/optimization/sci_gateway/c/libscioptimization_la-sci_qp_solve.lo b/modules/optimization/sci_gateway/c/libscioptimization_la-sci_qp_solve.lo
new file mode 100755
index 000000000..e7e34c486
--- /dev/null
+++ b/modules/optimization/sci_gateway/c/libscioptimization_la-sci_qp_solve.lo
@@ -0,0 +1,12 @@
+# sci_gateway/c/libscioptimization_la-sci_qp_solve.lo - a libtool object file
+# Generated by libtool (GNU libtool) 2.4.2
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/libscioptimization_la-sci_qp_solve.o'
+
+# Name of the non-PIC object
+non_pic_object=none
+
diff --git a/modules/optimization/sci_gateway/c/libscioptimization_la-sci_readmps.lo b/modules/optimization/sci_gateway/c/libscioptimization_la-sci_readmps.lo
new file mode 100755
index 000000000..c235553ec
--- /dev/null
+++ b/modules/optimization/sci_gateway/c/libscioptimization_la-sci_readmps.lo
@@ -0,0 +1,12 @@
+# sci_gateway/c/libscioptimization_la-sci_readmps.lo - a libtool object file
+# Generated by libtool (GNU libtool) 2.4.2
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/libscioptimization_la-sci_readmps.o'
+
+# Name of the non-PIC object
+non_pic_object=none
+
diff --git a/modules/optimization/sci_gateway/c/libscioptimization_la-sci_semidef.lo b/modules/optimization/sci_gateway/c/libscioptimization_la-sci_semidef.lo
new file mode 100755
index 000000000..fea0477cb
--- /dev/null
+++ b/modules/optimization/sci_gateway/c/libscioptimization_la-sci_semidef.lo
@@ -0,0 +1,12 @@
+# sci_gateway/c/libscioptimization_la-sci_semidef.lo - a libtool object file
+# Generated by libtool (GNU libtool) 2.4.2
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/libscioptimization_la-sci_semidef.o'
+
+# Name of the non-PIC object
+non_pic_object=none
+
diff --git a/modules/optimization/sci_gateway/c/libscioptimization_la-sci_sqrsolve.lo b/modules/optimization/sci_gateway/c/libscioptimization_la-sci_sqrsolve.lo
new file mode 100755
index 000000000..9b36e8574
--- /dev/null
+++ b/modules/optimization/sci_gateway/c/libscioptimization_la-sci_sqrsolve.lo
@@ -0,0 +1,12 @@
+# sci_gateway/c/libscioptimization_la-sci_sqrsolve.lo - a libtool object file
+# Generated by libtool (GNU libtool) 2.4.2
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/libscioptimization_la-sci_sqrsolve.o'
+
+# Name of the non-PIC object
+non_pic_object=none
+
diff --git a/modules/optimization/sci_gateway/c/sci_fsolv.c b/modules/optimization/sci_gateway/c/sci_fsolv.c
new file mode 100755
index 000000000..d94467564
--- /dev/null
+++ b/modules/optimization/sci_gateway/c/sci_fsolv.c
@@ -0,0 +1,40 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2006 - INRIA - Allan CORNET
+ *
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+ *
+ */
+/*--------------------------------------------------------------------------*/
+#include "gw_optimization.h"
+#include "machine.h"
+/*--------------------------------------------------------------------------*/
+#ifdef _MSC_VER
+/* bug 3161 (F2C)*/
+/* common need to be defined and exported from C */
+__declspec (dllexport) struct
+{
+ char namef[25], namej[25];
+} C2F(csolve);
+
+__declspec (dllexport) struct
+{
+ double t0, tf, dti, dtf, ermx;
+ int iu[5], nuc, nuv, ilin, nti, ntf, ny, nea, itmx, nex, nob, ntob,
+ ntobi, nitu, ndtu;
+} C2F(icsez);
+
+#endif
+/*--------------------------------------------------------------------------*/
+extern int C2F(scisolv)(); /* FORTRAN subroutine */
+/*--------------------------------------------------------------------------*/
+int sci_fsolve(char *fname, unsigned long fname_len)
+{
+ C2F(scisolv)(fname, fname_len);
+ return 0;
+}
+/*--------------------------------------------------------------------------*/
diff --git a/modules/optimization/sci_gateway/c/sci_optim.c b/modules/optimization/sci_gateway/c/sci_optim.c
new file mode 100755
index 000000000..608f7dabe
--- /dev/null
+++ b/modules/optimization/sci_gateway/c/sci_optim.c
@@ -0,0 +1,43 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2006 - INRIA - Allan CORNET
+ *
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+ *
+ */
+/*--------------------------------------------------------------------------*/
+#include "gw_optimization.h"
+#include "machine.h"
+/*--------------------------------------------------------------------------*/
+#ifdef _MSC_VER
+/* bug 3161 (F2C)*/
+/* common need to be defined and exported from C */
+__declspec (dllexport) struct
+{
+ char nomsub[80];
+} C2F(optim);
+
+__declspec (dllexport) struct
+{
+ int nizs, nrzs, ndzs;
+} C2F(nird);
+
+__declspec (dllexport) struct
+{
+ double u1;
+ int nc;
+} C2F(fprf2c);
+#endif
+/*--------------------------------------------------------------------------*/
+extern int C2F(scioptim)(); /* FORTRAN subroutine */
+/*--------------------------------------------------------------------------*/
+int sci_optim(char *fname, unsigned long fname_len)
+{
+ C2F(scioptim)(fname, fname_len);
+ return 0;
+}
+/*--------------------------------------------------------------------------*/
diff --git a/modules/optimization/sci_gateway/c/sci_qld.c b/modules/optimization/sci_gateway/c/sci_qld.c
new file mode 100755
index 000000000..2e4f7206c
--- /dev/null
+++ b/modules/optimization/sci_gateway/c/sci_qld.c
@@ -0,0 +1,417 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2006 - INRIA - Allan CORNET
+ *
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+ *
+ */
+/*--------------------------------------------------------------------------*/
+#include <string.h>
+#include "gw_optimization.h"
+#include "api_scilab.h"
+#include "Scierror.h"
+#include "localization.h"
+/*--------------------------------------------------------------------------*/
+/* fortran subroutines */
+extern double C2F(dlamch) (char *CMACH, unsigned long int);
+extern int C2F(ql0001)(int *m, int *me, int *mmax, int *n, int *nmax, int *mnn,
+ double *c, double *d, double *a, double *b, double *xl,
+ double *xu, double *x, double *u, int *iout, int *ifail,
+ int *iprint, double *war, int *lwar, int *iwar, int *liwar,
+ double *eps1);
+/*--------------------------------------------------------------------------*/
+int sci_qld(char *fname, unsigned long fname_len)
+{
+ SciErr sciErr;
+ static int un = 1, zero = 0;
+ static int n = 0, nbis = 0;
+ static int unbis = 0;
+ static int mmax = 0, m = 0, mnn = 0;
+ static int mbis = 0;
+ static int pipo = 0;
+ static int ifail = 0;
+ int next = 0;
+
+ static int lwar = 0, iout = 0, k = 0, l = 0;
+ static double eps1 = 0;
+
+ int* piAddr1 = NULL;
+ int* piAddr2 = NULL;
+ int* piAddr3 = NULL;
+ int* piAddr4 = NULL;
+ int* piAddr5 = NULL;
+ int* piAddr6 = NULL;
+ int* piAddr7 = NULL;
+
+ double* Q = NULL;
+ double* p = NULL;
+ double* C = NULL;
+ double* b = NULL;
+ double* lb = NULL;
+ double* ub = NULL;
+ int* me = NULL;
+
+ double* x = NULL;
+ double* lambda = NULL;
+ int* inform = NULL;
+ double* war = NULL;
+ int* iwar = NULL;
+
+ /* Check rhs and lhs */
+ CheckInputArgument(pvApiCtx, 7, 8) ;
+ CheckOutputArgument(pvApiCtx, 1, 3) ;
+
+ /* RhsVar: qld(Q,p,C,b,lb,ub,me,eps) */
+ /* 1,2,3,4,5 ,6 ,7, 8 */
+ eps1 = C2F(dlamch)("e", 1L);
+ next = nbInputArgument(pvApiCtx) + 1;
+ /* Variable 1 (Q) */
+ //get variable address
+
+ sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr1);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 1;
+ }
+
+ // Retrieve a matrix of double at position 1.
+ sciErr = getMatrixOfDouble(pvApiCtx, piAddr1, &n, &nbis, &Q);
+ if (sciErr.iErr)
+ {
+ Scierror(202, _("%s: Wrong type for argument #%d: A real expected.\n"), fname, 1);
+ printError(&sciErr, 0);
+ return 1;
+ }
+
+ //CheckSquare
+ if (n != nbis)
+ {
+ Scierror(999, _("%s: Wrong size for input argument #%d: A square matrix expected.\n"), fname, 1);
+ return 1;
+ }
+
+
+ /* Variable 2 (p) */
+ //get variable address
+ sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddr2);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 1;
+ }
+
+ // Retrieve a matrix of double at position 2.
+ sciErr = getMatrixOfDouble(pvApiCtx, piAddr2, &nbis, &unbis, &p);
+ if (sciErr.iErr)
+ {
+ Scierror(202, _("%s: Wrong type for argument #%d: A real expected.\n"), fname, 2);
+ printError(&sciErr, 0);
+ return 1;
+ }
+
+ //CheckLength
+ if (nbis * unbis != n)
+ {
+ Scierror(999, _("%s: Wrong size for input argument #%d: %d expected.\n"), fname, 2, nbis * unbis);
+ return 1;
+ }
+
+
+ /* Variable 3 (C) */
+ //get variable address
+ sciErr = getVarAddressFromPosition(pvApiCtx, 3, &piAddr3);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 1;
+ }
+
+ // Retrieve a matrix of double at position 3.
+ sciErr = getMatrixOfDouble(pvApiCtx, piAddr3, &m, &nbis, &C);
+ if (sciErr.iErr)
+ {
+ Scierror(202, _("%s: Wrong type for argument #%d: A real expected.\n"), fname, 3);
+ printError(&sciErr, 0);
+ return 1;
+ }
+
+ if (( nbis != n ) && (m > 0))
+ {
+ Scierror(205, _("%s: Wrong size for input argument #%d: number of columns %d expected.\n"), fname, 3, n);
+ return 0;
+ }
+ mmax = m;
+ mnn = m + n + n;
+
+ /* Variable 4 (b) */
+ //get variable address
+ sciErr = getVarAddressFromPosition(pvApiCtx, 4, &piAddr4);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 1;
+ }
+
+ // Retrieve a matrix of double at position 4.
+ sciErr = getMatrixOfDouble(pvApiCtx, piAddr4, &mbis, &unbis, &b);
+ if (sciErr.iErr)
+ {
+ Scierror(202, _("%s: Wrong type for argument #%d: A real expected.\n"), fname, 4);
+ printError(&sciErr, 0);
+ return 1;
+ }
+
+ //CheckLength
+ if (mbis * unbis != m)
+ {
+ Scierror(999, _("%s: Wrong size for input argument #%d: %d expected.\n"), fname, 4, mbis * unbis);
+ return 1;
+ }
+
+
+ /* Variable 5 (lb) */
+ //get variable address
+ sciErr = getVarAddressFromPosition(pvApiCtx, 5, &piAddr5);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 1;
+ }
+
+ // Retrieve a matrix of double at position 5.
+ sciErr = getMatrixOfDouble(pvApiCtx, piAddr5, &nbis, &unbis, &lb);
+ if (sciErr.iErr)
+ {
+ Scierror(202, _("%s: Wrong type for argument #%d: A real expected.\n"), fname, 5);
+ printError(&sciErr, 0);
+ return 1;
+ }
+
+ if (nbis*unbis == 0)
+ {
+ sciErr = allocMatrixOfDouble(pvApiCtx, next, n, un, &lb);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ Scierror(999, _("%s: Memory allocation error.\n"), fname);
+ return 1;
+ }
+
+ for (k = 0; k < n; k++)
+ {
+ (lb)[k] = -C2F(dlamch)("o", 1L);
+ }
+ next = next + 1;
+ }
+ else if (nbis * unbis != n) //CheckLength
+ {
+ Scierror(999, _("%s: Wrong size for input argument #%d: %d expected.\n"), fname, 5, nbis * unbis);
+ return 1;
+ }
+
+ /* Variable 6 (ub) */
+ //get variable address
+ sciErr = getVarAddressFromPosition(pvApiCtx, 6, &piAddr6);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 1;
+ }
+
+ // Retrieve a matrix of double at position 6.
+ sciErr = getMatrixOfDouble(pvApiCtx, piAddr6, &nbis, &unbis, &ub);
+ if (sciErr.iErr)
+ {
+ Scierror(202, _("%s: Wrong type for argument #%d: A real expected.\n"), fname, 6);
+ printError(&sciErr, 0);
+ return 1;
+ }
+
+ if (nbis*unbis == 0)
+ {
+ sciErr = allocMatrixOfDouble(pvApiCtx, next, n, un, &ub);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ Scierror(999, _("%s: Memory allocation error.\n"), fname);
+ return 1;
+ }
+
+ for (k = 0; k < n; k++)
+ {
+ (ub)[k] = C2F(dlamch)("o", 1L);
+ }
+ next = next + 1;
+ }
+ else if (nbis * unbis != n)//CheckLength
+ {
+ Scierror(999, _("%s: Wrong size for input argument #%d: %d expected.\n"), fname, 6, nbis * unbis);
+ return 1;
+ }
+
+
+ /* Variable 7 (me) */
+ //get variable address
+ sciErr = getVarAddressFromPosition(pvApiCtx, 7, &piAddr7);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 1;
+ }
+
+ // Retrieve a matrix of double at position 7.
+ sciErr = getMatrixOfDoubleAsInteger(pvApiCtx, piAddr7, &pipo, &unbis, &me);
+ if (sciErr.iErr)
+ {
+ Scierror(202, _("%s: Wrong type for argument #%d: A real expected.\n"), fname, 7);
+ printError(&sciErr, 0);
+ return 1;
+ }
+
+ //CheckScalar
+ if (pipo != 1 || unbis != 1)
+ {
+ Scierror(999, _("%s: Wrong size for input argument #%d: A real scalar expected.\n"), fname, 7);
+ return 1;
+ }
+
+ if ((*(me) < 0) || (*(me) > n))
+ {
+ Err = 7;
+ SciError(116);
+ return 0;
+ }
+
+ if (nbInputArgument(pvApiCtx) == 8)
+ {
+ /* Variable 8 (eps1) */
+ //get variable address
+ int* piAddr8 = NULL;
+ double* leps = NULL;
+ sciErr = getVarAddressFromPosition(pvApiCtx, 8, &piAddr8);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 1;
+ }
+
+ // Retrieve a matrix of double at position 8.
+ sciErr = getMatrixOfDouble(pvApiCtx, piAddr8, &pipo, &unbis, &leps);
+ if (sciErr.iErr)
+ {
+ Scierror(202, _("%s: Wrong type for argument #%d: A real expected.\n"), fname, 8);
+ printError(&sciErr, 0);
+ return 1;
+ }
+
+ //CheckScalar
+ if (pipo != 1 || unbis != 1)
+ {
+ Scierror(999, _("%s: Wrong size for input argument #%d: A real scalar expected.\n"), fname, 8);
+ return 1;
+ }
+
+ eps1 = Max(eps1, *leps);
+ }
+
+ /* Internal variables: x, lambda, inform, C_mmax, b_mmax */
+ sciErr = allocMatrixOfDouble(pvApiCtx, next, n, un, &x);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ Scierror(999, _("%s: Memory allocation error.\n"), fname);
+ return 1;
+ }
+
+ sciErr = allocMatrixOfDouble(pvApiCtx, next + 1, mnn, un, &lambda);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ Scierror(999, _("%s: Memory allocation error.\n"), fname);
+ return 1;
+ }
+
+ sciErr = allocMatrixOfDoubleAsInteger(pvApiCtx, next + 2, un, un, &inform);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ Scierror(999, _("%s: Memory allocation error.\n"), fname);
+ return 1;
+ }
+
+
+ lwar = 3 * n * n / 2 + 10 * n + 2 * mmax + 2;
+ sciErr = allocMatrixOfDouble(pvApiCtx, next + 3, lwar, un, &war);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ Scierror(999, _("%s: Memory allocation error.\n"), fname);
+ return 1;
+ }
+
+ sciErr = allocMatrixOfDoubleAsInteger(pvApiCtx, next + 4, n, un, &iwar);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ Scierror(999, _("%s: Memory allocation error.\n"), fname);
+ return 1;
+ }
+
+ (iwar)[0] = 1; /*Cholesky factorization required*/
+
+ /* Change the sign of C*/
+ for (k = 0; k < n; k++)
+ {
+ for (l = 0; l < m; l++)
+ {
+ (C)[k * m + l] = -(C)[k * m + l];
+ }
+ }
+
+ iout = 0;
+ ifail = 0;
+ C2F(ql0001)(&m, (me), &mmax, &n, &n, &mnn, (Q), (p), (C),
+ (b), (lb), (ub), (x), (lambda), &iout,
+ &ifail, &zero, (war), &lwar, (iwar), &n, &eps1);
+
+
+ /* LhsVar: [x, lambda, inform] = qld(...) */
+ if (ifail == 0)
+ {
+ AssignOutputVariable(pvApiCtx, 1) = next;
+ AssignOutputVariable(pvApiCtx, 2) = next + 1;
+ if (nbOutputArgument(pvApiCtx) == 3)
+ {
+ AssignOutputVariable(pvApiCtx, 3) = next + 2;
+ *(inform) = ifail;
+ }
+ ReturnArguments(pvApiCtx);
+ }
+ else if (ifail == 1)
+ {
+ Scierror(24, _("%s: Too many iterations (more than %d).\n"), fname, 40 * (n + m));
+ }
+ else if (ifail == 2)
+ {
+ Scierror(24, _("%s: Accuracy insufficient to satisfy convergence criterion.\n"), fname);
+ }
+ else if (ifail == 5)
+ {
+ Scierror(999, _("%s: Length of working array is too short.\n"), fname);
+ }
+ else if (ifail > 10)
+ {
+ Scierror(999, _("%s: The constraints are inconsistent.\n"), fname);
+ }
+ else
+ {
+ }
+ return 0;
+}
+
+/*--------------------------------------------------------------------------*/
diff --git a/modules/optimization/sci_gateway/c/sci_qp_solve.c b/modules/optimization/sci_gateway/c/sci_qp_solve.c
new file mode 100755
index 000000000..c89efd58a
--- /dev/null
+++ b/modules/optimization/sci_gateway/c/sci_qp_solve.c
@@ -0,0 +1,391 @@
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) 2008 - INRIA - Serge Steer
+* Copyright (C) 2012 - Scilab Enterprises - Adeline CARNIS
+*
+* This file must be used under the terms of the CeCILL.
+* This source file is licensed as described in the file COPYING, which
+* you should have received as part of this distribution. The terms
+* are also available at
+* http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+*
+*/
+
+/*--------------------------------------------------------------------------*/
+#include <string.h>
+#include "gw_optimization.h"
+#include "api_scilab.h"
+#include "MALLOC.h"
+#include "Scierror.h"
+#include "sciprint.h"
+#include "warningmode.h"
+#include "localization.h"
+/*--------------------------------------------------------------------------*/
+/* fortran subroutines */
+extern int C2F(qpgen2)(double *dmat, double *dvec, int *fddmat, int *n,
+ double *sol, double *crval, double *amat, double *bvec,
+ int *fdamat, int *q, int *meq, int *iact, int *nact,
+ int *iter, double *work, int *ierr);
+extern int C2F(qpgen1sci)(double *dmat, double *dvec, int *fddmat, int *n, double *sol, double *crval,
+ int *colnnz, int *nzrindex, double *amat,
+ double *bvec, int *q, int *meq, int *iact, int *nact,
+ int *iter, double *work, int *ierr);
+extern int C2F(spt)(int *m, int *n, int *nel, int *it, int *ptr,
+ double *A_R, double *A_I, int *mnel, int *A_icol,
+ double *At_R, double *At_I, int *At_mnel, int *At_icol);
+/*--------------------------------------------------------------------------*/
+int sci_qp_solve(char *fname, unsigned long fname_len)
+{
+ SciErr sciErr;
+ static int un = 1, deux = 2;
+ // n : first dimension of Q
+ // nbis : second dimension of Q (nbis is expected to be equal to n)
+ static int n = 0, nbis = 0;
+ static int unbis = 0;
+ static int m = 0, next = 0;
+ static int mbis = 0;
+ static int pipo = 0;
+ static int nact = 0;
+ int r = 0;
+ static int lw = 0, k = 0;
+ static SciSparse Sp;
+ static int issparse = 0;
+ double *work = NULL;
+
+ int* piAddr1 = NULL;
+ int* piAddr2 = NULL;
+ int* piAddr3 = NULL;
+ int* piAddr4 = NULL;
+ int* piAddr5 = NULL;
+
+ double* Q = NULL;
+ double* C = NULL;
+ double* p = NULL;
+ double* b = NULL;
+ int* me = NULL;
+
+ double* x = NULL;
+ int* iact = NULL;
+ int* iter = NULL;
+ double* crval = NULL;
+ int *ierr = NULL;
+
+
+ /* Check rhs and lhs */
+ CheckInputArgument(pvApiCtx, 5, 5) ;
+ CheckOutputArgument(pvApiCtx, 1, 5) ;
+
+ /*Warning this interface does not support arguments passed by reference */
+
+ /* RhsVar: qp_solve(Q,p,C,b,me) */
+ /* 1,2,3,4,5 */
+
+ next = nbInputArgument(pvApiCtx) + 1;
+ /* Variable 1 (Q) */
+ //get variable address
+ sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr1);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 1;
+ }
+
+ // Retrieve a matrix of double at position 1.
+ sciErr = getMatrixOfDouble(pvApiCtx, piAddr1, &n, &nbis, &Q);
+ if (sciErr.iErr)
+ {
+ Scierror(202, _("%s: Wrong type for argument #%d: A real expected.\n"), fname, 1);
+ printError(&sciErr, 0);
+ return 1;
+ }
+
+ //CheckSquare
+ if (n != nbis)
+ {
+ Scierror(999, _("%s: Wrong size for input argument #%d: A square matrix expected.\n"), fname, 1);
+ return 1;
+ }
+
+ /* Variable 2 (p) */
+ //get variable address
+ sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddr2);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 1;
+ }
+
+ // Retrieve a matrix of double at position 2.
+ sciErr = getMatrixOfDouble(pvApiCtx, piAddr2, &nbis, &unbis, &p);
+ if (sciErr.iErr)
+ {
+ Scierror(202, _("%s: Wrong type for argument #%d: A real expected.\n"), fname, 2);
+ printError(&sciErr, 0);
+ return 1;
+ }
+
+ //CheckLength
+ if (nbis * unbis != n)
+ {
+ Scierror(999, _("%s: Wrong size for input argument #%d: %d expected.\n"), fname, 2, nbis * unbis);
+ return 1;
+ }
+
+
+ /* Variable 3 (C) */
+ issparse = (checkInputArgumentType(pvApiCtx, 3, 5));
+ //get variable address
+ sciErr = getVarAddressFromPosition(pvApiCtx, 3, &piAddr3);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 1;
+ }
+
+ if (!issparse)
+ {
+ // Retrieve a matrix of double at position 3.
+ sciErr = getMatrixOfDouble(pvApiCtx, piAddr3, &nbis, &m, &C);
+ if (sciErr.iErr)
+ {
+ Scierror(202, _("%s: Wrong type for argument #%d: A real expected.\n"), fname, 3);
+ printError(&sciErr, 0);
+ return 1;
+ }
+ }
+ else
+ {
+ if (isVarComplex(pvApiCtx, piAddr3))
+ {
+ Sp.it = 1;
+ sciErr = getComplexSparseMatrix(pvApiCtx, piAddr3, &(Sp.m), &(Sp.n), &(Sp.nel), &(Sp.mnel), &(Sp.icol), &(Sp.R), &(Sp.I));
+ }
+ else
+ {
+ Sp.it = 0;
+ sciErr = getSparseMatrix(pvApiCtx, piAddr3, &(Sp.m), &(Sp.n), &(Sp.nel), &(Sp.mnel), &(Sp.icol), &(Sp.R));
+ }
+
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 1;
+ }
+
+ nbis = Sp.m;
+ m = Sp.n;
+ }
+
+ if ( nbis != n ) // car C est passee en transposee dans la macro qpsolve
+ {
+ Scierror(999, _("%s: Wrong size for input argument #%d: %d column(s) expected for matrix %s.\n"), fname, 3, n, "C");
+ return 0;
+ }
+
+ /* Variable 4 (b) */
+ //get variable address
+ sciErr = getVarAddressFromPosition(pvApiCtx, 4, &piAddr4);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 1;
+ }
+
+ // Retrieve a matrix of double at position 4.
+ sciErr = getMatrixOfDouble(pvApiCtx, piAddr4, &mbis, &unbis, &b);
+ if (sciErr.iErr)
+ {
+ Scierror(202, _("%s: Wrong type for argument #%d: A real expected.\n"), fname, 4);
+ printError(&sciErr, 0);
+ return 1;
+ }
+
+ //CheckLength
+ if (mbis * unbis != m)
+ {
+ Scierror(999, _("%s: Wrong size for input argument #%d: %d expected.\n"), fname, 4, mbis * unbis);
+ return 1;
+ }
+
+
+ /* Variable 5 (me) */
+ //get variable address
+ sciErr = getVarAddressFromPosition(pvApiCtx, 5, &piAddr5);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 1;
+ }
+
+ // Retrieve a matrix of double at position 5.
+ sciErr = getMatrixOfDoubleAsInteger(pvApiCtx, piAddr5, &pipo, &unbis, &me);
+ if (sciErr.iErr)
+ {
+ Scierror(202, _("%s: Wrong type for argument #%d: A real expected.\n"), fname, 5);
+ printError(&sciErr, 0);
+ return 1;
+ }
+
+ //CheckScalar
+ if (pipo != 1 || unbis != 1)
+ {
+ Scierror(999, _("%s: Wrong size for input argument #%d: A real scalar expected.\n"), fname, 5);
+ return 1;
+ }
+
+ if ((*(me) < 0) || (*(me) > n))
+ {
+ Scierror(999, _("%s: Wrong value for input argument #%d: %s must be an integer in the range 0 to %d.\n"), fname, 5, "me", n);
+ return 0;
+ }
+
+ /* nbOutputArgument(pvApiCtx) variables: x, iact, iter, crval */
+ next = Rhs;
+ sciErr = allocMatrixOfDouble(pvApiCtx, next + 1, n, un, &x);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ Scierror(999, _("%s: Memory allocation error.\n"), fname);
+ return 1;
+ }
+
+ sciErr = allocMatrixOfDoubleAsInteger(pvApiCtx, next + 2, m, un, &iact);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ Scierror(999, _("%s: Memory allocation error.\n"), fname);
+ return 1;
+ }
+
+ sciErr = allocMatrixOfDoubleAsInteger(pvApiCtx, next + 3, deux, un, &iter);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ Scierror(999, _("%s: Memory allocation error.\n"), fname);
+ return 1;
+ }
+
+ sciErr = allocMatrixOfDouble(pvApiCtx, next + 4, un, un, &crval);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ Scierror(999, _("%s: Memory allocation error.\n"), fname);
+ return 1;
+ }
+
+ sciErr = allocMatrixOfDoubleAsInteger(pvApiCtx, next + 5, un, un, &ierr);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ Scierror(999, _("%s: Memory allocation error.\n"), fname);
+ return 1;
+ }
+
+
+ r = Min(n, m);
+ lw = 2 * n + r * (r + 5) / 2 + 2 * m + 1;
+ if ((work = (double *)MALLOC(lw * sizeof(double))) == NULL)
+ {
+ Scierror(999, _("%s: Cannot allocate more memory.\n"), fname);
+ return 1;
+ }
+ /* change the sign of C and b.*/
+ *ierr = 0;
+ if (!issparse)
+ {
+ /* linear constraints matrix is stored full */
+ C2F(qpgen2)((Q), (p), &n, &n, (x), (crval), (C),
+ (b), &n, &m, (me), (iact), &nact, (iter), work,
+ (ierr));
+ }
+ else
+ {
+ /* linear constraints matrix is a sparse matrix */
+ /* Change the linear constraints matrix representation:
+ qpgen1sci requires column-compressed sparse matrix internal
+ representation while Scilab sparse matrices are row-compressed */
+ double *R = NULL, *I = NULL;
+ int *ind = NULL;
+
+ if ((R = (double *)MALLOC(Sp.nel * sizeof(double))) == NULL)
+ {
+ FREE(work);
+ work = NULL;
+ Scierror(999, _("%s: Cannot allocate more memory.\n"), fname);
+ return 1;
+ }
+ if ((ind = (int *)MALLOC((m + Sp.nel) * sizeof(int))) == NULL)
+ {
+ FREE(work);
+ work = NULL;
+ FREE(R);
+ R = NULL;
+ Scierror(999, _("%s: Cannot allocate more memory.\n"), fname);
+ return 1;
+ }
+
+ // Transpose the sparse matrix A
+ C2F(spt)(&n, &m, &(Sp.nel) , &(Sp.it), (int *)work,
+ Sp.R, Sp.I, Sp.mnel, Sp.icol, R, I, ind, ind + m);
+
+ C2F(qpgen1sci)((Q), (p), &n, &n, (x), (crval),
+ ind, ind + m, R,
+ (b), &m, (me), (iact), &nact, (iter),
+ work, (ierr));
+ FREE(work);
+ work = NULL;
+ FREE(R);
+ R = NULL;
+ FREE(ind);
+ ind = NULL;
+ }
+
+ for (k = nact; k < m; k++)
+ {
+ (iact)[k] = 0;
+ }
+ /* LhsVar: [x, iact, iter, f] = qp_solve(...) */
+ if (Lhs != 5)
+ {
+ if (*ierr == 0)
+ {
+ for (k = 0; k < Lhs; k++)
+ {
+ AssignOutputVariable(pvApiCtx, 1 + k) = next + 1 + k;
+ }
+ ReturnArguments(pvApiCtx);
+ }
+ else if (*ierr == 1)
+ {
+ Scierror(999, _("%s: The minimization problem has no solution.\n"), fname);
+ }
+ else if (*ierr == 2)
+ {
+ Scierror(999, _("%s: Q is not symmetric positive definite.\n"), fname);
+ }
+ }
+ else
+ {
+ for (k = 0; k < Lhs; k++)
+ {
+ AssignOutputVariable(pvApiCtx, 1 + k) = next + 1 + k;
+ }
+ if (*ierr == 1)
+ {
+ if (getWarningMode())
+ {
+ sciprint(_("\n%s: Warning: The minimization problem has no solution. The results may be inaccurate.\n\n"), fname);
+ }
+ }
+ else if (*ierr == 2)
+ {
+ if (getWarningMode())
+ {
+ sciprint(_("\n%s: Warning: Q is not symmetric positive definite. The results may be inaccurate.\n\n"), fname);
+ }
+ }
+ ReturnArguments(pvApiCtx);
+ }
+ return 0;
+}
+/*--------------------------------------------------------------------------*/
diff --git a/modules/optimization/sci_gateway/c/sci_readmps.c b/modules/optimization/sci_gateway/c/sci_readmps.c
new file mode 100755
index 000000000..d577cb5e5
--- /dev/null
+++ b/modules/optimization/sci_gateway/c/sci_readmps.c
@@ -0,0 +1,24 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2006 - INRIA - Allan CORNET
+ *
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+ *
+ */
+
+#include "gw_optimization.h"
+#include "machine.h"
+/*--------------------------------------------------------------------------*/
+extern int C2F(intreadmps)(int *id);
+/*--------------------------------------------------------------------------*/
+int sci_readmps(char *fname, unsigned long fname_len)
+{
+ static int id[6];
+ C2F(intreadmps)(id);
+ return 0;
+}
+/*--------------------------------------------------------------------------*/
diff --git a/modules/optimization/sci_gateway/c/sci_semidef.c b/modules/optimization/sci_gateway/c/sci_semidef.c
new file mode 100755
index 000000000..b94718b85
--- /dev/null
+++ b/modules/optimization/sci_gateway/c/sci_semidef.c
@@ -0,0 +1,23 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2006 - INRIA - Allan CORNET
+ *
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+ *
+ */
+/*--------------------------------------------------------------------------*/
+#include "gw_optimization.h"
+#include "machine.h"
+/*--------------------------------------------------------------------------*/
+extern int C2F(scisemidef)(); /* FORTRAN subroutine */
+/*--------------------------------------------------------------------------*/
+int sci_semidef(char *fname, unsigned long fname_len)
+{
+ C2F(scisemidef)(fname, fname_len);
+ return 0;
+}
+/*--------------------------------------------------------------------------*/
diff --git a/modules/optimization/sci_gateway/c/sci_sqrsolve.c b/modules/optimization/sci_gateway/c/sci_sqrsolve.c
new file mode 100755
index 000000000..466042909
--- /dev/null
+++ b/modules/optimization/sci_gateway/c/sci_sqrsolve.c
@@ -0,0 +1,32 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2006 - INRIA - Allan CORNET
+ *
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+ *
+ */
+/*--------------------------------------------------------------------------*/
+#include "gw_optimization.h"
+#include "machine.h"
+/*--------------------------------------------------------------------------*/
+#ifdef _MSC_VER
+/* bug 3161 (F2C)*/
+/* common need to be defined and exported from C */
+__declspec (dllexport) struct
+{
+ char namef[25], namej[25];
+} C2F(clsqrsolve);
+#endif
+/*--------------------------------------------------------------------------*/
+extern int C2F(intlsqrsolve)(); /* FORTRAN subroutine */
+/*--------------------------------------------------------------------------*/
+int sci_sqrsolve(char *fname, unsigned long fname_len)
+{
+ C2F(intlsqrsolve)(fname, fname_len);
+ return 0;
+}
+/*--------------------------------------------------------------------------*/
diff --git a/modules/optimization/sci_gateway/fortran/.deps/.dirstamp b/modules/optimization/sci_gateway/fortran/.deps/.dirstamp
new file mode 100755
index 000000000..e69de29bb
--- /dev/null
+++ b/modules/optimization/sci_gateway/fortran/.deps/.dirstamp
diff --git a/modules/optimization/sci_gateway/fortran/.dirstamp b/modules/optimization/sci_gateway/fortran/.dirstamp
new file mode 100755
index 000000000..e69de29bb
--- /dev/null
+++ b/modules/optimization/sci_gateway/fortran/.dirstamp
diff --git a/modules/optimization/sci_gateway/fortran/.libs/Ex-fsolve.o b/modules/optimization/sci_gateway/fortran/.libs/Ex-fsolve.o
new file mode 100755
index 000000000..b1c86cb86
--- /dev/null
+++ b/modules/optimization/sci_gateway/fortran/.libs/Ex-fsolve.o
Binary files differ
diff --git a/modules/optimization/sci_gateway/fortran/.libs/Ex-lsqrsolve.o b/modules/optimization/sci_gateway/fortran/.libs/Ex-lsqrsolve.o
new file mode 100755
index 000000000..aca2bd44e
--- /dev/null
+++ b/modules/optimization/sci_gateway/fortran/.libs/Ex-lsqrsolve.o
Binary files differ
diff --git a/modules/optimization/sci_gateway/fortran/.libs/Ex-optim.o b/modules/optimization/sci_gateway/fortran/.libs/Ex-optim.o
new file mode 100755
index 000000000..f45360a8c
--- /dev/null
+++ b/modules/optimization/sci_gateway/fortran/.libs/Ex-optim.o
Binary files differ
diff --git a/modules/optimization/sci_gateway/fortran/.libs/bjlsqrsolv.o b/modules/optimization/sci_gateway/fortran/.libs/bjlsqrsolv.o
new file mode 100755
index 000000000..ac5ed4321
--- /dev/null
+++ b/modules/optimization/sci_gateway/fortran/.libs/bjlsqrsolv.o
Binary files differ
diff --git a/modules/optimization/sci_gateway/fortran/.libs/bjsolv.o b/modules/optimization/sci_gateway/fortran/.libs/bjsolv.o
new file mode 100755
index 000000000..985f72186
--- /dev/null
+++ b/modules/optimization/sci_gateway/fortran/.libs/bjsolv.o
Binary files differ
diff --git a/modules/optimization/sci_gateway/fortran/.libs/blsqrsolv.o b/modules/optimization/sci_gateway/fortran/.libs/blsqrsolv.o
new file mode 100755
index 000000000..0ef39df84
--- /dev/null
+++ b/modules/optimization/sci_gateway/fortran/.libs/blsqrsolv.o
Binary files differ
diff --git a/modules/optimization/sci_gateway/fortran/.libs/boptim.o b/modules/optimization/sci_gateway/fortran/.libs/boptim.o
new file mode 100755
index 000000000..25237c9cb
--- /dev/null
+++ b/modules/optimization/sci_gateway/fortran/.libs/boptim.o
Binary files differ
diff --git a/modules/optimization/sci_gateway/fortran/.libs/bsolv.o b/modules/optimization/sci_gateway/fortran/.libs/bsolv.o
new file mode 100755
index 000000000..b9323aacd
--- /dev/null
+++ b/modules/optimization/sci_gateway/fortran/.libs/bsolv.o
Binary files differ
diff --git a/modules/optimization/sci_gateway/fortran/.libs/intlsqrsolve.o b/modules/optimization/sci_gateway/fortran/.libs/intlsqrsolve.o
new file mode 100755
index 000000000..87429d565
--- /dev/null
+++ b/modules/optimization/sci_gateway/fortran/.libs/intlsqrsolve.o
Binary files differ
diff --git a/modules/optimization/sci_gateway/fortran/.libs/sci_f_fsolve.o b/modules/optimization/sci_gateway/fortran/.libs/sci_f_fsolve.o
new file mode 100755
index 000000000..9d6ef9c45
--- /dev/null
+++ b/modules/optimization/sci_gateway/fortran/.libs/sci_f_fsolve.o
Binary files differ
diff --git a/modules/optimization/sci_gateway/fortran/.libs/sci_f_optim.o b/modules/optimization/sci_gateway/fortran/.libs/sci_f_optim.o
new file mode 100755
index 000000000..4c510b175
--- /dev/null
+++ b/modules/optimization/sci_gateway/fortran/.libs/sci_f_optim.o
Binary files differ
diff --git a/modules/optimization/sci_gateway/fortran/.libs/sci_f_semidef.o b/modules/optimization/sci_gateway/fortran/.libs/sci_f_semidef.o
new file mode 100755
index 000000000..4e1cc0837
--- /dev/null
+++ b/modules/optimization/sci_gateway/fortran/.libs/sci_f_semidef.o
Binary files differ
diff --git a/modules/optimization/sci_gateway/fortran/Ex-fsolve.f b/modules/optimization/sci_gateway/fortran/Ex-fsolve.f
new file mode 100755
index 000000000..4a5ac3967
--- /dev/null
+++ b/modules/optimization/sci_gateway/fortran/Ex-fsolve.f
@@ -0,0 +1,70 @@
+c Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+c Copyright (C) INRIA
+c
+c This file must be used under the terms of the CeCILL.
+c This source file is licensed as described in the file COPYING, which
+c you should have received as part of this distribution. The terms
+c are also available at
+c http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+c
+c Example for fsolve
+c -----------------------------------------------------
+c subroutine myprog(n,x,fvec,iflag)
+c integer n,iflag
+c double precision x(n),fvec(n)
+c ----------
+c calculate the functions at x and
+c return this vector in fvec.
+c ---------
+c return
+c end
+c
+c the value of iflag should not be changed by fcn unless
+c the user wants to terminate execution of hybrd.
+c in this case set iflag to a negative integer.
+c
+c n is a positive integer input variable set to the number
+c of functions and variables.
+c
+c x is an array of length n. on input x must contain
+c an initial estimate of the solution vector. on output x
+c contains the final estimate of the solution vector.
+c
+c fvec is an output array of length n which contains
+c the functions evaluated at the output x.
+c
+ subroutine fsol1(n,x,fvec,iflag)
+ integer n,iflag
+ double precision x(n),fvec(n)
+ double precision a,b(2)
+ common / exfsol / a(2*2)
+ data a / 1.0,2.0, 7.0, 8.0 /
+ data b / 10.0 ,11.0 /
+ do 10 i=1,2
+ fvec(i)= b(i)
+ do 20 j=1,2
+ fvec(i)= fvec(i)+a(i+2*(j-1))*x(j)
+ 20 continue
+ 10 continue
+ return
+ end
+
+c ----------
+c calculate the jacobian at x and
+c return the result in fjac
+c ---------
+
+ subroutine fsolj1(n,x,fjac,iflag)
+ integer n,iflag
+ double precision x(n),fjac(n*n)
+ double precision a
+ common / exfsol / a(2*2)
+ do 10 i=1,2
+ fjac(i)= 0.0
+ do 20 j=1,2
+ fjac(i+(j-1)*2)= a(i+2*(j-1))
+ 20 continue
+ 10 continue
+ return
+ end
+
diff --git a/modules/optimization/sci_gateway/fortran/Ex-fsolve.lo b/modules/optimization/sci_gateway/fortran/Ex-fsolve.lo
new file mode 100755
index 000000000..20cf498e6
--- /dev/null
+++ b/modules/optimization/sci_gateway/fortran/Ex-fsolve.lo
@@ -0,0 +1,12 @@
+# sci_gateway/fortran/Ex-fsolve.lo - a libtool object file
+# Generated by libtool (GNU libtool) 2.4.2
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/Ex-fsolve.o'
+
+# Name of the non-PIC object
+non_pic_object=none
+
diff --git a/modules/optimization/sci_gateway/fortran/Ex-lsqrsolve.f b/modules/optimization/sci_gateway/fortran/Ex-lsqrsolve.f
new file mode 100755
index 000000000..a9ad68d4e
--- /dev/null
+++ b/modules/optimization/sci_gateway/fortran/Ex-lsqrsolve.f
@@ -0,0 +1,70 @@
+c Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+c Copyright (C) INRIA
+c
+c This file must be used under the terms of the CeCILL.
+c This source file is licensed as described in the file COPYING, which
+c you should have received as part of this distribution. The terms
+c are also available at
+c http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+c
+c Example for lsqrsolve
+c -----------------------------------------------------
+c subroutine myprog(n,x,fvec,iflag)
+c integer n,iflag
+c double precision x(n),fvec(n)
+c ----------
+c calculate the functions at x and
+c return this vector in fvec.
+c ---------
+c return
+c end
+c
+c the value of iflag should not be changed by fcn unless
+c the user wants to terminate execution of hybrd.
+c in this case set iflag to a negative integer.
+c
+c n is a positive integer input variable set to the number
+c of functions and variables.
+c
+c x is an array of length n. on input x must contain
+c an initial estimate of the solution vector. on output x
+c contains the final estimate of the solution vector.
+c
+c fvec is an output array of length n which contains
+c the functions evaluated at the output x.
+c
+ subroutine lsqrsol1(m,n,x,fvec,iflag)
+ integer n,iflag
+ double precision x(n),fvec(m)
+ double precision a,b
+ common / exlsqrsol / a(2*3),b(3)
+ data a / 1.0,2.0,4.0, 7.0, 8.0,3.0 /
+ data b / 10.0 ,11.0,-1 /
+ do 10 i=1,3
+ fvec(i)= b(i)
+ do 20 j=1,2
+ fvec(i)= fvec(i)+a(i+2*(j-1))*x(j)
+ 20 continue
+ 10 continue
+ return
+ end
+
+c ----------
+c calculate the jacobian at x and
+c return the result in fjac
+c ---------
+
+ subroutine lsqrsolj1(m,n,x,fjac,ldfjac,iflag)
+ integer n,iflag
+ double precision x(n),fjac(n*m)
+ double precision a,b
+ common / exlsqrsol / a(2*3),b(3)
+ do 10 i=1,3
+ fjac(i)= 0.0
+ do 20 j=1,2
+ fjac(i+(j-1)*2)= a(i+2*(j-1))
+ 20 continue
+ 10 continue
+ return
+ end
+
diff --git a/modules/optimization/sci_gateway/fortran/Ex-lsqrsolve.lo b/modules/optimization/sci_gateway/fortran/Ex-lsqrsolve.lo
new file mode 100755
index 000000000..8760436d8
--- /dev/null
+++ b/modules/optimization/sci_gateway/fortran/Ex-lsqrsolve.lo
@@ -0,0 +1,12 @@
+# sci_gateway/fortran/Ex-lsqrsolve.lo - a libtool object file
+# Generated by libtool (GNU libtool) 2.4.2
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/Ex-lsqrsolve.o'
+
+# Name of the non-PIC object
+non_pic_object=none
+
diff --git a/modules/optimization/sci_gateway/fortran/Ex-optim.f b/modules/optimization/sci_gateway/fortran/Ex-optim.f
new file mode 100755
index 000000000..ece240af0
--- /dev/null
+++ b/modules/optimization/sci_gateway/fortran/Ex-optim.f
@@ -0,0 +1,132 @@
+c Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+c Copyright (C) INRIA
+c
+c This file must be used under the terms of the CeCILL.
+c This source file is licensed as described in the file COPYING, which
+c you should have received as part of this distribution. The terms
+c are also available at
+c http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+c
+C Examples for the optim Scilab function
+C -------------------------------------------
+c
+ subroutine genros(ind,n,x,f,g,izs,rzs,dzs)
+C -------------------------------------------
+c Example of cost function given by a subroutine
+c if n<=2 returns ind=0
+c f.bonnans, oct 86
+ implicit double precision (a-h,o-z)
+ real rzs(1)
+ double precision dzs(*)
+ dimension x(n),g(n),izs(*)
+ common/nird/nizs,nrzs,ndzs
+ if (n.lt.3) then
+ ind=0
+ return
+ endif
+ if(ind.eq.10) then
+ nizs=2
+ nrzs=1
+ ndzs=2
+ return
+ endif
+ if(ind.eq.11) then
+ izs(1)=5
+ izs(2)=10
+ dzs(2)=100.0d+0
+ return
+ endif
+ if(ind.eq.2)go to 5
+ if(ind.eq.3)go to 20
+ if(ind.eq.4)go to 5
+ ind=-1
+ return
+5 f=1.0d+0
+ do 10 i=2,n
+ im1=i-1
+10 f=f + dzs(2)*(x(i)-x(im1)**2)**2 + (1.0d+0-x(i))**2
+ if(ind.eq.2)return
+20 g(1)=-4.0d+0*dzs(2)*(x(2)-x(1)**2)*x(1)
+ nm1=n-1
+ do 30 i=2,nm1
+ im1=i-1
+ ip1=i+1
+ g(i)=2.0d+0*dzs(2)*(x(i)-x(im1)**2)
+30 g(i)=g(i) -4.0d+0*dzs(2)*(x(ip1)-x(i)**2)*x(i) -
+ & 2.0d+0*(1.0d+0-x(i))
+ g(n)=2.0d+0*dzs(2)*(x(n)-x(nm1)**2) - 2.0d+0*(1.0d+0-x(n))
+ return
+ end
+
+
+
+ subroutine topt2(i,n,x,f,g,izs,rzs,dzs)
+C -------------------------------------------
+c 2 levels optimization test
+ implicit double precision (a-h,o-z)
+ dimension x(2),g(2),dzs(1)
+ i=1
+ f=(x(1)-dzs(1))**2 + 10* x(2)**2
+ g(1)=2*(x(1)-dzs(1))
+ g(2)=20*x(2)
+ end
+
+
+ subroutine icsemc(ind,nu,u,co,g,itv,rtv,dtv)
+ external mcsec,icsec2,icsei
+C -------------------------------------------
+c least square of LQ problems
+ call icse(ind,nu,u,co,g,itv,rtv,dtv,mcsec,icsec2,icsei)
+ end
+
+ subroutine mcsec(indf,t,y,uc,uv,f,fy,fu,b,itu,dtu,
+ & t0,tf,dti,dtf,ermx,iu,nuc,nuv,ilin,nti,ntf,ny,nea,
+ & itmx,nex,nob,ntob,ntobi,nitu,ndtu)
+C -------------------------------------------
+c
+c RHS of state equation
+c input parameters:
+c indf : 1,2,3 repectively if f,fy,fu is to be calculated
+c t : current time
+c y(ny) : state vector
+c uc(nuc) : time independent control
+c uv(nuv) : time dependent control
+c b(ny) : constant term in the LQ case
+c output parameters :
+c indf : >0 if computation is correct,<=0 if not
+c f(ny) : rhs
+c fy(ny,ny): jacobian of f wrt y
+c fu(ny,nuc+nuv) : derivative of f wrt u
+c Working arrays (for the user) :
+c itu(nitu): integer array
+c dtu(ndtu): double precision array
+c (nitu and ndtu are initialized in common icsez).
+c!
+ implicit double precision (a-h,o-z)
+ dimension y(ny),uc(*),uv(*),f(ny),fy(ny,ny),fu(ny,*),
+ & b(ny),itu(*),dtu(*),iu(5)
+c
+ if (indf.eq.1) then
+ do 50 i=1,ny
+ fii=b(i)
+ do 20 j=1,ny
+ fii=fii+fy(i,j)*y(j)
+ 20 continue
+ if(nuc.gt.0) then
+ do 30 j=1,nuc
+ fii=fii+fu(i,j)*uc(j)
+ 30 continue
+ endif
+ if(nuv.gt.0) then
+ jj=0
+ do 40 j=1+nuc,nuv+nuc
+ jj=jj+1
+ fii=fii+fu(i,j)*uv(jj)
+ 40 continue
+ endif
+ f(i)=fii
+ 50 continue
+ return
+ endif
+ end
+
diff --git a/modules/optimization/sci_gateway/fortran/Ex-optim.lo b/modules/optimization/sci_gateway/fortran/Ex-optim.lo
new file mode 100755
index 000000000..c0673043f
--- /dev/null
+++ b/modules/optimization/sci_gateway/fortran/Ex-optim.lo
@@ -0,0 +1,12 @@
+# sci_gateway/fortran/Ex-optim.lo - a libtool object file
+# Generated by libtool (GNU libtool) 2.4.2
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/Ex-optim.o'
+
+# Name of the non-PIC object
+non_pic_object=none
+
diff --git a/modules/optimization/sci_gateway/fortran/bjlsqrsolv.f b/modules/optimization/sci_gateway/fortran/bjlsqrsolv.f
new file mode 100755
index 000000000..6b76a8b26
--- /dev/null
+++ b/modules/optimization/sci_gateway/fortran/bjlsqrsolv.f
@@ -0,0 +1,162 @@
+c Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+c Copyright (C) INRIA - Serge STEER
+c
+c This file must be used under the terms of the CeCILL.
+c This source file is licensed as described in the file COPYING, which
+c you should have received as part of this distribution. The terms
+c are also available at
+c http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+c
+ subroutine bjlsqrsolv(m,n,x,fvec,fjac,ldfjac,iero)
+c
+c ======================================================================
+c external for lsqrsolve
+c ======================================================================
+c
+ INCLUDE 'stack.h'
+ integer iadr,sadr
+c
+ integer n,iflag
+ double precision x(n),fvec(m),fjac(ldfjac,*)
+ logical allowptr
+ integer vol,tops
+ data mlhs/1/
+c
+ iadr(l)=l+l-1
+ sadr(l)=(l/2)+1
+
+c
+ if (ddt .eq. 4) then
+ call writebufbjsqrsolv(buf,top,r,sym)
+ call basout(io,wte,' bjlsqrsolve top:'//buf(1:4))
+ endif
+ iflag=iero
+c
+c iflag est le numero d'ordre de cet external dans la structure
+c de donnee,
+c mlhs (mrhs) est le nombre de parametres de sortie (entree)
+c du simulateur
+c
+ iero=0
+ mrhs=2
+c
+ ilp=iadr(lstk(top))
+
+ il=istk(ilp+iflag)
+c
+ tops=istk(il)
+ ils=iadr(lstk(tops))
+c
+ if(istk(ils).eq.10) then
+c cas d'un simulateur en fortran
+ if(iflag.eq.1) then
+ call lsqrsolvf(m,n,x,fvec,iflag)
+ else
+ call lsqrsolvj(m,n,x,fjac,ldfjac,iflag)
+ endif
+ return
+ endif
+c external is a Scilab function
+
+c on return iero=-1 is used to notify to the solver that
+c scilab was not able to evaluate the external
+ iero=-1
+c
+c transfert des arguments d'entree minimaux du simulateur
+c la valeur de ces arguments vient du contexte fortran (liste d'appel)
+c la structure vient du contexte
+c+
+ call ftob(x,n,istk(il+1))
+ if(err.gt.0.or.err1.gt.0) return
+ call ftob(dble(m),1,istk(il+2))
+ if(err.gt.0.or.err1.gt.0) return
+
+c+
+c
+ if(istk(ils).eq.15) goto 10
+c
+c recuperation de l'adresse du simulateur
+ fin=lstk(tops)
+c
+ goto 40
+c cas ou le simulateur est decrit par une liste
+ 10 nelt=istk(ils+1)
+ l=sadr(ils+3+nelt)
+ ils=ils+2
+c
+c recuperation de l'adresse du simulateur
+ fin=l
+c
+c gestion des parametres supplementaires du simulateur
+c proviennent du contexte (elements de la liste
+c decrivant le simulateur
+c
+ nelt=nelt-1
+ if(nelt.ne.0) then
+ l=l+istk(ils+1)-istk(ils)
+ vol=istk(ils+nelt+1)-istk(ils+1)
+ if(top+1+nelt.ge.bot) then
+ call error(18)
+ return
+ endif
+ err=lstk(top+1)+vol-lstk(bot)
+ if(err.gt.0) then
+ call error(17)
+ return
+ endif
+ call unsfdcopy(vol,stk(l),1,stk(lstk(top+1)),1)
+ do 11 i=1,nelt
+ top=top+1
+ lstk(top+1)=lstk(top)+istk(ils+i+1)-istk(ils+i)
+ 11 continue
+ mrhs=mrhs+nelt
+ endif
+ 40 continue
+c
+c execution de la macro definissant le simulateur
+c
+ pt=pt+1
+ if(pt.gt.psiz) then
+ call error(26)
+ goto 9999
+ endif
+ ids(1,pt)=lhs
+ ids(2,pt)=rhs
+ rstk(pt)=1001
+ lhs=mlhs
+ rhs=mrhs
+ niv=niv+1
+ fun=0
+c
+ icall=5
+c
+ include "callinter.h.f"
+c
+ 200 lhs=ids(1,pt)
+ rhs=ids(2,pt)
+ pt=pt-1
+ niv=niv-1
+c+
+c transfert des variables de sortie vers fortran
+ if (iflag.eq.1) then
+ call btof(fvec,m)
+ else
+ call btof(fjac,m*n)
+ endif
+ if(err.gt.0.or.err1.gt.0) return
+c+
+c normal return iero set to 0
+ iero=0
+ return
+c
+ 9999 continue
+ niv=niv-1
+ iflag=-1
+ if(err1.gt.0) then
+ lhs=ids(1,pt)
+ rhs=ids(2,pt)
+ pt=pt-1
+ fun=0
+ endif
+ return
+ end
diff --git a/modules/optimization/sci_gateway/fortran/bjlsqrsolv.lo b/modules/optimization/sci_gateway/fortran/bjlsqrsolv.lo
new file mode 100755
index 000000000..dbf882172
--- /dev/null
+++ b/modules/optimization/sci_gateway/fortran/bjlsqrsolv.lo
@@ -0,0 +1,12 @@
+# sci_gateway/fortran/bjlsqrsolv.lo - a libtool object file
+# Generated by libtool (GNU libtool) 2.4.2
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/bjlsqrsolv.o'
+
+# Name of the non-PIC object
+non_pic_object=none
+
diff --git a/modules/optimization/sci_gateway/fortran/bjsolv.f b/modules/optimization/sci_gateway/fortran/bjsolv.f
new file mode 100755
index 000000000..c85022ef8
--- /dev/null
+++ b/modules/optimization/sci_gateway/fortran/bjsolv.f
@@ -0,0 +1,159 @@
+c Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+c Copyright (C) INRIA
+c
+c This file must be used under the terms of the CeCILL.
+c This source file is licensed as described in the file COPYING, which
+c you should have received as part of this distribution. The terms
+c are also available at
+c http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+c
+ subroutine bjsolv(n,x,fvec,fjac,ldfjac,iflag)
+c
+c ======================================================================
+c gestion external "soft" relatif a solve (jacobien fourni)
+c ======================================================================
+c
+ INCLUDE 'stack.h'
+ integer iadr,sadr
+c
+ integer n,iflag
+ double precision x(n),fvec(n),fjac(ldfjac,n)
+
+ logical allowptr
+ integer vol,tops,nordre
+ data nordre/1/,mlhs/1/
+c
+ iadr(l)=l+l-1
+ sadr(l)=(l/2)+1
+
+c
+ if (ddt .eq. 4) then
+ call writebufbjsolv(buf,top,r,sym)
+ call basout(io,wte,' bsolve top:'//buf(1:4))
+ endif
+
+c nordre est le numero d'ordre de cet external dans la structure
+c de donnee,
+c mlhs (mrhs) est le nombre de parametres de sortie (entree)
+c du simulateur
+c
+ nordre=iflag
+
+ mrhs=1
+c
+ ilp=iadr(lstk(top))
+ il=istk(ilp+nordre)
+c
+ tops=istk(il)
+ ils=iadr(lstk(tops))
+c
+ if(istk(ils).eq.10) then
+c cas d'un simulateur en fortran
+ if(iflag.eq.1) then
+ call fsolvf(n,x,fvec,iflag)
+ else
+ call fsolvj(n,x,fjac,iflag)
+ endif
+ return
+ endif
+c
+c on return iflag=-1 is used to notify to the solver that
+c scilab was not able to evaluate the external
+
+ iflag1=iflag
+ iflag=-1
+c transfert des arguments d'entree minimaux du simulateur
+c la valeur de ces arguments vient du contexte fortran (liste d'appel)
+c la structure vient du contexte
+c+
+ call ftob(x,n,istk(il+2))
+ if(err.gt.0.or.err1.gt.0) return
+c+
+c
+ if(istk(ils).eq.15) goto 10
+c
+c recuperation de l'adresse du simulateur
+ fin=lstk(tops)
+c
+ goto 40
+c cas ou le simulateur est decrit par une liste
+ 10 nelt=istk(ils+1)
+ l=sadr(ils+3+nelt)
+ ils=ils+2
+c
+c recuperation de l'adresse du simulateur
+ fin=l
+c
+c gestion des parametres supplementaires du simulateur
+c proviennent du contexte (elements de la liste
+c decrivant le simulateur
+c
+ nelt=nelt-1
+ if(nelt.ne.0) then
+ l=l+istk(ils+1)-istk(ils)
+ vol=istk(ils+nelt+1)-istk(ils+1)
+ if(top+1+nelt.ge.bot) then
+ call error(18)
+ return
+ endif
+ err=lstk(top+1)+vol-lstk(bot)
+ if(err.gt.0) then
+ call error(17)
+ return
+ endif
+ call unsfdcopy(vol,stk(l),1,stk(lstk(top+1)),1)
+ do 11 i=1,nelt
+ top=top+1
+ lstk(top+1)=lstk(top)+istk(ils+i+1)-istk(ils+i)
+ 11 continue
+ mrhs=mrhs+nelt
+ endif
+ 40 continue
+c
+c execution de la macro definissant le simulateur
+c
+ pt=pt+1
+ if(pt.gt.psiz) then
+ call error(26)
+ return
+ endif
+ ids(1,pt)=lhs
+ ids(2,pt)=rhs
+ rstk(pt)=1001
+ lhs=mlhs
+ rhs=mrhs
+ niv=niv+1
+ fun=0
+c
+ icall=5
+c
+ include "callinter.h.f"
+c
+ 200 lhs=ids(1,pt)
+ rhs=ids(2,pt)
+ pt=pt-1
+ niv=niv-1
+c+
+c transfert des variables de sortie vers fortran
+ if(iflag1.eq.1) then
+ call btof(fvec,n)
+ else
+ call btof(fjac,n*n)
+ endif
+ if(err.gt.0.or.err1.gt.0) return
+c+
+c normal return iflag set to its input value
+ iflag=iflag1
+ return
+c
+ 9999 continue
+ niv=niv-1
+ if(err1.gt.0) then
+ lhs=ids(1,pt)
+ rhs=ids(2,pt)
+ pt=pt-1
+ fun=0
+ endif
+ return
+ end
+
diff --git a/modules/optimization/sci_gateway/fortran/bjsolv.lo b/modules/optimization/sci_gateway/fortran/bjsolv.lo
new file mode 100755
index 000000000..1f15fc1ad
--- /dev/null
+++ b/modules/optimization/sci_gateway/fortran/bjsolv.lo
@@ -0,0 +1,12 @@
+# sci_gateway/fortran/bjsolv.lo - a libtool object file
+# Generated by libtool (GNU libtool) 2.4.2
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/bjsolv.o'
+
+# Name of the non-PIC object
+non_pic_object=none
+
diff --git a/modules/optimization/sci_gateway/fortran/blsqrsolv.f b/modules/optimization/sci_gateway/fortran/blsqrsolv.f
new file mode 100755
index 000000000..39fb544dd
--- /dev/null
+++ b/modules/optimization/sci_gateway/fortran/blsqrsolv.f
@@ -0,0 +1,165 @@
+c Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+c Copyright (C) INRIA - Serge STEER
+c
+c This file must be used under the terms of the CeCILL.
+c This source file is licensed as described in the file COPYING, which
+c you should have received as part of this distribution. The terms
+c are also available at
+c http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+c
+ subroutine blsqrsolv(m,n,x,fvec,iflag)
+c
+c ======================================================================
+c external for lsqrsolve
+c ======================================================================
+c
+ INCLUDE 'stack.h'
+ integer iadr,sadr
+c
+ integer n,iflag
+ double precision x(n),fvec(m)
+ logical allowptr
+ integer vol,tops,nordre
+ data mlhs/1/
+c
+ iadr(l)=l+l-1
+ sadr(l)=(l/2)+1
+
+c
+ if (ddt .eq. 4) then
+ call writebufblsqrsolv(buf,top,r,sym)
+ call basout(io,wte,' lsqrsolve top:'//buf(1:4))
+ endif
+c
+c nordre est le numero d'ordre de cet external dans la structure
+c de donnee,
+c mlhs (mrhs) est le nombre de parametres de sortie (entree)
+c du simulateur
+c
+ iero=0
+ mrhs=2
+c
+ nordre=1
+ ilp=iadr(lstk(top))
+ il=istk(ilp+nordre)
+c
+ tops=istk(il)
+ ils=iadr(lstk(tops))
+c
+ if(istk(ils).eq.10) then
+c cas d'un simulateur en fortran ou C
+ call lsqrsolvf(m,n,x,fvec,iflag)
+ return
+ endif
+ iflag1=iflag
+c
+c external is a Scilab function
+
+c on return iflag=-1 is used to notify to the ode solver that
+c scilab was not able to evaluate the external
+ iflag=-1
+
+c Putting Fortran arguments on Scilab stack
+
+c transfert des arguments d'entree minimaux du simulateur
+c la valeur de ces arguments vient du contexte fortran (liste d'appel)
+c la structure vient du contexte
+c+
+ call ftob(x,n,istk(il+1))
+ if(err.gt.0.or.err1.gt.0) return
+ call ftob(dble(m),1,istk(il+2))
+ if(err.gt.0.or.err1.gt.0) return
+
+c+
+c
+ if(istk(ils).eq.15) goto 10
+c
+c recuperation de l'adresse du simulateur
+ fin=lstk(tops)
+c
+ goto 40
+c cas ou le simulateur est decrit par une liste
+ 10 nelt=istk(ils+1)
+ l=sadr(ils+3+nelt)
+ ils=ils+2
+c
+c recuperation de l'adresse du simulateur
+ fin=l
+c
+c gestion des parametres supplementaires du simulateur
+c proviennent du contexte (elements de la liste
+c decrivant le simulateur
+c
+ nelt=nelt-1
+ if(nelt.ne.0) then
+ l=l+istk(ils+1)-istk(ils)
+ vol=istk(ils+nelt+1)-istk(ils+1)
+ if(top+1+nelt.ge.bot) then
+ call error(18)
+ return
+ endif
+ err=lstk(top+1)+vol-lstk(bot)
+ if(err.gt.0) then
+ call error(17)
+ return
+ endif
+ call unsfdcopy(vol,stk(l),1,stk(lstk(top+1)),1)
+ do 11 i=1,nelt
+ top=top+1
+ lstk(top+1)=lstk(top)+istk(ils+i+1)-istk(ils+i)
+ 11 continue
+ mrhs=mrhs+nelt
+ endif
+ 40 continue
+c
+c execution de la macro definissant le simulateur
+c
+ pt=pt+1
+ if(pt.gt.psiz) then
+ call error(26)
+ return
+ endif
+ ids(1,pt)=lhs
+ ids(2,pt)=rhs
+ rstk(pt)=1001
+ lhs=mlhs
+ rhs=mrhs
+ niv=niv+1
+ fun=0
+c
+ icall=5
+c
+ include "callinter.h.f"
+c======================================================================
+c this include file contains code relative to interfaces calling. We use
+c include file instead of subroutine to avoid recursion pb's. This file
+c must be included in each routine which compute an external
+c
+c======================================================================
+c
+ 200 lhs=ids(1,pt)
+ rhs=ids(2,pt)
+ pt=pt-1
+ niv=niv-1
+c+
+c transfert des variables de sortie vers fortran
+ call btof(fvec,m)
+ if(err.gt.0.or.err1.gt.0) return
+
+c+
+c normal return iflag set to its input value
+ iflag=iflag1
+ return
+c
+ 9999 continue
+ niv=niv-1
+ if(err1.gt.0) then
+ lhs=ids(1,pt)
+ rhs=ids(2,pt)
+ pt=pt-1
+ fun=0
+ endif
+ return
+ end
+
+
diff --git a/modules/optimization/sci_gateway/fortran/blsqrsolv.lo b/modules/optimization/sci_gateway/fortran/blsqrsolv.lo
new file mode 100755
index 000000000..375f38cba
--- /dev/null
+++ b/modules/optimization/sci_gateway/fortran/blsqrsolv.lo
@@ -0,0 +1,12 @@
+# sci_gateway/fortran/blsqrsolv.lo - a libtool object file
+# Generated by libtool (GNU libtool) 2.4.2
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/blsqrsolv.o'
+
+# Name of the non-PIC object
+non_pic_object=none
+
diff --git a/modules/optimization/sci_gateway/fortran/boptim.f b/modules/optimization/sci_gateway/fortran/boptim.f
new file mode 100755
index 000000000..c5e078c40
--- /dev/null
+++ b/modules/optimization/sci_gateway/fortran/boptim.f
@@ -0,0 +1,146 @@
+c Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+c Copyright (C) INRIA
+c
+c This file must be used under the terms of the CeCILL.
+c This source file is licensed as described in the file COPYING, which
+c you should have received as part of this distribution. The terms
+c are also available at
+c http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+c
+ subroutine boptim(iero,n,x,f,g,izs,rzs,dzs)
+c
+c ======================================================================
+c gestion des macros externals pour la primitive OPTIM
+c ======================================================================
+c
+ INCLUDE 'stack.h'
+ integer iadr,sadr
+c
+ integer tops,vol
+ integer izs(*)
+ real rzs(*)
+ logical allowptr
+c+
+ double precision x(n),f(*),g(n),dzs(*)
+ double precision xind
+ data nordre/1/,mlhs/3/
+c
+ iadr(l)=l+l-1
+ sadr(l)=(l/2)+1
+c
+c nordre est le numero d'ordre de cet external dans la structure
+c de donnee,
+c mlhs (mrhs) est le nombre de parametres de sortie (entree)
+c du simulateur
+c
+ indsim=iero
+ mrhs=2
+c
+ ilp=iadr(lstk(top))
+ il=istk(ilp+nordre)
+
+c on return iero=0 is used to notify to the solver that
+c scilab was not able to evaluate the external
+ iero=0
+
+
+c
+c transfert des arguments d'entree minimaux du simulateur
+c la valeur de ces arguments vient du contexte fortran (liste d'appel)
+c la structure vient du contexte
+c+
+ call ftob(x,n,istk(il+1))
+ if(err.gt.0.or.err1.gt.0) return
+ call ftob(dble(indsim),1,istk(il+2))
+ if(err.gt.0.or.err1.gt.0) return
+c+
+c
+ tops=istk(il)
+ ils=iadr(lstk(tops))
+ if(istk(ils).eq.15) goto 10
+c
+c recuperation de l'adresse du simulateur
+ fin=lstk(tops)
+c
+ goto 40
+c cas ou le simulateur est decrit par une liste
+ 10 nelt=istk(ils+1)
+ l=sadr(ils+3+nelt)
+ ils=ils+2
+c
+c recuperation de l'adresse du simulateur
+ fin=l
+c
+c gestion des parametres supplementaires du simulateur
+c proviennent du contexte (elements de la liste
+c decrivant le simulateur
+c
+ nelt=nelt-1
+ if(nelt.eq.0) goto 40
+ l=l+istk(ils+1)-istk(ils)
+ vol=istk(ils+nelt+1)-istk(ils+1)
+ if(top+1+nelt.ge.bot) then
+ call error(18)
+ return
+ endif
+ err=lstk(top+1)+vol-lstk(bot)
+ if(err.gt.0) then
+ call error(17)
+ return
+ endif
+ call unsfdcopy(vol,stk(l),1,stk(lstk(top+1)),1)
+ do 11 i=1,nelt
+ top=top+1
+ lstk(top+1)=lstk(top)+istk(ils+i+1)-istk(ils+i)
+ 11 continue
+ mrhs=mrhs+nelt
+ 40 continue
+c
+c execution de la macro definissant le simulateur
+c
+ pt=pt+1
+ if(pt.gt.psiz) then
+ call error(26)
+ return
+ endif
+ ids(1,pt)=lhs
+ ids(2,pt)=rhs
+ rstk(pt)=1001
+ lhs=mlhs
+ rhs=mrhs
+ niv=niv+1
+ fun=0
+c
+ icall=5
+
+ include 'callinter.h.f'
+c
+ 200 lhs=ids(1,pt)
+ rhs=ids(2,pt)
+ pt=pt-1
+ niv=niv-1
+
+c+
+c transfert des variables de sortie vers fortran
+ call btof(xind,1)
+ indsim=int(xind)
+ if(err.gt.0.or.err1.gt.0) return
+ call btof(g,n)
+ if(err.gt.0.or.err1.gt.0) return
+ call btof(f,1)
+ if(err.gt.0.or.err1.gt.0) return
+c+
+c normal return iero set to 0
+ iero=indsim
+ return
+c
+ 9999 continue
+ niv=niv-1
+ if(err1.gt.0) then
+ lhs=ids(1,pt)
+ rhs=ids(2,pt)
+ pt=pt-1
+ fun=0
+ endif
+ return
+ end
diff --git a/modules/optimization/sci_gateway/fortran/boptim.lo b/modules/optimization/sci_gateway/fortran/boptim.lo
new file mode 100755
index 000000000..58298a3bd
--- /dev/null
+++ b/modules/optimization/sci_gateway/fortran/boptim.lo
@@ -0,0 +1,12 @@
+# sci_gateway/fortran/boptim.lo - a libtool object file
+# Generated by libtool (GNU libtool) 2.4.2
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/boptim.o'
+
+# Name of the non-PIC object
+non_pic_object=none
+
diff --git a/modules/optimization/sci_gateway/fortran/bsolv.f b/modules/optimization/sci_gateway/fortran/bsolv.f
new file mode 100755
index 000000000..358647ec2
--- /dev/null
+++ b/modules/optimization/sci_gateway/fortran/bsolv.f
@@ -0,0 +1,151 @@
+c Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+c Copyright (C) INRIA
+c
+c This file must be used under the terms of the CeCILL.
+c This source file is licensed as described in the file COPYING, which
+c you should have received as part of this distribution. The terms
+c are also available at
+c http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+c
+ subroutine bsolv(n,x,fvec,iflag)
+c
+c ======================================================================
+c gestion external "soft" relatif a solve
+c ======================================================================
+c
+ INCLUDE 'stack.h'
+ integer iadr,sadr
+c
+ integer n,iflag
+ double precision x(n),fvec(n)
+ logical allowptr
+ integer vol,tops,nordre
+ data nordre/1/,mlhs/1/
+c
+ iadr(l)=l+l-1
+ sadr(l)=(l/2)+1
+
+c
+ if (ddt .eq. 4) then
+ call writebufbsolv(buf,top,r,sym)
+ call basout(io,wte,' bsolve top:'//buf(1:4))
+ endif
+c
+c nordre est le numero d'ordre de cet external dans la structure
+c de donnee,
+c mlhs (mrhs) est le nombre de parametres de sortie (entree)
+c du simulateur
+c
+ mrhs=1
+c
+ ilp=iadr(lstk(top))
+ il=istk(ilp+nordre)
+c
+ tops=istk(il)
+ ils=iadr(lstk(tops))
+c
+ if(istk(ils).eq.10) then
+c cas d'un simulateur en fortran
+ call fsolvf(n,x,fvec,iflag)
+ return
+ endif
+c
+c external is a Scilab function
+
+c on return iflag=-1 is used to notify to the solver that
+c scilab was not able to evaluate the external
+ iflag1=iflag
+ iflag=-1
+
+
+c transfert des arguments d'entree minimaux du simulateur
+c la valeur de ces arguments vient du contexte fortran (liste d'appel)
+c la structure vient du contexte
+c+
+ call ftob(x,n,istk(il+2))
+ if(err.gt.0.or.err1.gt.0) return
+c+
+c
+ if(istk(ils).eq.15) goto 10
+c
+c recuperation de l'adresse du simulateur
+ fin=lstk(tops)
+c
+ goto 40
+c cas ou le simulateur est decrit par une liste
+ 10 nelt=istk(ils+1)
+ l=sadr(ils+3+nelt)
+ ils=ils+2
+c
+c recuperation de l'adresse du simulateur
+ fin=l
+c
+c gestion des parametres supplementaires du simulateur
+c proviennent du contexte (elements de la liste
+c decrivant le simulateur
+c
+ nelt=nelt-1
+ if(nelt.ne.0) then
+ l=l+istk(ils+1)-istk(ils)
+ vol=istk(ils+nelt+1)-istk(ils+1)
+ if(top+1+nelt.ge.bot) then
+ call error(18)
+ return
+ endif
+ err=lstk(top+1)+vol-lstk(bot)
+ if(err.gt.0) then
+ call error(17)
+ return
+ endif
+ call unsfdcopy(vol,stk(l),1,stk(lstk(top+1)),1)
+ do 11 i=1,nelt
+ top=top+1
+ lstk(top+1)=lstk(top)+istk(ils+i+1)-istk(ils+i)
+ 11 continue
+ mrhs=mrhs+nelt
+ endif
+ 40 continue
+c
+c execution de la macro definissant le simulateur
+c
+ pt=pt+1
+ if(pt.gt.psiz) then
+ call error(26)
+ return
+ endif
+ ids(1,pt)=lhs
+ ids(2,pt)=rhs
+ rstk(pt)=1001
+ lhs=mlhs
+ rhs=mrhs
+ niv=niv+1
+ fun=0
+c
+ icall=5
+c
+ include "callinter.h.f"
+c
+ 200 lhs=ids(1,pt)
+ rhs=ids(2,pt)
+ pt=pt-1
+ niv=niv-1
+c+
+c transfert des variables de sortie vers fortran
+ call btof(fvec,n)
+ if(err.gt.0.or.err1.gt.0) return
+c+
+c normal return iflag set to its initial value
+ iflag=iflag1
+ return
+c
+ 9999 continue
+ niv=niv-1
+ if(err1.gt.0) then
+ lhs=ids(1,pt)
+ rhs=ids(2,pt)
+ pt=pt-1
+ fun=0
+ endif
+ return
+ end
+
diff --git a/modules/optimization/sci_gateway/fortran/bsolv.lo b/modules/optimization/sci_gateway/fortran/bsolv.lo
new file mode 100755
index 000000000..ea0d805df
--- /dev/null
+++ b/modules/optimization/sci_gateway/fortran/bsolv.lo
@@ -0,0 +1,12 @@
+# sci_gateway/fortran/bsolv.lo - a libtool object file
+# Generated by libtool (GNU libtool) 2.4.2
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/bsolv.o'
+
+# Name of the non-PIC object
+non_pic_object=none
+
diff --git a/modules/optimization/sci_gateway/fortran/intlsqrsolve.f b/modules/optimization/sci_gateway/fortran/intlsqrsolve.f
new file mode 100755
index 000000000..130f1e94d
--- /dev/null
+++ b/modules/optimization/sci_gateway/fortran/intlsqrsolve.f
@@ -0,0 +1,221 @@
+c Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+c Copyright (C) INRIA - Serge Steer
+c
+c This file must be used under the terms of the CeCILL.
+c This source file is licensed as described in the file COPYING, which
+c you should have received as part of this distribution. The terms
+c are also available at
+c http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+c
+ subroutine intlsqrsolve(fname)
+c ----------------------------
+c Scilab lsqrsolve function
+c ---------------------------
+ character*(*) fname
+c implicit undefined (a-z)
+ include 'stack.h'
+ integer topk,kres,kjac,kx,m1,n1,lr1,lr,lw,gettype
+ logical checklhs,checkrhs,getrmat,getexternal,cremat,jac
+ logical type,getscalar
+ double precision ftol,xtol,gtol,epsfcn,factor
+ integer maxfev,nprint
+ external blsqrsolv,bjlsqrsolv,setlsqrsolvf,setlsqrsolvj
+ character*(nlgh+1) namef,namej
+ common/clsqrsolve/namef,namej
+ integer iadr, sadr
+ iadr(l)=l+l-1
+ sadr(l)=(l/2)+1
+
+ topk = top
+ if (.not.checkrhs(fname,3,6)) return
+ if (.not.checklhs(fname,1,3)) return
+
+c checking variable x (number 1)
+ kx=top-rhs+1
+ if(.not.getrmat(fname,topk,kx,m1,n1,lr1))return
+ n=m1*n1
+
+c checking variable fcn (number 2)
+ kres=top-rhs+2
+ if (.not.getexternal(fname,topk,kres,namef,type,
+ $ setlsqrsolvf)) return
+c
+c checking variable m (number 3)
+ km=top-rhs+3
+ if(.not.getscalar(fname,topk,km,lr3))return
+ m=stk(lr3)
+ if (m.lt.n) then
+ err=3
+ call error(116)
+ return
+ endif
+
+
+c checking variable jac (number 4)
+ jac=.false.
+ kjac=0
+ iskip=0
+ if (rhs.ge.4) then
+ itype=gettype(top-rhs+4)
+ if (itype.eq.13.or.itype.eq.10.or.itype.eq.11.or.
+ $ itype.eq.15) then
+ jac=.true.
+ kjac=top-rhs+4
+ if (.not.getexternal(fname,topk,kjac,namej,
+ $ type,setlsqrsolvj)) return
+ else
+ iskip=1
+ endif
+ endif
+
+c checking variable tol (number 5)
+ if(rhs.ge.5-iskip) then
+ if(.not.getrmat(fname,topk,top-rhs+5-iskip,m5,n5,lr5))return
+ if(m5*n5.ne.6) then
+ call error(60)
+ return
+ endif
+ ftol=stk(lr5)
+ xtol=stk(lr5+1)
+ gtol=stk(lr5+2)
+ maxfev=stk(lr5+3)
+ epsfcn=stk(lr5+4)
+ factor=stk(lr5+5)
+ if(ftol.lt.0.0D0 .or. xtol.lt.0.0D0 .or. gtol.lt.0.0D0
+ * .or. maxfev.le.0 .or. factor.le.0.0D0) then
+ err=5-iskip
+ call error(116)
+ return
+ endif
+ nprint=0
+ else
+ ftol=1.d-8
+ xtol=1.d-8
+ gtol=1.d-8
+ maxfev=1000
+ epsfcn=0
+ factor=100.0d0
+ nprint=0
+ endif
+
+c checking variable diag (number 6)
+ if(rhs.ge.6-iskip) then
+ if(.not.getrmat(fname,topk,top-rhs+6-iskip,m6,n6,lr6))return
+ ldiag=lr6
+ if (m6*n6.ne.n) then
+ err=6-iskip
+ call error(44)
+ return
+ endif
+c test m6*n6=n
+ do ii=0,n-1
+ if (stk(ldiag+ii).le.0.0D0) then
+ err=6-iskip
+ call error(116)
+ return
+ endif
+ enddo
+
+ mode=2
+ else
+ mode=1
+ endif
+ top=top+1
+ if (.not.cremat(fname,top,0,m,n,lfjac,lc)) return
+
+c
+c to keep track of externals
+C --------------------------
+ top=top+1
+ lw = lstk(top)
+ ilext=iadr(lw)
+ istk(ilext)=1
+ istk(ilext+1)=ilext+3
+ istk(ilext+2)=ilext+6
+ istk(ilext+3)=kres
+ istk(ilext+4)=kx
+ istk(ilext+5)=km
+ istk(ilext+6)=kjac
+ istk(ilext+7)=kx
+ istk(ilext+8)=km
+ ilw=ilext+9
+
+c Working areas
+C -------------------------------------------
+ ilpvt=ilw
+ lw=sadr(ilpvt+n)
+ lqtf=lw
+ lw=lqtf+n
+ lwa1=lw
+ lw=lwa1+n
+ lwa2=lw
+ lw=lwa2+n
+ lwa3=lw
+ lw=lwa3+n
+ lwa4=lw
+ lw=lwa4+m
+ lfvec=lw
+ lw=lfvec+m
+ if(mode.eq.1) then
+ ldiag=lw
+ lw=lw+n
+ endif
+
+ err=lw-lstk(bot)
+ if (err .gt. 0) then
+ call error(17)
+ return
+ endif
+ lstk(top+1)=lw
+ if(jac) then
+ call lmder(bjlsqrsolv,m,n,stk(lr1),stk(lfvec),stk(lfjac),m,ftol
+ $ ,xtol,gtol,maxfev,stk(ldiag),mode,factor,nprint,info,nfev
+ $ ,njev,istk(ilpvt),stk(lqtf),stk(lwa1),stk(lwa2),stk(lwa3)
+ $ ,stk(lwa4))
+
+ else
+ call lmdif(blsqrsolv,m,n,stk(lr1),stk(lfvec),ftol,xtol,gtol
+ $ ,maxfev,epsfcn,stk(ldiag),mode,factor,nprint,info,nfev
+ $ ,stk(lfjac),m,istk(ilpvt),stk(lqtf),stk(lwa1),stk(lwa2)
+ $ ,stk(lwa3),stk(lwa4))
+
+ endif
+ if(err.gt.0.or.err1.gt.0) return
+c
+ top=top-2
+ if(lhs.eq.1) then
+ top=top-rhs+1
+ goto 999
+ endif
+ top=top-rhs+2
+ if (.not.cremat(fname,top,0,m,1,lr,lc)) return
+ call unsfdcopy(m,stk(lfvec),1,stk(lr),1)
+ if(lhs.eq.3) then
+c info = 0 improper input parameters.
+c info = 1 algorithm estimates that the relative error
+c between x and the solution is at most tol.
+c info = 2 number of calls to fcn with iflag = 1 has
+c reached 100*(n+1).
+c info = 3 tol is too small. no further improvement in
+c the approximate solution x is possible.
+c info = 4 iteration is not making good progress.
+ top=top+1
+ if (.not.cremat(fname,top,0,1,1,lr,lc)) return
+ stk(lr)=info
+ else
+ if(info.eq.5) then
+ call msgs(111,0)
+ elseif(info.eq.6) then
+ call msgs(112,0)
+ elseif(info.eq.7) then
+ call msgs(113,0)
+ elseif(info.eq.8) then
+ call msgs(114,0)
+ endif
+ endif
+ goto 999
+
+c
+ 999 continue
+ return
+ end
diff --git a/modules/optimization/sci_gateway/fortran/intlsqrsolve.lo b/modules/optimization/sci_gateway/fortran/intlsqrsolve.lo
new file mode 100755
index 000000000..e902ac263
--- /dev/null
+++ b/modules/optimization/sci_gateway/fortran/intlsqrsolve.lo
@@ -0,0 +1,12 @@
+# sci_gateway/fortran/intlsqrsolve.lo - a libtool object file
+# Generated by libtool (GNU libtool) 2.4.2
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/intlsqrsolve.o'
+
+# Name of the non-PIC object
+non_pic_object=none
+
diff --git a/modules/optimization/sci_gateway/fortran/sci_f_fsolve.f b/modules/optimization/sci_gateway/fortran/sci_f_fsolve.f
new file mode 100755
index 000000000..f54e76a41
--- /dev/null
+++ b/modules/optimization/sci_gateway/fortran/sci_f_fsolve.f
@@ -0,0 +1,141 @@
+c Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+c Copyright (C) INRIA
+c
+c This file must be used under the terms of the CeCILL.
+c This source file is licensed as described in the file COPYING, which
+c you should have received as part of this distribution. The terms
+c are also available at
+c http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+c
+c
+ subroutine scisolv(fname)
+c ----------------------------
+c Scilab fsolve function
+c ---------------------------
+ character*(*) fname
+c implicit undefined (a-z)
+ include 'stack.h'
+ integer topk,kres,kjac,kx,m1,n1,lr1,lr,lw,gettype
+ logical checklhs,checkrhs,getrmat,getexternal,cremat,jac
+ logical type,getscalar
+ double precision tol
+ external bsolv,bjsolv,setfsolvf,setfsolvj
+ character*(nlgh+1) namef,namej
+ common/csolve/namef,namej
+ integer iadr, sadr
+ iadr(l)=l+l-1
+ sadr(l)=(l/2)+1
+ topk = top
+ if (.not.checkrhs(fname,2,4)) return
+ if (.not.checklhs(fname,1,3)) return
+c checking variable x (number 1)
+c
+ kx=top-rhs+1
+ if(.not.getrmat(fname,topk,kx,m1,n1,lr1))return
+ mn1=m1*n1
+c checking variable fcn (number 2)
+c
+ kres=top-rhs+2
+ if (.not.getexternal(fname,topk,kres,namef,type,
+ $ setfsolvf)) return
+c
+c checking variable jac (number 3)
+c
+ jac=.false.
+ kjac=0
+ iskip=0
+ if (rhs.ge.3) then
+ itype=gettype(top-rhs+3)
+ if (itype.eq.13.or.itype.eq.10.or.itype.eq.11.or.
+ $ itype.eq.15) then
+ jac=.true.
+ kjac=top-rhs+3
+ if (.not.getexternal(fname,topk,kjac,namej,
+ $ type,setfsolvj)) return
+ else
+ iskip=1
+ endif
+ endif
+c checking variable tol (number 4)
+c
+ if(rhs.eq.4-iskip) then
+ if(.not.getscalar(fname,topk,top,lr4))return
+ tol=stk(lr4)
+ else
+ tol=1.d-10
+ endif
+c
+c An Ugly feature to keep track of externals
+C -------------------------------------------
+ top=top+1
+ lw = lstk(top)
+ ilext=iadr(lw)
+ istk(ilext)=2
+ istk(ilext+1)=ilext+4
+ istk(ilext+2)=ilext+7
+ istk(ilext+3)=ilext+10
+ istk(ilext+4)=kres
+ istk(ilext+5)=mn1
+ istk(ilext+6)=kx
+ istk(ilext+7)=kjac
+ istk(ilext+8)=mn1
+ istk(ilext+9)=kx
+c Working areas
+C -------------------------------------------
+ lw=sadr(ilext+10)
+ lw4=lw
+ lw=lw4+mn1
+ lw6=lw
+ lw=lw+1
+ if(jac) then
+ nn7=(mn1*(mn1+13))/2+mn1*mn1
+ else
+ nn7=(mn1*(3*mn1+13))/2
+ endif
+ lw7=lw
+ lw=lw+nn7
+ err=lw-lstk(bot)
+ if (err .gt. 0) then
+ call error(17)
+ return
+ endif
+ lstk(top+1)=lw
+ if(jac) then
+ call hybrj1(bjsolv,mn1,stk(lr1),stk(lw4),stk(lw7),
+ $ mn1,tol,info,stk(lw7+mn1*mn1),nn7)
+ else
+ call hybrd1(bsolv,mn1,stk(lr1),stk(lw4),tol,info,
+ $ stk(lw7),nn7)
+ endif
+ if(err.gt.0.or.err1.gt.0) return
+c
+ top=top-1
+ if(lhs.eq.1) then
+ top=top-rhs+1
+ goto 999
+ endif
+ top=top-rhs+2
+ if (.not.cremat(fname,top,0,m1,n1,lr,lc)) return
+ call unsfdcopy(mn1,stk(lw4),1,stk(lr),1)
+ if(lhs.eq.3) then
+c info = 0 improper input parameters.
+c info = 1 algorithm estimates that the relative error
+c between x and the solution is at most tol.
+c info = 2 number of calls to fcn with iflag = 1 has
+c reached 100*(n+1).
+c info = 3 tol is too small. no further improvement in
+c the approximate solution x is possible.
+c info = 4 iteration is not making good progress.
+ top=top+1
+ if (.not.cremat(fname,top,0,1,1,lr,lc)) return
+ stk(lr)=info
+ endif
+ goto 999
+
+c
+ 999 continue
+ return
+ end
+
+
+
diff --git a/modules/optimization/sci_gateway/fortran/sci_f_fsolve.lo b/modules/optimization/sci_gateway/fortran/sci_f_fsolve.lo
new file mode 100755
index 000000000..cb0e444bf
--- /dev/null
+++ b/modules/optimization/sci_gateway/fortran/sci_f_fsolve.lo
@@ -0,0 +1,12 @@
+# sci_gateway/fortran/sci_f_fsolve.lo - a libtool object file
+# Generated by libtool (GNU libtool) 2.4.2
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/sci_f_fsolve.o'
+
+# Name of the non-PIC object
+non_pic_object=none
+
diff --git a/modules/optimization/sci_gateway/fortran/sci_f_optim.f b/modules/optimization/sci_gateway/fortran/sci_f_optim.f
new file mode 100755
index 000000000..663ad8de9
--- /dev/null
+++ b/modules/optimization/sci_gateway/fortran/sci_f_optim.f
@@ -0,0 +1,1061 @@
+c Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+c Copyright (C) INRIA
+c
+c This file must be used under the terms of the CeCILL.
+c This source file is licensed as described in the file COPYING, which
+c you should have received as part of this distribution. The terms
+c are also available at
+c http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+c
+c --------------------------
+c SCILAB function : optim
+c --------------------------
+ subroutine scioptim(fname)
+
+ character*(*) fname
+ INCLUDE 'stack.h'
+ double precision tol,df0,zng,dxmin
+ double precision epsg,epsg1,epsf,dzs
+ integer top2,topin,topind,topx,top3
+ character*80 nomsub
+ common /optim/ nomsub
+ integer nizs,nrzs,ndzs
+ common /nird/ nizs,nrzs,ndzs
+ external foptim,boptim,fuclid,ctonb,ctcab
+ integer coin,coar,coti,cotd,cosi,cosd,nfac
+c
+ character*(nlgh+1) namef,namej
+ common/csolve/namef,namej
+c
+ integer impn(nsiz)
+ logical eqid, getscalar
+ integer iadr, sadr
+c
+ parameter (nsiz1=nsiz-1)
+ data impn/672732690,nsiz1*673720360/
+c
+ data coin,coar,coti,cotd,cosi,cosd,nfac
+ & / 5906,6922,4637,3357,4636,3356, 0/
+c
+
+ iadr(l)=l+l-1
+ sadr(l)=(l/2)+1
+
+ napm=100
+ itmax=100
+ epsf=0.0d+0
+ iepsx=1
+ indtes=0
+ imp=0
+ io=wte
+ tol=stk(leps)
+ df0=1.0d+0
+ immx=0
+ epsg=tol
+ indtv=0
+ icontr=1
+ ialg=1
+ irecd=0
+ ireci=0
+
+c
+ if(infstk(top).eq.1) then
+ infstk(top)=0
+ if(eqid(idstk(1,top),impn)) then
+ if (.not.getscalar('optim',top,top,lr)) return
+ imp=stk(lr)
+ top=top-1
+ rhs=rhs-1
+ endif
+ endif
+
+ lf=lstk(top+1)
+ ldisp=lf+1
+ lizs=iadr(ldisp)
+ lrzs=ldisp
+ ldzs=ldisp
+ ldisp=ldzs+1
+c
+ top2=top+1-rhs
+ top3=top2
+ topin=top2-1
+ il=iadr(lstk(top2))
+ if (rhs.lt.2) then
+ call error(39)
+ return
+ endif
+c
+c
+c traitement de simul
+ l1=istk(il)
+ if((l1-10)*(l1-11)*(l1-13)*(l1-15).ne.0) then
+ err=top2-topin
+ call error(80)
+ return
+ endif
+c
+c Compute isim :
+c - isim=1 if the cost function is given as a string (code 10), that is, the cost function is
+c a C or Fortran routine.
+c In that case, the cost function is computed with a call to "foptim".
+c - isim=2 if the cost function is given as a script (code 11), a compiled script (code 13),
+c or a list (code 15)
+c In that case, the cost function is computed with a call to "boptim".
+c
+c cas simul=liste
+ if(istk(il).eq.10) then
+ if (istk(il+1)*istk(il+2).ne.1) then
+ err=top2-topin
+ call error(89)
+ return
+ endif
+ nc=min(istk(il+5)-1,80)
+ nomsub(1:80)= ' '
+ call cvstr(nc,istk(il+6),nomsub,1)
+ if(err.gt.0) return
+ nomsub(nc+1:nc+1)=char(0)
+ call setfoptim(nomsub,irep)
+ if ( irep.eq.1) then
+ buf = nomsub
+ call error(50)
+ return
+ endif
+ isim=1
+ endif
+c cas simul=macro
+ if(istk(il).eq.11.or.istk(il).eq.13.or.istk(il).eq.15) then
+ kopt=top2
+ isim=2
+ endif
+ top2=top2+1
+ il=iadr(lstk(top2))
+c
+c Compute icontr
+c - icontr=1 if without constraints
+c - icontr=2 if with bound constraints
+c
+c contraintes de borne :chaine "b" (code 11), xinf , xsup
+ if(istk(il).eq.10.and.istk(il+5).eq.2.and.
+ + abs(istk(il+6)).eq.11) then
+ if (rhs.lt.5) then
+ call error(39)
+ return
+ endif
+ top2=top2+1
+ il=iadr(lstk(top2))
+ if(istk(il).gt.2.or.istk(il).eq.0) then
+ err=top2-topin
+ call error(54)
+ return
+ endif
+ nbi=istk(il+1)*istk(il+2)
+ if(istk(il).eq.1) then
+ nbi=nbi*(istk(il+3)+1)
+ lbi=sadr(il+4)
+ else
+ lbi=sadr(il+9+nbi)
+ nbi=(istk(il+8+nbi)-1)*(istk(il+3)+1)
+ endif
+ top2=top2+1
+ il=iadr(lstk(top2))
+ if(istk(il).gt.2.or.istk(il).eq.0) then
+ err=top2-topin
+ call error(54)
+ return
+ endif
+ nbs=istk(il+1)*istk(il+2)
+ if(istk(il).eq.1) then
+ nbs=nbs*(istk(il+3)+1)
+ lbs=sadr(il+4)
+ else
+ lbs=sadr(il+9+nbs)
+ nbs=(istk(il+8+nbs)-1)*(istk(il+3)+1)
+ endif
+ if((nbs.ne.nbi)) then
+ call error(139)
+ return
+ endif
+ icontr=2
+ top2=top2+1
+ il=iadr(lstk(top2))
+ end if
+c
+c point initial
+ if(istk(il).gt.2.or.istk(il).eq.0) then
+ err=top2-topin
+ call error(54)
+ return
+ endif
+ topx=top2
+ nx1=istk(il+1)
+ nx2=istk(il+2)
+ itvx=istk(il)
+ ilx=il
+ if(istk(il).eq.1) then
+ nx=nx1*nx2*(istk(il+3)+1)
+ lx=sadr(il+4)
+ else
+ nx=(istk(il+8+nx1*nx2)-1)*(istk(il+3)+1)
+ lx=sadr(il+9+nx1*nx2)
+ endif
+ if (icontr.ne.1.and.nx.ne.nbi) then
+ call error(135)
+ return
+ endif
+c a quoi servent les 2 lignes suivantes. elle pose pb pour le nom de la macro
+c simulateur dans les messages d'erreur
+c idstk(1,top-1)=nx1
+c idstk(2,top-1)=nx2
+c
+c stockage de g
+ lg=ldisp
+ ldisp=lg + nx
+ err=ldisp - lstk(bot)
+ if (err.gt.0) then
+ call error(17)
+ return
+ endif
+ if (top2.eq.top) go to 200
+ top2=top2+1
+ il=iadr(lstk(top2))
+c
+c choix d algorithme
+c
+c Compute ialg1
+c (26,23) > "qn" > Quasi-Newton > ialg1=1
+c (16,12) > "gc" > Gradient Conjugate > ialg1=2
+c (23,13) > "nd" > Non Differentiable > ialg1=10
+c
+ if(istk(il).eq.10) then
+ if (istk(il+5)-1.ne.2) then
+ err=top2-topin
+ call error(36)
+ return
+ endif
+ ic1=abs(istk(il+6))
+ ic2=abs(istk(il+7))
+ ialg1=0
+ if (ic1.eq.26.and.ic2.eq.23) ialg1=1
+ if (ic1.eq.16.and.ic2.eq.12) ialg1=2
+ if (ic1.eq.23.and.ic2.eq.13) ialg1=10
+ if (ialg1.ne.0) then
+ ialg=ialg1
+ if (top2.eq.top) go to 200
+ top2=top2+1
+ il=iadr(lstk(top2))
+ end if
+ endif
+c
+c df0
+ if(istk(il).eq.1.and.istk(il+1)*istk(il+2).eq.1) then
+ df0=stk(sadr(il+4))
+ if (df0.le.0) then
+ call error(143)
+ return
+ endif
+ if (top.eq.top2) go to 200
+ top2=top2 + 1
+ il=iadr(lstk(top2))
+ endif
+c
+c mmx
+ if(istk(il).eq.1.and.istk(il+1)*istk(il+2).eq.1) then
+ l=sadr(il+4)
+ mmx=int(stk(l))
+ immx=1
+ if (top2.eq.top) go to 200
+ top2=top2+1
+ il=iadr(lstk(top2))
+ end if
+c
+c hot start (optimiseurs n1qn1 et qnbd)
+ if(istk(il).eq.1.and.istk(il+3).eq.0) then
+ if (ialg.ne.1) then
+ call error(137)
+ return
+ endif
+ ntv=istk(il+1)*istk(il+2)
+ if(icontr.eq.1.and.ntv.ne.nx*(nx+13)/2) then
+ err=top2-topin
+ call error(142)
+ return
+ endif
+ ltv=sadr(il+4)
+ indtv=1
+ if (top2.eq.top) go to 200
+ top2=top2+1
+ il=iadr(lstk(top2))
+ end if
+c
+c chaine 'ar'
+ if(istk(il).ne.10) then
+ err=top2-topin
+ call error(55)
+ return
+ endif
+ if (istk(il+1)*istk(il+2).ne.1) then
+ err=top2-topin
+ call error(89)
+ return
+ endif
+ if(istk(il+5)-1.ne.2 ) then
+ err=top2-topin
+ call error(36)
+ return
+ endif
+ if(abs(istk(il+6))+256*abs(istk(il+7)).ne.coar) goto 150
+ if (top2.eq.top) go to 200
+ top2=top2+1
+ il=iadr(lstk(top2))
+c
+c napm et itmax
+ if(istk(il).eq.1.and.istk(il+1)*istk(il+2).eq.1) then
+ l=sadr(il+4)
+ napm=int(stk(l))
+ if (top2.eq.top) go to 200
+ top2=top2+1
+ il=iadr(lstk(top2))
+ end if
+ if(istk(il).eq.1.and.istk(il+1)*istk(il+2).eq.1) then
+ l=sadr(il+4)
+ itmax=int(stk(l))
+ if (top2.eq.top) go to 200
+ top2=top2+1
+ il=iadr(lstk(top2))
+ end if
+c
+c epsg,epsf,epsx (note : epsx est un vecteur)
+ if(istk(il).eq.1.and.istk(il+1)*istk(il+2).eq.1) then
+ epsg=stk(sadr(il+4))
+ if (top2.eq.top) go to 200
+ top2=top2+1
+ il=iadr(lstk(top2))
+ endif
+ if(istk(il).eq.1.and.istk(il+1)*istk(il+2).eq.1) then
+ epsf=stk(sadr(il+4))
+ if (top2.eq.top) go to 200
+ top2=top2+1
+ il=iadr(lstk(top2))
+ endif
+ if(istk(il).eq.1.and.istk(il+3).eq.0) then
+ if(istk(il+1)*istk(il+2).ne.nx) then
+ call error(138)
+ return
+ endif
+ iepsx=0
+ lepsx=sadr(il+4)
+ if (top2.eq.top) go to 200
+ top2=top2+1
+ il=iadr(lstk(top2))
+ endif
+c
+c chaine 'in'
+c
+ 150 if(istk(il).ne.10) then
+ err=top2-topin
+ call error(55)
+ return
+ endif
+ if (istk(il+1)*istk(il+2).ne.1) then
+ err=top2-topin
+ call error(89)
+ return
+ endif
+ if (istk(il+5)-1.ne.2) then
+ err=top2-topin
+ call error(36)
+ return
+ endif
+ if(abs(istk(il+6))+256*abs(istk(il+7)).eq. coin) then
+ if(isim.ne.1) then
+ buf='''in'' not allowed with simulator defined '//
+ $ 'by a function'
+ call error(9999)
+ return
+ endif
+
+c on initialise nizs,nrzs,ndzs
+ indsim=10
+ if(isim.eq.1) then
+ call foptim(indsim,nx,stk(lx),stk(lf),stk(lg),
+ & istk(lizs),sstk(lrzs),stk(ldzs))
+ else
+ call boptim(indsim,nx,stk(lx),stk(lf),stk(lg),
+ & izs,rzs,dzs)
+ endif
+ if(err.gt.0.or.err1.gt.0) return
+c
+ if(indsim.le.0) then
+ indopt=-7
+ if(indsim.eq.0) indopt=0
+ go to 350
+ endif
+c stockage de izs,rzs,dzs dans la pile
+ l1=ldisp
+ lizs=iadr(l1)
+ lrzs=lizs+nizs
+ ldzs=sadr(lrzs+nrzs)
+ ldisp=ldzs + ndzs
+ err=ldisp - lstk(bot)
+ if (err.gt.0) then
+ call error(17)
+ return
+ endif
+ indsim=11
+ lstk(top+1)=ldisp
+ if(isim.eq.1) then
+ call foptim(indsim,nx,stk(lx),stk(lf),stk(lg),
+ & istk(lizs),sstk(lrzs),stk(ldzs))
+ endif
+ if(indsim.le.0) then
+ if(indsim.eq.0) indopt=0
+ go to 350
+ endif
+ if (top2.eq.top) go to 200
+ top2=top2 + 1
+ il=iadr(lstk(top2))
+ endif
+c
+c izs et dzs en entree (chaine 'ti' et/ou 'td' suivie du tableau)
+ if(istk(il).ne.10) then
+ err=top2-topin
+ call error(55)
+ return
+ endif
+ if (istk(il+1)*istk(il+2).ne.1) then
+ err=top2-topin
+ call error(89)
+ return
+ endif
+ if(istk(il+5)-1.ne.2) then
+ err=top2-topin
+ call error(36)
+ return
+ endif
+ if(abs(istk(il+6))+256*abs(istk(il+7)).eq.coti) then
+ if (top2.eq.top) go to 200
+ top2=top2+1
+ il=iadr(lstk(top2))
+ if(istk(il).eq.1.and.istk(il+3).eq.0) then
+ nizs=istk(il+1)*istk(il+2)
+ lizs1=sadr(il+4)
+ lizs=iadr(lizs1)
+ do 185 i=0,nizs-1
+ istk(lizs+i)=int(stk(lizs1+i))
+ 185 continue
+ if (top2.eq.top) go to 200
+ top2=top2+1
+ il=iadr(lstk(top2))
+ endif
+ endif
+ if(istk(il).ne.10) then
+ err=top2-topin
+ call error(55)
+ return
+ endif
+ if (istk(il+1)*istk(il+2).ne.1) then
+ err=top2-topin
+ call error(89)
+ return
+ endif
+ if(istk(il+5)-1.ne.2) then
+ err=top2-topin
+ call error(36)
+ return
+ endif
+ if(abs(istk(il+6))+256*abs(istk(il+7)).eq.cotd) then
+ if (top2.eq.top) go to 200
+ top2=top2+1
+ il=iadr(lstk(top2))
+ if(istk(il).eq.1.and.istk(il+3).eq.0) then
+ ndzs=istk(il+1)*istk(il+2)
+ ldzs=sadr(il+4)
+ if (top2.eq.top) go to 200
+ top2=top2+1
+ il=iadr(lstk(top2))
+ endif
+ endif
+c
+c mettre ti = izs et/ou td = dzs en sortie (chaine 'si' ou 'sd')
+ if(istk(il).ne.10) then
+ err=top2-topin
+ call error(55)
+ return
+ endif
+ if (istk(il+1)*istk(il+2).ne.1) then
+ err=top2-topin
+ call error(89)
+ return
+ endif
+ if(istk(il+5)-1.ne.2) then
+ err=top2-topin
+ call error(36)
+ return
+ endif
+ if(abs(istk(il+6))+256*abs(istk(il+7)).eq.cosi) then
+ ireci=1
+ if (top2.eq.top) go to 200
+ top2=top2+1
+ il=iadr(lstk(top2))
+ endif
+c
+ if(istk(il).ne.10) then
+ err=top2-topin
+ call error(55)
+ return
+ endif
+ if (istk(il+1)*istk(il+2).ne.1) then
+ err=top2-topin
+ call error(89)
+ return
+ endif
+ if(istk(il+5)-1.ne.2) then
+ err=top2-topin
+ call error(36)
+ return
+ endif
+ if(abs(istk(il+6))+256*abs(istk(il+7)).ne.cosd) then
+ err=top2-topin
+ call error(36)
+ return
+ endif
+ irecd=1
+c
+c fin epluchage liste appel
+ 200 if (top.ne.top2) then
+ call error(39)
+ return
+ endif
+c
+c creation des variables contenant le simulateur et ind
+ top=top+1
+ topind=top
+ lstk(top)=ldisp
+ il=iadr(ldisp)
+ istk(il)=1
+ istk(il+1)=1
+ istk(il+2)=1
+ istk(il+3)=0
+ ldisp=sadr(il+4)
+ ldisp=ldisp+1
+c
+ top=top+1
+ lstk(top)=ldisp
+ il=iadr(ldisp)
+ istk(il)=1
+ istk(il+1)=il+2
+ istk(il+2)=kopt
+ istk(il+3)=topx
+ istk(il+4)=topind
+ ldisp=sadr(il+5)
+c
+c initialisation eventuelle de f et g
+ iarret=0
+ if (napm.lt.2.or.itmax.lt.1) iarret=1
+c
+ if((icontr.eq.1.and.(ialg.eq.2.or.ialg.eq.10)).or.
+ & (icontr.eq.2.and.ialg.eq.1.and.indtv.eq.1) .or.
+ & (iarret.eq.1) ) then
+ indsim=4
+ lstk(top+1)=ldisp
+ if(isim.eq.1) then
+ call foptim(indsim,nx,stk(lx),stk(lf),stk(lg),
+ & istk(lizs),sstk(lrzs),stk(ldzs))
+ else
+ call boptim(indsim,nx,stk(lx),stk(lf),stk(lg),
+ & istk(lizs),sstk(lrzs),stk(ldzs))
+ endif
+ if(err.gt.0.or.err1.gt.0)return
+ if(indsim.le.0) then
+ indopt=-7
+ if(indsim.eq.0) indopt=0
+ go to 350
+ endif
+ if (napm.lt.2.or.itmax.lt.1) go to 300
+ endif
+c
+c appel de l optimiseur
+c
+c optimiseur n1qn1 : Quasi-Newton without constraints
+ if(icontr.eq.1.and.ialg.eq.1) then
+ lvar=ldisp
+ mode=3
+c If nx is greater than 46333, then we cannot compute nx*(nx+13)/2 properly,
+c which is the required memory for the "qn" algorithm
+ if (nx.gt.46333) then
+ call error(17)
+ return
+ endif
+ ntv=nx*(nx+13)/2
+ ldisp=lvar + nx
+ if(indtv.eq.0) then
+ mode=1
+ ltv=lvar + nx
+ ldisp=ltv + ntv
+ endif
+ err=ldisp - lstk(bot)
+ if (err.gt.0) then
+ call error(17)
+ return
+ endif
+ do 50 i=0,nx-1
+ stk(lvar+i)=0.10d+0
+ 50 continue
+ nitv=0
+ lstk(top + 1)=ldisp
+c
+c mise en memoire de parametres d entree pour l affectation de indop
+ itmax1=itmax
+ napm1=napm
+ epsg1=epsg
+c
+ if(isim.eq.1) then
+ call n1qn1(foptim,nx,stk(lx),stk(lf),stk(lg),
+ & stk(lvar),epsg,mode,itmax,napm,imp,io,stk(ltv),
+ & istk(lizs),sstk(lrzs),stk(ldzs))
+ else
+ call n1qn1(boptim,nx,stk(lx),stk(lf),stk(lg),
+ & stk(lvar),epsg,mode,itmax,napm,imp,io,stk(ltv),
+ & istk(lizs),sstk(lrzs),stk(ldzs))
+ endif
+ if(err.gt.0.or.err1.gt.0) return
+c affectation de indopt
+ epsg=sqrt(epsg)
+ indopt=9
+ if(itmax.ge.itmax1) indopt=5
+ if(napm.ge.napm1) indopt=4
+ if(epsg1.ge.epsg) indopt=1
+ go to 300
+ endif
+
+c algorithme n1qn3 : Gradient Conjugate without constraints
+ if(icontr.eq.1.and.ialg.eq.2) then
+c calcul de epsrel
+ zng=0.0d+0
+ do 230 i=0,nx-1
+ zng=zng + stk(lg+i)**2
+ 230 continue
+ zng=sqrt(zng)
+ if (zng.gt.0.0d+0) epsg=epsg/zng
+c calcul du scalaire dxmin
+ dxmin=stk(leps)
+ if (iepsx.eq.0) then
+ dxmin=stk(lepsx)
+ if (nx.gt.1) then
+ do 235 i=1,nx-1
+ dxmin=min(dxmin,stk(lepsx+i))
+ 235 continue
+ endif
+ endif
+c tableaux de travail (mmx=nombre de mises a jour)
+ if (immx.eq.0) mmx=10
+ ntv=4*nx + mmx*(2*nx + 1)
+ ltv=ldisp
+ ldisp=ltv + ntv
+ err=ldisp - lstk(bot)
+ if (err.gt.0) then
+ call error(17)
+ return
+ endif
+ lstk(top+1)=ldisp
+c
+ if(isim.eq.1) then
+ indsim=4
+ call foptim(indsim,nx,stk(lx),stk(lf),stk(lg),
+ & istk(lizs),sstk(lrzs),stk(ldzs))
+ call n1qn3(foptim,fuclid,ctonb,ctcab,nx,stk(lx),stk(lf),
+ $ stk(lg),dxmin,df0,epsg,imp,io,mode,itmax,napm,
+ & stk(Ltv),Ntv,istk(lizs),sstk(lrzs),stk(ldzs) )
+ else
+ indsim=4
+ call boptim(indsim,nx,stk(lx),stk(lf),stk(lg),
+ & istk(lizs),sstk(lrzs),stk(ldzs))
+ call n1qn3(boptim,fuclid,ctonb,ctcab,nx,stk(lx),stk(lf),
+ & stk(lg),dxmin,df0,epsg,imp,io,mode,itmax,napm,
+ & stk(ltv),ntv,istk(lizs),sstk(lrzs),stk(ldzs) )
+ endif
+ if (err.gt.0.or.err1.gt.0) return
+ indopt=9
+ if (mode.eq.0) indopt=0
+ if (mode.eq.1) indopt=1
+ if (mode.eq.2) indopt=-10
+ if (mode.eq.3) indopt=7
+
+ if (mode.eq.4) indopt=5
+ if (mode.eq.5) indopt=4
+ if (mode.eq.6) indopt=3
+ if (mode.eq.7) indopt=7
+ go to 300
+ endif
+c
+c optimiseur n1fc1 : non smooth without constraints
+ if(icontr.eq.1.and.ialg.eq.10) then
+ if (immx.eq.0) mmx=10
+ nitv=2*mmx + 2
+ itv1=5*nx + (nx+4)*mmx
+ itv2=(mmx+9)*mmx + 8
+ err=ldisp + iepsx*nx + nitv/2 +1 +itv1 +itv2 -lstk(bot)
+ if (err.gt.0) then
+ call error(17)
+ return
+ endif
+ if (iepsx.eq.1) then
+ lepsx=ldisp
+ do 115 i=1,nx
+ stk(lepsx+i - 1)=tol
+ 115 continue
+ ldisp=lepsx+nx
+ endif
+ litv=iadr(ldisp)
+ ltv1=sadr(litv+nitv)
+ ltv2=ltv1 + itv1
+ ldisp=ltv2 + itv2
+ lstk(top+1)=ldisp
+ if (isim.eq.1) then
+ call n1fc1(foptim,fuclid,nx,stk(lx),stk(lf),stk(lg),
+ & stk(lepsx),df0,epsf,tol,imp,io,mode,itmax,napm,mmx,
+ & istk(litv),stk(ltv1),stk(ltv2),istk(lizs),sstk(lrzs),
+ $ stk(ldzs))
+ else
+ call n1fc1(boptim,fuclid,nx,stk(lx),stk(lf),stk(lg),
+ & stk(lepsx),df0,epsf,tol,imp,io,mode,itmax,napm,mmx,
+ & istk(litv),stk(ltv1),stk(ltv2),istk(lizs),sstk(lrzs),
+ $ stk(ldzs))
+ endif
+ if (err.gt.0.or.err1.gt.0) return
+c interpretation de la cause de retour
+ indopt=9
+ if (mode.eq.0)indopt=0
+ if (mode.eq.1)indopt=2
+ if (mode.eq.2)indopt=-10
+ if (mode.eq.4)indopt=5
+ if (mode.eq.5)indopt=4
+ if (mode.eq.6)indopt=3
+ go to 300
+ endif
+c
+c optimiseur qnbd : quasi-newton with bound constraints
+ if(icontr.eq.2.and.ialg.eq.1) then
+ if (iepsx.eq.1) then
+ err=ldisp +nx - lstk(bot)
+ if (err.gt.0) then
+ call error(17)
+ return
+ endif
+ lepsx=ldisp
+ ldisp=lepsx + nx
+ do 118 i=0,nx-1
+ stk(lepsx+i)=tol
+ 118 continue
+ endif
+ ntv1=nx*(nx+1)/2 + 4*nx + 1
+ nitv= 2*nx
+ if (indtv.eq.0) then
+ ntv=ntv1
+ err= ldisp + ntv + nitv/2 +1 - lstk(bot)
+ if (err.gt.0) then
+ call error(17)
+ return
+ endif
+ ltv=ldisp
+ litv=iadr(ltv+ntv)
+ lstk(top+1)=sadr(litv+nitv)
+ else
+ if (ntv.ne.ntv1+nitv) then
+ err=top2-topin
+ call error(142)
+ return
+ endif
+ ntv=ntv1
+ litv1=ltv+ntv
+ litv=iadr(litv1)
+ do 117 i=0,nitv-1
+ istk(litv+i)=int(stk(litv1+i))
+ 117 continue
+ endif
+ indopt=1 +indtv
+ if(isim.eq.1) then
+ call qnbd(indopt,foptim,nx,stk(lx),stk(lf),
+ & stk(lg),imp,io,tol,napm,itmax,epsf,epsg,
+ & stk(lepsx),df0,stk(lbi),stk(lbs),nfac,
+ & stk(ltv),ntv,istk(litv),nitv,
+ & istk(lizs),sstk(lrzs),stk(ldzs))
+ else
+ call qnbd(indopt,boptim,nx,stk(lx),stk(lf),
+ & stk(lg),imp,io,tol,napm,itmax,epsf,epsg,
+ & stk(lepsx),df0,stk(lbi),stk(lbs),nfac,
+ & stk(ltv),ntv,istk(litv),nitv,
+ & istk(lizs),sstk(lrzs),stk(ldzs))
+ endif
+ if(err.gt.0.or.err1.gt.0) return
+ go to 300
+ endif
+c
+c optimiseur gcbd : Gradient Conjugate with bound constraints
+ if(icontr.eq.2.and.ialg.eq.2) then
+ nt=2
+ if (immx.eq.1) nt= max(1,mmx/3)
+ ntv=nx*(5 + 3*nt) + 2*nt +1
+ nitv=nx + nt + 1
+ err= ldisp + iepsx*nx + ntv + nitv/2 - lstk(bot)
+ if (err.gt.0) then
+ call error(17)
+ return
+ endif
+ if (iepsx.eq.1) then
+ lepsx=ldisp
+ ltv=lepsx + nx
+ do 119 i=0,nx-1
+ stk(lepsx+i)=tol
+ 119 continue
+ else
+ ltv=ldisp
+ endif
+ litv=iadr(ltv+ntv)
+ lstk(top+1)=sadr(litv+nitv)
+ indopt=1
+ if (indtes.ne.0) indopt=indtes
+ if(isim.eq.1) then
+ call gcbd(indopt,foptim,nomsub,nx,stk(lx),
+ & stk(lf),stk(lg),imp,io,tol,napm,itmax,epsf,epsg,
+ & stk(lepsx),df0,stk(lbi),stk(lbs),nfac,
+ & stk(ltv),ntv,istk(litv),nitv,
+ & istk(lizs),sstk(lrzs),stk(ldzs))
+ else
+ call gcbd(indopt,boptim,nomsub,nx,stk(lx),stk(lf),
+ & stk(lg),imp,io,tol,napm,itmax,epsf,epsg,
+ & stk(lepsx),df0,stk(lbi),stk(lbs),nfac,
+ & stk(ltv),ntv,istk(litv),nitv,
+ & istk(lizs),sstk(lrzs),stk(ldzs))
+ endif
+ if(err.gt.0.or.err1.gt.0) return
+ go to 300
+ endif
+c
+c algorithme non implante
+ call error(136)
+ return
+c
+c laissons la pile aussi propre qu on aurait aime la trouver
+ 300 top2=top3
+ top =top3 + lhs - 1
+ fun=0
+c
+ lhs1=lhs - ireci -irecd
+ if (lhs1.le.0) then
+ call error(41)
+ return
+ endif
+c
+c sauvegarde de f
+ il=iadr(lstk(top2))
+ istk(il)=1
+ istk(il+1)=1
+ istk(il+2)=1
+ istk(il+3)=0
+ l=sadr(il+4)
+ stk(l)=stk(lf)
+ lstk(top+1)=l+1
+ if(lhs.eq.1) go to 320
+c
+c sauvegarde de x
+ l=l+1
+ top2=top2 + 1
+ lstk(top2)=l
+ il=iadr(l)
+ if(itvx.eq.1) then
+ call icopy(4,istk(ilx),1,istk(il),1)
+ lx1=sadr(il+4)
+ else
+ call icopy(9+nx1*nx2,istk(ilx),1,istk(il),1)
+ lx1=sadr(il+9+nx1*nx2)
+ endif
+ ilx=il
+ lstk(top+1)=lx1+nx
+ call unsfdcopy(nx,stk(lx) ,1,stk(lx1),1)
+ if(lhs1.eq.2) go to 320
+c
+c sauvegarde de g
+ top2=top2 + 1
+ lstk(top2)=lstk(top+1)
+ il=iadr(lstk(top2))
+ if(itvx.eq.1) then
+ call icopy(4,istk(ilx),1,istk(il),1)
+ l=sadr(il+4)
+ else
+ call icopy(9+nx1*nx2,istk(ilx),1,istk(il),1)
+ l=sadr(il+9+nx1*nx2)
+ endif
+ call unsfdcopy(nx,stk(lg) ,1,stk(l),1)
+ lstk(top+1)=l+nx
+ if(lhs1.eq.3) goto 320
+c
+c sauvegarde de tv (tableau interne a l' optimiseur - pour hot start
+ if (lhs1.ge.4) then
+ istv=0
+ if(ialg.eq.1) istv=1
+ if (istv.eq.0) then
+c pas de hot start pour cet algorithme
+ call error(137)
+ return
+ endif
+ top2=top2 + 1
+ lstk(top2)=lstk(top+1)
+ il=iadr(lstk(top2))
+ istk(il)=1
+ istk(il+1)=1
+ istk(il+2)=ntv + nitv
+ istk(il+3)=0
+ l=sadr(il+4)
+c recopie eventuelle de dzs et izs pour ne pas les ecraser
+ if (indtv.eq.0.and.(ireci-1)*(irecd-1).eq.0) then
+ err=l+ntv+nitv+ireci*nizs+irecd*ndzs-lstk(bot)
+ if (err.gt.0) then
+ call error(17)
+ return
+ endif
+c if (l+ntv+nitv+1.ge.sadr(lizs)) then
+ ldzs2=lstk(bot)-ndzs
+ lizs2=iadr(ldzs2)-nizs
+ if (sadr(lizs2).le.ltv+ntv+nitv+1) then
+ call error(17)
+ return
+ endif
+ call unsfdcopy(ndzs,stk(ldzs),-1,stk(ldzs2),-1)
+ do 315 i=nizs-1,0,-1
+ istk(lizs2+i)=istk(lizs+i)
+ 315 continue
+ ldzs=ldzs2
+ lizs=lizs2
+ endif
+ endif
+ call unsfdcopy(ntv,stk(ltv),1,stk(l),1)
+ if (nitv.gt.0) then
+ do 316 i=nitv-1,0,-1
+ istk(litv+2*i)=istk(litv+i)
+ 316 continue
+ litv1=l+ntv
+ do 317 i=0,nitv-1
+ stk(litv1+i)=real(istk(litv+i))
+ 317 continue
+ endif
+ lstk(top+1)=l + ntv + nitv
+ if(lhs1.eq.4) goto 320
+c
+c sauvegarde de niter
+ top2=top2 + 1
+ lstk(top2)=lstk(top+1)
+ il=iadr(lstk(top2))
+ istk(il)=1
+ istk(il+1)=1
+ istk(il+2)=1
+ istk(il+3)=0
+ l=sadr(il+4)
+ stk(l)=itmax
+ lstk(top+1)=l+1
+ if(lhs1.eq.5) go to 320
+c
+c sauvegarde de napm
+ top2=top2 + 1
+ lstk(top2)=lstk(top+1)
+ il=iadr(lstk(top2))
+ istk(il)=1
+ istk(il+1)=1
+ istk(il+2)=1
+ istk(il+3)=0
+ l=sadr(il+4)
+ stk(l)=napm
+ lstk(top+1)=l+1
+ if(lhs1.eq.6) go to 320
+c
+c sauvegarde de indopt
+ top2=top2 + 1
+ lstk(top2)=lstk(top+1)
+ il=iadr(lstk(top2))
+ istk(il)=1
+ istk(il+1)=1
+ istk(il+2)=1
+ istk(il+3)=0
+ l=sadr(il+4)
+ stk(l)=indopt
+ lstk(top+1)=l+1
+c
+c sauvegarde de izs et dzs
+ 320 if (lhs.eq.lhs1) go to 350
+ if (ireci.eq.1) then
+ top2=top2 + 1
+ lstk(top2)=lstk(top+1)
+ il=iadr(lstk(top2))
+ istk(il)=1
+ istk(il+1)=1
+ istk(il+2)=nizs
+ istk(il+3)=0
+ l=sadr(il+4)
+c izs can be transformed in place. (int to double)
+c Inverse the loop prevents the overwrite of the second int.
+ do 325 i=(nizs-1), 0, -1
+ stk(l+i)=real(istk(lizs+i))
+ 325 continue
+ lstk(top+1)=l+nizs
+ endif
+ if (irecd.eq.1) then
+ top2=top2 + 1
+ lstk(top2)=lstk(top+1)
+ il=iadr(lstk(top2))
+ istk(il)=1
+ istk(il+1)=1
+ istk(il+2)=ndzs
+ istk(il+3)=0
+ l=sadr(il+4)
+ call unsfdcopy(ndzs,stk(ldzs) ,1,stk(l),1)
+ lstk(top+1)=l+ndzs
+ endif
+ go to 350
+c
+c commentaires finaux
+ 350 continue
+ if (iarret.eq.1) return
+ if (indopt.gt.0) go to 360
+ if(indopt.eq.0) then
+ call error(131)
+ return
+ elseif(indopt.eq.-7) then
+ call error(134)
+ return
+ elseif (indopt.eq.-14) then
+ call error(133)
+ return
+ elseif(indopt.le.-10) then
+ call error(132)
+ return
+ endif
+
+ 360 continue
+ if(imp.ne.0) then
+ if(indopt.eq.1) then
+ call writebufscioptim(buf,epsg)
+ call msgs(12,0)
+ elseif(indopt.eq.2) then
+ call writebufscioptim(buf,epsg)
+ call msgs(13,0)
+ elseif(indopt.eq.3) then
+ call msgs(14,0)
+ elseif(indopt.eq.4) then
+ call msgs(15,0)
+ elseif(indopt.eq.5) then
+ call msgs(16,0)
+ elseif(indopt.eq.6) then
+ call msgs(17,0)
+ elseif(indopt.eq.7) then
+ call msgs(18,0)
+ elseif(indopt.eq.8) then
+ call msgs(19,0)
+ elseif(indopt.eq.9) then
+ call msgs(20,0)
+ elseif(indopt.ge.10) then
+ call msgs(21,0)
+ endif
+ endif
+ return
+ end
+c --------------------------
diff --git a/modules/optimization/sci_gateway/fortran/sci_f_optim.lo b/modules/optimization/sci_gateway/fortran/sci_f_optim.lo
new file mode 100755
index 000000000..f1b0727db
--- /dev/null
+++ b/modules/optimization/sci_gateway/fortran/sci_f_optim.lo
@@ -0,0 +1,12 @@
+# sci_gateway/fortran/sci_f_optim.lo - a libtool object file
+# Generated by libtool (GNU libtool) 2.4.2
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/sci_f_optim.o'
+
+# Name of the non-PIC object
+non_pic_object=none
+
diff --git a/modules/optimization/sci_gateway/fortran/sci_f_semidef.f b/modules/optimization/sci_gateway/fortran/sci_f_semidef.f
new file mode 100755
index 000000000..04b90bef1
--- /dev/null
+++ b/modules/optimization/sci_gateway/fortran/sci_f_semidef.f
@@ -0,0 +1,214 @@
+c Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+c Copyright (C) INRIA
+c
+c This file must be used under the terms of the CeCILL.
+c This source file is licensed as described in the file COPYING, which
+c you should have received as part of this distribution. The terms
+c are also available at
+c http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+c
+c --------------------------
+c SCILAB function : semidef
+c --------------------------
+ subroutine scisemidef(fname)
+
+ character*(*) fname
+ INCLUDE 'stack.h'
+ double precision abstol,reltol,nu,tv
+ integer sz,upsz
+ integer iadr, sadr
+
+ iadr(l)=l+l-1
+ sadr(l)=(l/2)+1
+
+
+ lw = lstk(top+1)
+ l0 = lstk(top+1-rhs)
+ if (rhs .ne. 6) then
+ call error(39)
+ return
+ endif
+ if (lhs .gt. 4) then
+ call error(41)
+ return
+ endif
+c checking variable x (number 1)
+c
+ il1 = iadr(lstk(top-rhs+1))
+ if (istk(il1) .ne. 1) then
+ err = 1
+ call error(53)
+ return
+ endif
+ m = istk(il1+1)*istk(il1+2)
+ l1 = sadr(il1+4)
+c checking variable Z (number 2)
+c
+ il2 = iadr(lstk(top-rhs+2))
+ if (istk(il2) .ne. 1) then
+ err = 2
+ call error(53)
+ return
+ endif
+ m2 = istk(il2+1)*istk(il2+2)
+ l2 = sadr(il2+4)
+c checking variable F (number 3)
+c
+ il3 = iadr(lstk(top-rhs+3))
+ if (istk(il3) .ne. 1) then
+ err = 3
+ call error(53)
+ return
+ endif
+ m3 = istk(il3+1)*istk(il3+2)
+ l3 = sadr(il3+4)
+c checking variable ind (number 4)
+c
+ il4 = iadr(lstk(top-rhs+4))
+ if (istk(il4) .ne. 1) then
+ err = 4
+ call error(53)
+ return
+ endif
+ m4 = istk(il4+1)*istk(il4+2)
+ l4 = sadr(il4+4)
+c checking variable c (number 5)
+c
+ il5 = iadr(lstk(top-rhs+5))
+ if (istk(il5) .ne. 1) then
+ err = 5
+ call error(53)
+ return
+ endif
+ m5 = istk(il5+1)*istk(il5+2)
+ l5 = sadr(il5+4)
+c checking variable pars (number 6)
+c
+ il6 = iadr(lstk(top-rhs+6))
+ if (istk(il6) .ne. 1) then
+ err = 6
+ call error(53)
+ return
+ endif
+ m6 = istk(il6+1)*istk(il6+2)
+ if (m6 .ne. 5) then
+ err = 6
+ call error(89)
+ return
+ endif
+ l6 = sadr(il6+4)
+ nu=stk(l6)
+ abstol=stk(l6+1)
+ reltol=stk(l6+2)
+ tv=stk(l6+3)
+ iters=stk(l6+4)
+c
+c cross variable size checking
+c
+ if (m .ne. m5) then
+ call error(42)
+ return
+ endif
+ call entier(m4,stk(l4),istk(iadr(l4)))
+ nn8=2
+ lw8=lw
+ lw=lw+nn8
+ n=0
+ sz=0
+ upsz=0
+ maxn=0
+ lind=iadr(l4)
+ do 10 i=0,m4-1
+ indi=istk(lind+i)
+ n=n+indi
+ sz=sz+indi*(indi+1)/2
+ upsz=upsz+indi*indi
+ maxn=max(maxn,indi)
+ 10 continue
+c optimal block size for dgels ????
+ nb=32
+ lwork=(m+2)*sz+upsz+2*n+max(m+sz*nb,3*maxn+maxn*(maxn+1),3*m)
+ nn14=lwork
+ lw14=lw
+ lw=lw+nn14
+ ilw15=iadr(lw)
+ lw=sadr(ilw15+m)
+ err=lw-lstk(bot)
+ if (err .gt. 0) then
+ call error(17)
+ return
+ endif
+c call sp(m, L, F, ind, c, x, Z,
+ call spf(m,m4,stk(l3),istk(iadr(l4)),stk(l5),stk(l1),stk(l2),
+c ul, nu,abstol,reltol,tv,iters,work, lwork,info)
+ & stk(lw8),nu,abstol,reltol,tv,iters,stk(lw14),lwork,
+ & istk(ilw15),info)
+ if(info.lt.0) then
+ call error(230)
+ return
+ endif
+
+c
+ top=top-rhs
+ lw0=lw
+ mv=lw0-l0
+c
+ if(lhs .ge. 1) then
+c
+c output variable: x
+c
+ top=top+1
+ endif
+ if(lhs .ge. 2) then
+c
+c output variable: Z
+c
+ top=top+1
+ endif
+ if(lhs .ge. 3) then
+c
+c output variable: ul
+c
+ top=top+1
+ lw=lstk(top)
+ err=lw+4+nn8-lstk(bot)
+ if (err .gt. 0) then
+ call error(17)
+ return
+ endif
+ ilw=iadr(lw)
+ istk(ilw)=1
+ istk(ilw+1)=1
+ istk(ilw+2)=nn8
+ istk(ilw+3)=0
+ lw=sadr(ilw+4)
+ call unsfdcopy(nn8,stk(lw8),1,stk(lw),1)
+ lw=lw+nn8
+ lstk(top+1)=lw
+ endif
+c
+ if(lhs .ge. 4) then
+c
+c output variable: [info iters]
+c
+ top=top+1
+ lw=lstk(top)
+ err=lw+4+2-lstk(bot)
+ if (err .gt. 0) then
+ call error(17)
+ return
+ endif
+ ilw=iadr(lw)
+ istk(ilw)=1
+ istk(ilw+1)=1
+ istk(ilw+2)=2
+ istk(ilw+3)=0
+ lw=sadr(ilw+4)
+ stk(lw)=info
+ stk(lw+1)=iters
+ lw=lw+2
+ lstk(top+1)=lw
+ endif
+ return
+ end
+c --------------------------
diff --git a/modules/optimization/sci_gateway/fortran/sci_f_semidef.lo b/modules/optimization/sci_gateway/fortran/sci_f_semidef.lo
new file mode 100755
index 000000000..122788b91
--- /dev/null
+++ b/modules/optimization/sci_gateway/fortran/sci_f_semidef.lo
@@ -0,0 +1,12 @@
+# sci_gateway/fortran/sci_f_semidef.lo - a libtool object file
+# Generated by libtool (GNU libtool) 2.4.2
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/sci_f_semidef.o'
+
+# Name of the non-PIC object
+non_pic_object=none
+
diff --git a/modules/optimization/sci_gateway/optimization_gateway.xml b/modules/optimization/sci_gateway/optimization_gateway.xml
new file mode 100755
index 000000000..60f5adf74
--- /dev/null
+++ b/modules/optimization/sci_gateway/optimization_gateway.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2007 - INRIA - Allan CORNET
+ * Copyright (C) 2007 - INRIA - Sylvestre LEDRU
+ *
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+ *
+ -->
+<!DOCTYPE GATEWAY SYSTEM "../../functions/xml/gateway.dtd">
+<GATEWAY name="optimization">
+ <!-- =================== -->
+ <!--
+ Scilab
+ Interface description. In this file, we define the list of the function which
+ will be available into Scilab and the link to the "native" function.
+
+ gatewayId is the position in the hashtable 'Interfaces' defined in the
+ file SCI/modules/core/src/c/callinterf.h
+
+ primitiveId is the position in the hashtable '<module>Table Tab[]' defined
+ in the file modules/<module>/sci_gateway/c/gw_<module>.c
+
+ primitiveName is the name of the Scilab function
+ ===================
+ Don't touch if you do not know what you are doing
+-->
+ <!-- =================== -->
+
+ <PRIMITIVE gatewayId="11" primitiveId="1" primitiveName="optim" />
+ <PRIMITIVE gatewayId="11" primitiveId="2" primitiveName="semidef" />
+ <PRIMITIVE gatewayId="11" primitiveId="3" primitiveName="fsolve" />
+ <PRIMITIVE gatewayId="11" primitiveId="4" primitiveName="lsqrsolve" />
+ <PRIMITIVE gatewayId="11" primitiveId="5" primitiveName="qld" />
+ <PRIMITIVE gatewayId="11" primitiveId="6" primitiveName="qp_solve" />
+ <PRIMITIVE gatewayId="11" primitiveId="7" primitiveName="readmps" />
+</GATEWAY>