differential_equations plugged. 47/5447/10
Cedric Delamarre [Thu, 17 Nov 2011 15:21:10 +0000 (16:21 +0100)]
Change-Id: I90c1b662567a3b3a9e195fd668a6b5e0eab4b3f9

110 files changed:
scilab/CHANGES_6.0.X
scilab/Scilab.sln
scilab/etc/modules.xml.in
scilab/etc/modules.xml.vc
scilab/modules/ast/includes/run_CallExp.hxx
scilab/modules/ast/includes/runvisitor.hxx
scilab/modules/core/includes/callinterf.h
scilab/modules/core/includes/stack-def.h
scilab/modules/core/src/c/callinterf.c
scilab/modules/core/src/c/stack2.c
scilab/modules/differential_equations/Makefile.am
scilab/modules/differential_equations/Makefile.in
scilab/modules/differential_equations/help/en_US/dasrt.xml
scilab/modules/differential_equations/help/en_US/impl.xml
scilab/modules/differential_equations/help/en_US/ode.xml
scilab/modules/differential_equations/help/fr_FR/ode.xml
scilab/modules/differential_equations/help/ja_JP/dasrt.xml
scilab/modules/differential_equations/help/ja_JP/ode.xml
scilab/modules/differential_equations/help/pt_BR/dasrt.xml
scilab/modules/differential_equations/help/pt_BR/ode.xml
scilab/modules/differential_equations/includes/checkodeerror.h [new file with mode: 0644]
scilab/modules/differential_equations/includes/common_structure.h [new file with mode: 0644]
scilab/modules/differential_equations/includes/differential_equations_gw.hxx [new file with mode: 0644]
scilab/modules/differential_equations/includes/differentialequationfunctions.hxx [new file with mode: 0644]
scilab/modules/differential_equations/includes/dynlib_differential_equations_gw.h [new file with mode: 0644]
scilab/modules/differential_equations/includes/gw_differential_equations1.h
scilab/modules/differential_equations/includes/gw_differential_equations2.h
scilab/modules/differential_equations/includes/gw_differential_equations3.h
scilab/modules/differential_equations/includes/gw_differential_equations4.h
scilab/modules/differential_equations/includes/gw_differential_equations6.h
scilab/modules/differential_equations/includes/scifunctions.h [new file with mode: 0644]
scilab/modules/differential_equations/sci_gateway/c/gw_differential_equations1.c
scilab/modules/differential_equations/sci_gateway/c/gw_differential_equations2.c
scilab/modules/differential_equations/sci_gateway/c/gw_differential_equations3.c
scilab/modules/differential_equations/sci_gateway/c/gw_differential_equations4.c
scilab/modules/differential_equations/sci_gateway/c/gw_differential_equations6.c
scilab/modules/differential_equations/sci_gateway/cpp/sci_bvode.cpp [new file with mode: 0644]
scilab/modules/differential_equations/sci_gateway/cpp/sci_dasrt.cpp [new file with mode: 0644]
scilab/modules/differential_equations/sci_gateway/cpp/sci_dassl.cpp [new file with mode: 0644]
scilab/modules/differential_equations/sci_gateway/cpp/sci_feval.cpp [new file with mode: 0644]
scilab/modules/differential_equations/sci_gateway/cpp/sci_impl.cpp [new file with mode: 0644]
scilab/modules/differential_equations/sci_gateway/cpp/sci_int2d.cpp [new file with mode: 0644]
scilab/modules/differential_equations/sci_gateway/cpp/sci_int3d.cpp [new file with mode: 0644]
scilab/modules/differential_equations/sci_gateway/cpp/sci_intg.cpp [new file with mode: 0644]
scilab/modules/differential_equations/sci_gateway/cpp/sci_intg2.cpp [new file with mode: 0644]
scilab/modules/differential_equations/sci_gateway/cpp/sci_ode.cpp [new file with mode: 0644]
scilab/modules/differential_equations/sci_gateway/cpp/sci_odedc.cpp [new file with mode: 0644]
scilab/modules/differential_equations/sci_gateway/differential_equations_f_Import.def [new file with mode: 0644]
scilab/modules/differential_equations/sci_gateway/differential_equations_gateway.xml
scilab/modules/differential_equations/sci_gateway/differential_equations_gw.vcxproj [new file with mode: 0644]
scilab/modules/differential_equations/sci_gateway/differential_equations_gw.vcxproj.filters [new file with mode: 0644]
scilab/modules/differential_equations/src/c/DllmainDifferential_equations.c
scilab/modules/differential_equations/src/c/differential_equations.vcxproj
scilab/modules/differential_equations/src/c/differential_equations.vcxproj.filters
scilab/modules/differential_equations/src/c/differential_equations_f_Import.def
scilab/modules/differential_equations/src/c/feval.c
scilab/modules/differential_equations/src/c/feval.h
scilab/modules/differential_equations/src/cpp/checkodeerror.cpp [new file with mode: 0644]
scilab/modules/differential_equations/src/cpp/differentialequationfunctions.cpp [new file with mode: 0644]
scilab/modules/differential_equations/src/cpp/scifunctions.cpp [new file with mode: 0644]
scilab/modules/differential_equations/src/fortran/differential_equations_Import.def
scilab/modules/differential_equations/src/fortran/differential_equations_f.vfproj
scilab/modules/differential_equations/src/fortran/intdy.f
scilab/modules/differential_equations/src/fortran/lsoda.f
scilab/modules/differential_equations/src/fortran/lsodar.f
scilab/modules/differential_equations/src/fortran/lsode.f
scilab/modules/differential_equations/src/fortran/lsodi.f
scilab/modules/differential_equations/src/fortran/prepj.f
scilab/modules/differential_equations/src/fortran/prepji.f
scilab/modules/differential_equations/src/fortran/prja.f
scilab/modules/differential_equations/src/fortran/rchek.f
scilab/modules/differential_equations/src/fortran/rchek2.f
scilab/modules/differential_equations/src/fortran/roots.f
scilab/modules/differential_equations/src/fortran/roots2.f
scilab/modules/differential_equations/src/fortran/rscar1.f
scilab/modules/differential_equations/src/fortran/rscma1.f
scilab/modules/differential_equations/src/fortran/rscom1.f
scilab/modules/differential_equations/src/fortran/solsy.f
scilab/modules/differential_equations/src/fortran/stoda.f
scilab/modules/differential_equations/src/fortran/stode.f
scilab/modules/differential_equations/src/fortran/stodi.f
scilab/modules/differential_equations/src/fortran/svcar1.f
scilab/modules/differential_equations/src/fortran/svcma1.f
scilab/modules/differential_equations/src/fortran/svcom1.f
scilab/modules/differential_equations/src/fortran/xerrwv.f
scilab/modules/differential_equations/src/fortran/xsetf.f
scilab/modules/differential_equations/src/fortran/xsetun.f
scilab/modules/differential_equations/tests/unit_tests/bvode.tst
scilab/modules/differential_equations/tests/unit_tests/dae.tst
scilab/modules/differential_equations/tests/unit_tests/dassldasrt.tst
scilab/modules/differential_equations/tests/unit_tests/feval.tst
scilab/modules/differential_equations/tests/unit_tests/impl.tst
scilab/modules/differential_equations/tests/unit_tests/int2d.tst
scilab/modules/differential_equations/tests/unit_tests/matode.tst
scilab/modules/differential_equations/tests/unit_tests/ode.tst
scilab/modules/differential_equations/tests/unit_tests/odedc.tst
scilab/modules/dynamic_link/Makefile.am
scilab/modules/dynamic_link/Makefile.in
scilab/modules/dynamic_link/macros/ilib_gen_loader.sci
scilab/modules/dynamic_link/src/c/GetFunctionByName.c
scilab/modules/functions_manager/includes/dynamic_modules.hxx
scilab/modules/functions_manager/includes/module_declaration.hxx
scilab/modules/functions_manager/src/cpp/dynamic_modules.cpp
scilab/modules/functions_manager/src/cpp/funcmanager.cpp
scilab/modules/system_env/Makefile.am
scilab/modules/system_env/Makefile.in
scilab/modules/system_env/includes/configvariable.hxx
scilab/modules/system_env/src/cpp/configvariable.cpp
scilab/modules/system_env/system_env.vcxproj
scilab/modules/system_env/system_env.vcxproj.filters

index 32aa874..55e5014 100644 (file)
@@ -12,3 +12,9 @@ Removed functions (previously declared as obsolete):
 
 * maxfile function is now obsolete.
 
+Functions modified:
+===================
+
+* impl : Recall impl with the same parameters as in its previous stop is now available.
+* ode  : y0 is restricted to a column vector.
+
index 0396cf2..7a8629e 100644 (file)
@@ -624,6 +624,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ant-all", "Visual-Studio-se
                {DD8A0506-8D31-4CF8-856A-C10ECE9C13A4} = {DD8A0506-8D31-4CF8-856A-C10ECE9C13A4}
        EndProjectSection
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "differential_equations_gw", "modules\differential_equations\sci_gateway\differential_equations_gw.vcxproj", "{99D6BDD6-2226-43A1-B0FA-9D412BBCA6DD}"
+EndProject
 Global
        GlobalSection(SolutionConfigurationPlatforms) = preSolution
                Debug|Win32 = Debug|Win32
@@ -1904,6 +1906,14 @@ Global
                {A9A2020D-5541-44F2-B080-DF3C9426C409}.Release|Win32.Build.0 = Release|Win32
                {A9A2020D-5541-44F2-B080-DF3C9426C409}.Release|x64.ActiveCfg = Release|x64
                {A9A2020D-5541-44F2-B080-DF3C9426C409}.Release|x64.Build.0 = Release|x64
+               {99D6BDD6-2226-43A1-B0FA-9D412BBCA6DD}.Debug|Win32.ActiveCfg = Debug|Win32
+               {99D6BDD6-2226-43A1-B0FA-9D412BBCA6DD}.Debug|Win32.Build.0 = Debug|Win32
+               {99D6BDD6-2226-43A1-B0FA-9D412BBCA6DD}.Debug|x64.ActiveCfg = Debug|x64
+               {99D6BDD6-2226-43A1-B0FA-9D412BBCA6DD}.Debug|x64.Build.0 = Debug|x64
+               {99D6BDD6-2226-43A1-B0FA-9D412BBCA6DD}.Release|Win32.ActiveCfg = Release|Win32
+               {99D6BDD6-2226-43A1-B0FA-9D412BBCA6DD}.Release|Win32.Build.0 = Release|Win32
+               {99D6BDD6-2226-43A1-B0FA-9D412BBCA6DD}.Release|x64.ActiveCfg = Release|x64
+               {99D6BDD6-2226-43A1-B0FA-9D412BBCA6DD}.Release|x64.Build.0 = Release|x64
        EndGlobalSection
        GlobalSection(SolutionProperties) = preSolution
                HideSolutionNode = FALSE
index c0f447b..467e6c2 100644 (file)
@@ -44,5 +44,6 @@
     <module name="signal_processing" activate="yes"/>
     <module name="linear_algebra" activate="yes"/>
     <module name="statistics" activate="yes"/>
+    <module name="differential_equations" activate="yes"/>
 </modules>
 
index a7ad3e2..d3373a9 100644 (file)
@@ -45,5 +45,6 @@
     <module name="signal_processing" activate="yes"/>
     <module name="linear_algebra" activate="yes"/>
     <module name="statistics" activate="yes"/>
+    <module name="differential_equations" activate="yes"/>
 </modules>
 
index 4375c08..37f2bd9 100644 (file)
@@ -18,6 +18,7 @@
 
 void visitprivate(const CallExp &e)
 {
+    wchar_t pwstLog[200];
     std::list<Exp *>::const_iterator   itExp;
 
     e.name_get().accept(*this);
@@ -28,8 +29,23 @@ void visitprivate(const CallExp &e)
         types::typed_list out;
         types::typed_list in;
 
+        //iLevel++;
+        //for(int i = 0 ; i < iLevel ; i++)
+        //{
+        //    scilabForcedWriteW(L"\t");
+        //}
+        //os_swprintf(pwstLog, 200, L"************  DEBUT %s ***************\n", pCall->getName().c_str());
+        //scilabForcedWriteW(pwstLog);
+
         int iRetCount = expected_getSize();
 
+        //for(int i = 0 ; i < iLevel ; i++)
+        //{
+        //    scilabForcedWriteW(L"\t");
+        //}
+        //os_swprintf(pwstLog, 200, L"expected_getSize : %d\n", expected_getSize());
+        //scilabForcedWriteW(pwstLog);
+
         //get function arguments
         for (itExp = e.args_get().begin (); itExp != e.args_get().end (); ++itExp)
         {
@@ -73,14 +89,46 @@ void visitprivate(const CallExp &e)
             }
         }
 
+        //for(int i = 0 ; i < iLevel ; i++)
+        //{
+        //    scilabForcedWriteW(L"\t");
+        //}
+        //os_swprintf(pwstLog, 200, L"After inputs %d\n", expected_getSize());
+        //scilabForcedWriteW(pwstLog);
+
         ////reset result
         //result_clear();
 
         try
         {
-            expected_size_set(iRetCount);
+            int iSaveExpectedSize = iRetCount;
+            expected_size_set(iSaveExpectedSize);
             iRetCount = Max(1, iRetCount);
+
+            //for(int i = 0 ; i < iLevel ; i++)
+            //{
+            //    scilabForcedWriteW(L"\t");
+            //}
+            //os_swprintf(pwstLog, 200, L"Before call : %d\n", expected_getSize());
+            //scilabForcedWriteW(pwstLog);
+
             types::Function::ReturnValue Ret = pCall->call(in, iRetCount, out, this);
+            expected_size_set(iSaveExpectedSize);
+
+            //for(int i = 0 ; i < iLevel ; i++)
+            //{
+            //    scilabForcedWriteW(L"\t");
+            //}
+            //os_swprintf(pwstLog, 200, L"After call : %d\n", expected_getSize());
+            //scilabForcedWriteW(pwstLog);
+
+            //for(int i = 0 ; i < iLevel ; i++)
+            //{
+            //    scilabForcedWriteW(L"\t");
+            //}
+            //os_swprintf(pwstLog, 200, L"************  FIN %s ***************\n\n\n", pCall->getName().c_str());
+            //scilabForcedWriteW(pwstLog);
+            //iLevel--;
             //reset result
             result_clear();
             if(Ret == types::Callable::OK)
index 1cba80f..d236411 100644 (file)
@@ -1010,28 +1010,22 @@ namespace ast
 
                             try
                             {
+                                //in this case of calling, we can return only one values
+                                int iSaveExpectedSize = expected_getSize();
+                                expected_size_set(1);
                                 Function::ReturnValue Ret = pCall->call(in, expected_getSize(), out, this);
-
+                                expected_size_set(iSaveExpectedSize);
+            
                                 if(Ret == Callable::OK)
                                 {
                                     if(out.size() == 0)
                                     {
                                         result_set(NULL);
                                     }
-                                    else if(out.size() == 1)
-                                    {
-                                        out[0]->DecreaseRef();
-                                        result_set(out[0]);
-                                    }
                                     else
                                     {
-                                        for(int i = 0 ; i < static_cast<int>(out.size()) ; i++)
-                                        {
-                                            out[i]->DecreaseRef();
-                                            result_set(i, out[i]);
-                                        }
+                                        result_set(out[0]);
                                     }
-
                                     bImplicitCall = true;
                                 }
                                 else if(Ret == Callable::Error)
index 013eaa1..16b7d18 100644 (file)
@@ -32,7 +32,7 @@
 /* 09 */                                               #include "../../cacsd/includes/gw_cacsd1.h"
 /* 10 */                                               #include "../../cacsd/includes/gw_cacsd2.h"
 /* 11 */                                               #include "dynamic_gateways.h" /* optimization */
-/* 12 */                                               #include "../../differential_equations/includes/gw_differential_equations1.h"
+/* 12 *///                                             #include "../../differential_equations/includes/gw_differential_equations1.h"
 /* 13 */                                               #include "gw_core.h"
 /* 14  gw_user(); RESERVED to gw_user (see callinter.h) */
 /* 15  gw_user(); FREE */
 /* 24  gw_user2(); RESERVED to gw_user (see callinter.h) */
                                 #include "gw_user2.h"
 /* 25 */                                               #include "../../gui/includes/gw_gui.h"
-/* 26 */                                               #include "../../differential_equations/includes/gw_differential_equations2.h"
+/* 26 *///                                             #include "../../differential_equations/includes/gw_differential_equations2.h"
 /* 27 */                                               #include "../../sparse/includes/gw_sparse.h"
 /* 28 */                                               #include "../../cacsd/includes/gw_slicot.h"
-/* 29 */                                               #include "../../differential_equations/includes/gw_differential_equations3.h"
-/* 30 */                                               #include "../../differential_equations/includes/gw_differential_equations4.h"
+/* 29 *///                                             #include "../../differential_equations/includes/gw_differential_equations3.h"
+/* 30 *///                                             #include "../../differential_equations/includes/gw_differential_equations4.h"
 /* 31 */                                       #include "dynamic_gateways.h"   /* functions */
-/* 32 */                                               #include "../../differential_equations/includes/gw_differential_equations6.h"
+/* 32 *///                                             #include "../../differential_equations/includes/gw_differential_equations6.h"
 /* 33 */                        #include "../../output_stream/includes/gw_output_stream.h"
 /* 34 */                                               #include "../../fileio/includes/gw_fileio.h"
 /* 35 */                                               #include "dynamic_gateways.h" /* arnoldi */
index e8ef2d0..6a3e109 100644 (file)
@@ -262,7 +262,7 @@ typedef struct {
        int nge; /**< @TODO : add comment */
 } LSR001_struct;
 
-IMPORT LSR001_struct C2F(lsr001);
+//IMPORT LSR001_struct C2F(lsr001);
 
 /**
  * @TODO : add comment 
@@ -317,7 +317,7 @@ typedef struct {
        int nqu; /**< @TODO : add comment */
 } LS0001_struct;
 
-IMPORT LS0001_struct C2F(ls0001);
+//IMPORT LS0001_struct C2F(ls0001);
 
 
 /**
@@ -337,9 +337,13 @@ typedef struct {
        int mxords; /**< @TODO : add comment */
 } LSA001_struct;
 
-IMPORT LSA001_struct C2F(lsa001);
+//IMPORT LSA001_struct C2F(lsa001);
 
+typedef struct {
+    int mesflg, lunit;
+} EH0001_struct;
 
+//IMPORT EH0001_struct C2F(eh0001);
 
 /**
  * @TODO : add comment 
index 2aba8ce..ac57bba 100644 (file)
@@ -47,7 +47,7 @@ static OpTab Interfaces[INTERFACES_MAX] = {
     /* 09  */ {gw_cacsd1},
     /* 10  */ {gw_cacsd2},
     /* 11  */ {gw_dynamic_optimization},
-    /* 12  */ {gw_differential_equations1},
+    /* 12  */ {NULL}, //gw_differential_equations1
     /* 13  */ {gw_core},
     /* 14  */ {gw_user}, /* RESERVED (see callinter.h) */
     /* 15  */ {gw_user}, /* free position may be used */
@@ -61,13 +61,13 @@ static OpTab Interfaces[INTERFACES_MAX] = {
     /* 23  */ {NULL}, //gw_boolean
     /* 24  */ {gw_user2}, /* RESERVED (see callinter.h) */
     /* 25  */ {gw_gui},
-    /* 26  */ {gw_differential_equations2},
+    /* 26  */ {NULL}, //gw_differential_equations2
     /* 27  */ {gw_sparse},
     /* 28  */ {gw_slicot},
-    /* 29  */ {gw_differential_equations3},
-    /* 30  */ {gw_differential_equations4},
+    /* 29  */ {NULL}, //gw_differential_equations3
+    /* 30  */ {NULL}, //gw_differential_equations4
     /* 31  */ {NULL}, //gw_dynamic_functions
-    /* 32  */ {gw_differential_equations6},
+    /* 32  */ {NULL}, //gw_differential_equations6
     /* 33  */ {gw_output_stream},
     /* 34  */ {gw_fileio},
     /* 35  */ {gw_dynamic_arnoldi},
index aa46c42..f6a7961 100644 (file)
@@ -1335,232 +1335,7 @@ int C2F(getmatdims) (int *number, int *m, int *n)
 
 int C2F(getrhsvar) (int *number, char *typex, int *m, int *n, int *lr, unsigned long type_len)
 {
-    int ierr = 0, il1 = 0, ild1 = 0, nn = 0;
-    int lrr = 0;
-    char *fname = Get_Iname();
-    char **items = NULL, namex[nlgh + 1];
-    unsigned char Type = *(unsigned char *)typex;
-    int topk = 0, ltype = 0, m1 = 0, n1 = 0, lc = 0, lr1 = 0, it = 0, lw = 0, ile = 0, ils = 0, ix1 = 0, ix2 = 0;
-    int mnel = 0, icol = 0;
-    SciSparse *Sp = NULL;
-    SciIntMat *Im = NULL;
-
-    /* we accept a call to getrhsvar after a createvarfromptr call */
-    if (*number > Rhs && *number > Nbvars)
-    {
-        Scierror(999, _("%s: bad call to %s! (1rst argument).\n"), fname, "getrhsvar");
-        return FALSE;
-    }
-
-    Nbvars = Max(Nbvars, *number);
-    lw = *number + Top - Rhs;
-
-    if (*number > intersiz)
-    {
-        Scierror(999, _("%s: (%s) too many arguments in the stack edit stack.h and enlarge intersiz.\n"), fname, "getrhsvar");
-        return FALSE;
-    }
-
-    if (overloadtype(&lw, fname, &Type) == 0)
-        return FALSE;
-
-    topk = Top;
-    switch (Type)
-    {
-    case 'c':
-        *n = 1;
-        if (!C2F(getsmat) (fname, &topk, &lw, &m1, &n1, &cx1, &cx1, lr, m, nlgh))
-        {
-            return FALSE;
-        }
-
-        if ((m1 != 1) || (n1 != 1))
-        {
-            /* bug 8768 check dimensions */
-            Scierror(999, _("%s: Wrong size for input argument #%d: A string expected.\n"), fname, *number);
-            return FALSE;
-        }
-
-        ix2 = *m * *n;
-        /* in case where ix2 is 0 in2str adds the \0 char after the end of
-         * the storage of the variable, so it writes over the next variable
-         * tp avoid this pb we shift up by one the location where the
-         * data is written */
-        lrr = *lr;
-        if (ix2 == 0)
-            lrr--;
-
-        C2F(in2str) (&ix2, istk(*lr), cstk(cadr(*lr)), ix2 + 1);
-        *lr = cadr(*lr);
-        C2F(intersci).ntypes[*number - 1] = Type;
-        C2F(intersci).iwhere[*number - 1] = *Lstk(lw);
-        C2F(intersci).lad[*number - 1] = *lr;
-        break;
-
-    case 'd':
-        if (!C2F(getmat) (fname, &topk, &lw, &it, m, n, lr, &lc, nlgh))
-            return FALSE;
-        C2F(intersci).ntypes[*number - 1] = Type;
-        C2F(intersci).iwhere[*number - 1] = *Lstk(lw);
-        C2F(intersci).lad[*number - 1] = *lr;
-        break;
-    case 'z':
-        if (!C2F(getmat) (fname, &topk, &lw, &it, m, n, lr, &lc, nlgh))
-            return FALSE;
-        ix2 = *m * *n;
-        if ((it != 1) && (ix2 != 0))
-        {
-            Scierror(999, _("%s: Wrong type for argument: Complex expected.\n"), fname);
-            return FALSE;
-        };
-        if (!(*lr % 2))
-        {                       /* bad adress (lr is even) shift up the stack */
-            double2z(stk(*lr), stk(*lr) - 1, ix2, ix2);
-            *istk(iadr(*lr) - 4) = 133;
-            *istk(iadr(*lr) - 3) = iadr(*lr + 2 * ix2 - 1);
-            *istk(iadr(*lr + 2 * ix2 - 1)) = *m;
-            *istk(iadr(*lr + 2 * ix2 - 1) + 1) = *n;
-            C2F(intersci).ntypes[*number - 1] = Type;
-            C2F(intersci).iwhere[*number - 1] = *Lstk(lw);
-            C2F(intersci).lad[*number - 1] = *lr - 1;
-            *lr = sadr(*lr - 1);
-        }
-        else
-        {
-            SciToF77(stk(*lr), ix2, ix2);
-            C2F(intersci).ntypes[*number - 1] = Type;
-            C2F(intersci).iwhere[*number - 1] = *Lstk(lw);
-            C2F(intersci).lad[*number - 1] = *lr;
-            *lr = sadr(*lr);
-        };
-        break;
-    case 'r':
-        if (!C2F(getmat) (fname, &topk, &lw, &it, m, n, lr, &lc, nlgh))
-            return FALSE;
-        ix1 = *m * *n;
-        C2F(simple) (&ix1, stk(*lr), sstk(iadr(*lr)));
-        *lr = iadr(*lr);
-        C2F(intersci).ntypes[*number - 1] = Type;
-        C2F(intersci).iwhere[*number - 1] = *Lstk(lw);
-        C2F(intersci).lad[*number - 1] = *lr;
-        break;
-    case 'i':
-        if (!C2F(getmat) (fname, &topk, &lw, &it, m, n, lr, &lc, nlgh))
-            return FALSE;
-        ix1 = *m * *n;
-        C2F(entier) (&ix1, stk(*lr), istk(iadr(*lr)));
-        *lr = iadr(*lr);
-        C2F(intersci).ntypes[*number - 1] = Type;
-        C2F(intersci).iwhere[*number - 1] = *Lstk(lw);
-        C2F(intersci).lad[*number - 1] = *lr;
-        break;
-    case 'b':
-        if (!C2F(getbmat) (fname, &topk, &lw, m, n, lr, nlgh))
-            return FALSE;
-        C2F(intersci).ntypes[*number - 1] = Type;
-        C2F(intersci).iwhere[*number - 1] = *Lstk(lw);
-        C2F(intersci).lad[*number - 1] = *lr;
-        break;
-    case 'l':
-    case 't':
-    case 'm':
-        *n = 1;
-        if (!C2F(getilist) (fname, &topk, &lw, m, n, lr, nlgh))
-            return FALSE;
-        /* No data conversion for list members ichar(type)='$' */
-        Type = '$';
-        C2F(intersci).ntypes[*number - 1] = Type;
-        C2F(intersci).iwhere[*number - 1] = *Lstk(lw);
-        C2F(intersci).lad[*number - 1] = *lr;
-        break;
-    case 'S':
-        /** getwsmat : must be back in stack1.c from xawelm.f */
-        if (!C2F(getwsmat) (fname, &topk, &lw, m, n, &il1, &ild1, nlgh))
-            return FALSE;
-        nn = (*m) * (*n);
-        ScilabMStr2CM(istk(il1), &nn, istk(ild1), &items, &ierr);
-        if (ierr == 1)
-            return FALSE;
-        Type = '$';
-        /*
-         * Warning : lr must have the proper size when calling getrhsvar
-         * char **Str1; .... GetRhsVar(...., &lr)
-         */
-        *((char ***)lr) = items;
-        C2F(intersci).ntypes[*number - 1] = Type;
-        C2F(intersci).iwhere[*number - 1] = *Lstk(lw);
-        C2F(intersci).lad[*number - 1] = *lr;
-        break;
-    case 's':
-        /* sparse matrices */
-        Sp = (SciSparse *) lr;
-        if (!C2F(getsparse) (fname, &topk, &lw, &it, m, n, &(Sp->nel), &mnel, &icol, &lr1, &lc, nlgh))
-            return FALSE;
-        Sp->m = *m;
-        Sp->n = *n;
-        Sp->it = it;
-        Sp->mnel = istk(mnel);
-        Sp->icol = istk(icol);
-        Sp->R = stk(lr1);
-        Sp->I = (it == 1) ? stk(lc) : NULL;
-        Type = '$';
-        C2F(intersci).ntypes[*number - 1] = Type;
-        C2F(intersci).iwhere[*number - 1] = *Lstk(lw);
-        C2F(intersci).lad[*number - 1] = *lr;
-        break;
-    case 'I':
-        /* int matrices */
-        Im = (SciIntMat *) lr;
-        if (!C2F(getimat) (fname, &topk, &lw, &it, m, n, &lr1, nlgh))
-            return FALSE;
-        Im->m = *m;
-        Im->n = *n;
-        Im->it = it;
-        Im->l = lr1;
-        Im->D = istk(lr1);
-        Type = '$';
-        C2F(intersci).ntypes[*number - 1] = Type;
-        C2F(intersci).iwhere[*number - 1] = *Lstk(lw);
-        C2F(intersci).lad[*number - 1] = *lr;
-        break;
-    case 'f':
-        /* XXXXXX : gros bug ici car getexternal a besoin de savoir
-         * pour quelle fonction on recupere un external
-         * or ici on presuppose que c'est setfeval
-         * de plus on ne sait pas exactement de quel type d'external il s'agit
-         */
-
-        /*      int function getrhsvar(number,type,m,n,lr) */
-        *lr = *Lstk(lw);
-        ils = iadr(*lr) + 1;
-        *m = *istk(ils);
-        ile = ils + *m * nsiz + 1;
-        *n = *istk(ile);
-        if (!C2F(getexternal) (fname, &topk, &lw, namex, &ltype, C2F(setfeval), nlgh, nlgh))
-        {
-            return FALSE;
-        }
-        Type = '$';
-        C2F(intersci).ntypes[*number - 1] = Type;
-        C2F(intersci).iwhere[*number - 1] = *Lstk(lw);
-        C2F(intersci).lad[*number - 1] = *lr;
-        break;
-    case 'p':
-        if (!C2F(getpointer) (fname, &topk, &lw, lr, nlgh))
-            return FALSE;
-        C2F(intersci).ntypes[*number - 1] = Type;
-        C2F(intersci).iwhere[*number - 1] = *Lstk(lw);
-        C2F(intersci).lad[*number - 1] = *lr;
-        break;
-    case 'h':
-        if (!C2F(gethmat) (fname, &topk, &lw, m, n, lr, nlgh))
-            return FALSE;
-        C2F(intersci).ntypes[*number - 1] = Type;
-        C2F(intersci).iwhere[*number - 1] = *Lstk(lw);
-        C2F(intersci).lad[*number - 1] = *lr;
-        break;
-    }
-    return TRUE;
+    return FALSE;
 }
 
 /*---------------------------------------------------------------------
index 44b0d7e..5294eef 100644 (file)
@@ -3,22 +3,20 @@
 #
 # This file is distributed under the same license as the Scilab package.
 
+DIFFERENTIAL_EQUATIONS_CPP_SOURCES = \
+src/cpp/scifunctions.cpp \
+src/cpp/checkodeerror.cpp \
+src/cpp/differentialequationfunctions.cpp
 
-DIFFERENTIAL_EQUATIONS_C_SOURCES = src/c/dassl.c \
+
+DIFFERENTIAL_EQUATIONS_C_SOURCES = \
+src/c/dassl.c \
 src/c/feval.c \
-src/c/fevaltable.c \
-src/c/fydottable.c \
-src/c/impltable.c \
-src/c/colnewtable.c \
-src/c/intgtable.c \
-src/c/int2dtable.c \
-src/c/int3dtable.c \
-src/c/fydot2table.c \
-src/c/dassltable.c \
 src/c/arnol.c \
 src/c/rk4.c
 
-DIFFERENTIAL_EQUATIONS_FORTRAN_SOURCES = src/fortran/rscar1.f \
+DIFFERENTIAL_EQUATIONS_FORTRAN_SOURCES = \
+src/fortran/rscar1.f \
 src/fortran/bcomp.f \
 src/fortran/lcomp.f \
 src/fortran/loren.f \
@@ -76,45 +74,7 @@ src/fortran/odeint.f \
 src/fortran/rkqc.f \
 src/fortran/writbufode.f
 
-GATEWAY_C_SOURCES = \
-sci_gateway/c/sci_int2d.c \
-sci_gateway/c/sci_int3d.c \
-sci_gateway/c/sci_intg.c \
-sci_gateway/c/sci_ode.c \
-sci_gateway/c/sci_odc.c \
-sci_gateway/c/sci_feval.c \
-sci_gateway/c/gw_differential_equations1.c \
-sci_gateway/c/gw_differential_equations2.c \
-sci_gateway/c/gw_differential_equations3.c \
-sci_gateway/c/gw_differential_equations4.c \
-sci_gateway/c/sci_bvode.c \
-sci_gateway/c/gw_differential_equations6.c
-
 GATEWAY_FORTRAN_SOURCES = \
-sci_gateway/fortran/sci_f_dasrt.f \
-sci_gateway/fortran/sci_f_feval.f \
-sci_gateway/fortran/sci_f_odedc.f \
-sci_gateway/fortran/sci_f_bvode.f \
-sci_gateway/fortran/sci_f_impl.f \
-sci_gateway/fortran/sci_f_dassl.f \
-sci_gateway/fortran/sci_f_ode.f \
-sci_gateway/fortran/bsurf.f \
-sci_gateway/fortran/bsurfd.f \
-sci_gateway/fortran/bydot.f \
-sci_gateway/fortran/bydot2.f \
-sci_gateway/fortran/bresd.f \
-sci_gateway/fortran/bresid.f \
-sci_gateway/fortran/bjac.f \
-sci_gateway/fortran/bjacd.f \
-sci_gateway/fortran/badd.f \
-sci_gateway/fortran/bj2.f \
-sci_gateway/fortran/bfeval.f \
-sci_gateway/fortran/int2d.f \
-sci_gateway/fortran/bint2d.f \
-sci_gateway/fortran/bint3d.f \
-sci_gateway/fortran/bintg.f \
-sci_gateway/fortran/int3d.f \
-sci_gateway/fortran/intg.f \
 sci_gateway/fortran/Ex-odedc.f \
 sci_gateway/fortran/Ex-ode.f \
 sci_gateway/fortran/Ex-impl.f \
@@ -123,19 +83,45 @@ sci_gateway/fortran/Ex-int3d.f \
 sci_gateway/fortran/Ex-intg.f \
 sci_gateway/fortran/Ex-dasrt.f \
 sci_gateway/fortran/Ex-dassl.f \
-sci_gateway/fortran/Ex-bvode.f \
-sci_gateway/fortran/bbvode.f
-
-
-libscidifferential_equations_la_CFLAGS=        -I$(srcdir)/includes/ \
-                                               -I$(top_srcdir)/modules/output_stream/includes \
-                                               -I$(top_srcdir)/modules/dynamic_link/includes \
-                                               -I$(top_srcdir)/modules/elementary_functions/includes \
-                                               -I$(top_srcdir)/modules/api_scilab/includes \
-                                               -I$(top_srcdir)/modules/operations/includes
-                                               -I$(top_srcdir)/modules/api_scilab/includes \
-                                               -I$(top_srcdir)/modules/elementary_functions/includes \
-                                               -I$(top_srcdir)/modules/dynamic_link/includes
+sci_gateway/fortran/Ex-bvode.f
+
+GATEWAY_CPP_SOURCES = \
+sci_gateway/cpp/sci_int2d.cpp \
+sci_gateway/cpp/sci_int3d.cpp \
+sci_gateway/cpp/sci_intg.cpp \
+sci_gateway/cpp/sci_ode.cpp \
+sci_gateway/cpp/sci_odedc.cpp \
+sci_gateway/cpp/sci_feval.cpp \
+sci_gateway/cpp/sci_bvode.cpp \
+sci_gateway/cpp/sci_impl.cpp \
+sci_gateway/cpp/sci_dassl.cpp \
+sci_gateway/cpp/sci_dasrt.cpp
+
+libscidifferential_equations_la_CFLAGS= \
+-I$(srcdir)/includes/ \
+-I$(top_srcdir)/modules/output_stream/includes \
+-I$(top_srcdir)/modules/dynamic_link/includes \
+-I$(top_srcdir)/modules/elementary_functions/includes \
+-I$(top_srcdir)/modules/api_scilab/includes \
+-I$(top_srcdir)/modules/operations/includes
+
+libscidifferential_equations_la_CPPFLAGS= \
+-I$(srcdir)/includes/ \
+-I$(srcdir)/src/cpp/ \
+-I$(srcdir)/src/c/ \
+-I$(top_srcdir)/modules/output_stream/includes \
+-I$(top_srcdir)/modules/api_scilab/includes \
+-I$(top_srcdir)/modules/dynamic_link/includes \
+-I$(top_srcdir)/modules/symbol/includes \
+-I$(top_srcdir)/modules/ast/includes \
+-I$(top_srcdir)/modules/threads/includes \
+-I$(top_srcdir)/modules/operations/includes \
+-I$(top_srcdir)/modules/system_env/includes \
+-I$(top_srcdir)/modules/string/includes \
+-I$(top_srcdir)/modules/elementary_functions/includes \
+-I$(top_srcdir)/libs/dynamiclibrary/includes \
+-I$(top_srcdir)/modules/types/includes \
+$(EIGEN_CPPFLAGS)
 
 
 if MAINTAINER_MODE
@@ -148,12 +134,13 @@ endif
 
 libscidifferential_equations_la_LDFLAGS = -version-number $(SCILAB_LIBRARY_VERSION)
 
-libscidifferential_equations_algo_la_SOURCES = $(DIFFERENTIAL_EQUATIONS_C_SOURCES) $(DIFFERENTIAL_EQUATIONS_FORTRAN_SOURCES)
-libscidifferential_equations_la_SOURCES = $(GATEWAY_C_SOURCES) $(GATEWAY_FORTRAN_SOURCES)
+libscidifferential_equations_algo_la_SOURCES = $(DIFFERENTIAL_EQUATIONS_C_SOURCES) $(DIFFERENTIAL_EQUATIONS_FORTRAN_SOURCES) $(DIFFERENTIAL_EQUATIONS_CPP_SOURCES)
+libscidifferential_equations_la_SOURCES = $(GATEWAY_FORTRAN_SOURCES) $(GATEWAY_CPP_SOURCES)
 libscidifferential_equations_algo_la_CFLAGS = $(libscidifferential_equations_la_CFLAGS)
+libscidifferential_equations_algo_la_CPPFLAGS = $(libscidifferential_equations_la_CPPFLAGS)
 
 # For the code check (splint)
-CHECK_SRC= $(DIFFERENTIAL_EQUATIONS_C_SOURCES) $(GATEWAY_C_SOURCES)
+CHECK_SRC= $(DIFFERENTIAL_EQUATIONS_C_SOURCES) $(DIFFERENTIAL_EQUATIONS_CPP_SOURCES)
 INCLUDE_FLAGS = $(libscidifferential_equations_la_CFLAGS)
 
 libscidifferential_equations_la_LIBADD = libscidifferential_equations-algo.la
index 719cd93..a067044 100644 (file)
@@ -112,15 +112,6 @@ LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkglib_LTLIBRARIES)
 libscidifferential_equations_algo_la_LIBADD =
 am__objects_1 = libscidifferential_equations_algo_la-dassl.lo \
        libscidifferential_equations_algo_la-feval.lo \
-       libscidifferential_equations_algo_la-fevaltable.lo \
-       libscidifferential_equations_algo_la-fydottable.lo \
-       libscidifferential_equations_algo_la-impltable.lo \
-       libscidifferential_equations_algo_la-colnewtable.lo \
-       libscidifferential_equations_algo_la-intgtable.lo \
-       libscidifferential_equations_algo_la-int2dtable.lo \
-       libscidifferential_equations_algo_la-int3dtable.lo \
-       libscidifferential_equations_algo_la-fydot2table.lo \
-       libscidifferential_equations_algo_la-dassltable.lo \
        libscidifferential_equations_algo_la-arnol.lo \
        libscidifferential_equations_algo_la-rk4.lo
 am__objects_2 = rscar1.lo bcomp.lo lcomp.lo loren.lo prja.lo vnorm.lo \
@@ -133,40 +124,36 @@ am__objects_2 = rscar1.lo bcomp.lo lcomp.lo loren.lo prja.lo vnorm.lo \
        prepj.lo lsdisc.lo fnorm.lo ddasrt.lo stodi.lo xsetun.lo \
        intdy.lo ewset.lo roots2.lo prepji.lo svcma1.lo lsrgk.lo \
        odeint.lo rkqc.lo writbufode.lo
+am__objects_3 = libscidifferential_equations_algo_la-scifunctions.lo \
+       libscidifferential_equations_algo_la-checkodeerror.lo \
+       libscidifferential_equations_algo_la-differentialequationfunctions.lo
 am_libscidifferential_equations_algo_la_OBJECTS = $(am__objects_1) \
-       $(am__objects_2)
+       $(am__objects_2) $(am__objects_3)
 libscidifferential_equations_algo_la_OBJECTS =  \
        $(am_libscidifferential_equations_algo_la_OBJECTS)
 @MAINTAINER_MODE_FALSE@am_libscidifferential_equations_algo_la_rpath =
 @MAINTAINER_MODE_TRUE@am_libscidifferential_equations_algo_la_rpath =
 libscidifferential_equations_la_DEPENDENCIES =  \
        libscidifferential_equations-algo.la
-am__objects_3 = libscidifferential_equations_la-sci_int2d.lo \
+am__objects_4 = Ex-odedc.lo Ex-ode.lo Ex-impl.lo Ex-int2d.lo \
+       Ex-int3d.lo Ex-intg.lo Ex-dasrt.lo Ex-dassl.lo Ex-bvode.lo
+am__objects_5 = libscidifferential_equations_la-sci_int2d.lo \
        libscidifferential_equations_la-sci_int3d.lo \
        libscidifferential_equations_la-sci_intg.lo \
        libscidifferential_equations_la-sci_ode.lo \
-       libscidifferential_equations_la-sci_odc.lo \
+       libscidifferential_equations_la-sci_odedc.lo \
        libscidifferential_equations_la-sci_feval.lo \
-       libscidifferential_equations_la-gw_differential_equations1.lo \
-       libscidifferential_equations_la-gw_differential_equations2.lo \
-       libscidifferential_equations_la-gw_differential_equations3.lo \
-       libscidifferential_equations_la-gw_differential_equations4.lo \
        libscidifferential_equations_la-sci_bvode.lo \
-       libscidifferential_equations_la-gw_differential_equations6.lo
-am__objects_4 = sci_f_dasrt.lo sci_f_feval.lo sci_f_odedc.lo \
-       sci_f_bvode.lo sci_f_impl.lo sci_f_dassl.lo sci_f_ode.lo \
-       bsurf.lo bsurfd.lo bydot.lo bydot2.lo bresd.lo bresid.lo \
-       bjac.lo bjacd.lo badd.lo bj2.lo bfeval.lo int2d.lo bint2d.lo \
-       bint3d.lo bintg.lo int3d.lo intg.lo Ex-odedc.lo Ex-ode.lo \
-       Ex-impl.lo Ex-int2d.lo Ex-int3d.lo Ex-intg.lo Ex-dasrt.lo \
-       Ex-dassl.lo Ex-bvode.lo bbvode.lo
-am_libscidifferential_equations_la_OBJECTS = $(am__objects_3) \
-       $(am__objects_4)
+       libscidifferential_equations_la-sci_impl.lo \
+       libscidifferential_equations_la-sci_dassl.lo \
+       libscidifferential_equations_la-sci_dasrt.lo
+am_libscidifferential_equations_la_OBJECTS = $(am__objects_4) \
+       $(am__objects_5)
 libscidifferential_equations_la_OBJECTS =  \
        $(am_libscidifferential_equations_la_OBJECTS)
-libscidifferential_equations_la_LINK = $(LIBTOOL) --tag=F77 \
-       $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(F77LD) \
-       $(AM_FFLAGS) $(FFLAGS) \
+libscidifferential_equations_la_LINK = $(LIBTOOL) --tag=CXX \
+       $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \
+       $(AM_CXXFLAGS) $(CXXFLAGS) \
        $(libscidifferential_equations_la_LDFLAGS) $(LDFLAGS) -o $@
 @MAINTAINER_MODE_FALSE@am_libscidifferential_equations_la_rpath =
 @MAINTAINER_MODE_TRUE@am_libscidifferential_equations_la_rpath =  \
@@ -184,6 +171,15 @@ CCLD = $(CC)
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
        --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
        $(LDFLAGS) -o $@
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+       $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+       --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+       $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+       --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
+       $(LDFLAGS) -o $@
 F77COMPILE = $(F77) $(AM_FFLAGS) $(FFLAGS)
 LTF77COMPILE = $(LIBTOOL) --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
        --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS)
@@ -459,21 +455,19 @@ top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 yacc_present = @yacc_present@
-DIFFERENTIAL_EQUATIONS_C_SOURCES = src/c/dassl.c \
+DIFFERENTIAL_EQUATIONS_CPP_SOURCES = \
+src/cpp/scifunctions.cpp \
+src/cpp/checkodeerror.cpp \
+src/cpp/differentialequationfunctions.cpp
+
+DIFFERENTIAL_EQUATIONS_C_SOURCES = \
+src/c/dassl.c \
 src/c/feval.c \
-src/c/fevaltable.c \
-src/c/fydottable.c \
-src/c/impltable.c \
-src/c/colnewtable.c \
-src/c/intgtable.c \
-src/c/int2dtable.c \
-src/c/int3dtable.c \
-src/c/fydot2table.c \
-src/c/dassltable.c \
 src/c/arnol.c \
 src/c/rk4.c
 
-DIFFERENTIAL_EQUATIONS_FORTRAN_SOURCES = src/fortran/rscar1.f \
+DIFFERENTIAL_EQUATIONS_FORTRAN_SOURCES = \
+src/fortran/rscar1.f \
 src/fortran/bcomp.f \
 src/fortran/lcomp.f \
 src/fortran/loren.f \
@@ -531,45 +525,7 @@ src/fortran/odeint.f \
 src/fortran/rkqc.f \
 src/fortran/writbufode.f
 
-GATEWAY_C_SOURCES = \
-sci_gateway/c/sci_int2d.c \
-sci_gateway/c/sci_int3d.c \
-sci_gateway/c/sci_intg.c \
-sci_gateway/c/sci_ode.c \
-sci_gateway/c/sci_odc.c \
-sci_gateway/c/sci_feval.c \
-sci_gateway/c/gw_differential_equations1.c \
-sci_gateway/c/gw_differential_equations2.c \
-sci_gateway/c/gw_differential_equations3.c \
-sci_gateway/c/gw_differential_equations4.c \
-sci_gateway/c/sci_bvode.c \
-sci_gateway/c/gw_differential_equations6.c
-
 GATEWAY_FORTRAN_SOURCES = \
-sci_gateway/fortran/sci_f_dasrt.f \
-sci_gateway/fortran/sci_f_feval.f \
-sci_gateway/fortran/sci_f_odedc.f \
-sci_gateway/fortran/sci_f_bvode.f \
-sci_gateway/fortran/sci_f_impl.f \
-sci_gateway/fortran/sci_f_dassl.f \
-sci_gateway/fortran/sci_f_ode.f \
-sci_gateway/fortran/bsurf.f \
-sci_gateway/fortran/bsurfd.f \
-sci_gateway/fortran/bydot.f \
-sci_gateway/fortran/bydot2.f \
-sci_gateway/fortran/bresd.f \
-sci_gateway/fortran/bresid.f \
-sci_gateway/fortran/bjac.f \
-sci_gateway/fortran/bjacd.f \
-sci_gateway/fortran/badd.f \
-sci_gateway/fortran/bj2.f \
-sci_gateway/fortran/bfeval.f \
-sci_gateway/fortran/int2d.f \
-sci_gateway/fortran/bint2d.f \
-sci_gateway/fortran/bint3d.f \
-sci_gateway/fortran/bintg.f \
-sci_gateway/fortran/int3d.f \
-sci_gateway/fortran/intg.f \
 sci_gateway/fortran/Ex-odedc.f \
 sci_gateway/fortran/Ex-ode.f \
 sci_gateway/fortran/Ex-impl.f \
@@ -578,26 +534,57 @@ sci_gateway/fortran/Ex-int3d.f \
 sci_gateway/fortran/Ex-intg.f \
 sci_gateway/fortran/Ex-dasrt.f \
 sci_gateway/fortran/Ex-dassl.f \
-sci_gateway/fortran/Ex-bvode.f \
-sci_gateway/fortran/bbvode.f
-
-libscidifferential_equations_la_CFLAGS = -I$(srcdir)/includes/ \
-                                               -I$(top_srcdir)/modules/output_stream/includes \
-                                               -I$(top_srcdir)/modules/dynamic_link/includes \
-                                               -I$(top_srcdir)/modules/elementary_functions/includes \
-                                               -I$(top_srcdir)/modules/api_scilab/includes \
-                                               -I$(top_srcdir)/modules/operations/includes
+sci_gateway/fortran/Ex-bvode.f
+
+GATEWAY_CPP_SOURCES = \
+sci_gateway/cpp/sci_int2d.cpp \
+sci_gateway/cpp/sci_int3d.cpp \
+sci_gateway/cpp/sci_intg.cpp \
+sci_gateway/cpp/sci_ode.cpp \
+sci_gateway/cpp/sci_odedc.cpp \
+sci_gateway/cpp/sci_feval.cpp \
+sci_gateway/cpp/sci_bvode.cpp \
+sci_gateway/cpp/sci_impl.cpp \
+sci_gateway/cpp/sci_dassl.cpp \
+sci_gateway/cpp/sci_dasrt.cpp
+
+libscidifferential_equations_la_CFLAGS = \
+-I$(srcdir)/includes/ \
+-I$(top_srcdir)/modules/output_stream/includes \
+-I$(top_srcdir)/modules/dynamic_link/includes \
+-I$(top_srcdir)/modules/elementary_functions/includes \
+-I$(top_srcdir)/modules/api_scilab/includes \
+-I$(top_srcdir)/modules/operations/includes
+
+libscidifferential_equations_la_CPPFLAGS = \
+-I$(srcdir)/includes/ \
+-I$(srcdir)/src/cpp/ \
+-I$(srcdir)/src/c/ \
+-I$(top_srcdir)/modules/output_stream/includes \
+-I$(top_srcdir)/modules/api_scilab/includes \
+-I$(top_srcdir)/modules/dynamic_link/includes \
+-I$(top_srcdir)/modules/symbol/includes \
+-I$(top_srcdir)/modules/ast/includes \
+-I$(top_srcdir)/modules/threads/includes \
+-I$(top_srcdir)/modules/operations/includes \
+-I$(top_srcdir)/modules/system_env/includes \
+-I$(top_srcdir)/modules/string/includes \
+-I$(top_srcdir)/modules/elementary_functions/includes \
+-I$(top_srcdir)/libs/dynamiclibrary/includes \
+-I$(top_srcdir)/modules/types/includes \
+$(EIGEN_CPPFLAGS)
 
 @MAINTAINER_MODE_TRUE@pkglib_LTLIBRARIES = libscidifferential_equations.la
 @MAINTAINER_MODE_FALSE@noinst_LTLIBRARIES = libscidifferential_equations-algo.la libscidifferential_equations.la
 @MAINTAINER_MODE_TRUE@noinst_LTLIBRARIES = libscidifferential_equations-algo.la
 libscidifferential_equations_la_LDFLAGS = -version-number $(SCILAB_LIBRARY_VERSION)
-libscidifferential_equations_algo_la_SOURCES = $(DIFFERENTIAL_EQUATIONS_C_SOURCES) $(DIFFERENTIAL_EQUATIONS_FORTRAN_SOURCES)
-libscidifferential_equations_la_SOURCES = $(GATEWAY_C_SOURCES) $(GATEWAY_FORTRAN_SOURCES)
+libscidifferential_equations_algo_la_SOURCES = $(DIFFERENTIAL_EQUATIONS_C_SOURCES) $(DIFFERENTIAL_EQUATIONS_FORTRAN_SOURCES) $(DIFFERENTIAL_EQUATIONS_CPP_SOURCES)
+libscidifferential_equations_la_SOURCES = $(GATEWAY_FORTRAN_SOURCES) $(GATEWAY_CPP_SOURCES)
 libscidifferential_equations_algo_la_CFLAGS = $(libscidifferential_equations_la_CFLAGS)
+libscidifferential_equations_algo_la_CPPFLAGS = $(libscidifferential_equations_la_CPPFLAGS)
 
 # For the code check (splint)
-CHECK_SRC = $(DIFFERENTIAL_EQUATIONS_C_SOURCES) $(GATEWAY_C_SOURCES)
+CHECK_SRC = $(DIFFERENTIAL_EQUATIONS_C_SOURCES) $(DIFFERENTIAL_EQUATIONS_CPP_SOURCES)
 INCLUDE_FLAGS = $(libscidifferential_equations_la_CFLAGS)
 libscidifferential_equations_la_LIBADD = libscidifferential_equations-algo.la
 
@@ -681,7 +668,7 @@ HELP_CHAPTERLANG = en_US fr_FR pt_BR
 all: all-am
 
 .SUFFIXES:
-.SUFFIXES: .sci .bin .c .f .lo .o .obj
+.SUFFIXES: .sci .bin .c .cpp .f .lo .o .obj
 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/Makefile.incl.am $(am__configure_deps)
        @for dep in $?; do \
          case '$(am__configure_deps)' in \
@@ -753,7 +740,7 @@ clean-pkglibLTLIBRARIES:
          rm -f "$${dir}/so_locations"; \
        done
 libscidifferential_equations-algo.la: $(libscidifferential_equations_algo_la_OBJECTS) $(libscidifferential_equations_algo_la_DEPENDENCIES) 
-       $(F77LINK) $(am_libscidifferential_equations_algo_la_rpath) $(libscidifferential_equations_algo_la_OBJECTS) $(libscidifferential_equations_algo_la_LIBADD) $(LIBS)
+       $(CXXLINK) $(am_libscidifferential_equations_algo_la_rpath) $(libscidifferential_equations_algo_la_OBJECTS) $(libscidifferential_equations_algo_la_LIBADD) $(LIBS)
 libscidifferential_equations.la: $(libscidifferential_equations_la_OBJECTS) $(libscidifferential_equations_la_DEPENDENCIES) 
        $(libscidifferential_equations_la_LINK) $(am_libscidifferential_equations_la_rpath) $(libscidifferential_equations_la_OBJECTS) $(libscidifferential_equations_la_LIBADD) $(LIBS)
 
@@ -764,30 +751,22 @@ distclean-compile:
        -rm -f *.tab.c
 
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscidifferential_equations_algo_la-arnol.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscidifferential_equations_algo_la-colnewtable.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscidifferential_equations_algo_la-checkodeerror.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscidifferential_equations_algo_la-dassl.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscidifferential_equations_algo_la-dassltable.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscidifferential_equations_algo_la-differentialequationfunctions.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscidifferential_equations_algo_la-feval.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscidifferential_equations_algo_la-fevaltable.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscidifferential_equations_algo_la-fydot2table.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscidifferential_equations_algo_la-fydottable.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscidifferential_equations_algo_la-impltable.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscidifferential_equations_algo_la-int2dtable.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscidifferential_equations_algo_la-int3dtable.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscidifferential_equations_algo_la-intgtable.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscidifferential_equations_algo_la-rk4.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscidifferential_equations_la-gw_differential_equations1.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscidifferential_equations_la-gw_differential_equations2.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscidifferential_equations_la-gw_differential_equations3.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscidifferential_equations_la-gw_differential_equations4.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscidifferential_equations_la-gw_differential_equations6.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscidifferential_equations_algo_la-scifunctions.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscidifferential_equations_la-sci_bvode.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscidifferential_equations_la-sci_dasrt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscidifferential_equations_la-sci_dassl.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscidifferential_equations_la-sci_feval.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscidifferential_equations_la-sci_impl.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscidifferential_equations_la-sci_int2d.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscidifferential_equations_la-sci_int3d.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscidifferential_equations_la-sci_intg.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscidifferential_equations_la-sci_odc.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscidifferential_equations_la-sci_ode.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscidifferential_equations_la-sci_odedc.Plo@am__quote@
 
 .c.o:
 @am__fastdepCC_TRUE@   $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@@ -811,179 +790,144 @@ distclean-compile:
 @am__fastdepCC_FALSE@  $(LTCOMPILE) -c -o $@ $<
 
 libscidifferential_equations_algo_la-dassl.lo: src/c/dassl.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_algo_la_CFLAGS) $(CFLAGS) -MT libscidifferential_equations_algo_la-dassl.lo -MD -MP -MF $(DEPDIR)/libscidifferential_equations_algo_la-dassl.Tpo -c -o libscidifferential_equations_algo_la-dassl.lo `test -f 'src/c/dassl.c' || echo '$(srcdir)/'`src/c/dassl.c
+@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscidifferential_equations_algo_la_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_algo_la_CFLAGS) $(CFLAGS) -MT libscidifferential_equations_algo_la-dassl.lo -MD -MP -MF $(DEPDIR)/libscidifferential_equations_algo_la-dassl.Tpo -c -o libscidifferential_equations_algo_la-dassl.lo `test -f 'src/c/dassl.c' || echo '$(srcdir)/'`src/c/dassl.c
 @am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscidifferential_equations_algo_la-dassl.Tpo $(DEPDIR)/libscidifferential_equations_algo_la-dassl.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/c/dassl.c' object='libscidifferential_equations_algo_la-dassl.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_algo_la_CFLAGS) $(CFLAGS) -c -o libscidifferential_equations_algo_la-dassl.lo `test -f 'src/c/dassl.c' || echo '$(srcdir)/'`src/c/dassl.c
+@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscidifferential_equations_algo_la_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_algo_la_CFLAGS) $(CFLAGS) -c -o libscidifferential_equations_algo_la-dassl.lo `test -f 'src/c/dassl.c' || echo '$(srcdir)/'`src/c/dassl.c
 
 libscidifferential_equations_algo_la-feval.lo: src/c/feval.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_algo_la_CFLAGS) $(CFLAGS) -MT libscidifferential_equations_algo_la-feval.lo -MD -MP -MF $(DEPDIR)/libscidifferential_equations_algo_la-feval.Tpo -c -o libscidifferential_equations_algo_la-feval.lo `test -f 'src/c/feval.c' || echo '$(srcdir)/'`src/c/feval.c
+@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscidifferential_equations_algo_la_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_algo_la_CFLAGS) $(CFLAGS) -MT libscidifferential_equations_algo_la-feval.lo -MD -MP -MF $(DEPDIR)/libscidifferential_equations_algo_la-feval.Tpo -c -o libscidifferential_equations_algo_la-feval.lo `test -f 'src/c/feval.c' || echo '$(srcdir)/'`src/c/feval.c
 @am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscidifferential_equations_algo_la-feval.Tpo $(DEPDIR)/libscidifferential_equations_algo_la-feval.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/c/feval.c' object='libscidifferential_equations_algo_la-feval.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_algo_la_CFLAGS) $(CFLAGS) -c -o libscidifferential_equations_algo_la-feval.lo `test -f 'src/c/feval.c' || echo '$(srcdir)/'`src/c/feval.c
-
-libscidifferential_equations_algo_la-fevaltable.lo: src/c/fevaltable.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_algo_la_CFLAGS) $(CFLAGS) -MT libscidifferential_equations_algo_la-fevaltable.lo -MD -MP -MF $(DEPDIR)/libscidifferential_equations_algo_la-fevaltable.Tpo -c -o libscidifferential_equations_algo_la-fevaltable.lo `test -f 'src/c/fevaltable.c' || echo '$(srcdir)/'`src/c/fevaltable.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscidifferential_equations_algo_la-fevaltable.Tpo $(DEPDIR)/libscidifferential_equations_algo_la-fevaltable.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/c/fevaltable.c' object='libscidifferential_equations_algo_la-fevaltable.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_algo_la_CFLAGS) $(CFLAGS) -c -o libscidifferential_equations_algo_la-fevaltable.lo `test -f 'src/c/fevaltable.c' || echo '$(srcdir)/'`src/c/fevaltable.c
-
-libscidifferential_equations_algo_la-fydottable.lo: src/c/fydottable.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_algo_la_CFLAGS) $(CFLAGS) -MT libscidifferential_equations_algo_la-fydottable.lo -MD -MP -MF $(DEPDIR)/libscidifferential_equations_algo_la-fydottable.Tpo -c -o libscidifferential_equations_algo_la-fydottable.lo `test -f 'src/c/fydottable.c' || echo '$(srcdir)/'`src/c/fydottable.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscidifferential_equations_algo_la-fydottable.Tpo $(DEPDIR)/libscidifferential_equations_algo_la-fydottable.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/c/fydottable.c' object='libscidifferential_equations_algo_la-fydottable.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_algo_la_CFLAGS) $(CFLAGS) -c -o libscidifferential_equations_algo_la-fydottable.lo `test -f 'src/c/fydottable.c' || echo '$(srcdir)/'`src/c/fydottable.c
-
-libscidifferential_equations_algo_la-impltable.lo: src/c/impltable.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_algo_la_CFLAGS) $(CFLAGS) -MT libscidifferential_equations_algo_la-impltable.lo -MD -MP -MF $(DEPDIR)/libscidifferential_equations_algo_la-impltable.Tpo -c -o libscidifferential_equations_algo_la-impltable.lo `test -f 'src/c/impltable.c' || echo '$(srcdir)/'`src/c/impltable.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscidifferential_equations_algo_la-impltable.Tpo $(DEPDIR)/libscidifferential_equations_algo_la-impltable.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/c/impltable.c' object='libscidifferential_equations_algo_la-impltable.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_algo_la_CFLAGS) $(CFLAGS) -c -o libscidifferential_equations_algo_la-impltable.lo `test -f 'src/c/impltable.c' || echo '$(srcdir)/'`src/c/impltable.c
-
-libscidifferential_equations_algo_la-colnewtable.lo: src/c/colnewtable.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_algo_la_CFLAGS) $(CFLAGS) -MT libscidifferential_equations_algo_la-colnewtable.lo -MD -MP -MF $(DEPDIR)/libscidifferential_equations_algo_la-colnewtable.Tpo -c -o libscidifferential_equations_algo_la-colnewtable.lo `test -f 'src/c/colnewtable.c' || echo '$(srcdir)/'`src/c/colnewtable.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscidifferential_equations_algo_la-colnewtable.Tpo $(DEPDIR)/libscidifferential_equations_algo_la-colnewtable.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/c/colnewtable.c' object='libscidifferential_equations_algo_la-colnewtable.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_algo_la_CFLAGS) $(CFLAGS) -c -o libscidifferential_equations_algo_la-colnewtable.lo `test -f 'src/c/colnewtable.c' || echo '$(srcdir)/'`src/c/colnewtable.c
-
-libscidifferential_equations_algo_la-intgtable.lo: src/c/intgtable.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_algo_la_CFLAGS) $(CFLAGS) -MT libscidifferential_equations_algo_la-intgtable.lo -MD -MP -MF $(DEPDIR)/libscidifferential_equations_algo_la-intgtable.Tpo -c -o libscidifferential_equations_algo_la-intgtable.lo `test -f 'src/c/intgtable.c' || echo '$(srcdir)/'`src/c/intgtable.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscidifferential_equations_algo_la-intgtable.Tpo $(DEPDIR)/libscidifferential_equations_algo_la-intgtable.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/c/intgtable.c' object='libscidifferential_equations_algo_la-intgtable.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_algo_la_CFLAGS) $(CFLAGS) -c -o libscidifferential_equations_algo_la-intgtable.lo `test -f 'src/c/intgtable.c' || echo '$(srcdir)/'`src/c/intgtable.c
-
-libscidifferential_equations_algo_la-int2dtable.lo: src/c/int2dtable.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_algo_la_CFLAGS) $(CFLAGS) -MT libscidifferential_equations_algo_la-int2dtable.lo -MD -MP -MF $(DEPDIR)/libscidifferential_equations_algo_la-int2dtable.Tpo -c -o libscidifferential_equations_algo_la-int2dtable.lo `test -f 'src/c/int2dtable.c' || echo '$(srcdir)/'`src/c/int2dtable.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscidifferential_equations_algo_la-int2dtable.Tpo $(DEPDIR)/libscidifferential_equations_algo_la-int2dtable.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/c/int2dtable.c' object='libscidifferential_equations_algo_la-int2dtable.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_algo_la_CFLAGS) $(CFLAGS) -c -o libscidifferential_equations_algo_la-int2dtable.lo `test -f 'src/c/int2dtable.c' || echo '$(srcdir)/'`src/c/int2dtable.c
-
-libscidifferential_equations_algo_la-int3dtable.lo: src/c/int3dtable.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_algo_la_CFLAGS) $(CFLAGS) -MT libscidifferential_equations_algo_la-int3dtable.lo -MD -MP -MF $(DEPDIR)/libscidifferential_equations_algo_la-int3dtable.Tpo -c -o libscidifferential_equations_algo_la-int3dtable.lo `test -f 'src/c/int3dtable.c' || echo '$(srcdir)/'`src/c/int3dtable.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscidifferential_equations_algo_la-int3dtable.Tpo $(DEPDIR)/libscidifferential_equations_algo_la-int3dtable.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/c/int3dtable.c' object='libscidifferential_equations_algo_la-int3dtable.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_algo_la_CFLAGS) $(CFLAGS) -c -o libscidifferential_equations_algo_la-int3dtable.lo `test -f 'src/c/int3dtable.c' || echo '$(srcdir)/'`src/c/int3dtable.c
-
-libscidifferential_equations_algo_la-fydot2table.lo: src/c/fydot2table.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_algo_la_CFLAGS) $(CFLAGS) -MT libscidifferential_equations_algo_la-fydot2table.lo -MD -MP -MF $(DEPDIR)/libscidifferential_equations_algo_la-fydot2table.Tpo -c -o libscidifferential_equations_algo_la-fydot2table.lo `test -f 'src/c/fydot2table.c' || echo '$(srcdir)/'`src/c/fydot2table.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscidifferential_equations_algo_la-fydot2table.Tpo $(DEPDIR)/libscidifferential_equations_algo_la-fydot2table.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/c/fydot2table.c' object='libscidifferential_equations_algo_la-fydot2table.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_algo_la_CFLAGS) $(CFLAGS) -c -o libscidifferential_equations_algo_la-fydot2table.lo `test -f 'src/c/fydot2table.c' || echo '$(srcdir)/'`src/c/fydot2table.c
-
-libscidifferential_equations_algo_la-dassltable.lo: src/c/dassltable.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_algo_la_CFLAGS) $(CFLAGS) -MT libscidifferential_equations_algo_la-dassltable.lo -MD -MP -MF $(DEPDIR)/libscidifferential_equations_algo_la-dassltable.Tpo -c -o libscidifferential_equations_algo_la-dassltable.lo `test -f 'src/c/dassltable.c' || echo '$(srcdir)/'`src/c/dassltable.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscidifferential_equations_algo_la-dassltable.Tpo $(DEPDIR)/libscidifferential_equations_algo_la-dassltable.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/c/dassltable.c' object='libscidifferential_equations_algo_la-dassltable.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_algo_la_CFLAGS) $(CFLAGS) -c -o libscidifferential_equations_algo_la-dassltable.lo `test -f 'src/c/dassltable.c' || echo '$(srcdir)/'`src/c/dassltable.c
+@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscidifferential_equations_algo_la_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_algo_la_CFLAGS) $(CFLAGS) -c -o libscidifferential_equations_algo_la-feval.lo `test -f 'src/c/feval.c' || echo '$(srcdir)/'`src/c/feval.c
 
 libscidifferential_equations_algo_la-arnol.lo: src/c/arnol.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_algo_la_CFLAGS) $(CFLAGS) -MT libscidifferential_equations_algo_la-arnol.lo -MD -MP -MF $(DEPDIR)/libscidifferential_equations_algo_la-arnol.Tpo -c -o libscidifferential_equations_algo_la-arnol.lo `test -f 'src/c/arnol.c' || echo '$(srcdir)/'`src/c/arnol.c
+@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscidifferential_equations_algo_la_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_algo_la_CFLAGS) $(CFLAGS) -MT libscidifferential_equations_algo_la-arnol.lo -MD -MP -MF $(DEPDIR)/libscidifferential_equations_algo_la-arnol.Tpo -c -o libscidifferential_equations_algo_la-arnol.lo `test -f 'src/c/arnol.c' || echo '$(srcdir)/'`src/c/arnol.c
 @am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscidifferential_equations_algo_la-arnol.Tpo $(DEPDIR)/libscidifferential_equations_algo_la-arnol.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/c/arnol.c' object='libscidifferential_equations_algo_la-arnol.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_algo_la_CFLAGS) $(CFLAGS) -c -o libscidifferential_equations_algo_la-arnol.lo `test -f 'src/c/arnol.c' || echo '$(srcdir)/'`src/c/arnol.c
+@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscidifferential_equations_algo_la_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_algo_la_CFLAGS) $(CFLAGS) -c -o libscidifferential_equations_algo_la-arnol.lo `test -f 'src/c/arnol.c' || echo '$(srcdir)/'`src/c/arnol.c
 
 libscidifferential_equations_algo_la-rk4.lo: src/c/rk4.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_algo_la_CFLAGS) $(CFLAGS) -MT libscidifferential_equations_algo_la-rk4.lo -MD -MP -MF $(DEPDIR)/libscidifferential_equations_algo_la-rk4.Tpo -c -o libscidifferential_equations_algo_la-rk4.lo `test -f 'src/c/rk4.c' || echo '$(srcdir)/'`src/c/rk4.c
+@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscidifferential_equations_algo_la_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_algo_la_CFLAGS) $(CFLAGS) -MT libscidifferential_equations_algo_la-rk4.lo -MD -MP -MF $(DEPDIR)/libscidifferential_equations_algo_la-rk4.Tpo -c -o libscidifferential_equations_algo_la-rk4.lo `test -f 'src/c/rk4.c' || echo '$(srcdir)/'`src/c/rk4.c
 @am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscidifferential_equations_algo_la-rk4.Tpo $(DEPDIR)/libscidifferential_equations_algo_la-rk4.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/c/rk4.c' object='libscidifferential_equations_algo_la-rk4.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_algo_la_CFLAGS) $(CFLAGS) -c -o libscidifferential_equations_algo_la-rk4.lo `test -f 'src/c/rk4.c' || echo '$(srcdir)/'`src/c/rk4.c
-
-libscidifferential_equations_la-sci_int2d.lo: sci_gateway/c/sci_int2d.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_la_CFLAGS) $(CFLAGS) -MT libscidifferential_equations_la-sci_int2d.lo -MD -MP -MF $(DEPDIR)/libscidifferential_equations_la-sci_int2d.Tpo -c -o libscidifferential_equations_la-sci_int2d.lo `test -f 'sci_gateway/c/sci_int2d.c' || echo '$(srcdir)/'`sci_gateway/c/sci_int2d.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscidifferential_equations_la-sci_int2d.Tpo $(DEPDIR)/libscidifferential_equations_la-sci_int2d.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_int2d.c' object='libscidifferential_equations_la-sci_int2d.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_la_CFLAGS) $(CFLAGS) -c -o libscidifferential_equations_la-sci_int2d.lo `test -f 'sci_gateway/c/sci_int2d.c' || echo '$(srcdir)/'`sci_gateway/c/sci_int2d.c
-
-libscidifferential_equations_la-sci_int3d.lo: sci_gateway/c/sci_int3d.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_la_CFLAGS) $(CFLAGS) -MT libscidifferential_equations_la-sci_int3d.lo -MD -MP -MF $(DEPDIR)/libscidifferential_equations_la-sci_int3d.Tpo -c -o libscidifferential_equations_la-sci_int3d.lo `test -f 'sci_gateway/c/sci_int3d.c' || echo '$(srcdir)/'`sci_gateway/c/sci_int3d.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscidifferential_equations_la-sci_int3d.Tpo $(DEPDIR)/libscidifferential_equations_la-sci_int3d.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_int3d.c' object='libscidifferential_equations_la-sci_int3d.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_la_CFLAGS) $(CFLAGS) -c -o libscidifferential_equations_la-sci_int3d.lo `test -f 'sci_gateway/c/sci_int3d.c' || echo '$(srcdir)/'`sci_gateway/c/sci_int3d.c
-
-libscidifferential_equations_la-sci_intg.lo: sci_gateway/c/sci_intg.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_la_CFLAGS) $(CFLAGS) -MT libscidifferential_equations_la-sci_intg.lo -MD -MP -MF $(DEPDIR)/libscidifferential_equations_la-sci_intg.Tpo -c -o libscidifferential_equations_la-sci_intg.lo `test -f 'sci_gateway/c/sci_intg.c' || echo '$(srcdir)/'`sci_gateway/c/sci_intg.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscidifferential_equations_la-sci_intg.Tpo $(DEPDIR)/libscidifferential_equations_la-sci_intg.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_intg.c' object='libscidifferential_equations_la-sci_intg.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_la_CFLAGS) $(CFLAGS) -c -o libscidifferential_equations_la-sci_intg.lo `test -f 'sci_gateway/c/sci_intg.c' || echo '$(srcdir)/'`sci_gateway/c/sci_intg.c
-
-libscidifferential_equations_la-sci_ode.lo: sci_gateway/c/sci_ode.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_la_CFLAGS) $(CFLAGS) -MT libscidifferential_equations_la-sci_ode.lo -MD -MP -MF $(DEPDIR)/libscidifferential_equations_la-sci_ode.Tpo -c -o libscidifferential_equations_la-sci_ode.lo `test -f 'sci_gateway/c/sci_ode.c' || echo '$(srcdir)/'`sci_gateway/c/sci_ode.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscidifferential_equations_la-sci_ode.Tpo $(DEPDIR)/libscidifferential_equations_la-sci_ode.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_ode.c' object='libscidifferential_equations_la-sci_ode.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_la_CFLAGS) $(CFLAGS) -c -o libscidifferential_equations_la-sci_ode.lo `test -f 'sci_gateway/c/sci_ode.c' || echo '$(srcdir)/'`sci_gateway/c/sci_ode.c
-
-libscidifferential_equations_la-sci_odc.lo: sci_gateway/c/sci_odc.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_la_CFLAGS) $(CFLAGS) -MT libscidifferential_equations_la-sci_odc.lo -MD -MP -MF $(DEPDIR)/libscidifferential_equations_la-sci_odc.Tpo -c -o libscidifferential_equations_la-sci_odc.lo `test -f 'sci_gateway/c/sci_odc.c' || echo '$(srcdir)/'`sci_gateway/c/sci_odc.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscidifferential_equations_la-sci_odc.Tpo $(DEPDIR)/libscidifferential_equations_la-sci_odc.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_odc.c' object='libscidifferential_equations_la-sci_odc.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_la_CFLAGS) $(CFLAGS) -c -o libscidifferential_equations_la-sci_odc.lo `test -f 'sci_gateway/c/sci_odc.c' || echo '$(srcdir)/'`sci_gateway/c/sci_odc.c
-
-libscidifferential_equations_la-sci_feval.lo: sci_gateway/c/sci_feval.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_la_CFLAGS) $(CFLAGS) -MT libscidifferential_equations_la-sci_feval.lo -MD -MP -MF $(DEPDIR)/libscidifferential_equations_la-sci_feval.Tpo -c -o libscidifferential_equations_la-sci_feval.lo `test -f 'sci_gateway/c/sci_feval.c' || echo '$(srcdir)/'`sci_gateway/c/sci_feval.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscidifferential_equations_la-sci_feval.Tpo $(DEPDIR)/libscidifferential_equations_la-sci_feval.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_feval.c' object='libscidifferential_equations_la-sci_feval.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_la_CFLAGS) $(CFLAGS) -c -o libscidifferential_equations_la-sci_feval.lo `test -f 'sci_gateway/c/sci_feval.c' || echo '$(srcdir)/'`sci_gateway/c/sci_feval.c
-
-libscidifferential_equations_la-gw_differential_equations1.lo: sci_gateway/c/gw_differential_equations1.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_la_CFLAGS) $(CFLAGS) -MT libscidifferential_equations_la-gw_differential_equations1.lo -MD -MP -MF $(DEPDIR)/libscidifferential_equations_la-gw_differential_equations1.Tpo -c -o libscidifferential_equations_la-gw_differential_equations1.lo `test -f 'sci_gateway/c/gw_differential_equations1.c' || echo '$(srcdir)/'`sci_gateway/c/gw_differential_equations1.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscidifferential_equations_la-gw_differential_equations1.Tpo $(DEPDIR)/libscidifferential_equations_la-gw_differential_equations1.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/gw_differential_equations1.c' object='libscidifferential_equations_la-gw_differential_equations1.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_la_CFLAGS) $(CFLAGS) -c -o libscidifferential_equations_la-gw_differential_equations1.lo `test -f 'sci_gateway/c/gw_differential_equations1.c' || echo '$(srcdir)/'`sci_gateway/c/gw_differential_equations1.c
-
-libscidifferential_equations_la-gw_differential_equations2.lo: sci_gateway/c/gw_differential_equations2.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_la_CFLAGS) $(CFLAGS) -MT libscidifferential_equations_la-gw_differential_equations2.lo -MD -MP -MF $(DEPDIR)/libscidifferential_equations_la-gw_differential_equations2.Tpo -c -o libscidifferential_equations_la-gw_differential_equations2.lo `test -f 'sci_gateway/c/gw_differential_equations2.c' || echo '$(srcdir)/'`sci_gateway/c/gw_differential_equations2.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscidifferential_equations_la-gw_differential_equations2.Tpo $(DEPDIR)/libscidifferential_equations_la-gw_differential_equations2.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/gw_differential_equations2.c' object='libscidifferential_equations_la-gw_differential_equations2.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_la_CFLAGS) $(CFLAGS) -c -o libscidifferential_equations_la-gw_differential_equations2.lo `test -f 'sci_gateway/c/gw_differential_equations2.c' || echo '$(srcdir)/'`sci_gateway/c/gw_differential_equations2.c
-
-libscidifferential_equations_la-gw_differential_equations3.lo: sci_gateway/c/gw_differential_equations3.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_la_CFLAGS) $(CFLAGS) -MT libscidifferential_equations_la-gw_differential_equations3.lo -MD -MP -MF $(DEPDIR)/libscidifferential_equations_la-gw_differential_equations3.Tpo -c -o libscidifferential_equations_la-gw_differential_equations3.lo `test -f 'sci_gateway/c/gw_differential_equations3.c' || echo '$(srcdir)/'`sci_gateway/c/gw_differential_equations3.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscidifferential_equations_la-gw_differential_equations3.Tpo $(DEPDIR)/libscidifferential_equations_la-gw_differential_equations3.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/gw_differential_equations3.c' object='libscidifferential_equations_la-gw_differential_equations3.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_la_CFLAGS) $(CFLAGS) -c -o libscidifferential_equations_la-gw_differential_equations3.lo `test -f 'sci_gateway/c/gw_differential_equations3.c' || echo '$(srcdir)/'`sci_gateway/c/gw_differential_equations3.c
-
-libscidifferential_equations_la-gw_differential_equations4.lo: sci_gateway/c/gw_differential_equations4.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_la_CFLAGS) $(CFLAGS) -MT libscidifferential_equations_la-gw_differential_equations4.lo -MD -MP -MF $(DEPDIR)/libscidifferential_equations_la-gw_differential_equations4.Tpo -c -o libscidifferential_equations_la-gw_differential_equations4.lo `test -f 'sci_gateway/c/gw_differential_equations4.c' || echo '$(srcdir)/'`sci_gateway/c/gw_differential_equations4.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscidifferential_equations_la-gw_differential_equations4.Tpo $(DEPDIR)/libscidifferential_equations_la-gw_differential_equations4.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/gw_differential_equations4.c' object='libscidifferential_equations_la-gw_differential_equations4.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_la_CFLAGS) $(CFLAGS) -c -o libscidifferential_equations_la-gw_differential_equations4.lo `test -f 'sci_gateway/c/gw_differential_equations4.c' || echo '$(srcdir)/'`sci_gateway/c/gw_differential_equations4.c
-
-libscidifferential_equations_la-sci_bvode.lo: sci_gateway/c/sci_bvode.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_la_CFLAGS) $(CFLAGS) -MT libscidifferential_equations_la-sci_bvode.lo -MD -MP -MF $(DEPDIR)/libscidifferential_equations_la-sci_bvode.Tpo -c -o libscidifferential_equations_la-sci_bvode.lo `test -f 'sci_gateway/c/sci_bvode.c' || echo '$(srcdir)/'`sci_gateway/c/sci_bvode.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscidifferential_equations_la-sci_bvode.Tpo $(DEPDIR)/libscidifferential_equations_la-sci_bvode.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_bvode.c' object='libscidifferential_equations_la-sci_bvode.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_la_CFLAGS) $(CFLAGS) -c -o libscidifferential_equations_la-sci_bvode.lo `test -f 'sci_gateway/c/sci_bvode.c' || echo '$(srcdir)/'`sci_gateway/c/sci_bvode.c
-
-libscidifferential_equations_la-gw_differential_equations6.lo: sci_gateway/c/gw_differential_equations6.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_la_CFLAGS) $(CFLAGS) -MT libscidifferential_equations_la-gw_differential_equations6.lo -MD -MP -MF $(DEPDIR)/libscidifferential_equations_la-gw_differential_equations6.Tpo -c -o libscidifferential_equations_la-gw_differential_equations6.lo `test -f 'sci_gateway/c/gw_differential_equations6.c' || echo '$(srcdir)/'`sci_gateway/c/gw_differential_equations6.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscidifferential_equations_la-gw_differential_equations6.Tpo $(DEPDIR)/libscidifferential_equations_la-gw_differential_equations6.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/gw_differential_equations6.c' object='libscidifferential_equations_la-gw_differential_equations6.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_la_CFLAGS) $(CFLAGS) -c -o libscidifferential_equations_la-gw_differential_equations6.lo `test -f 'sci_gateway/c/gw_differential_equations6.c' || echo '$(srcdir)/'`sci_gateway/c/gw_differential_equations6.c
+@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscidifferential_equations_algo_la_CPPFLAGS) $(CPPFLAGS) $(libscidifferential_equations_algo_la_CFLAGS) $(CFLAGS) -c -o libscidifferential_equations_algo_la-rk4.lo `test -f 'src/c/rk4.c' || echo '$(srcdir)/'`src/c/rk4.c
+
+.cpp.o:
+@am__fastdepCXX_TRUE@  $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+@am__fastdepCXX_TRUE@  $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cpp.lo:
+@am__fastdepCXX_TRUE@  $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
+
+libscidifferential_equations_algo_la-scifunctions.lo: src/cpp/scifunctions.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscidifferential_equations_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscidifferential_equations_algo_la-scifunctions.lo -MD -MP -MF $(DEPDIR)/libscidifferential_equations_algo_la-scifunctions.Tpo -c -o libscidifferential_equations_algo_la-scifunctions.lo `test -f 'src/cpp/scifunctions.cpp' || echo '$(srcdir)/'`src/cpp/scifunctions.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscidifferential_equations_algo_la-scifunctions.Tpo $(DEPDIR)/libscidifferential_equations_algo_la-scifunctions.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='src/cpp/scifunctions.cpp' object='libscidifferential_equations_algo_la-scifunctions.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscidifferential_equations_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscidifferential_equations_algo_la-scifunctions.lo `test -f 'src/cpp/scifunctions.cpp' || echo '$(srcdir)/'`src/cpp/scifunctions.cpp
+
+libscidifferential_equations_algo_la-checkodeerror.lo: src/cpp/checkodeerror.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscidifferential_equations_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscidifferential_equations_algo_la-checkodeerror.lo -MD -MP -MF $(DEPDIR)/libscidifferential_equations_algo_la-checkodeerror.Tpo -c -o libscidifferential_equations_algo_la-checkodeerror.lo `test -f 'src/cpp/checkodeerror.cpp' || echo '$(srcdir)/'`src/cpp/checkodeerror.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscidifferential_equations_algo_la-checkodeerror.Tpo $(DEPDIR)/libscidifferential_equations_algo_la-checkodeerror.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='src/cpp/checkodeerror.cpp' object='libscidifferential_equations_algo_la-checkodeerror.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscidifferential_equations_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscidifferential_equations_algo_la-checkodeerror.lo `test -f 'src/cpp/checkodeerror.cpp' || echo '$(srcdir)/'`src/cpp/checkodeerror.cpp
+
+libscidifferential_equations_algo_la-differentialequationfunctions.lo: src/cpp/differentialequationfunctions.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscidifferential_equations_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscidifferential_equations_algo_la-differentialequationfunctions.lo -MD -MP -MF $(DEPDIR)/libscidifferential_equations_algo_la-differentialequationfunctions.Tpo -c -o libscidifferential_equations_algo_la-differentialequationfunctions.lo `test -f 'src/cpp/differentialequationfunctions.cpp' || echo '$(srcdir)/'`src/cpp/differentialequationfunctions.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscidifferential_equations_algo_la-differentialequationfunctions.Tpo $(DEPDIR)/libscidifferential_equations_algo_la-differentialequationfunctions.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='src/cpp/differentialequationfunctions.cpp' object='libscidifferential_equations_algo_la-differentialequationfunctions.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscidifferential_equations_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscidifferential_equations_algo_la-differentialequationfunctions.lo `test -f 'src/cpp/differentialequationfunctions.cpp' || echo '$(srcdir)/'`src/cpp/differentialequationfunctions.cpp
+
+libscidifferential_equations_la-sci_int2d.lo: sci_gateway/cpp/sci_int2d.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscidifferential_equations_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscidifferential_equations_la-sci_int2d.lo -MD -MP -MF $(DEPDIR)/libscidifferential_equations_la-sci_int2d.Tpo -c -o libscidifferential_equations_la-sci_int2d.lo `test -f 'sci_gateway/cpp/sci_int2d.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_int2d.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscidifferential_equations_la-sci_int2d.Tpo $(DEPDIR)/libscidifferential_equations_la-sci_int2d.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_int2d.cpp' object='libscidifferential_equations_la-sci_int2d.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscidifferential_equations_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscidifferential_equations_la-sci_int2d.lo `test -f 'sci_gateway/cpp/sci_int2d.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_int2d.cpp
+
+libscidifferential_equations_la-sci_int3d.lo: sci_gateway/cpp/sci_int3d.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscidifferential_equations_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscidifferential_equations_la-sci_int3d.lo -MD -MP -MF $(DEPDIR)/libscidifferential_equations_la-sci_int3d.Tpo -c -o libscidifferential_equations_la-sci_int3d.lo `test -f 'sci_gateway/cpp/sci_int3d.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_int3d.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscidifferential_equations_la-sci_int3d.Tpo $(DEPDIR)/libscidifferential_equations_la-sci_int3d.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_int3d.cpp' object='libscidifferential_equations_la-sci_int3d.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscidifferential_equations_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscidifferential_equations_la-sci_int3d.lo `test -f 'sci_gateway/cpp/sci_int3d.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_int3d.cpp
+
+libscidifferential_equations_la-sci_intg.lo: sci_gateway/cpp/sci_intg.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscidifferential_equations_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscidifferential_equations_la-sci_intg.lo -MD -MP -MF $(DEPDIR)/libscidifferential_equations_la-sci_intg.Tpo -c -o libscidifferential_equations_la-sci_intg.lo `test -f 'sci_gateway/cpp/sci_intg.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_intg.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscidifferential_equations_la-sci_intg.Tpo $(DEPDIR)/libscidifferential_equations_la-sci_intg.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_intg.cpp' object='libscidifferential_equations_la-sci_intg.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscidifferential_equations_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscidifferential_equations_la-sci_intg.lo `test -f 'sci_gateway/cpp/sci_intg.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_intg.cpp
+
+libscidifferential_equations_la-sci_ode.lo: sci_gateway/cpp/sci_ode.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscidifferential_equations_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscidifferential_equations_la-sci_ode.lo -MD -MP -MF $(DEPDIR)/libscidifferential_equations_la-sci_ode.Tpo -c -o libscidifferential_equations_la-sci_ode.lo `test -f 'sci_gateway/cpp/sci_ode.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_ode.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscidifferential_equations_la-sci_ode.Tpo $(DEPDIR)/libscidifferential_equations_la-sci_ode.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_ode.cpp' object='libscidifferential_equations_la-sci_ode.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscidifferential_equations_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscidifferential_equations_la-sci_ode.lo `test -f 'sci_gateway/cpp/sci_ode.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_ode.cpp
+
+libscidifferential_equations_la-sci_odedc.lo: sci_gateway/cpp/sci_odedc.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscidifferential_equations_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscidifferential_equations_la-sci_odedc.lo -MD -MP -MF $(DEPDIR)/libscidifferential_equations_la-sci_odedc.Tpo -c -o libscidifferential_equations_la-sci_odedc.lo `test -f 'sci_gateway/cpp/sci_odedc.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_odedc.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscidifferential_equations_la-sci_odedc.Tpo $(DEPDIR)/libscidifferential_equations_la-sci_odedc.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_odedc.cpp' object='libscidifferential_equations_la-sci_odedc.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscidifferential_equations_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscidifferential_equations_la-sci_odedc.lo `test -f 'sci_gateway/cpp/sci_odedc.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_odedc.cpp
+
+libscidifferential_equations_la-sci_feval.lo: sci_gateway/cpp/sci_feval.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscidifferential_equations_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscidifferential_equations_la-sci_feval.lo -MD -MP -MF $(DEPDIR)/libscidifferential_equations_la-sci_feval.Tpo -c -o libscidifferential_equations_la-sci_feval.lo `test -f 'sci_gateway/cpp/sci_feval.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_feval.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscidifferential_equations_la-sci_feval.Tpo $(DEPDIR)/libscidifferential_equations_la-sci_feval.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_feval.cpp' object='libscidifferential_equations_la-sci_feval.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscidifferential_equations_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscidifferential_equations_la-sci_feval.lo `test -f 'sci_gateway/cpp/sci_feval.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_feval.cpp
+
+libscidifferential_equations_la-sci_bvode.lo: sci_gateway/cpp/sci_bvode.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscidifferential_equations_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscidifferential_equations_la-sci_bvode.lo -MD -MP -MF $(DEPDIR)/libscidifferential_equations_la-sci_bvode.Tpo -c -o libscidifferential_equations_la-sci_bvode.lo `test -f 'sci_gateway/cpp/sci_bvode.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_bvode.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscidifferential_equations_la-sci_bvode.Tpo $(DEPDIR)/libscidifferential_equations_la-sci_bvode.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_bvode.cpp' object='libscidifferential_equations_la-sci_bvode.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscidifferential_equations_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscidifferential_equations_la-sci_bvode.lo `test -f 'sci_gateway/cpp/sci_bvode.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_bvode.cpp
+
+libscidifferential_equations_la-sci_impl.lo: sci_gateway/cpp/sci_impl.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscidifferential_equations_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscidifferential_equations_la-sci_impl.lo -MD -MP -MF $(DEPDIR)/libscidifferential_equations_la-sci_impl.Tpo -c -o libscidifferential_equations_la-sci_impl.lo `test -f 'sci_gateway/cpp/sci_impl.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_impl.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscidifferential_equations_la-sci_impl.Tpo $(DEPDIR)/libscidifferential_equations_la-sci_impl.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_impl.cpp' object='libscidifferential_equations_la-sci_impl.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscidifferential_equations_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscidifferential_equations_la-sci_impl.lo `test -f 'sci_gateway/cpp/sci_impl.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_impl.cpp
+
+libscidifferential_equations_la-sci_dassl.lo: sci_gateway/cpp/sci_dassl.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscidifferential_equations_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscidifferential_equations_la-sci_dassl.lo -MD -MP -MF $(DEPDIR)/libscidifferential_equations_la-sci_dassl.Tpo -c -o libscidifferential_equations_la-sci_dassl.lo `test -f 'sci_gateway/cpp/sci_dassl.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_dassl.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscidifferential_equations_la-sci_dassl.Tpo $(DEPDIR)/libscidifferential_equations_la-sci_dassl.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_dassl.cpp' object='libscidifferential_equations_la-sci_dassl.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscidifferential_equations_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscidifferential_equations_la-sci_dassl.lo `test -f 'sci_gateway/cpp/sci_dassl.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_dassl.cpp
+
+libscidifferential_equations_la-sci_dasrt.lo: sci_gateway/cpp/sci_dasrt.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscidifferential_equations_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscidifferential_equations_la-sci_dasrt.lo -MD -MP -MF $(DEPDIR)/libscidifferential_equations_la-sci_dasrt.Tpo -c -o libscidifferential_equations_la-sci_dasrt.lo `test -f 'sci_gateway/cpp/sci_dasrt.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_dasrt.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscidifferential_equations_la-sci_dasrt.Tpo $(DEPDIR)/libscidifferential_equations_la-sci_dasrt.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_dasrt.cpp' object='libscidifferential_equations_la-sci_dasrt.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscidifferential_equations_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscidifferential_equations_la-sci_dasrt.lo `test -f 'sci_gateway/cpp/sci_dasrt.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_dasrt.cpp
 
 .f.o:
        $(F77COMPILE) -c -o $@ $<
@@ -1165,78 +1109,6 @@ rkqc.lo: src/fortran/rkqc.f
 writbufode.lo: src/fortran/writbufode.f
        $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o writbufode.lo `test -f 'src/fortran/writbufode.f' || echo '$(srcdir)/'`src/fortran/writbufode.f
 
-sci_f_dasrt.lo: sci_gateway/fortran/sci_f_dasrt.f
-       $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o sci_f_dasrt.lo `test -f 'sci_gateway/fortran/sci_f_dasrt.f' || echo '$(srcdir)/'`sci_gateway/fortran/sci_f_dasrt.f
-
-sci_f_feval.lo: sci_gateway/fortran/sci_f_feval.f
-       $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o sci_f_feval.lo `test -f 'sci_gateway/fortran/sci_f_feval.f' || echo '$(srcdir)/'`sci_gateway/fortran/sci_f_feval.f
-
-sci_f_odedc.lo: sci_gateway/fortran/sci_f_odedc.f
-       $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o sci_f_odedc.lo `test -f 'sci_gateway/fortran/sci_f_odedc.f' || echo '$(srcdir)/'`sci_gateway/fortran/sci_f_odedc.f
-
-sci_f_bvode.lo: sci_gateway/fortran/sci_f_bvode.f
-       $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o sci_f_bvode.lo `test -f 'sci_gateway/fortran/sci_f_bvode.f' || echo '$(srcdir)/'`sci_gateway/fortran/sci_f_bvode.f
-
-sci_f_impl.lo: sci_gateway/fortran/sci_f_impl.f
-       $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o sci_f_impl.lo `test -f 'sci_gateway/fortran/sci_f_impl.f' || echo '$(srcdir)/'`sci_gateway/fortran/sci_f_impl.f
-
-sci_f_dassl.lo: sci_gateway/fortran/sci_f_dassl.f
-       $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o sci_f_dassl.lo `test -f 'sci_gateway/fortran/sci_f_dassl.f' || echo '$(srcdir)/'`sci_gateway/fortran/sci_f_dassl.f
-
-sci_f_ode.lo: sci_gateway/fortran/sci_f_ode.f
-       $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o sci_f_ode.lo `test -f 'sci_gateway/fortran/sci_f_ode.f' || echo '$(srcdir)/'`sci_gateway/fortran/sci_f_ode.f
-
-bsurf.lo: sci_gateway/fortran/bsurf.f
-       $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o bsurf.lo `test -f 'sci_gateway/fortran/bsurf.f' || echo '$(srcdir)/'`sci_gateway/fortran/bsurf.f
-
-bsurfd.lo: sci_gateway/fortran/bsurfd.f
-       $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o bsurfd.lo `test -f 'sci_gateway/fortran/bsurfd.f' || echo '$(srcdir)/'`sci_gateway/fortran/bsurfd.f
-
-bydot.lo: sci_gateway/fortran/bydot.f
-       $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o bydot.lo `test -f 'sci_gateway/fortran/bydot.f' || echo '$(srcdir)/'`sci_gateway/fortran/bydot.f
-
-bydot2.lo: sci_gateway/fortran/bydot2.f
-       $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o bydot2.lo `test -f 'sci_gateway/fortran/bydot2.f' || echo '$(srcdir)/'`sci_gateway/fortran/bydot2.f
-
-bresd.lo: sci_gateway/fortran/bresd.f
-       $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o bresd.lo `test -f 'sci_gateway/fortran/bresd.f' || echo '$(srcdir)/'`sci_gateway/fortran/bresd.f
-
-bresid.lo: sci_gateway/fortran/bresid.f
-       $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o bresid.lo `test -f 'sci_gateway/fortran/bresid.f' || echo '$(srcdir)/'`sci_gateway/fortran/bresid.f
-
-bjac.lo: sci_gateway/fortran/bjac.f
-       $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o bjac.lo `test -f 'sci_gateway/fortran/bjac.f' || echo '$(srcdir)/'`sci_gateway/fortran/bjac.f
-
-bjacd.lo: sci_gateway/fortran/bjacd.f
-       $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o bjacd.lo `test -f 'sci_gateway/fortran/bjacd.f' || echo '$(srcdir)/'`sci_gateway/fortran/bjacd.f
-
-badd.lo: sci_gateway/fortran/badd.f
-       $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o badd.lo `test -f 'sci_gateway/fortran/badd.f' || echo '$(srcdir)/'`sci_gateway/fortran/badd.f
-
-bj2.lo: sci_gateway/fortran/bj2.f
-       $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o bj2.lo `test -f 'sci_gateway/fortran/bj2.f' || echo '$(srcdir)/'`sci_gateway/fortran/bj2.f
-
-bfeval.lo: sci_gateway/fortran/bfeval.f
-       $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o bfeval.lo `test -f 'sci_gateway/fortran/bfeval.f' || echo '$(srcdir)/'`sci_gateway/fortran/bfeval.f
-
-int2d.lo: sci_gateway/fortran/int2d.f
-       $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o int2d.lo `test -f 'sci_gateway/fortran/int2d.f' || echo '$(srcdir)/'`sci_gateway/fortran/int2d.f
-
-bint2d.lo: sci_gateway/fortran/bint2d.f
-       $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o bint2d.lo `test -f 'sci_gateway/fortran/bint2d.f' || echo '$(srcdir)/'`sci_gateway/fortran/bint2d.f
-
-bint3d.lo: sci_gateway/fortran/bint3d.f
-       $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o bint3d.lo `test -f 'sci_gateway/fortran/bint3d.f' || echo '$(srcdir)/'`sci_gateway/fortran/bint3d.f
-
-bintg.lo: sci_gateway/fortran/bintg.f
-       $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o bintg.lo `test -f 'sci_gateway/fortran/bintg.f' || echo '$(srcdir)/'`sci_gateway/fortran/bintg.f
-
-int3d.lo: sci_gateway/fortran/int3d.f
-       $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o int3d.lo `test -f 'sci_gateway/fortran/int3d.f' || echo '$(srcdir)/'`sci_gateway/fortran/int3d.f
-
-intg.lo: sci_gateway/fortran/intg.f
-       $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o intg.lo `test -f 'sci_gateway/fortran/intg.f' || echo '$(srcdir)/'`sci_gateway/fortran/intg.f
-
 Ex-odedc.lo: sci_gateway/fortran/Ex-odedc.f
        $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o Ex-odedc.lo `test -f 'sci_gateway/fortran/Ex-odedc.f' || echo '$(srcdir)/'`sci_gateway/fortran/Ex-odedc.f
 
@@ -1264,9 +1136,6 @@ Ex-dassl.lo: sci_gateway/fortran/Ex-dassl.f
 Ex-bvode.lo: sci_gateway/fortran/Ex-bvode.f
        $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o Ex-bvode.lo `test -f 'sci_gateway/fortran/Ex-bvode.f' || echo '$(srcdir)/'`sci_gateway/fortran/Ex-bvode.f
 
-bbvode.lo: sci_gateway/fortran/bbvode.f
-       $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o bbvode.lo `test -f 'sci_gateway/fortran/bbvode.f' || echo '$(srcdir)/'`sci_gateway/fortran/bbvode.f
-
 mostlyclean-libtool:
        -rm -f *.lo
 
@@ -1551,9 +1420,6 @@ uninstall-am: uninstall-libscidifferential_equations_la_etcDATA \
        uninstall-libscidifferential_equations_la_sci_gatewayDATA \
        uninstall-pkglibLTLIBRARIES
 
-                                               -I$(top_srcdir)/modules/api_scilab/includes \
-                                               -I$(top_srcdir)/modules/elementary_functions/includes \
-                                               -I$(top_srcdir)/modules/dynamic_link/includes
 
 # This target enables tests for Scilab
 check-local: $(top_builddir)/scilab-bin test
index 52476cc..04d9ff3 100644 (file)
@@ -295,7 +295,7 @@ r=surf(t,y,x1,x2,...)
               <para>In C The calling sequence must be:</para>
 
               <programlisting role = ""><![CDATA[ 
-void surf(int *ny, double *t, double y[], int *ng, double gout[])
+void surf(int *ny, double *t, double y[], int *ng, double gout[], double rpar[], int ipar[])
  ]]></programlisting>
 
               <para>In Fortran it must be:</para>
@@ -466,4 +466,13 @@ deff('[rts]=gr1(t,y)','rts=[((2*log(y)+8)/t-5)*y;log(y)-2.2491]')
       <member><link linkend="external">external</link></member>
     </simplelist>
   </refsection>
+  <refsection>
+    <title>History</title>
+    <revhistory>
+      <revision>
+        <revnumber>6.0.0</revnumber>
+        <revremark>Prototype of C calling sequence for surf function was wrong.</revremark>
+      </revision>
+    </revhistory>
+  </refsection>
 </refentry>
index 7c901d0..5cbecac 100644 (file)
@@ -31,7 +31,7 @@
   <refsynopsisdiv>
     <title>Calling Sequence</title>
 
-    <synopsis>y=impl([type],y0,ydot0,t0,t [,atol, [rtol]],res,adda [,jac])</synopsis>
+    <synopsis>[y,w,iw]=impl([type,]y0,ydot0,t0,t [,atol, [rtol]],res,adda [,jac] [,w,iw])</synopsis>
   </refsynopsisdiv>
 
   <refsection>
@@ -42,7 +42,7 @@
         <term>y0,ydot0</term>
 
         <listitem>
-          <para>real vectors or matrix (initial conditions).</para>
+          <para>real vectors (initial conditions).</para>
         </listitem>
       </varlistentry>
 
         </listitem>
       </varlistentry>
     </variablelist>
+
+      <varlistentry>
+        <term>w, iw</term>
+
+        <listitem>
+          <para>real vectors.
+        Optional arguments <literal>w</literal> and
+      <literal>iw</literal> are vectors for storing information returned by
+      the integration routine (see <link
+        linkend="ode_optional_output">ode_optional_output</link> for details).
+      When these vectors are provided in RHS of <literal>impl</literal> the
+      integration re-starts with the same parameters as in its previous
+      stop.</para>
+        </listitem>
+      </varlistentry>
+    </variablelist>
   </refsection>
 
   <refsection>
@@ -200,4 +216,13 @@ y=impl([1;0;0],[-0.04;0.04;0],0,0.4,'resid','aplusp');
       <member><link linkend="external">external</link></member>
     </simplelist>
   </refsection>
+  <refsection>
+    <title>History</title>
+    <revhistory>
+      <revision>
+        <revnumber>6.0.0</revnumber>
+        <revremark>Recall impl with the same parameters as in its previous stop is now available.</revremark>
+      </revision>
+    </revhistory>
+  </refsection>
 </refentry>
index 8e9d463..0aeca00 100644 (file)
@@ -34,7 +34,7 @@
       <varlistentry>
         <term>y0</term>
         <listitem>
-          <para>real vector or matrix, the initial conditions.</para>
+          <para>real column vector, the initial conditions.</para>
         </listitem>
       </varlistentry>
       <varlistentry>
@@ -580,4 +580,13 @@ y=ode(y0,t0,t,'myode');
       lsode.f lsoda.f lsodar.f
     </para>
   </refsection>
+  <refsection>
+    <title>History</title>
+    <revhistory>
+      <revision>
+        <revnumber>6.0.0</revnumber>
+        <revremark>y0 is restricted to a column vector.</revremark>
+      </revision>
+    </revhistory>
+  </refsection>
 </refentry>
index 02e1419..057993e 100644 (file)
@@ -33,7 +33,7 @@ y=ode("discrete",y0,k0,kvect,f)</synopsis>
         <term>y0</term>
 
         <listitem>
-          <para>vecteur ou matrice réelle (conditions initiales).</para>
+          <para>vecteur colonne réel (conditions initiales).</para>
         </listitem>
       </varlistentry>
 
@@ -490,4 +490,13 @@ ode("stiff",[0;1],0,1,f,Jacobian)
     <para>Les sous programmes associés se trouvent dans le repertoire
            SCI/modules/differential_equations/src/fortran: lsode.f lsoda.f lsodar.f</para>
   </refsection>
+  <refsection>
+    <title>History</title>
+    <revhistory>
+      <revision>
+        <revnumber>6.0.0</revnumber>
+        <revremark>y0 est resteint a un vecteur colonne.</revremark>
+      </revision>
+    </revhistory>
+  </refsection>
 </refentry>
index 795d787..adb3ca4 100644 (file)
@@ -296,7 +296,7 @@ r=surf(t,y,x1,x2,...)
               <para>Cの場合,呼び出し手順は次のようになります:</para>
 
               <programlisting role = ""><![CDATA[ 
-void surf(int *ny, double *t, double y[], int *ng, double gout[])
+void surf(int *ny, double *t, double y[], int *ng, double gout[], double rpar[], int ipar[])
  ]]></programlisting>
 
               <para>Fortranの場合,呼び出し手順は次のようになります:</para>
index b7b406b..209c1f0 100644 (file)
@@ -1,3 +1,4 @@
+
 <?xml version="1.0" encoding="UTF-8"?>
 <refentry version="5.0-subset Scilab" xml:id="ode" xml:lang="ja"
           xmlns="http://docbook.org/ns/docbook"
@@ -33,7 +34,7 @@ y=ode("discrete",y0,k0,kvect,f)</synopsis>
         <term>y0</term>
 
         <listitem>
-          <para>実数ベクトルまたは行列 (初期条件).</para>
+          <para>実数列ベクトル (初期条件).</para>
         </listitem>
       </varlistentry>
 
index 90755e9..59b5b7c 100644 (file)
@@ -297,7 +297,7 @@ r=surf(t,y,x1,x2,...)
               <para>Em C a seqüência de chamamento deve ser:</para>
 
               <programlisting role = ""><![CDATA[ 
-void surf(int *ny, double *t, double y[], int *ng, double gout[])
+void surf(int *ny, double *t, double y[], int *ng, double gout[], double rpar[], int ipar[])
  ]]></programlisting>
 
               <para>Em Fortran deve ser</para>
index db7cc6b..b904fd2 100644 (file)
@@ -33,7 +33,7 @@ y=ode("discrete",y0,k0,kvect,f)</synopsis>
         <term>y0</term>
 
         <listitem>
-          <para>matriz ou vetor de reais (condições iniciais).</para>
+          <para>vetor coluna de reais (condições iniciais).</para>
         </listitem>
       </varlistentry>
 
diff --git a/scilab/modules/differential_equations/includes/checkodeerror.h b/scilab/modules/differential_equations/includes/checkodeerror.h
new file mode 100644 (file)
index 0000000..51481e2
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) 2011 - DIGITEO - Cedric DELAMARRE
+*
+* 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-en.txt
+*
+*/
+/*--------------------------------------------------------------------------*/
+#include "dynlib_differential_equations.h"
+
+DIFFERENTIAL_EQUATIONS_IMPEXP int checkOdeError(int meth, int istate);
+DIFFERENTIAL_EQUATIONS_IMPEXP int checkDasslError(int idid);
diff --git a/scilab/modules/differential_equations/includes/common_structure.h b/scilab/modules/differential_equations/includes/common_structure.h
new file mode 100644 (file)
index 0000000..afc6cf9
--- /dev/null
@@ -0,0 +1,119 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2012 - DIGITEO - Antoine ELIAS
+ *
+ * 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-en.txt
+ *
+ */
+#ifndef __COMMOM_STRUCTURE_H__
+#define __COMMOM_STRUCTURE_H__
+
+#include "machine.h"
+#include "dynlib_differential_equations.h"
+
+typedef struct {
+    int mesflg, lunit;
+} STR_EH0001;
+
+typedef struct {
+       double tsw; /**< @TODO : add comment */
+       double rowns2[20]; /**< @TODO : add comment */
+       double pdnorm; /**< @TODO : add comment */
+       int insufr; /**< @TODO : add comment */
+       int insufi; /**< @TODO : add comment */
+       int ixpr; /**< @TODO : add comment */
+       int iowns2[2]; /**< @TODO : add comment */
+       int jtyp; /**< @TODO : add comment */
+       int mused; /**< @TODO : add comment */
+       int mxordn; /**< @TODO : add comment */
+       int mxords; /**< @TODO : add comment */
+} STR_LSA001;
+
+typedef struct {
+    double rownr3[2]; 
+    double t0; 
+    double tlast; 
+    double toutc;  
+    int lg0; 
+    int lg1; 
+    int lgx; 
+    int iownr3[2]; 
+    int irfnd; 
+    int itaskc; 
+    int ngc; 
+    int nge; 
+} STR_LSR001;
+
+typedef struct {
+    double tret; 
+    double rowns[209]; 
+    double ccmax; 
+    double el0; 
+    double h__; 
+    double hmin; 
+    double hmxi; 
+    double hu; 
+    double rc; 
+    double tn; 
+    double uround; 
+    int illin; 
+    int init; 
+    int lyh; 
+    int lewt; 
+    int lacor; 
+    int lsavf; 
+    int lwm; 
+    int liwm; 
+    int mxstep; 
+    int mxhnil; 
+
+    int nhnil; 
+    int ntrep; 
+    int nslast; 
+    int nyh; 
+    int iowns[6]; 
+    int icf; 
+    int ierpj; 
+    int iersl; 
+    int jcur; 
+
+    int jstart; 
+    int kflag; 
+    int l; 
+    int meth; 
+    int miter; 
+    int maxord; 
+    int maxcor; 
+    int msbp; 
+    int mxncf; 
+    int n; 
+    int nq; 
+    int nst; 
+    int nfe; 
+    int nje; 
+    int nqu; 
+} STR_LS0001;
+
+#ifdef _MSC_VER
+    DIFFERENTIAL_EQUATIONS_IMPEXP STR_EH0001 C2F(eh0001);
+    DIFFERENTIAL_EQUATIONS_IMPEXP STR_LSA001 C2F(lsa001);
+    DIFFERENTIAL_EQUATIONS_IMPEXP STR_LSR001 C2F(lsr001);
+    DIFFERENTIAL_EQUATIONS_IMPEXP STR_LS0001 C2F(ls0001);
+#else
+    #ifdef __DIFFERENTIAL_EQUATIONS_GW_HXX__
+        extern STR_EH0001 C2F(eh0001);
+        extern STR_LSA001 C2F(lsa001);
+        extern STR_LSR001 C2F(lsr001);
+        extern STR_LS0001 C2F(ls0001);
+    #else
+        STR_EH0001 C2F(eh0001);
+        STR_LSA001 C2F(lsa001);
+        STR_LSR001 C2F(lsr001);
+        STR_LS0001 C2F(ls0001);
+    #endif
+#endif
+#endif /* !__COMMOM_STRUCTURE_H__ */
diff --git a/scilab/modules/differential_equations/includes/differential_equations_gw.hxx b/scilab/modules/differential_equations/includes/differential_equations_gw.hxx
new file mode 100644 (file)
index 0000000..c1279a0
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ *  Copyright (C) 2011 - DIGITEO - Cedric DELAMARRE
+ *
+ *  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-en.txt
+ *
+ */
+
+#ifndef __DIFFERENTIAL_EQUATIONS_GW_HXX__
+#define __DIFFERENTIAL_EQUATIONS_GW_HXX__
+
+#include "cpp_gateway_prototype.hxx"
+
+extern "C"
+{
+#include "dynlib_differential_equations.h"
+}
+
+// equation 1
+CPP_GATEWAY_PROTOTYPE_EXPORT(sci_ode, DIFFERENTIAL_EQUATIONS_IMPEXP);
+
+// equation 2
+CPP_GATEWAY_PROTOTYPE_EXPORT(sci_impl, DIFFERENTIAL_EQUATIONS_IMPEXP);    // Old function name was sciimpl
+CPP_GATEWAY_PROTOTYPE_EXPORT(sci_dassl, DIFFERENTIAL_EQUATIONS_IMPEXP);   // Old function name dassli
+CPP_GATEWAY_PROTOTYPE_EXPORT(sci_dasrt, DIFFERENTIAL_EQUATIONS_IMPEXP);   // Old function name was dasrti
+
+// equation 3
+CPP_GATEWAY_PROTOTYPE_EXPORT(sci_odedc, DIFFERENTIAL_EQUATIONS_IMPEXP);   // Old function name was sci_odc
+
+// equation 4
+CPP_GATEWAY_PROTOTYPE_EXPORT(sci_intg, DIFFERENTIAL_EQUATIONS_IMPEXP);
+CPP_GATEWAY_PROTOTYPE_EXPORT(sci_int2d, DIFFERENTIAL_EQUATIONS_IMPEXP);
+CPP_GATEWAY_PROTOTYPE_EXPORT(sci_int3d, DIFFERENTIAL_EQUATIONS_IMPEXP);
+CPP_GATEWAY_PROTOTYPE_EXPORT(sci_feval, DIFFERENTIAL_EQUATIONS_IMPEXP);
+
+// equation 6
+CPP_GATEWAY_PROTOTYPE_EXPORT(sci_bvode, DIFFERENTIAL_EQUATIONS_IMPEXP);   // Old function name was scibvode
+
+#endif /* !__DIFFERENTIAL_EQUATIONS_GW_HXX__ */
diff --git a/scilab/modules/differential_equations/includes/differentialequationfunctions.hxx b/scilab/modules/differential_equations/includes/differentialequationfunctions.hxx
new file mode 100644 (file)
index 0000000..d42aa80
--- /dev/null
@@ -0,0 +1,283 @@
+/*
+ *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ *  Copyright (C) 2011 - DIGITEO - Cedric DELAMARRE
+ *
+ *  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-en.txt
+ *
+ */
+
+#ifndef __DIFFERENTIALEQUATIONS_HXX__
+#define __DIFFERENTIALEQUATIONS_HXX__
+
+#include <map>
+#include "dynlib_differential_equations.h"
+#include "string.hxx"
+#include "callable.hxx"
+
+extern "C"
+{
+#include "Thread_Wrapper.h"
+}
+
+extern "C"
+{
+    // jacobian
+    void C2F(jex)   (int*, double*, double*, int*, int*, double*, int*);
+
+    // ode
+    void C2F(arnol) (int*, double*, double*, double*);
+    void C2F(fex)   (int*, double*, double*, double*);
+    void C2F(fex2)  (int*, double*, double*, double*);
+    void C2F(fex3)  (int*, double*, double*, double*);
+    void C2F(fexab) (int*, double*, double*, double*);
+    void C2F(loren) (int*, double*, double*, double*);
+    void C2F(bcomp) (int*, double*, double*, double*);
+    void C2F(lcomp) (int*, double*, double*, double*);
+
+    // odedc
+    typedef int(*odedc_f_t)(int*, int*, int*, double *, double*, double*);
+    void C2F(fcd)   (int*, int*, int*, double *, double*, double*);
+    void C2F(fcd1)  (int*, int*, int*, double *, double*, double*);
+    void C2F(fexcd) (int*, int*, int*, double *, double*, double*);
+    void C2F(phis)  (int*, int*, int*, double *, double*, double*);
+    void C2F(phit)  (int*, int*, int*, double *, double*, double*);
+
+    // intg
+    double C2F(intgex)(double*);
+
+    // int2d
+    double C2F(int2dex)(double*, double*);
+
+    // int3d
+    void C2F(int3dex)(double*, int*, double*);
+
+    // feval
+    int C2F(parab)  (int*, double*, double*, double*, int*);
+    int C2F(parabc) (int*, double*, double*, double*, int*);
+
+    // bvode
+    void C2F(cndg)  (int*, double*, double*);
+    void C2F(cng)   (int*, double*, double*);
+    void C2F(cnf)   (double*, double*, double*);
+    void C2F(cndf)  (double*, double*, double*);
+    void C2F(cngu)  (double*, double*, double*);
+
+    // impl
+    void C2F(resid) (int*, double*, double*, double*, double*, int*);
+    void C2F(aplusp)(int*, double*, double*, double*, double*, double*, int*);
+    void C2F(dgbydy)(int*, double*, double*, double*, double*, double*, double*, int*);
+
+    // dassl dasrt
+    void C2F(res1)  (double*, double*, double*, double*, int*, double*, int*);
+    void C2F(res2)  (double*, double*, double*, double*, int*, double*, int*);
+    void C2F(dres1) (double*, double*, double*, double*, int*, double*, int*);
+    void C2F(dres2) (double*, double*, double*, double*, int*, double*, int*);
+    void C2F(jac2)  (double*, double*, double*, double*, double*, double*, int*);
+    void C2F(djac2) (double*, double*, double*, double*, double*, double*, int*);
+    void C2F(djac1) (double*, double*, double*, double*, double*, double*, int*);
+
+    // dasrt
+    void C2F(gr1)(int*, double*, double*, int*, double*, double*, int*);
+    void C2F(gr2)(int*, double*, double*, int*, double*, double*, int*);
+}
+
+class DIFFERENTIAL_EQUATIONS_IMPEXP DifferentialEquationFunctions
+{
+
+public :
+
+    DifferentialEquationFunctions(std::wstring callerName);
+    ~DifferentialEquationFunctions();
+
+    void setOdeYRows(int);
+    void setOdeYCols(int);
+
+    void setOdedcYDSize(int);
+    void setOdedcFlag();
+    void resetOdedcFlag();
+
+    void setFFunction(types::Callable*);
+    void setJacFunction(types::Callable*);
+    void setGFunction(types::Callable*);
+
+    bool setFFunction(types::String*);
+    bool setJacFunction(types::String*);
+    bool setGFunction(types::String*);
+
+    void setFArgs(types::InternalType*);
+    void setJacArgs(types::InternalType*);
+    void setGArgs(types::InternalType*);
+
+    int getOdeYRows();
+    int getOdeYCols();
+
+    int getOdedcYDSize();
+    int getOdedcFlag();
+
+    int execOdeF(int* n, double* t, double* y, double* ydot);
+    int execFunctionJac(int *n,double *t,double *y,int *ml,int *mu,double *J,int *nrpd);
+    int execFunctionG(int* n, double* t, double* y, int* ng, double* gout);
+
+    double execIntgF(double* x);
+    double execInt2dF(double* x, double* y);
+    double execInt3dF(double* x, int* numfun, double* funvls);
+
+    int execFevalF(int *nn, double *x1, double *x2, double *xres, int *itype);
+
+    // bvode
+    void setFsubFunction(types::Callable*);
+    void setDfsubFunction(types::Callable*);
+    void setGsubFunction(types::Callable*);
+    void setDgsubFunction(types::Callable*);
+    void setGuessFunction(types::Callable*);
+
+    bool setFsubFunction(types::String*);
+    bool setDfsubFunction(types::String*);
+    bool setGsubFunction(types::String*);
+    bool setDgsubFunction(types::String*);
+    bool setGuessFunction(types::String*);
+
+    void setFsubArgs(types::InternalType*);
+    void setDfsubArgs(types::InternalType*);
+    void setGsubArgs(types::InternalType*);
+    void setDgsubArgs(types::InternalType*);
+    void setGuessArgs(types::InternalType*);
+
+    void setBvodeM(int);
+    void setBvodeN(int);
+
+    int execBvodeGsub(int*, double*, double*);
+    int execBvodeDgsub(int*, double*, double*);
+    int execBvodeFsub(double*, double*, double*);
+    int execBvodeDfsub(double*, double*, double*);
+    int execBvodeGuess(double*, double*, double*);
+
+    // impl
+    int execImplF(int*, double*, double*, double*, double*, int*);
+    int execImplG(int*, double*, double*, double*, double*, double*, int*);
+    int execImplJac(int*, double*, double*, double*, double*, double*, double*, int*);
+
+    //dassl dasrt
+    int execDasslF(double*, double*, double*, double*, int*, double*, int*);
+    int execDasslJac(double*, double*, double*, double*, double*, double*, int*);
+    void setMu(int);
+    void setMl(int);
+
+    // dasrt
+    int execDasrtG(int*, double*, double*, int*, double*, double*, int*);
+
+private :
+
+    std::map<std::wstring, void*> m_staticFunctionMap;
+    std::wstring m_wstrCaller;
+
+    int m_odeYRows;
+    int m_odeYCols;
+
+    // odedc
+    int m_odedcYDSize;
+    int m_odedcFlag;
+
+    // bvode
+    int m_bvodeM;
+    int m_bvodeN;
+
+    // dassl dasrt
+    int m_mu;
+    int m_ml;
+    bool m_bandedJac;
+
+    types::Callable* m_pCallFFunction;
+    types::Callable* m_pCallJacFunction;
+    types::Callable* m_pCallGFunction;
+
+    types::String* m_pStringFFunctionDyn;
+    types::String* m_pStringJacFunctionDyn;
+    types::String* m_pStringGFunctionDyn;
+
+    types::String* m_pStringFFunctionStatic;
+    types::String* m_pStringJacFunctionStatic;
+    types::String* m_pStringGFunctionStatic;
+
+    std::vector<types::InternalType*> m_FArgs;
+    std::vector<types::InternalType*> m_JacArgs;
+    std::vector<types::InternalType*> m_odeGArgs;
+
+    // ode / odedc
+    int callOdeMacroF(int* n, double* t, double* y, double* ydot);
+    int callMacroJac(int *n,double *t,double *y,int *ml,int *mu,double *J,int *nrpd);
+    int callMacroG(int* n, double* t, double* y, int* ng, double* gout);
+
+    // intg
+    double callIntgMacroF(double* x);
+
+    // int2d
+    double callInt2dMacroF(double* x, double* y);
+
+    // int3d
+    double callInt3dMacroF(double* x, int* numfun, double* funvls);
+
+    // feval
+    int callFevalMacroF(int *nn, double *x1, double *x2, double *xres, int *itype);
+
+    // bvode
+    types::Callable* m_pCallFsubFunction;
+    types::Callable* m_pCallDfsubFunction;
+    types::Callable* m_pCallGsubFunction;
+    types::Callable* m_pCallDgsubFunction;
+    types::Callable* m_pCallGuessFunction;
+
+    types::String* m_pStringFsubFunctionDyn;
+    types::String* m_pStringDfsubFunctionDyn;
+    types::String* m_pStringGsubFunctionDyn;
+    types::String* m_pStringDgsubFunctionDyn;
+    types::String* m_pStringGuessFunctionDyn;
+
+    types::String* m_pStringFsubFunctionStatic;
+    types::String* m_pStringDfsubFunctionStatic;
+    types::String* m_pStringGsubFunctionStatic;
+    types::String* m_pStringDgsubFunctionStatic;
+    types::String* m_pStringGuessFunctionStatic;
+
+    std::vector<types::InternalType*> m_FsubArgs;
+    std::vector<types::InternalType*> m_DfsubArgs;
+    std::vector<types::InternalType*> m_GsubArgs;
+    std::vector<types::InternalType*> m_DgsubArgs;
+    std::vector<types::InternalType*> m_GuessArgs;
+
+    int callBvodeMacroGsub  (int* i, double* z, double* g);
+    int callBvodeMacroDgsub (int* i, double* z, double* g);
+    int callBvodeMacroFsub  (double* x, double* z, double* d);
+    int callBvodeMacroDfsub (double* x, double* z, double* d);
+    int callBvodeMacroGuess (double* x, double* z, double* d);
+
+    // impl
+    int callImplMacroF(int*, double*, double*, double*, double*, int*);
+    int callImplMacroG(int*, double*, double*, double*, double*, double*, int*);
+    int callImplMacroJac(int*, double*, double*, double*, double*, double*, double*, int*);
+
+    // dassl dasrt
+    int callDasslMacroF(double*, double*, double*, double*, int*, double*, int*);
+    int callDasslMacroJac(double*, double*, double*, double*, double*, double*, int*);
+
+    // dasrt
+    int callDasrtMacroG(int*, double*, double*, int*, double*, double*, int*);
+};
+
+class DIFFERENTIAL_EQUATIONS_IMPEXP DifferentialEquation 
+{
+    // differential equation functions
+private :
+    static std::map<__threadId, DifferentialEquationFunctions*> m_mapDifferentialEquationFunctions;
+
+public :
+    static void addDifferentialEquationFunctions(DifferentialEquationFunctions* _deFunction);
+    static void removeDifferentialEquationFunctions();
+    static DifferentialEquationFunctions* getDifferentialEquationFunctions();
+};
+#endif /* !__DIFFERENTIALEQUATIONS_HXX__ */
+
diff --git a/scilab/modules/differential_equations/includes/dynlib_differential_equations_gw.h b/scilab/modules/differential_equations/includes/dynlib_differential_equations_gw.h
new file mode 100644 (file)
index 0000000..1cb3f03
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) DIGITEO - 2012 - Antoine ELIAS
+* 
+* 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-en.txt
+*
+*/
+
+/*--------------------------------------------------------------------------*/ 
+#ifndef __DYNLIB_DIFFERENTIAL_EQUATIONS_GW_H__
+#define __DYNLIB_DIFFERENTIAL_EQUATIONS_GW_H__
+
+#ifdef _MSC_VER
+    #ifdef DIFFERENTIAL_EQUATIONS_GW_EXPORTS
+               #define DIFFERENTIAL_EQUATIONS_GW_IMPEXP __declspec(dllexport)
+       #else
+               #define DIFFERENTIAL_EQUATIONS_GW_IMPEXP __declspec(dllimport)
+       #endif
+#else
+       #define DIFFERENTIAL_EQUATIONS_GW_IMPEXP
+#endif
+
+#endif /* __DYNLIB_DIFFERENTIAL_EQUATIONS_GW_H__ */
+/*--------------------------------------------------------------------------*/ 
index f53c53c..a248798 100644 (file)
@@ -18,7 +18,7 @@
 /*--------------------------------------------------------------------------*/
 DIFFERENTIAL_EQUATIONS_IMPEXP int gw_differential_equations1(void);
 /*--------------------------------------------------------------------------*/
-int sci_ode(char *fname,unsigned long fname_len);
+//int sci_ode(char *fname,unsigned long fname_len);
 /*--------------------------------------------------------------------------*/
 #endif  /* __GW_DIFFERENTIAL_EQUATIONS1__ */
 /*--------------------------------------------------------------------------*/
index 800b85b..1edad3a 100644 (file)
@@ -19,9 +19,9 @@
 /*--------------------------------------------------------------------------*/ 
 DIFFERENTIAL_EQUATIONS_IMPEXP int gw_differential_equations2(void);
 /*--------------------------------------------------------------------------*/ 
-int C2F(sciimpl)(char *fname,unsigned long fname_len);
-int C2F(dassli)(char *fname,unsigned long fname_len);
-int C2F(dasrti)(char *fname,unsigned long fname_len);
+//int C2F(sciimpl)(char *fname,unsigned long fname_len);
+//int C2F(dassli)(char *fname,unsigned long fname_len);
+//int C2F(dasrti)(char *fname,unsigned long fname_len);
 /*--------------------------------------------------------------------------*/ 
 #endif  /* __GW_DIFFERENTIAL_EQUATIONS2__ */
 /*--------------------------------------------------------------------------*/
index 1e9faf3..bb02c46 100644 (file)
@@ -18,7 +18,7 @@
 /*--------------------------------------------------------------------------*/
 DIFFERENTIAL_EQUATIONS_IMPEXP int gw_differential_equations3(void);
 /*--------------------------------------------------------------------------*/
-int sci_odc(char *fname,unsigned long l);
+//int sci_odc(char *fname,unsigned long l);
 /*--------------------------------------------------------------------------*/
 #endif  /* __GW_DIFFERENTIAL_EQUATIONS3__ */
 /*--------------------------------------------------------------------------*/
index 19b79e7..e2f20c3 100644 (file)
 /*--------------------------------------------------------------------------*/
 DIFFERENTIAL_EQUATIONS_IMPEXP int gw_differential_equations4(void);
 /*--------------------------------------------------------------------------*/
-int sci_intg(char *fname,unsigned long fname_len);
-int sci_int2d(char *fname,unsigned long fname_len);
-int sci_int3d(char *fname,unsigned long fname_len);
-int sci_feval(char *fname,unsigned long fname_len);
+//int sci_intg(char *fname,unsigned long fname_len);
+//int sci_int2d(char *fname,unsigned long fname_len);
+//int sci_int3d(char *fname,unsigned long fname_len);
+//int sci_feval(char *fname,unsigned long fname_len);
 /*--------------------------------------------------------------------------*/
 #endif  /* __GW_DIFFERENTIAL_EQUATIONS4__ */
 /*--------------------------------------------------------------------------*/
index 5409baa..4378edf 100644 (file)
@@ -19,7 +19,7 @@
 /*--------------------------------------------------------------------------*/ 
 DIFFERENTIAL_EQUATIONS_IMPEXP int gw_differential_equations6(void);
 /*--------------------------------------------------------------------------*/ 
-int C2F(scibvode)(char *fname,unsigned long fname_len);
+//int C2F(scibvode)(char *fname,unsigned long fname_len);
 /*--------------------------------------------------------------------------*/ 
 #endif  /* __GW_DIFFERENTIAL_EQUATIONS6__ */
 /*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/differential_equations/includes/scifunctions.h b/scilab/modules/differential_equations/includes/scifunctions.h
new file mode 100644 (file)
index 0000000..76a56b3
--- /dev/null
@@ -0,0 +1,97 @@
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) 2011 - DIGITEO - Cedric DELAMARRE
+*
+* 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-en.txt
+*
+*/
+/*--------------------------------------------------------------------------*/
+
+#include "dynlib_differential_equations.h"
+
+// ode / odedc
+typedef int(*ode_f_t)(int *n, double *t, double *y, double *ydot);
+typedef int(*func_jac_t)(int *n, double *t, double *y, int *ml, int *mu, double *J, int *nrpd);
+typedef int(*func_g_t)(int *n, double *t, double *y, int *ng, double *gout);
+
+extern double C2F(lsoda)(ode_f_t, int*, double*, double*, double*, int*, double*, double*, int*, int*, int*, double*, int*, int*, int*, func_jac_t, int*);
+extern double C2F(lsode)(ode_f_t, int*, double*, double*, double*, int*, double*, double*, int*, int*, int*, double*, int*, int*, int*, func_jac_t, int*);
+extern double C2F(lsodar)(ode_f_t, int*, double*, double*, double*, int*, double*, double*, int*, int*, int*, double*, int*, int*, int*, func_jac_t, int*, func_g_t, int*, int*);
+extern double C2F(lsdisc)(ode_f_t f, int* neq, double* y, double* t, double* tout, double* rwork, int* lrw, int* istate);
+extern double C2F(lsrgk)(ode_f_t, int*, double*, double*, double*, int*, double*, double*, int*, int*, int*, double*, int*, int*, int*, func_jac_t, int*);
+extern double C2F(rkf45)(ode_f_t, int*, double*, double*, double*, int*, double*, double*, int*, int*, int*, double*, int*, int*, int*, func_jac_t, int*);
+extern double C2F(rksimp)(ode_f_t, int*, double*, double*, double*, int*, double*, double*, int*, int*, int*, double*, int*, int*, int*, func_jac_t, int*);
+
+DIFFERENTIAL_EQUATIONS_IMPEXP int ode_f(int* n, double* t, double* y, double* ydot);
+DIFFERENTIAL_EQUATIONS_IMPEXP int ode_jac(int *n, double *t, double *y, int *ml, int *mu, double *J, int *nrpd);
+DIFFERENTIAL_EQUATIONS_IMPEXP int ode_g(int *n, double *t, double *y, int *ng, double *gout);
+
+// intg
+typedef double(*intg_f_t)(double*);
+
+extern double C2F(dqags)(intg_f_t, double*, double*, double*, double*, double*, double*, double*, double*, int*, int*, int*, double*, double*, int*);
+
+DIFFERENTIAL_EQUATIONS_IMPEXP double intg_f(double*);
+
+// int2d
+typedef double(*int2d_f_t)(double*, double*);
+
+extern double C2F(twodq)(int2d_f_t, int*, double*, double*, double*, int*, int*, int*, double*, double*, int*, int*, int*, int*, double*, int*);
+
+DIFFERENTIAL_EQUATIONS_IMPEXP double int2d_f(double*, double*);
+
+// int3d
+typedef double(*int3d_f_t)(double*, int*, double*);
+
+extern double C2F(dcutet)(int3d_f_t, int*, double*, int*, int*, int*, double*, double*, int*, int*, int*, double*, double*, int*, int*, double*, int*);
+
+DIFFERENTIAL_EQUATIONS_IMPEXP double int3d_f(double*, int*, double*);
+
+// feval
+typedef int(*feval_f_t)(int*, double*, double*, double*, int*);
+
+// bvode
+typedef int(*bvode_idd_t)(int*, double*, double*);
+typedef int(*bvode_ddd_t)(double*, double*, double*);
+
+extern double C2F(colnew)(int*, int*, double*, double*, double*, int*, int*, double*, double*, int*, double*, int*, bvode_ddd_t, bvode_ddd_t, bvode_idd_t, bvode_idd_t, bvode_ddd_t);
+
+extern double C2F(appsln)(double*, double*, double*, int*);
+
+DIFFERENTIAL_EQUATIONS_IMPEXP int bvode_gsub(int*, double*, double*);
+DIFFERENTIAL_EQUATIONS_IMPEXP int bvode_dgsub(int*, double*, double*);
+DIFFERENTIAL_EQUATIONS_IMPEXP int bvode_fsub(double*, double*, double*);
+DIFFERENTIAL_EQUATIONS_IMPEXP int bvode_dfsub(double*, double*, double*);
+DIFFERENTIAL_EQUATIONS_IMPEXP int bvode_guess(double*, double*, double*);
+
+// impl
+typedef int(*impl_f_t)(int*, double*, double*, double*, double*, int*);
+typedef int(*impl_g_t)(int*, double*, double*, double*, double*, double*, int*);
+typedef int(*impl_jac_t)(int*, double*, double*, double*, double*, double*, double*, int*);
+
+DIFFERENTIAL_EQUATIONS_IMPEXP extern double C2F(lsodi)(impl_f_t, impl_g_t, impl_jac_t, int*, double*, double*, double*, double*, int*, double*, double*, int*, int*, int*, double*, int*, int*, int*, int*);
+
+DIFFERENTIAL_EQUATIONS_IMPEXP int impl_f(int*, double*, double*, double*, double*, int*);
+DIFFERENTIAL_EQUATIONS_IMPEXP int impl_g(int*, double*, double*, double*, double*, double*, int*);
+DIFFERENTIAL_EQUATIONS_IMPEXP int impl_jac(int*, double*, double*, double*, double*, double*, double*, int*);
+
+//dassl dasrt
+typedef int(*dassl_f_t)(double*, double*, double*, double*, int*, double*, int*);
+typedef int(*dassl_jac_t)(double*, double*, double*, double*, double*, double*, int*);
+
+extern void C2F(dassl)(dassl_f_t, int*, double*, double*, double*, double*, int*, double*, double*, int*, double*, int*, int*, int*, double*, int*, dassl_jac_t);
+
+DIFFERENTIAL_EQUATIONS_IMPEXP int dassl_f(double*, double*, double*, double*, int*, double*, int*);
+DIFFERENTIAL_EQUATIONS_IMPEXP int dassl_jac(double*, double*, double*, double*, double*, double*, int*);
+
+//dasrt
+typedef int(*dasrt_g_t)(int*, double*, double*, int*, double*, double*, int*);
+
+extern void C2F(ddasrt)(dassl_f_t, int*, double*, double*, double*, double*, int*, double*, double*, int*, double*, int*, int*, int*, double*, int*, dassl_jac_t, dasrt_g_t, int*, int*);
+
+DIFFERENTIAL_EQUATIONS_IMPEXP int dasrt_g(int*, double*, double*, int*, double*, double*, int*);
+
index 82e448b..692b2b1 100644 (file)
@@ -18,7 +18,7 @@
 /*--------------------------------------------------------------------------*/
 static gw_generic_table Tab[] =
 {
-       {sci_ode,"ode"}
+       {NULL,""} //
 };
 /*--------------------------------------------------------------------------*/
 int gw_differential_equations1(void)
index a9a06ef..6c08ab5 100644 (file)
@@ -18,9 +18,9 @@
 /*--------------------------------------------------------------------------*/
 static gw_generic_table Tab[]=
 {
-       {C2F(sciimpl),"impl"},
-       {C2F(dassli),"dassl"},
-       {C2F(dasrti),"dasrt"}
+       {NULL,""}, // impl
+       {NULL,""}, // dassl
+       {NULL,""}  // dasrt
 };
 
 /*--------------------------------------------------------------------------*/
index a05bc87..f9c814c 100644 (file)
@@ -17,7 +17,7 @@
 /*--------------------------------------------------------------------------*/
 static gw_generic_table Tab[] =
 {
-       {sci_odc,"odedc"}
+       {NULL,""} // odedc
 };
 /*--------------------------------------------------------------------------*/
 int gw_differential_equations3(void)
index 58ef47e..1a070cb 100644 (file)
 /*--------------------------------------------------------------------------*/
 static gw_generic_table Tab[] =
 {
-       {sci_intg,"intg"},
-       {sci_int2d,"int2d"},
-       {sci_int3d,"int3d"},
-       {sci_feval,"feval"}
+       {NULL,""},  // intg
+       {NULL,""}, // int2d
+       {NULL,""}, // int3d
+       {NULL,""}  // feval
 };
 /*--------------------------------------------------------------------------*/
 int gw_differential_equations4(void)
index 7067e9b..13f9fa2 100644 (file)
@@ -18,7 +18,7 @@
 /*--------------------------------------------------------------------------*/
 static gw_generic_table Tab[] =
 {
-       {C2F(scibvode),"bvode"}
+       {NULL,""} // bvode
 };
 /*--------------------------------------------------------------------------*/
 int gw_differential_equations6(void)
diff --git a/scilab/modules/differential_equations/sci_gateway/cpp/sci_bvode.cpp b/scilab/modules/differential_equations/sci_gateway/cpp/sci_bvode.cpp
new file mode 100644 (file)
index 0000000..6477f4f
--- /dev/null
@@ -0,0 +1,554 @@
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (//) 2011 - DIGITEO - Cedric DELAMARRE
+*
+* 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-en.txt
+*
+*/
+/*--------------------------------------------------------------------------*/
+
+#include "differential_equations_gw.hxx"
+#include "function.hxx"
+#include "double.hxx"
+#include "string.hxx"
+#include "list.hxx"
+#include "callable.hxx"
+#include "differentialequationfunctions.hxx"
+
+extern "C"
+{
+#include "localization.h"
+#include "Scierror.h"
+#include "scifunctions.h"
+}
+
+/*--------------------------------------------------------------------------*/
+types::Function::ReturnValue sci_bvode(types::typed_list &in, int _iRetCount, types::typed_list &out)
+{
+    int iPos = 0;
+
+    // input
+    types::Double* pDblXpts     = NULL;
+    types::Double* pDblM        = NULL;
+    types::Double* pDblZeta     = NULL;
+    types::Double* pDblIpar     = NULL;
+    types::Double* pDblLtol     = NULL;
+    types::Double* pDblTol      = NULL;
+    types::Double* pDblFixpnt   = NULL;
+
+    double aleft    = 0;
+    double aright   = 0;
+    int ncomp       = 0;
+    int sumM        = 0;
+    int maxM        = 0;
+    int iflag       = 0;
+    int ipar[11];
+
+// *** check the minimal number of input args. ***
+    if(in.size() != 15)
+    {
+        ScierrorW(77, _W("%ls: Wrong number of input argument(s): %d expected.\n"), L"bvode", 15);
+        return types::Function::Error;
+    }
+
+// *** check number of output args ***
+    if(_iRetCount > 1)
+    {
+        ScierrorW(78, _W("%ls: Wrong number of output argument(s): %d expected.\n"), L"bvode", 1);
+        return types::Function::Error;
+    }
+
+// *** check type of input args and get it. ***
+
+    // xpoints
+    if(in[iPos]->isDouble() == false)
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A matrix expected.\n"), L"bvode", iPos+1);
+        return types::Function::Error;
+    }
+
+    pDblXpts = in[iPos]->getAs<types::Double>();
+    iPos++;
+
+    // ncomp
+    if(in[iPos]->isDouble() == false)
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A scalar expected.\n"), L"bvode", iPos+1);
+        return types::Function::Error;
+    }
+
+    types::Double* pDblN = in[iPos]->getAs<types::Double>();
+
+    if(pDblN->isScalar() == false)
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A scalar expected.\n"), L"bvode", iPos+1);
+        return types::Function::Error;
+    }
+
+    ncomp = (int)pDblN->get(0);
+
+    if(ncomp > 20)
+    {
+        ScierrorW(999, _W("%ls: Wrong value for input argument #%d : Value at most 20 expected.\n"), L"bvode", iPos+1);
+        return types::Function::Error;
+    }
+    iPos++;
+
+    // m
+    if(in[iPos]->isDouble() == false)
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A matrix expected.\n"), L"bvode", iPos+1);
+        return types::Function::Error;
+    }
+
+    pDblM = in[iPos]->getAs<types::Double>();
+
+    if(pDblM->getSize() != ncomp)
+    {
+        ScierrorW(999, _W("%ls: Wrong size for input argument #%d : A vector of size %d (N) expected.\n"), L"bvode", iPos+1, ncomp);
+        return types::Function::Error;
+    }
+
+    int* M = (int*)malloc(pDblM->getSize() * sizeof(int));
+    for(int i = 0; i < pDblM->getSize(); i++)
+    {
+        M[i] = (int)pDblM->get(i);
+        sumM += (int)pDblM->get(i);
+        maxM = Max(maxM, (int)pDblM->get(i));
+    }
+
+    if(sumM > 40)
+    {
+        ScierrorW(999, _W("%ls: Wrong value for input argument #%d : Sum of m must be less than 40.\n"), L"bvode", iPos+1, sumM);
+        free(M);
+        return types::Function::Error;
+    }
+
+    iPos++;
+
+    // aleft
+    if(in[iPos]->isDouble() == false)
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A scalar expected.\n"), L"bvode", iPos+1);
+        free(M);
+        return types::Function::Error;
+    }
+
+    types::Double* pDblXLow = in[iPos]->getAs<types::Double>();
+
+    if(pDblXLow->isScalar() == false)
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A scalar expected.\n"), L"bvode", iPos+1);
+        free(M);
+        return types::Function::Error;
+    }
+
+    aleft = pDblXLow->get(0);
+    iPos++;
+
+    // aright
+    if(in[iPos]->isDouble() == false)
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A scalar expected.\n"), L"bvode", iPos+1);
+        free(M);
+        return types::Function::Error;
+    }
+
+    types::Double* pDblXUp = in[iPos]->getAs<types::Double>();
+
+    if(pDblXUp->isScalar() == false)
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A scalar expected.\n"), L"bvode", iPos+1);
+        free(M);
+        return types::Function::Error;
+    }
+
+    aright = pDblXUp->get(0);
+    iPos++;
+
+    // zeta
+    if(in[iPos]->isDouble() == false)
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A matrix expected.\n"), L"bvode", iPos+1);
+        free(M);
+        return types::Function::Error;
+    }
+
+    pDblZeta = in[iPos]->getAs<types::Double>();
+
+    for(int i = 0; i < pDblZeta->getSize() - 1; i++)
+    {
+        if(pDblZeta->get(i) > pDblZeta->get(i+1))
+        {
+            ScierrorW(999, _W("%ls: Wrong value for input argument #%d : zeta(j) lower or equal to zeta(j+1) expected.\n"), L"bvode", iPos+1);
+            free(M);
+            return types::Function::Error;
+        }
+    }
+
+    iPos++;
+
+    // ipar
+    if(in[iPos]->isDouble() == false)
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A matrix expected.\n"), L"bvode", iPos+1);
+        free(M);
+        return types::Function::Error;
+    }
+
+    pDblIpar = in[iPos]->getAs<types::Double>();
+
+    if(pDblIpar->getSize() != 11)
+    {
+        ScierrorW(999, _W("%ls: Wrong size for input argument #%d : A vector of size 11 expected.\n"), L"bvode", iPos+1);
+        free(M);
+        return types::Function::Error;
+    }
+
+    for(int i = 0; i < 11; i++)
+    {
+       ipar[i] = (int)pDblIpar->get(i);
+    }
+
+    if(ipar[1] < maxM || ipar[1] > 7)
+    {
+        ipar[1] = Max(maxM + 1, 5 - maxM);
+    }
+
+    if(ipar[2] == 0)
+    {
+        ipar[2] = 5;
+    }
+
+    iPos++;
+
+    // ltol
+    if(in[iPos]->isDouble() == false)
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A matrix expected.\n"), L"bvode", iPos+1);
+        free(M);
+        return types::Function::Error;
+    }
+
+    pDblLtol = in[iPos]->getAs<types::Double>();
+
+    if(pDblLtol->getSize() != ipar[3])
+    {
+        ScierrorW(999, _W("%ls: Wrong size for input argument #%d : An array of size %d (ipar(4)) expected.\n"), L"bvode", iPos+1, ipar[3]);
+        free(M);
+        return types::Function::Error;
+    }
+
+    iPos++;
+
+    // tol
+    if(in[iPos]->isDouble() == false)
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A matrix expected.\n"), L"bvode", iPos+1);
+        free(M);
+        return types::Function::Error;
+    }
+
+    pDblTol = in[iPos]->getAs<types::Double>();
+
+    if(pDblTol->getSize() != ipar[3])
+    {
+        ScierrorW(999, _W("%ls: Wrong size for input argument #%d : An array of size %d (ipar(4)) expected.\n"), L"bvode", iPos+1, ipar[3]);
+        free(M);
+        return types::Function::Error;
+    }
+
+    iPos++;
+
+    // fixpnt
+    if(in[iPos]->isDouble() == false)
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A matrix expected.\n"), L"bvode", iPos+1);
+        free(M);
+        return types::Function::Error;
+    }
+
+    pDblFixpnt = in[iPos]->getAs<types::Double>();
+
+    if(pDblFixpnt->getSize() != ipar[10] && ipar[10] != 0)
+    {
+        ScierrorW(999, _W("%ls: Wrong size for input argument #%d : An array of size %d (ipar(11)) expected.\n"), L"bvode", iPos+1, ipar[10]);
+        free(M);
+        return types::Function::Error;
+    }
+
+    iPos++;
+
+    // functions : fsub,dfsub,gsub,dgsub,guess
+    DifferentialEquationFunctions* deFunctionsManager = new DifferentialEquationFunctions(L"bvode");
+    DifferentialEquation::addDifferentialEquationFunctions(deFunctionsManager);
+    deFunctionsManager->setBvodeM(sumM);
+    deFunctionsManager->setBvodeN(ncomp);
+
+    for(int i = iPos; i < 15; i++)
+    {
+        if(in[i]->isCallable())
+        {
+            types::Callable* pCall = in[i]->getAs<types::Callable>();
+            if(i == 10) // fsub
+            {
+                deFunctionsManager->setFsubFunction(pCall);
+            }
+            else if(i == 11) // dfsub
+            {
+                deFunctionsManager->setDfsubFunction(pCall);
+            }
+            else if(i == 12) // gsub
+            {
+                deFunctionsManager->setGsubFunction(pCall);
+            }
+            else if(i == 13) // dgsub
+            {
+                deFunctionsManager->setDgsubFunction(pCall);
+            }
+            else if(i == 14 && ipar[8] == 1) // guess is needed only if ipar(9) == 1
+            {
+                deFunctionsManager->setGuessFunction(pCall);
+            }
+        }
+        else if(in[i]->isString())
+        {
+            bool bOK = false;
+            types::String* pStr = in[i]->getAs<types::String>();
+            if(i == 10) // fsub
+            {
+                bOK = deFunctionsManager->setFsubFunction(pStr);
+            }
+            else if(i == 11) // dfsub
+            {
+                bOK = deFunctionsManager->setDfsubFunction(pStr);
+            }
+            else if(i == 12) // gsub
+            {
+                bOK = deFunctionsManager->setGsubFunction(pStr);
+            }
+            else if(i == 13) // dgsub
+            {
+                bOK = deFunctionsManager->setDgsubFunction(pStr);
+            }
+            else if(i == 14 && ipar[8] == 1) // guess is needed only if ipar(9) == 1
+            {
+                bOK = deFunctionsManager->setGuessFunction(pStr);
+            }
+
+            if(bOK == false)
+            {
+                ScierrorW(50,_W("%ls: Subroutine not found: %ls\n"), L"bvode", pStr->get(0));
+                DifferentialEquation::removeDifferentialEquationFunctions();
+                free(M);
+                return types::Function::Error;
+            }
+        }
+        else if(in[i]->isList())
+        {
+            types::List* pList = in[i]->getAs<types::List>();
+
+            if(pList->getSize() == 0)
+            {
+                ScierrorW(50,_W("%ls: Argument #%d : Subroutine not found in list: %ls\n"), L"bvode", i+1, L"(string empty)");
+                DifferentialEquation::removeDifferentialEquationFunctions();
+                free(M);
+                return types::Function::Error;
+            }
+
+            if(pList->get(0)->isCallable())
+            {
+                if(i == 10) // fsub
+                {
+                    deFunctionsManager->setFsubFunction(pList->get(0)->getAs<types::Callable>());
+                    for(int iter = 1; iter < pList->getSize(); iter++)
+                    {
+                        deFunctionsManager->setFsubArgs(pList->get(iter)->getAs<types::InternalType>());
+                    }
+                }
+                else if(i == 11) // dfsub
+                {
+                    deFunctionsManager->setDfsubFunction(pList->get(0)->getAs<types::Callable>());
+                    for(int iter = 1; iter < pList->getSize(); iter++)
+                    {
+                        deFunctionsManager->setDfsubArgs(pList->get(iter)->getAs<types::InternalType>());
+                    }
+                }
+                else if(i == 12) // gsub
+                {
+                    deFunctionsManager->setGsubFunction(pList->get(0)->getAs<types::Callable>());
+                    for(int iter = 1; iter < pList->getSize(); iter++)
+                    {
+                        deFunctionsManager->setGsubArgs(pList->get(iter)->getAs<types::InternalType>());
+                    }
+                }
+                else if(i == 13) // dgsub
+                {
+                    deFunctionsManager->setDgsubFunction(pList->get(0)->getAs<types::Callable>());
+                    for(int iter = 1; iter < pList->getSize(); iter++)
+                    {
+                        deFunctionsManager->setDgsubArgs(pList->get(iter)->getAs<types::InternalType>());
+                    }
+                }
+                else if(i == 14 && ipar[8] == 1) // guess is needed only if ipar(9) == 1
+                {
+                    deFunctionsManager->setGuessFunction(pList->get(0)->getAs<types::Callable>());
+                    for(int iter = 1; iter < pList->getSize(); iter++)
+                    {
+                        deFunctionsManager->setGuessArgs(pList->get(iter)->getAs<types::InternalType>());
+                    }
+                }
+            }
+            else
+            {
+                ScierrorW(999, _W("%ls: Wrong type for input argument #%d : The first argument in the list must be a Scilab function.\n"), L"bvode", i+1);
+                DifferentialEquation::removeDifferentialEquationFunctions();
+                free(M);
+                return types::Function::Error;
+            }
+        }
+        else
+        {
+            ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A function expected.\n"), L"bvode", i+1);
+            DifferentialEquation::removeDifferentialEquationFunctions();
+            free(M);
+            return types::Function::Error;
+        }
+    }
+
+// *** check functions. ***
+
+    int ret     = 0;
+    int i       = 1;
+    double x    = 1;
+    double* z   = (double*)malloc(sumM * sizeof(double));
+    double* d   = (double*)malloc(ncomp * sumM * sizeof(double)); // max size
+
+    memset(z, 0x01, sumM);
+
+    // fsub
+    ret = bvode_fsub(&x, z, d);
+    if(ret == 0)
+    {
+        ScierrorW(50,_W("%ls: Argument #%d : Execution of %ls function failed.\n"), L"bvode", 11, L"fsub");
+        free(d);
+        free(z);
+        DifferentialEquation::removeDifferentialEquationFunctions();
+        return types::Function::Error;
+    }
+
+    // dfsub
+    ret = bvode_dfsub(&x, z, d);
+    if(ret == 0)
+    {
+        ScierrorW(50,_W("%ls: Argument #%d : Execution of %ls function failed.\n"), L"bvode", 12, L"dfsub");
+        free(d);
+        free(z);
+        DifferentialEquation::removeDifferentialEquationFunctions();
+        return types::Function::Error;
+    }
+
+    // gsub
+    ret = bvode_gsub(&i, z, d);
+    if(ret == 0)
+    {
+        ScierrorW(50,_W("%ls: Argument #%d : Execution of %ls function failed.\n"), L"bvode", 13, L"gsub");
+        free(d);
+        free(z);
+        DifferentialEquation::removeDifferentialEquationFunctions();
+        return types::Function::Error;
+    }
+
+    // dgsub
+    ret = bvode_dgsub(&i, z, d);
+    if(ret == 0)
+    {
+        ScierrorW(50,_W("%ls: Argument #%d : Execution of %ls function failed.\n"), L"bvode", 14, L"dgsub");
+        free(d);
+        free(z);
+        DifferentialEquation::removeDifferentialEquationFunctions();
+        return types::Function::Error;
+    }
+
+    // guess
+    ret = bvode_guess(&x, z, d);
+    if(ret == 0)
+    {
+        ScierrorW(50,_W("%ls: Argument #%d : Execution of %ls function failed.\n"), L"bvode", 15, L"guess");
+        free(d);
+        free(z);
+        DifferentialEquation::removeDifferentialEquationFunctions();
+        return types::Function::Error;
+    }
+
+    free(d);
+    free(z);
+
+// *** Perform operation. ***
+    double* rwork   = (double*)malloc(ipar[4] * sizeof(double));
+    int* iwork      = (int*)malloc(ipar[5] * sizeof(int));
+    int* ltol       = (int*)malloc(pDblLtol->getSize() * sizeof(int));
+
+    for(int i = 0; i < pDblLtol->getSize(); i++)
+    {
+        ltol[i] = (int)pDblLtol->get(i);
+    }
+
+    C2F(colnew)(&ncomp, M, &aleft, &aright, pDblZeta->get(), ipar, ltol, pDblTol->get(), pDblFixpnt->get(), iwork, rwork, &iflag, bvode_fsub, bvode_dfsub, bvode_gsub, bvode_dgsub, bvode_guess);
+
+    if(iflag != 1)
+    {
+        if(iflag == 0)
+        {
+            ScierrorW(999, _W("%ls: The collocation matrix is singular.\n"), L"bvode");
+        }
+        else if(iflag == -1)
+        {
+            ScierrorW(999, _W("%ls: The expected no. of subintervals exceeds storage specifications.\n"), L"bvode");
+        }
+        else if(iflag == -2)
+        {
+            ScierrorW(999, _W("%ls: The nonlinear iteration has not converged.\n"), L"bvode");
+        }
+        else if(iflag == -3)
+        {
+            ScierrorW(999, _W("%ls: There is an input data error.\n"), L"bvode");
+        }
+
+        free(iwork);
+        free(rwork);
+        free(M);
+        free(ltol);
+        DifferentialEquation::removeDifferentialEquationFunctions();
+
+        return types::Function::Error;
+    }
+
+    types::Double* pDblRes = new types::Double(sumM, pDblXpts->getSize());
+    double* res = (double*)malloc(pDblXpts->getSize() * sumM * sizeof(double));
+    for(int i = 0; i < pDblXpts->getSize(); i++)
+    {
+        double val = pDblXpts->get(i);
+        C2F(appsln)(&val, &res[i * sumM], rwork, iwork);
+    }
+
+    pDblRes->set(res);
+
+    free(iwork);
+    free(rwork);
+    free(M);
+    free(ltol);
+    free(res);
+    DifferentialEquation::removeDifferentialEquationFunctions();
+
+// *** Return result in Scilab. ***
+    out.push_back(pDblRes);
+
+    return types::Function::OK;
+}
+/*--------------------------------------------------------------------------*/
+
diff --git a/scilab/modules/differential_equations/sci_gateway/cpp/sci_dasrt.cpp b/scilab/modules/differential_equations/sci_gateway/cpp/sci_dasrt.cpp
new file mode 100644 (file)
index 0000000..7e17f63
--- /dev/null
@@ -0,0 +1,803 @@
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) 2011 - DIGITEO - Cedric DELAMARRE
+*
+* 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-en.txt
+*
+*/
+/*--------------------------------------------------------------------------*/
+
+#include "differential_equations_gw.hxx"
+#include "function.hxx"
+#include "double.hxx"
+#include "string.hxx"
+#include "list.hxx"
+#include "callable.hxx"
+#include "differentialequationfunctions.hxx"
+#include "runvisitor.hxx"
+
+extern "C"
+{
+#include "localization.h"
+#include "Scierror.h"
+#include "scifunctions.h"
+#include "elem_common.h"
+#include "checkodeerror.h"
+}
+
+/*--------------------------------------------------------------------------*/
+types::Function::ReturnValue sci_dasrt(types::typed_list &in, int _iRetCount, types::typed_list &out)
+{
+    // input args
+    types::Double* pDblX0   = NULL;
+    types::Double* pDblT0   = NULL;
+    types::Double* pDblT    = NULL;
+    types::Double* pDblRtol = NULL;
+    types::Double* pDblAtol = NULL;
+    types::Double* pDblHd   = NULL;
+    types::Double* pDblNg   = NULL;
+
+    // x0 = [y0, ydot0]
+    double* pdYData         = NULL; // contain y0 following by all args data in list case.
+    double* pdYdotData      = NULL;
+    int sizeOfpdYData       = 0;
+
+    int sizeOfYSize = 1;
+    int* YSize      = NULL;    // YSize(1) = size of y0,
+                               // YSize(n) = size of Args(n) in list case.
+    int iPos    = 0;
+    int one     = 1;
+
+    int info[15]    = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+
+    double tstop    = 0;
+    double maxstep  = 0;
+    double stepin   = 0;
+    int ng          = 0;
+    int mu          = 0;
+    int ml          = 0;
+
+    // Indicate if the function is given.
+    bool bFuncF     = false;
+    bool bFuncJac   = false;
+    bool bFuncG     = false;
+
+    // Indicate if info list is given.
+    bool bListInfo  = false;
+
+// *** check the minimal number of input args. ***
+    if(in.size() < 6 || in.size() > 11)
+    {
+        ScierrorW(77, _W("%ls: Wrong number of input argument(s): %d to %d expected.\n"), L"dasrt", 6, 11);
+        return types::Function::Error;
+    }
+
+// *** check number of output args ***
+    if(_iRetCount != 3 && _iRetCount != 2)
+    {
+        ScierrorW(78, _W("%ls: Wrong number of output argument(s): %d to %d expected.\n"), L"dasrt", 2, 3);
+        return types::Function::Error;
+    }
+
+// *** check type of input args and get it. ***
+    // x0 = [y0, yd0]
+    if(in[iPos]->isDouble() == false)
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A matrix expected.\n"), L"dasrt", iPos+1);
+        return types::Function::Error;
+    }
+
+    pDblX0 = in[iPos]->getAs<types::Double>();
+
+    if(pDblX0->isComplex())
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A real matrix expected.\n"), L"dasrt", iPos+1);
+        return types::Function::Error;
+    }
+
+    if(pDblX0->getCols() > 2)
+    {
+        ScierrorW(999, _W("%ls: Wrong size for input argument #%d : A real matrix with %d to %d colomn(s) expected.\n"), L"dasrt", iPos+1, 1, 2);
+        return types::Function::Error;
+    }
+
+    if(pDblX0->getCols() == 1)
+    {
+        info[10] = 1;
+    }
+
+    // t0
+    iPos++;
+    if(in[iPos]->isDouble() == false)
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A scalar expected.\n"), L"dasrt", iPos+1);
+        return types::Function::Error;
+    }
+
+    pDblT0 = in[iPos]->getAs<types::Double>();
+
+    if(pDblT0->isScalar() == false)
+    {
+        ScierrorW(999, _W("%ls: Wrong size for input argument #%d : A scalar expected.\n"), L"dasrt", iPos+1);
+        return types::Function::Error;
+    }
+
+    // t
+    iPos++;
+    if(in[iPos]->isDouble() == false)
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A matrix expected.\n"), L"dasrt", iPos+1);
+        return types::Function::Error;
+    }
+
+    pDblT = in[iPos]->getAs<types::Double>();
+
+    if(pDblT->isComplex())
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A real matrix expected.\n"), L"dasrt", iPos+1);
+        return types::Function::Error;
+    }
+
+    // get next inputs
+    DifferentialEquationFunctions* deFunctionsManager = new DifferentialEquationFunctions(L"dasrt");
+    DifferentialEquation::addDifferentialEquationFunctions(deFunctionsManager);
+
+    YSize = (int*)malloc(sizeOfYSize * sizeof(int));
+    *YSize = pDblX0->getRows();
+
+    pdYData = (double*)malloc(*YSize * sizeof(double));
+    pdYdotData = (double*)malloc(*YSize * sizeof(double));
+
+    C2F(dcopy)(YSize, pDblX0->get(), &one, pdYData, &one);
+    if(pDblX0->getCols() == 2)
+    {
+        C2F(dcopy)(YSize, pDblX0->get() + *YSize, &one, pdYdotData, &one);
+    }
+    else
+    {
+        memset(pdYdotData, 0x00, *YSize);
+    }
+
+    deFunctionsManager->setOdeYRows(pDblX0->getRows());
+
+    for(iPos++; iPos < in.size(); iPos++)
+    {
+        if(in[iPos]->isDouble())
+        {
+            if(pDblAtol == NULL && bFuncF == false)
+            {
+                pDblAtol = in[iPos]->getAs<types::Double>();
+                if(pDblAtol->getSize() != pDblX0->getRows() && pDblAtol->isScalar() == false)
+                {
+                    ScierrorW(267,_W("%ls: Wrong size for input argument #%d : A scalar or a matrix of size %d expected.\n"), L"dasrt", iPos+1, pDblX0->getRows());
+                    DifferentialEquation::removeDifferentialEquationFunctions();
+                    free(pdYdotData);free(pdYData);free(YSize);
+                    return types::Function::Error;
+                }
+            }
+            else if(pDblRtol == NULL && bFuncF == false)
+            {
+                pDblRtol = in[iPos]->getAs<types::Double>();
+                if(pDblAtol->getSize() != pDblRtol->getSize())
+                {
+                    ScierrorW(267,_W("%ls: Wrong size for input argument #%d : Atol and Rtol must have the same size.\n"), L"dasrt", iPos+1, pDblX0->getRows());
+                    DifferentialEquation::removeDifferentialEquationFunctions();
+                    free(pdYdotData);free(pdYData);free(YSize);
+                    return types::Function::Error;
+                }
+            }
+            else if(pDblNg == NULL && bFuncF == true)
+            {
+                pDblNg = in[iPos]->getAs<types::Double>();
+                if(pDblNg->isScalar() == false)
+                {
+                    ScierrorW(999, _W("%ls: Wrong size for input argument #%d : A scalar expected.\n"), L"dasrt", iPos+1);
+                    DifferentialEquation::removeDifferentialEquationFunctions();
+                    free(pdYdotData);free(pdYData);free(YSize);
+                    return types::Function::Error;
+                }
+                ng = (int)pDblNg->get(0);
+            }
+            else if(pDblHd == NULL && bFuncF == true)
+            {
+                pDblHd = in[iPos]->getAs<types::Double>();
+                if(in.size() != iPos+1)
+                {
+                    ScierrorW(77, _W("%ls: Wrong number of input argument(s): %d expected.\n"), L"dasrt", iPos+1);
+                    DifferentialEquation::removeDifferentialEquationFunctions();
+                    free(pdYdotData);free(pdYData);free(YSize);
+                    return types::Function::Error;
+                }
+            }
+            else
+            {
+                ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A function expected.\n"), L"dasrt", iPos+1);
+                DifferentialEquation::removeDifferentialEquationFunctions();
+                free(pdYdotData);free(pdYData);free(YSize);
+                return types::Function::Error;
+            }
+        }
+        else if(in[iPos]->isCallable())
+        {
+            types::Callable* pCall = in[iPos]->getAs<types::Callable>();
+            if(bFuncF == false)
+            {
+                deFunctionsManager->setFFunction(pCall);
+                bFuncF = true;
+            }
+            else if(bFuncJac == false && pDblNg == NULL)
+            {
+                deFunctionsManager->setJacFunction(pCall);
+                bFuncJac = true;
+            }
+            else if(bFuncG == false && pDblNg)
+            {
+                deFunctionsManager->setGFunction(pCall);
+                bFuncG = true;
+            }
+            else
+            {
+                ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A matrix or a list expected.\n"), L"dasrt", iPos+1);
+                DifferentialEquation::removeDifferentialEquationFunctions();
+                free(pdYdotData);free(pdYData);free(YSize);
+                return types::Function::Error;
+            }
+        }
+        else if(in[iPos]->isString())
+        {
+            types::String* pStr = in[iPos]->getAs<types::String>();
+            bool bOK = false;
+
+            if(bFuncF == false)
+            {
+                bOK = deFunctionsManager->setFFunction(pStr);
+                bFuncF = true;
+            }
+            else if(bFuncJac == false && pDblNg == NULL)
+            {
+                bOK = deFunctionsManager->setJacFunction(pStr);
+                bFuncJac = true;
+            }
+            else if(bFuncG == false && pDblNg)
+            {
+                bOK = deFunctionsManager->setGFunction(pStr);
+                bFuncG = true;
+            }
+            else
+            {
+                ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A matrix or a list expected.\n"), L"dasrt", iPos+1);
+                DifferentialEquation::removeDifferentialEquationFunctions();
+                free(pdYdotData);free(pdYData);free(YSize);
+                return types::Function::Error;
+            }
+
+            if(bOK == false)
+            {
+                ScierrorW(50,_W("%ls: Subroutine not found: %ls\n"), L"dasrt", pStr->get(0));
+                DifferentialEquation::removeDifferentialEquationFunctions();
+                free(pdYdotData);free(pdYData);free(YSize);
+                return types::Function::Error;
+            }
+        }
+        else if(in[iPos]->isList())
+        {
+            types::List* pList = in[iPos]->getAs<types::List>();
+
+            if(pList->getSize() == 0)
+            {
+                ScierrorW(50,_W("%ls: Argument #%d : Subroutine not found in list: %ls\n"), L"dasrt", iPos+1, L"(string empty)");
+                DifferentialEquation::removeDifferentialEquationFunctions();
+                free(pdYdotData);free(pdYData);free(YSize);
+                return types::Function::Error;
+            }
+
+            if(bFuncF && bListInfo)
+            {
+                ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A matrix expected.\n"), L"dasrt", iPos+1);
+                DifferentialEquation::removeDifferentialEquationFunctions();
+                free(pdYdotData);free(pdYData);free(YSize);
+                return types::Function::Error;
+            }
+
+            if(pList->get(0)->isString())
+            {
+                types::String* pStr = pList->get(0)->getAs<types::String>();
+                bool bOK = false;
+
+                if(bFuncF == false)
+                {
+                    bFuncF = true;
+                    bOK = deFunctionsManager->setFFunction(pStr);
+                    sizeOfpdYData = *YSize;
+                }
+                else if(bFuncJac == false && pDblNg == NULL)
+                {
+                    bFuncJac = true;
+                    bOK = deFunctionsManager->setJacFunction(pStr);
+                    if(sizeOfpdYData == 0)
+                    {
+                        sizeOfpdYData = *YSize;
+                    }
+                }
+                else if(bFuncG == false && pDblNg)
+                {
+                    bFuncG = true;
+                    bOK = deFunctionsManager->setGFunction(pStr);
+                    if(sizeOfpdYData == 0)
+                    {
+                        sizeOfpdYData = *YSize;
+                    }
+                }
+
+                if(bOK == false)
+                {
+                    ScierrorW(50,_W("%ls: Argument #%d : Subroutine not found in list: %ls\n"), L"dasrt", iPos+1, pStr->get(0));
+                    DifferentialEquation::removeDifferentialEquationFunctions();
+                    free(pdYdotData);free(pdYData);free(YSize);
+                    return types::Function::Error;
+                }
+
+                int* sizeTemp = YSize;
+                int totalSize = sizeOfpdYData;
+
+                YSize = (int*)malloc((sizeOfYSize + pList->getSize() - 1) * sizeof(int));
+                memcpy(YSize, sizeTemp, sizeOfYSize * sizeof(int));
+
+                std::vector<types::Double*> vpDbl;
+                for(int iter = 0; iter < pList->getSize() - 1; iter++)
+                {
+                    if(pList->get(iter + 1)->isDouble() == false)
+                    {
+                        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : Argument %d in the list must be a matrix.\n"), L"dasrt", iPos+1, iter+1);
+                        DifferentialEquation::removeDifferentialEquationFunctions();
+                        free(pdYdotData);free(pdYData);free(YSize);
+                        return types::Function::Error;
+                    }
+
+                    vpDbl.push_back(pList->get(iter+1)->getAs<types::Double>());
+                    YSize[sizeOfYSize + iter] = vpDbl[iter]->getSize();
+                    totalSize += YSize[sizeOfYSize + iter];
+                }
+
+                double* pdYDataTemp = pdYData;
+                pdYData = (double*)malloc(totalSize * sizeof(double));
+                C2F(dcopy)(&sizeOfpdYData, pdYDataTemp, &one, pdYData, &one);
+
+                int position = sizeOfpdYData;
+                for(int iter = 0; iter < pList->getSize()-1; iter++)
+                {
+                    C2F(dcopy)(&YSize[sizeOfYSize + iter], vpDbl[iter]->get(), &one, &pdYData[position], &one);
+                    position += vpDbl[iter]->getSize();
+                }
+                vpDbl.clear();
+                sizeOfpdYData = totalSize;
+                sizeOfYSize += pList->getSize() - 1;
+                free(pdYDataTemp);
+                free(sizeTemp);
+            }
+            else if(pList->get(0)->isCallable())
+            {
+                if(bFuncF == false)
+                {
+                    bFuncF = true;
+                    deFunctionsManager->setFFunction(pList->get(0)->getAs<types::Callable>());
+                    for(int iter = 1; iter < pList->getSize(); iter++)
+                    {
+                        deFunctionsManager->setFArgs(pList->get(iter)->getAs<types::InternalType>());
+                    }
+                }
+                else if(bFuncJac == false && pDblNg == NULL)
+                {
+                    bFuncJac = true;
+                    deFunctionsManager->setJacFunction(pList->get(0)->getAs<types::Callable>());
+                    for(int iter = 1; iter < pList->getSize(); iter++)
+                    {
+                        deFunctionsManager->setJacArgs(pList->get(iter)->getAs<types::InternalType>());
+                    }
+                }
+                else if(bFuncG == false && pDblNg)
+                {
+                    bFuncG = true;
+                    deFunctionsManager->setGFunction(pList->get(0)->getAs<types::Callable>());
+                    for(int iter = 1; iter < pList->getSize(); iter++)
+                    {
+                        deFunctionsManager->setGArgs(pList->get(iter)->getAs<types::InternalType>());
+                    }
+                }
+            }
+            else if(pList->get(0)->isDouble() && bFuncF == true)
+            {
+                if(pList->getSize() != 7)
+                {
+                    ScierrorW(267,_W("%ls: Wrong size for input argument #%d : A list of size %d expected.\n"), L"dasrt", iPos+1, 7);
+                    DifferentialEquation::removeDifferentialEquationFunctions();
+                    free(pdYdotData);free(pdYData);free(YSize);
+                    return types::Function::Error;
+                }
+
+                for(int i = 0; i < 7; i++) // info = list([],0,[],[],[],0,0)
+                {
+                    if(pList->get(i)->isDouble() == false || (pList->get(i)->getAs<types::Double>()->isScalar() == false && (i == 1 || i == 5 || i == 6)))
+                    {
+                        if(i == 1 || i == 5 || i == 6)
+                        {
+                            ScierrorW(999, _W("%ls: Wrong type for input argument #%d : Element %d in the info list must be a scalar.\n"), L"dasrt", iPos+1, i);
+                        }
+                        else
+                        {
+                            ScierrorW(999, _W("%ls: Wrong type for input argument #%d : Element %d in the info list must be a matrix.\n"), L"dasrt", iPos+1, i);
+                        }
+                        DifferentialEquation::removeDifferentialEquationFunctions();
+                        free(pdYdotData);free(pdYData);free(YSize);
+                        return types::Function::Error;  
+                    }
+                }
+
+                types::Double* pDblTemp = pList->get(0)->getAs<types::Double>();
+                if(pDblTemp->getSize() != 0)
+                {
+                    info[3] = 1;
+                    tstop = pDblTemp->get(0);
+                }
+
+                info[2] = (int)pList->get(1)->getAs<types::Double>()->get(0);
+
+                pDblTemp = pList->get(2)->getAs<types::Double>();
+                if(pDblTemp->getSize() == 2)
+                {
+                    info[5] = 1;
+                    ml = (int)pDblTemp->get(0);
+                    mu = (int)pDblTemp->get(1);
+                    deFunctionsManager->setMl(ml);
+                    deFunctionsManager->setMu(mu);
+                }
+                else if(pDblTemp->getSize() != 0)
+                {
+                    ScierrorW(267,_W("%ls: Wrong size for input argument #%d : Argument %d in te list must be of size %d.\n"), L"dasrt", iPos+1, 3, 2);
+                    DifferentialEquation::removeDifferentialEquationFunctions();
+                    free(pdYdotData);free(pdYData);free(YSize);
+                    return types::Function::Error;
+                }
+
+                pDblTemp = pList->get(3)->getAs<types::Double>();
+                if(pDblTemp->getSize() != 0)
+                {
+                    info[6] = 1;
+                    maxstep = pDblTemp->get(0);
+                }
+
+                pDblTemp = pList->get(4)->getAs<types::Double>();
+                if(pDblTemp->getSize() != 0)
+                {
+                    info[7] = 1;
+                    stepin = pDblTemp->get(0);
+                }
+
+                info[9]  = (int)pList->get(5)->getAs<types::Double>()->get(0);
+                if(pList->get(6)->getAs<types::Double>()->get(0) == 1)
+                {
+                    info[10] = 1;
+                }
+
+                bListInfo = true;
+            }
+            else
+            {
+                ScierrorW(999, _W("%ls: Wrong type for input argument #%d : The first argument in the list must be a string, a function or a matrix in case of argument info.\n"), L"dasrt", iPos+1);
+                DifferentialEquation::removeDifferentialEquationFunctions();
+                free(pdYdotData);free(pdYData);free(YSize);
+                return types::Function::Error;
+            }
+        }
+        else
+        {
+            ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A matrix or a function expected.\n"), L"dasrt", iPos+1);
+            DifferentialEquation::removeDifferentialEquationFunctions();
+            free(pdYdotData);free(pdYData);free(YSize);
+            return types::Function::Error;
+        }
+    }
+
+    if(bFuncF == false)
+    {
+        ScierrorW(77, _W("%ls: Wrong number of input argument(s): %d expected.\n"), L"dasrt", in.size() + 3);
+        DifferentialEquation::removeDifferentialEquationFunctions();
+        free(pdYdotData);free(pdYData);free(YSize);
+        return types::Function::Error;
+    }
+
+    if(pDblNg == NULL)
+    {
+        ScierrorW(77, _W("%ls: Wrong number of input argument(s): %d expected.\n"), L"dasrt", in.size() + 2);
+        DifferentialEquation::removeDifferentialEquationFunctions();
+        free(pdYdotData);free(pdYData);free(YSize);
+        return types::Function::Error;
+    }
+
+    if(bFuncG == false)
+    {
+        ScierrorW(77, _W("%ls: Wrong number of input argument(s): %d expected.\n"), L"dasrt", in.size() + 1);
+        DifferentialEquation::removeDifferentialEquationFunctions();
+        free(pdYdotData);free(pdYData);free(YSize);
+        return types::Function::Error;
+    }
+
+    if(bFuncJac == true)
+    {
+        info[4] = 1;
+    }
+
+// *** Initialization. ***
+    double t0   = pDblT0->get(0);
+    double rpar = 0;
+    int ipar    = 0;
+    int idid    = 0;
+    int maxord  = 5;
+
+    //compute itol and set the tolerances rtol and atol.
+    double* rtol = NULL;
+    double* atol = NULL;
+
+    if(pDblAtol)
+    {
+        if(pDblAtol->isScalar())
+        {
+            atol  = (double*)malloc(sizeof(double));
+            *atol = pDblAtol->get(0);
+        }
+        else
+        {
+            atol    = pDblAtol->get();
+            info[1] = 1;
+        }
+    }
+    else
+    {
+        atol  = (double*)malloc(sizeof(double));
+        *atol = 1.e-7;
+    }
+
+    if(pDblRtol)
+    {
+        if(pDblRtol->isScalar())
+        {
+            rtol  = (double*)malloc(sizeof(double));
+            *rtol = pDblRtol->get(0);
+        }
+        else
+        {
+            rtol = pDblRtol->get();
+        }
+    }
+    else // if rtol is not given atol will be used as a scalar.
+    {
+        if(pDblAtol && pDblAtol->isScalar() == false)// info[1] == 1
+        {
+            double dblSrc = 1.e-9;
+            int iSize = pDblAtol->getSize();
+            int iOne = 1;
+            int iZero = 0;
+
+            rtol = (double*)malloc(iSize * sizeof(double));
+            C2F(dcopy)(&iSize, &dblSrc, &iZero, rtol, &iOne);
+        }
+        else
+        {
+            rtol    = (double*)malloc(sizeof(double));
+            *rtol   = 1.e-9;
+        }
+    }
+
+    // Compute rwork, iwork size.
+    // Create them.
+    int iworksize   = 20 + pDblX0->getRows();
+    int rworksize   = 0;
+    int* iwork      = NULL;
+    double* rwork   = NULL;
+    int* root    = NULL;
+
+    if(info[5] == 0)
+    {
+        rworksize = 50 + (maxord + 4) * pDblX0->getRows() + pDblX0->getRows() * pDblX0->getRows() + 3 * ng;
+    }
+    else if(info[4] == 1)
+    {
+        rworksize = 50 + (maxord + 4) * pDblX0->getRows() + (2 * ml + mu + 1) * pDblX0->getRows() + 3 * ng;
+    }
+    else if(info[4] == 0)
+    {
+        rworksize = 50 + (maxord + 4) * pDblX0->getRows() + (2 * ml + mu + 1) * pDblX0->getRows() + 2 * (pDblX0->getRows() / (ml + mu + 1) + 1) + 3 * ng;
+    }
+
+    iwork = (int*)malloc(iworksize * sizeof(int));
+    rwork = (double*)malloc(rworksize * sizeof(double));
+    root  = (int*)malloc(ng * sizeof(int));
+
+    if(pDblHd != NULL)
+    {
+        if(iworksize + rworksize != pDblHd->getSize())
+        {
+            ScierrorW(77, _W("%ls: Wrong size for input argument(s) %d: %d expected.\n"), L"dasrt", in.size(), iworksize + rworksize);
+            DifferentialEquation::removeDifferentialEquationFunctions();
+            free(pdYdotData);free(pdYData);free(YSize);
+            free(iwork);free(rwork);
+            if(pDblAtol == NULL || pDblAtol->isScalar()) free(atol);
+            if(pDblRtol == NULL || pDblRtol->isScalar()) free(rtol);
+            return types::Function::Error;
+        }
+
+        C2F(dcopy)(&rworksize, pDblHd->get(), &one, rwork, &one);
+
+        for(int i = 0; i < iworksize; i++)
+        {
+            iwork[i] = (int)pDblHd->get(rworksize + i);
+        }
+
+        info[0] = 1;
+    }
+
+    if(info[3] == 1)
+    {
+        rwork[0] = tstop;
+    }
+
+    if(info[6] == 1)
+    {
+        rwork[1] = maxstep;
+    }
+
+    if(info[7] == 1)
+    {
+        rwork[2] = stepin;
+    }
+
+    if(info[5] == 1)
+    {
+        iwork[0] = ml;
+        iwork[1] = mu;
+    }
+
+// *** Perform operation. ***
+    std::list<types::Double*> lpDblOut;
+    int size = pDblX0->getRows();
+    int rowsOut = 1 + pDblX0->getRows() * 2;
+
+    for(int i = 0; i < pDblT->getSize(); i++)
+    {
+        types::Double* pDblOut = new types::Double(rowsOut, 1);
+        lpDblOut.push_back(pDblOut);
+
+        double t = pDblT->get(i);
+        int pos  = 0;
+        pDblOut->set(pos, t);
+
+        if(t == t0)
+        {
+            pos++;
+            C2F(dcopy)(&size, pdYData, &one, pDblOut->get() + pos, &one);
+            pos += pDblX0->getRows();
+            C2F(dcopy)(&size, pdYdotData, &one, pDblOut->get() + pos, &one);
+
+            continue;
+        }
+
+        C2F(ddasrt)(dassl_f, YSize, &t0, pdYData, pdYdotData, &t, info, rtol, atol, &idid, rwork, &rworksize, iwork, &iworksize, &rpar, &ipar, dassl_jac, dasrt_g, &ng, root);
+
+        int iret = checkDasslError(idid);
+
+        if(iret == 1) // error
+        {
+            ScierrorW(999, _W("%ls: ddasrt return with state %d.\n"), L"dasrt", idid);
+            lpDblOut.clear();
+            DifferentialEquation::removeDifferentialEquationFunctions();
+            free(pdYdotData);free(pdYData);free(YSize);
+            free(iwork);free(rwork);free(root);
+            if(pDblAtol == NULL || pDblAtol->isScalar()) free(atol);
+            if(pDblRtol == NULL || pDblRtol->isScalar()) free(rtol);
+            return types::Function::Error;
+        }
+
+        pos++;
+        C2F(dcopy)(&size, pdYData, &one, pDblOut->get() + pos, &one);
+        pos += size;
+        C2F(dcopy)(&size, pdYdotData, &one, pDblOut->get() + pos, &one);
+
+        if(iret == 2) // warning
+        {
+            pDblOut->set(0, t0);
+            break;
+        }
+
+        // iret == 0
+        if(idid == 1)
+        {
+            pDblOut->set(0, t0);
+            i--;
+        }
+        else if(idid == -2)
+        {
+            t0 = t;
+            i--;
+        }
+        else
+        {
+            t0 = t;
+        }
+
+        info[0] = 1;
+    }
+
+// *** Return result in Scilab. ***
+    types::Double* pDblOut = new types::Double(rowsOut, (int)lpDblOut.size());
+
+    int sizeOfList = (int)lpDblOut.size();
+    for(int i = 0; i < sizeOfList; i++)
+    {
+        int pos = i * rowsOut;
+        C2F(dcopy)(&rowsOut, lpDblOut.front()->get(), &one, pDblOut->get() + pos, &one);
+        lpDblOut.pop_front();
+    }
+    out.push_back(pDblOut);
+
+
+    int sizeOfRoot = 1;
+    for(int i = 0; i < ng; i++)
+    {
+        if(root[i])
+        {
+            sizeOfRoot++;
+        }
+    }
+    types::Double* pDblRoot = new types::Double(1, sizeOfRoot);
+    pDblRoot->set(0,t0);
+    int j = 0;
+    for(int i = 0; i < ng; i++)
+    {
+        if(root[i])
+        {
+            j++;
+            pDblRoot->set(j, i+1);
+        }
+    }
+    out.push_back(pDblRoot);
+
+    if(_iRetCount == 3)
+    {
+        types::Double* pDblHdOut = new types::Double(rworksize + iworksize, 1);
+        C2F(dcopy)(&rworksize, rwork, &one, pDblHdOut->get(), &one);
+
+        for(int i = 0; i < iworksize; i++)
+        {
+            pDblHdOut->set(rworksize + i, (double)iwork[i]);
+        }
+
+        out.push_back(pDblHdOut);
+    }
+
+// *** free. ***
+    if(pDblAtol == NULL || pDblAtol->isScalar())
+    {
+        free(atol);
+    }
+
+    if(pDblRtol == NULL || pDblRtol->isScalar())
+    {
+        free(rtol);
+    }
+
+    free(pdYData);
+    free(pdYdotData);
+    free(YSize);
+    free(rwork);
+    free(iwork);
+    free(root);
+
+    DifferentialEquation::removeDifferentialEquationFunctions();
+
+    return types::Function::OK;
+}
+
diff --git a/scilab/modules/differential_equations/sci_gateway/cpp/sci_dassl.cpp b/scilab/modules/differential_equations/sci_gateway/cpp/sci_dassl.cpp
new file mode 100644 (file)
index 0000000..ffa97b4
--- /dev/null
@@ -0,0 +1,720 @@
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) 2011 - DIGITEO - Cedric DELAMARRE
+*
+* 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-en.txt
+*
+*/
+/*--------------------------------------------------------------------------*/
+
+#include "differential_equations_gw.hxx"
+#include "function.hxx"
+#include "double.hxx"
+#include "string.hxx"
+#include "list.hxx"
+#include "callable.hxx"
+#include "differentialequationfunctions.hxx"
+#include "runvisitor.hxx"
+
+extern "C"
+{
+#include "localization.h"
+#include "Scierror.h"
+#include "scifunctions.h"
+#include "elem_common.h"
+#include "checkodeerror.h"
+#include "xerhlt.h"
+}
+
+/*--------------------------------------------------------------------------*/
+types::Function::ReturnValue sci_dassl(types::typed_list &in, int _iRetCount, types::typed_list &out)
+{
+    // input args
+    types::Double* pDblX0   = NULL;
+    types::Double* pDblT0   = NULL;
+    types::Double* pDblT    = NULL;
+    types::Double* pDblRtol = NULL;
+    types::Double* pDblAtol = NULL;
+    types::Double* pDblHd   = NULL;
+
+    // x0 = [y0, ydot0]
+    double* pdYData         = NULL; // contain y0 following by all args data in list case.
+    double* pdYdotData      = NULL;
+    int sizeOfpdYData       = 0;
+
+    int iPos    = 0;
+    int one     = 1;
+
+    int info[15]    = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+
+    double tstop    = 0;
+    double maxstep  = 0;
+    double stepin   = 0;
+    int mu          = 0;
+    int ml          = 0;
+
+    int sizeOfYSize = 1;
+    int* YSize      = NULL;    // YSize(1) = size of y0,
+                               // YSize(n) = size of Args(n) in list case.
+
+    // Indicate if the function is given.
+    bool bFuncF     = false;
+    bool bFuncJac   = false;
+
+    // Indicate if info list is given.
+    bool bListInfo  = false;
+
+// *** check the minimal number of input args. ***
+    if(in.size() < 4 || in.size() > 9)
+    {
+        ScierrorW(77, _W("%ls: Wrong number of input argument(s): %d to %d expected.\n"), L"dassl", 4, 9);
+        return types::Function::Error;
+    }
+
+// *** check number of output args ***
+    if(_iRetCount > 2)
+    {
+        ScierrorW(78, _W("%ls: Wrong number of output argument(s): %d to %d expected.\n"), L"dassl", 1, 2);
+        return types::Function::Error;
+    }
+
+// *** check type of input args and get it. ***
+    // x0 = [y0, yd0]
+    if(in[iPos]->isDouble() == false)
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A matrix expected.\n"), L"dassl", iPos+1);
+        return types::Function::Error;
+    }
+
+    pDblX0 = in[iPos]->getAs<types::Double>();
+
+    if(pDblX0->isComplex())
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A real matrix expected.\n"), L"dassl", iPos+1);
+        return types::Function::Error;
+    }
+
+    if(pDblX0->getCols() > 2)
+    {
+        ScierrorW(999, _W("%ls: Wrong size for input argument #%d : A real matrix with %d to %d colomn(s) expected.\n"), L"dassl", iPos+1, 1, 2);
+        return types::Function::Error;
+    }
+
+    if(pDblX0->getCols() == 1)
+    {
+        info[10] = 1;
+    }
+
+    // t0
+    iPos++;
+    if(in[iPos]->isDouble() == false)
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A scalar expected.\n"), L"dassl", iPos+1);
+        return types::Function::Error;
+    }
+
+    pDblT0 = in[iPos]->getAs<types::Double>();
+
+    if(pDblT0->isScalar() == false)
+    {
+        ScierrorW(999, _W("%ls: Wrong size for input argument #%d : A scalar expected.\n"), L"dassl", iPos+1);
+        return types::Function::Error;
+    }
+
+    // t
+    iPos++;
+    if(in[iPos]->isDouble() == false)
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A matrix expected.\n"), L"dassl", iPos+1);
+        return types::Function::Error;
+    }
+
+    pDblT = in[iPos]->getAs<types::Double>();
+
+    if(pDblT->isComplex())
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A real matrix expected.\n"), L"dassl", iPos+1);
+        return types::Function::Error;
+    }
+
+    // get next inputs
+    DifferentialEquationFunctions* deFunctionsManager = new DifferentialEquationFunctions(L"dassl");
+    DifferentialEquation::addDifferentialEquationFunctions(deFunctionsManager);
+
+    YSize = (int*)malloc(sizeOfYSize * sizeof(int));
+    *YSize = pDblX0->getRows();
+
+    pdYData = (double*)malloc(*YSize * sizeof(double));
+    pdYdotData = (double*)malloc(*YSize * sizeof(double));
+
+    C2F(dcopy)(YSize, pDblX0->get(), &one, pdYData, &one);
+    if(pDblX0->getCols() == 2)
+    {
+        C2F(dcopy)(YSize, pDblX0->get() + *YSize, &one, pdYdotData, &one);
+    }
+    else
+    {
+        memset(pdYdotData, 0x00, *YSize);
+    }
+
+    deFunctionsManager->setOdeYRows(pDblX0->getRows());
+
+    for(iPos++; iPos < in.size(); iPos++)
+    {
+        if(in[iPos]->isDouble())
+        {
+            if(pDblAtol == NULL && bFuncF == false)
+            {
+                pDblAtol = in[iPos]->getAs<types::Double>();
+                if(pDblAtol->getSize() != pDblX0->getRows() && pDblAtol->isScalar() == false)
+                {
+                    ScierrorW(267,_W("%ls: Wrong size for input argument #%d : A scalar or a matrix of size %d expected.\n"), L"dassl", iPos+1, pDblX0->getRows());
+                    DifferentialEquation::removeDifferentialEquationFunctions();
+                    free(pdYdotData);free(pdYData);free(YSize);
+                    return types::Function::Error;
+                }
+            }
+            else if(pDblRtol == NULL && bFuncF == false)
+            {
+                pDblRtol = in[iPos]->getAs<types::Double>();
+                if(pDblAtol->getSize() != pDblRtol->getSize())
+                {
+                    ScierrorW(267,_W("%ls: Wrong size for input argument #%d : Atol and Rtol must have the same size.\n"), L"dassl", iPos+1, pDblX0->getRows());
+                    DifferentialEquation::removeDifferentialEquationFunctions();
+                    free(pdYdotData);free(pdYData);free(YSize);
+                    return types::Function::Error;
+                }
+            }
+            else if(pDblHd == NULL && bFuncF == true)
+            {
+                pDblHd = in[iPos]->getAs<types::Double>();
+                if(in.size() != iPos+1)
+                {
+                    ScierrorW(77, _W("%ls: Wrong number of input argument(s): %d expected.\n"), L"dassl", iPos+1);
+                    DifferentialEquation::removeDifferentialEquationFunctions();
+                    free(pdYdotData);free(pdYData);free(YSize);
+                    return types::Function::Error;
+                }
+            }
+            else
+            {
+                ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A function expected.\n"), L"dassl", iPos+1);
+                DifferentialEquation::removeDifferentialEquationFunctions();
+                free(pdYdotData);free(pdYData);free(YSize);
+                return types::Function::Error;
+            }
+        }
+        else if(in[iPos]->isCallable())
+        {
+            types::Callable* pCall = in[iPos]->getAs<types::Callable>();
+            if(bFuncF == false)
+            {
+                deFunctionsManager->setFFunction(pCall);
+                bFuncF = true;
+            }
+            else if(bFuncJac == false)
+            {
+                deFunctionsManager->setJacFunction(pCall);
+                bFuncJac = true;
+            }
+            else
+            {
+                ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A matrix or a list expected.\n"), L"dassl", iPos+1);
+                DifferentialEquation::removeDifferentialEquationFunctions();
+                free(pdYdotData);free(pdYData);free(YSize);
+                return types::Function::Error;
+            }
+        }
+        else if(in[iPos]->isString())
+        {
+            types::String* pStr = in[iPos]->getAs<types::String>();
+            bool bOK = false;
+
+            if(bFuncF == false)
+            {
+                bOK = deFunctionsManager->setFFunction(pStr);
+                bFuncF = true;
+            }
+            else if(bFuncJac == false)
+            {
+                bOK = deFunctionsManager->setJacFunction(pStr);
+                bFuncJac = true;
+            }
+            else
+            {
+                ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A matrix or a list expected.\n"), L"dassl", iPos+1);
+                DifferentialEquation::removeDifferentialEquationFunctions();
+                free(pdYdotData);free(pdYData);free(YSize);
+                return types::Function::Error;
+            }
+
+            if(bOK == false)
+            {
+                ScierrorW(50,_W("%ls: Subroutine not found: %ls\n"), L"dassl", pStr->get(0));
+                DifferentialEquation::removeDifferentialEquationFunctions();
+                free(pdYdotData);free(pdYData);free(YSize);
+                return types::Function::Error;
+            }
+        }
+        else if(in[iPos]->isList())
+        {
+            types::List* pList = in[iPos]->getAs<types::List>();
+
+            if(pList->getSize() == 0)
+            {
+                ScierrorW(50,_W("%ls: Argument #%d : Subroutine not found in list: %ls\n"), L"dassl", iPos+1, L"(string empty)");
+                DifferentialEquation::removeDifferentialEquationFunctions();
+                free(pdYdotData);free(pdYData);free(YSize);
+                return types::Function::Error;
+            }
+
+            if(bFuncF && bListInfo)
+            {
+                ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A matrix expected.\n"), L"dassl", iPos+1);
+                DifferentialEquation::removeDifferentialEquationFunctions();
+                free(pdYdotData);free(pdYData);free(YSize);
+                return types::Function::Error;
+            }
+
+            if(pList->get(0)->isString())
+            {
+                types::String* pStr = pList->get(0)->getAs<types::String>();
+                bool bOK = false;
+
+                if(bFuncF == false)
+                {
+                    bFuncF = true;
+                    bOK = deFunctionsManager->setFFunction(pStr);
+                    sizeOfpdYData = *YSize;
+                }
+                else if(bFuncJac == false)
+                {
+                    bFuncJac = true;
+                    bOK = deFunctionsManager->setJacFunction(pStr);
+                    if(sizeOfpdYData == 0)
+                    {
+                        sizeOfpdYData = *YSize;
+                    }
+                }
+
+                if(bOK == false)
+                {
+                    ScierrorW(50,_W("%ls: Argument #%d : Subroutine not found in list: %ls\n"), L"dassl", iPos+1, pStr->get(0));
+                    DifferentialEquation::removeDifferentialEquationFunctions();
+                    free(pdYdotData);free(pdYData);free(YSize);
+                    return types::Function::Error;
+                }
+
+                int* sizeTemp = YSize;
+                int totalSize = sizeOfpdYData;
+
+                YSize = (int*)malloc((sizeOfYSize + pList->getSize() - 1) * sizeof(int));
+                memcpy(YSize, sizeTemp, sizeOfYSize * sizeof(int));
+
+                std::vector<types::Double*> vpDbl;
+                for(int iter = 0; iter < pList->getSize() - 1; iter++)
+                {
+                    if(pList->get(iter + 1)->isDouble() == false)
+                    {
+                        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : Argument %d in the list must be a matrix.\n"), L"dassl", iPos+1, iter+1);
+                        DifferentialEquation::removeDifferentialEquationFunctions();
+                        free(pdYdotData);free(pdYData);free(YSize);
+                        return types::Function::Error;
+                    }
+
+                    vpDbl.push_back(pList->get(iter+1)->getAs<types::Double>());
+                    YSize[sizeOfYSize + iter] = vpDbl[iter]->getSize();
+                    totalSize += YSize[sizeOfYSize + iter];
+                }
+
+                double* pdYDataTemp = pdYData;
+                pdYData = (double*)malloc(totalSize * sizeof(double));
+                C2F(dcopy)(&sizeOfpdYData, pdYDataTemp, &one, pdYData, &one);
+
+                int position = sizeOfpdYData;
+                for(int iter = 0; iter < pList->getSize()-1; iter++)
+                {
+                    C2F(dcopy)(&YSize[sizeOfYSize + iter], vpDbl[iter]->get(), &one, &pdYData[position], &one);
+                    position += vpDbl[iter]->getSize();
+                }
+                vpDbl.clear();
+                sizeOfpdYData = totalSize;
+                sizeOfYSize += pList->getSize() - 1;
+                free(pdYDataTemp);
+                free(sizeTemp);
+            }
+            else if(pList->get(0)->isCallable())
+            {
+                if(bFuncF == false)
+                {
+                    bFuncF = true;
+                    deFunctionsManager->setFFunction(pList->get(0)->getAs<types::Callable>());
+                    for(int iter = 1; iter < pList->getSize(); iter++)
+                    {
+                        deFunctionsManager->setFArgs(pList->get(iter)->getAs<types::InternalType>());
+                    }
+                }
+                else if(bFuncJac == false)
+                {
+                    bFuncJac = true;
+                    deFunctionsManager->setJacFunction(pList->get(0)->getAs<types::Callable>());
+                    for(int iter = 1; iter < pList->getSize(); iter++)
+                    {
+                        deFunctionsManager->setJacArgs(pList->get(iter)->getAs<types::InternalType>());
+                    }
+                }
+            }
+            else if(pList->get(0)->isDouble() && bFuncF == true)
+            {
+                if(pList->getSize() != 7)
+                {
+                    ScierrorW(267,_W("%ls: Wrong size for input argument #%d : A list of size %d expected.\n"), L"dassl", iPos+1, 7);
+                    DifferentialEquation::removeDifferentialEquationFunctions();
+                    free(pdYdotData);free(pdYData);free(YSize);
+                    return types::Function::Error;
+                }
+
+                for(int i = 0; i < 7; i++) // info = list([],0,[],[],[],0,0)
+                {
+                    if(pList->get(i)->isDouble() == false || (pList->get(i)->getAs<types::Double>()->isScalar() == false && (i == 1 || i == 5 || i == 6)))
+                    {
+                        if(i == 1 || i == 5 || i == 6)
+                        {
+                            ScierrorW(999, _W("%ls: Wrong type for input argument #%d : Element %d in the info list must be a scalar.\n"), L"dassl", iPos+1, i);
+                        }
+                        else
+                        {
+                            ScierrorW(999, _W("%ls: Wrong type for input argument #%d : Element %d in the info list must be a matrix.\n"), L"dassl", iPos+1, i);
+                        }
+                        DifferentialEquation::removeDifferentialEquationFunctions();
+                        free(pdYdotData);free(pdYData);free(YSize);
+                        return types::Function::Error;  
+                    }
+                }
+
+                types::Double* pDblTemp = pList->get(0)->getAs<types::Double>();
+                if(pDblTemp->getSize() != 0)
+                {
+                    info[3] = 1;
+                    tstop = pDblTemp->get(0);
+                }
+
+                info[2] = (int)pList->get(1)->getAs<types::Double>()->get(0);
+
+                pDblTemp = pList->get(2)->getAs<types::Double>();
+                if(pDblTemp->getSize() == 2)
+                {
+                    info[5] = 1;
+                    ml = (int)pDblTemp->get(0);
+                    mu = (int)pDblTemp->get(1);
+                    deFunctionsManager->setMl(ml);
+                    deFunctionsManager->setMu(mu);
+                }
+                else if(pDblTemp->getSize() != 0)
+                {
+                    ScierrorW(267,_W("%ls: Wrong size for input argument #%d : Argument %d in te list must be of size %d.\n"), L"dassl", iPos+1, 3, 2);
+                    DifferentialEquation::removeDifferentialEquationFunctions();
+                    free(pdYdotData);free(pdYData);free(YSize);
+                    return types::Function::Error;
+                }
+
+                pDblTemp = pList->get(3)->getAs<types::Double>();
+                if(pDblTemp->getSize() != 0)
+                {
+                    info[6] = 1;
+                    maxstep = pDblTemp->get(0);
+                }
+
+                pDblTemp = pList->get(4)->getAs<types::Double>();
+                if(pDblTemp->getSize() != 0)
+                {
+                    info[7] = 1;
+                    stepin = pDblTemp->get(0);
+                }
+
+                info[9]  = (int)pList->get(5)->getAs<types::Double>()->get(0);
+                if(pList->get(6)->getAs<types::Double>()->get(0) == 1)
+                {
+                    info[10] = 1;
+                }
+
+                bListInfo = true;
+            }
+            else
+            {
+                ScierrorW(999, _W("%ls: Wrong type for input argument #%d : The first argument in the list must be a string, a function or a matrix in case of argument info.\n"), L"dassl", iPos+1);
+                DifferentialEquation::removeDifferentialEquationFunctions();
+                free(pdYdotData);free(pdYData);free(YSize);
+                return types::Function::Error;
+            }
+        }
+        else
+        {
+            ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A matrix or a function expected.\n"), L"dassl", iPos+1);
+            DifferentialEquation::removeDifferentialEquationFunctions();
+            free(pdYdotData);free(pdYData);free(YSize);
+            return types::Function::Error;
+        }
+    }
+
+    if(bFuncF == false)
+    {
+        ScierrorW(77, _W("%ls: Wrong number of input argument(s): %d expected.\n"), L"dassl", in.size() + 1);
+        DifferentialEquation::removeDifferentialEquationFunctions();
+        free(pdYdotData);free(pdYData);free(YSize);
+        return types::Function::Error;
+    }
+
+    if(bFuncJac == true)
+    {
+        info[4] = 1;
+    }
+
+// *** Initialization. ***
+    double t0   = pDblT0->get(0);
+    double rpar = 0;
+    int ipar    = 0;
+    int idid    = 0;
+    int maxord  = 5;
+
+    //compute itol and set the tolerances rtol and atol.
+    double* rtol = NULL;
+    double* atol = NULL;
+
+    if(pDblAtol)
+    {
+        if(pDblAtol->isScalar())
+        {
+            atol  = (double*)malloc(sizeof(double));
+            *atol = pDblAtol->get(0);
+        }
+        else
+        {
+            atol    = pDblAtol->get();
+            info[1] = 1;
+        }
+    }
+    else
+    {
+        atol  = (double*)malloc(sizeof(double));
+        *atol = 1.e-7;
+    }
+
+    if(pDblRtol)
+    {
+        if(pDblRtol->isScalar())
+        {
+            rtol  = (double*)malloc(sizeof(double));
+            *rtol = pDblRtol->get(0);
+        }
+        else
+        {
+            rtol = pDblRtol->get();
+        }
+    }
+    else // if rtol is not given atol will be used as a scalar.
+    {
+        if(pDblAtol && pDblAtol->isScalar() == false)// info[1] == 1
+        {
+            double dblSrc = 1.e-9;
+            int iSize = pDblAtol->getSize();
+            int iOne = 1;
+            int iZero = 0;
+
+            rtol = (double*)malloc(iSize * sizeof(double));
+            C2F(dcopy)(&iSize, &dblSrc, &iZero, rtol, &iOne);
+        }
+        else
+        {
+            rtol    = (double*)malloc(sizeof(double));
+            *rtol   = 1.e-9;
+        }
+    }
+
+    // Compute rwork, iwork size.
+    // Create them.
+    int iworksize   = 20 + pDblX0->getRows();
+    int rworksize   = 0;
+    int* iwork      = NULL;
+    double* rwork   = NULL;
+
+    if(info[5] == 0)
+    {
+        rworksize = 40 + (maxord + 4) * pDblX0->getRows() + pDblX0->getRows() * pDblX0->getRows();
+    }
+    else if(info[4] == 1)
+    {
+        rworksize = 40 + (maxord + 4) * pDblX0->getRows() + (2 * ml + mu + 1) * pDblX0->getRows();
+    }
+    else if(info[4] == 0)
+    {
+        rworksize = 40 + (maxord + 4) * pDblX0->getRows() + (2 * ml + mu + 1) * pDblX0->getRows() + 2 * (pDblX0->getRows() / (ml + mu + 1) + 1);
+    }
+
+    iwork = (int*)malloc(iworksize * sizeof(int));
+    rwork = (double*)malloc(rworksize * sizeof(double));
+
+    if(pDblHd != NULL)
+    {
+        if(iworksize + rworksize != pDblHd->getSize())
+        {
+            ScierrorW(77, _W("%ls: Wrong size for input argument(s) %d: %d expected.\n"), L"dassl", in.size(), iworksize + rworksize);
+            DifferentialEquation::removeDifferentialEquationFunctions();
+            free(pdYdotData);free(pdYData);free(YSize);
+            free(iwork);free(rwork);
+            if(pDblAtol == NULL || pDblAtol->isScalar()) free(atol);
+            if(pDblRtol == NULL || pDblRtol->isScalar()) free(rtol);
+            return types::Function::Error;
+        }
+
+        C2F(dcopy)(&rworksize, pDblHd->get(), &one, rwork, &one);
+
+        for(int i = 0; i < iworksize; i++)
+        {
+            iwork[i] = (int)pDblHd->get(rworksize + i);
+        }
+
+        info[0] = 1;
+    }
+
+    if(info[3] == 1)
+    {
+        rwork[0] = tstop;
+    }
+
+    if(info[6] == 1)
+    {
+        rwork[1] = maxstep;
+    }
+
+    if(info[7] == 1)
+    {
+        rwork[2] = stepin;
+    }
+
+    if(info[5] == 1)
+    {
+        iwork[0] = ml;
+        iwork[1] = mu;
+    }
+
+// *** Perform operation. ***
+    std::list<types::Double*> lpDblOut;
+    int size = pDblX0->getRows();
+    int rowsOut = 1 + pDblX0->getRows() * 2;
+
+    for(int i = 0; i < pDblT->getSize(); i++)
+    {
+        types::Double* pDblOut = new types::Double(rowsOut, 1);
+        lpDblOut.push_back(pDblOut);
+
+        double t = pDblT->get(i);
+        int pos  = 0;
+        pDblOut->set(pos, t);
+
+        if(t == t0)
+        {
+            pos++;
+            C2F(dcopy)(&size, pdYData, &one, pDblOut->get() + pos, &one);
+            pos += pDblX0->getRows();
+            C2F(dcopy)(&size, pdYdotData, &one, pDblOut->get() + pos, &one);
+
+            continue;
+        }
+
+        C2F(dassl)(dassl_f, YSize, &t0, pdYData, pdYdotData, &t, info, rtol, atol, &idid, rwork, &rworksize, iwork, &iworksize, &rpar, &ipar, dassl_jac);
+
+        int iret = checkDasslError(idid);
+
+        if(iret == 1) // error
+        {
+            ScierrorW(999, _W("%ls: dassl return with state %d.\n"), L"dassl", idid);
+            lpDblOut.clear();
+            DifferentialEquation::removeDifferentialEquationFunctions();
+            free(pdYdotData);free(pdYData);free(YSize);
+            free(iwork);free(rwork);
+            if(pDblAtol == NULL || pDblAtol->isScalar()) free(atol);
+            if(pDblRtol == NULL || pDblRtol->isScalar()) free(rtol);
+            return types::Function::Error;
+        }
+
+        pos++;
+        C2F(dcopy)(&size, pdYData, &one, pDblOut->get() + pos, &one);
+        pos += size;
+        C2F(dcopy)(&size, pdYdotData, &one, pDblOut->get() + pos, &one);
+
+        if(iret == 2) // warning
+        {
+            break;
+        }
+
+        // iret == 0
+        if(idid == 1)
+        {
+            pDblOut->set(0, t0);
+            i--;
+        }
+        else if(idid == -2)
+        {
+            t0 = t;
+            i--;
+        }
+        else
+        {
+            t0 = t;
+        }
+
+        info[0] = 1;
+    }
+
+// *** Return result in Scilab. ***
+    types::Double* pDblOut = new types::Double(rowsOut, (int)lpDblOut.size());
+
+    int sizeOfList = (int)lpDblOut.size();
+    for(int i = 0; i < sizeOfList; i++)
+    {
+        int pos = i * rowsOut;
+        C2F(dcopy)(&rowsOut, lpDblOut.front()->get(), &one, pDblOut->get() + pos, &one);
+        lpDblOut.pop_front();
+    }
+    out.push_back(pDblOut);
+
+    if(_iRetCount == 2)
+    {
+        types::Double* pDblHdOut = new types::Double(rworksize + iworksize, 1);
+        C2F(dcopy)(&rworksize, rwork, &one, pDblHdOut->get(), &one);
+
+        for(int i = 0; i < iworksize; i++)
+        {
+            pDblHdOut->set(rworksize + i, (double)iwork[i]);
+        }
+
+        out.push_back(pDblHdOut);
+    }
+
+// *** free. ***
+    if(pDblAtol == NULL || pDblAtol->isScalar())
+    {
+        free(atol);
+    }
+
+    if(pDblRtol == NULL || pDblRtol->isScalar())
+    {
+        free(rtol);
+    }
+
+    free(pdYData);
+    free(pdYdotData);
+    free(YSize);
+    free(rwork);
+    free(iwork);
+
+    DifferentialEquation::removeDifferentialEquationFunctions();
+
+    return types::Function::OK;
+}
+
diff --git a/scilab/modules/differential_equations/sci_gateway/cpp/sci_feval.cpp b/scilab/modules/differential_equations/sci_gateway/cpp/sci_feval.cpp
new file mode 100644 (file)
index 0000000..89bb8e7
--- /dev/null
@@ -0,0 +1,214 @@
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) 2011 - DIGITEO - Cedric DELAMARRE
+*
+* 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-en.txt
+*
+*/
+/*--------------------------------------------------------------------------*/
+
+#include "differential_equations_gw.hxx"
+#include "function.hxx"
+#include "double.hxx"
+#include "string.hxx"
+#include "list.hxx"
+#include "callable.hxx"
+#include "differentialequationfunctions.hxx"
+
+extern "C"
+{
+#include "localization.h"
+#include "Scierror.h"
+#include "scifunctions.h"
+#include "feval.h"
+}
+
+/*--------------------------------------------------------------------------*/
+types::Function::ReturnValue sci_feval(types::typed_list &in, int _iRetCount, types::typed_list &out)
+{
+    int iPos = 0;
+    int nn   = 1;
+
+    //input
+    types::Double* pDblX = NULL;
+    types::Double* pDblY = NULL;
+
+    // output
+    types::Double* pDblOut = NULL;
+
+// *** check the minimal number of input args. ***
+    if(in.size() < 2 || in.size() > 3)
+    {
+        ScierrorW(77, _W("%ls: Wrong number of input argument(s): %d to %d expected.\n"), L"feval", 2, 3);
+        return types::Function::Error;
+    }
+
+// *** check number of output args according the methode. ***
+    if(_iRetCount > 1)
+    {
+        ScierrorW(78, _W("%ls: Wrong number of output argument(s): %d expected.\n"), L"feval", 1);
+        return types::Function::Error;
+    }
+
+// *** check type of input args and get it. ***
+    // X
+    if(in[iPos]->isDouble() == false)
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A real matrix expected.\n"), L"feval", iPos+1);
+        return types::Function::Error;
+    }
+    pDblX = in[iPos]->getAs<types::Double>();
+    if(pDblX->isComplex())
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A real matrix expected.\n"), L"feval", iPos+1);
+        return types::Function::Error;
+    }
+    iPos++;
+
+    // Y
+    if(in.size() == 3)
+    {
+        if(in[iPos]->isDouble() == false)
+        {
+            ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A real matrix expected.\n"), L"feval", iPos+1);
+            return types::Function::Error;
+        }
+        pDblY = in[iPos]->getAs<types::Double>();
+        if(pDblY->isComplex())
+        {
+            ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A real matrix expected.\n"), L"feval", iPos+1);
+            return types::Function::Error;
+        }
+        iPos++;
+        nn = 2;
+    }
+
+    // function
+    DifferentialEquationFunctions* deFunctionsManager = new DifferentialEquationFunctions(L"feval");
+    DifferentialEquation::addDifferentialEquationFunctions(deFunctionsManager);
+
+    if(in[iPos]->isCallable())
+    {
+        types::Callable* pCall = in[iPos]->getAs<types::Callable>();
+        deFunctionsManager->setFFunction(pCall);
+
+        // check function
+        int iflag   = 0;
+        double x    = 1;
+        double y    = 1;
+        double res[2];
+
+        int ret  = deFunctionsManager->execFevalF(&nn, &x, &y, res, &iflag);
+        if(ret)
+        {
+            ScierrorW(50,_W("%ls: Argument #%d : Variable returned by scilab argument function is incorrect.\n"), L"int3d", 4);
+            DifferentialEquation::removeDifferentialEquationFunctions();
+            return types::Function::Error;
+        }
+    }
+    else if(in[iPos]->isString())
+    {
+        bool bOK = false;
+        types::String* pStr = in[iPos]->getAs<types::String>();
+        bOK = deFunctionsManager->setFFunction(pStr);
+
+        if(bOK == false)
+        {
+            ScierrorW(50,_W("%ls: Subroutine not found: %ls\n"), L"feval", pStr->get(0));
+            DifferentialEquation::removeDifferentialEquationFunctions();
+            return types::Function::Error;
+        }
+    }
+    else if(in[iPos]->isList())
+    {
+        types::List* pList = in[iPos]->getAs<types::List>();
+
+        if(pList->getSize() == 0)
+        {
+            ScierrorW(50,_W("%ls: Argument #%d : Subroutine not found in list: %ls\n"), L"feval", iPos+1, L"(string empty)");
+            DifferentialEquation::removeDifferentialEquationFunctions();
+            return types::Function::Error;
+        }
+
+        if(pList->get(0)->isCallable())
+        {
+            deFunctionsManager->setFFunction(pList->get(0)->getAs<types::Callable>());
+            for(int iter = 1; iter < pList->getSize(); iter++)
+            {
+                deFunctionsManager->setFArgs(pList->get(iter)->getAs<types::InternalType>());
+            }
+        }
+        else
+        {
+            ScierrorW(999, _W("%ls: Wrong type for input argument #%d : The first argument in the list must be a Scilab function.\n"), L"feval", 4);
+            DifferentialEquation::removeDifferentialEquationFunctions();
+            return types::Function::Error;
+        }
+    }
+    else
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A function expected.\n"), L"feval", iPos+1);
+        DifferentialEquation::removeDifferentialEquationFunctions();
+        return types::Function::Error;
+    }
+
+// *** Perform operation. ***
+    int itype       = 0; // output value
+    double* res     = (double*)malloc(2 * sizeof(double));
+    int sizeOfY     = pDblY ? pDblY->getSize() : 1;
+
+    if(nn == 2)
+    {
+        pDblOut = new types::Double(pDblX->getSize(), sizeOfY);
+    }
+    else
+    {
+        pDblOut = new types::Double(pDblX->getRows(), pDblX->getCols());
+    }
+
+    for(int y = 0; y < sizeOfY; y++)
+    {
+        for(int x = 0; x < pDblX->getSize(); x++)
+        {
+            double valX = pDblX->get(x);
+            // if pDblY == NULL, nn == 1 so valY will be never used.
+            double valY = pDblY ? pDblY->get(y) : 0;
+
+            int iret = deFunctionsManager->execFevalF(&nn, &valX, &valY, res, &itype);
+
+            if(iret)
+            {
+                ScierrorW(999, _W("%ls: Error during the function execution.\n"), L"feval");
+                DifferentialEquation::removeDifferentialEquationFunctions();
+                delete pDblOut;
+                return types::Function::Error;
+            }
+
+            if(itype)// is complex
+            {
+                pDblOut->setComplex(true);
+                pDblOut->set(x + y*pDblX->getSize(), res[0]);
+                pDblOut->setImg(x + y*pDblX->getSize(), res[1]);
+            }
+            else
+            {
+                pDblOut->set(x + y*pDblX->getSize(), res[0]);
+            }
+        }
+    }
+
+// *** Return result in Scilab. ***
+
+    out.push_back(pDblOut);
+
+    free(res);
+    DifferentialEquation::removeDifferentialEquationFunctions();
+
+    return types::Function::OK;
+}
+/*--------------------------------------------------------------------------*/
+
diff --git a/scilab/modules/differential_equations/sci_gateway/cpp/sci_impl.cpp b/scilab/modules/differential_equations/sci_gateway/cpp/sci_impl.cpp
new file mode 100644 (file)
index 0000000..92f2d55
--- /dev/null
@@ -0,0 +1,715 @@
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) 2011 - DIGITEO - Cedric DELAMARRE
+*
+* 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-en.txt
+*
+*/
+/*--------------------------------------------------------------------------*/
+
+#include "differential_equations_gw.hxx"
+#include "function.hxx"
+#include "double.hxx"
+#include "string.hxx"
+#include "list.hxx"
+#include "callable.hxx"
+#include "differentialequationfunctions.hxx"
+#include "runvisitor.hxx"
+
+extern "C"
+{
+#include "localization.h"
+#include "Scierror.h"
+#include "scifunctions.h"
+#include "elem_common.h"
+#include "checkodeerror.h"
+#include "sciprint.h"
+#include "common_structure.h"
+}
+/*--------------------------------------------------------------------------*/
+
+types::Function::ReturnValue sci_impl(types::typed_list &in, int _iRetCount, types::typed_list &out)
+{
+    // Methode
+    types::String* pStrType     = NULL;
+    wchar_t* wcsType            = L"lsoda";
+    int meth                    = 2;// default methode is stiff
+
+    // y0
+    types::Double* pDblY0       = NULL;
+    double* pdYData             = NULL; // contain y0 following by all args data in list case.
+    int sizeOfpdYData           = 0;
+
+    // Other input args
+    types::Double* pDblYdot0    = NULL;
+    types::Double* pDblT0       = NULL;
+    types::Double* pDblT        = NULL;
+    types::Double* pDblRtol     = NULL;
+    types::Double* pDblAtol     = NULL;
+    types::Double* pDblW        = NULL;
+    types::Double* pDblIw       = NULL;
+
+    // Result
+    types::Double* pDblYOut     = NULL;
+
+    // Indicate if the function is given.
+    bool bFuncF     = false; // res
+    bool bFuncJac   = false; // jac
+    bool bFuncG     = false; // adda
+
+    int iPos        = 0; // Position in types::typed_list in
+    int maxord      = 5; // maxord = 12 (if meth = 1) or 5 (if meth = 2)
+
+    int sizeOfYSize = 1;
+    int* YSize      = NULL;    // YSize(1) = size of y0,
+                               // YSize(n) = size of Args(n) in list case.
+
+    C2F(eh0001).mesflg  = 1; // flag to control printing of error messages in lapack routine.
+                             // 1 means print, 0 means no printing.
+    C2F(eh0001).lunit   = 6; // 6 = stdout
+
+    int one = 1; // use in dcopy
+
+// *** check the minimal number of input args. ***
+    if(in.size() < 6 || in.size() > 12)
+    {
+        ScierrorW(77, _W("%ls: Wrong number of input argument(s): %d to %d expected.\n"), L"impl", 6, 12);
+        return types::Function::Error;
+    }
+
+// *** check number of output args ***
+    if(_iRetCount > 3 || _iRetCount == 2)
+    {
+        ScierrorW(78, _W("%ls: Wrong number of output argument(s): %d or %d expected.\n"), L"impl", 1, 3);
+        return types::Function::Error;
+    }
+
+// *** Get the methode. ***
+    if(in[0]->isString())
+    {
+        pStrType = in[0]->getAs<types::String>();
+        wcsType = pStrType->get(0);
+        iPos++;
+    }
+
+    if(iPos)
+    {
+        if(wcscmp(wcsType, L"adams") == 0)
+        {
+            meth = 1;
+            maxord = 12;
+        }
+        else if(wcscmp(wcsType, L"stiff") == 0)
+        {
+            meth = 2;
+        }
+        else
+        {
+            ScierrorW(999, _W("%ls: Wrong value for input argument #%d : It must be one of the following strings : adams or stiff.\n"), L"impl", 1);
+            return types::Function::Error;
+        }
+    }
+
+// *** check type of input args and get it. ***
+    // y0
+    if(in[iPos]->isDouble() == false)
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A matrix expected.\n"), L"impl", iPos+1);
+        return types::Function::Error;
+    }
+
+    pDblY0 = in[iPos]->getAs<types::Double>();
+
+    if(pDblY0->isComplex())
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A real matrix expected.\n"), L"impl", iPos+1);
+        return types::Function::Error;
+    }
+
+    if(pDblY0->getCols() != 1 && pDblY0->getRows() != 1)
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A real vector expected.\n"), L"impl", iPos+1);
+        return types::Function::Error;
+    }
+
+    // ydot0
+    iPos++;
+    if(in[iPos]->isDouble() == false)
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A matrix expected.\n"), L"impl", iPos+1);
+        return types::Function::Error;
+    }
+
+    pDblYdot0 = in[iPos]->getAs<types::Double>();
+
+    if(pDblYdot0->isComplex())
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A real matrix expected.\n"), L"impl", iPos+1);
+        return types::Function::Error;
+    }
+
+    if(pDblYdot0->getCols() != 1 && pDblYdot0->getRows() != 1)
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A real vector expected.\n"), L"impl", iPos+1);
+        return types::Function::Error;
+    }
+
+    // t0
+    iPos++;
+    if(in[iPos]->isDouble() == false)
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A scalar expected.\n"), L"impl", iPos+1);
+        return types::Function::Error;
+    }
+
+    pDblT0 = in[iPos]->getAs<types::Double>();
+
+    if(pDblT0->isScalar() == false)
+    {
+        ScierrorW(999, _W("%ls: Wrong size for input argument #%d : A scalar expected.\n"), L"impl", iPos+1);
+        return types::Function::Error;
+    }
+
+    // t
+    iPos++;
+    if(in[iPos]->isDouble() == false)
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A matrix expected.\n"), L"impl", iPos+1);
+        return types::Function::Error;
+    }
+
+    pDblT = in[iPos]->getAs<types::Double>();
+
+    // get next inputs
+    DifferentialEquationFunctions* deFunctionsManager = new DifferentialEquationFunctions(L"impl");
+    DifferentialEquation::addDifferentialEquationFunctions(deFunctionsManager);
+
+    YSize = (int*)malloc(sizeOfYSize * sizeof(int));
+    *YSize = pDblY0->getSize();
+    pdYData = (double*)malloc(pDblY0->getSize() * sizeof(double));
+    C2F(dcopy)(YSize, pDblY0->get(), &one, pdYData, &one);
+
+    for(iPos++; iPos < in.size(); iPos++)
+    {
+        if(in[iPos]->isDouble())
+        {
+            if(pDblAtol == NULL && bFuncF == false)
+            {
+                pDblAtol = in[iPos]->getAs<types::Double>();
+                if(pDblAtol->getSize() != pDblY0->getSize() && pDblAtol->isScalar() == false)
+                {
+                    ScierrorW(267,_W("%ls: Arg %d and arg %d must have equal dimensions.\n"), L"impl", pStrType ? 2 : 1, iPos+1);
+                    DifferentialEquation::removeDifferentialEquationFunctions();
+                    free(pdYData);free(YSize);
+                    return types::Function::Error;
+                }
+            }
+            else if(pDblRtol == NULL && bFuncF == false)
+            {
+                pDblRtol = in[iPos]->getAs<types::Double>();
+                if(pDblRtol->getSize() != pDblY0->getSize() && pDblRtol->isScalar() == false)
+                {
+                    ScierrorW(267,_W("%ls: Arg %d and arg %d must have equal dimensions.\n"), L"impl", pStrType ? 2 : 1, iPos+1);
+                    DifferentialEquation::removeDifferentialEquationFunctions();
+                    free(pdYData);free(YSize);
+                    return types::Function::Error;
+                }
+            }
+            else if(pDblW == NULL && bFuncG == true)
+            {
+                if(in.size() == iPos + 2)
+                {
+                    if(in[iPos+1]->isDouble() == false)
+                    {
+                        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A matrix expected.\n"), L"impl", iPos+2);
+                        DifferentialEquation::removeDifferentialEquationFunctions();
+                        free(pdYData);free(YSize);
+                        return types::Function::Error;
+                    }
+
+                    pDblW = in[iPos]->getAs<types::Double>();
+                    pDblIw = in[iPos+1]->getAs<types::Double>();
+                    iPos++;
+                }
+                else
+                {
+                    ScierrorW(77, _W("%ls: Wrong number of input argument(s): %d expected.\n"), L"impl", iPos+2);
+                    DifferentialEquation::removeDifferentialEquationFunctions();
+                    free(pdYData);free(YSize);
+                    return types::Function::Error;
+                }
+            }
+            else
+            {
+                ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A function expected.\n"), L"impl", iPos+1);
+                DifferentialEquation::removeDifferentialEquationFunctions();
+                free(pdYData);free(YSize);
+                return types::Function::Error;
+            }
+        }
+        else if(in[iPos]->isCallable())
+        {
+            types::Callable* pCall = in[iPos]->getAs<types::Callable>();
+            if(bFuncF == false)
+            {
+                deFunctionsManager->setFFunction(pCall);
+                bFuncF = true;
+            }
+            else if(bFuncG == false)
+            {
+                deFunctionsManager->setGFunction(pCall);
+                bFuncG = true;
+            }
+            else if(bFuncJac == false)
+            {
+                deFunctionsManager->setJacFunction(pCall);
+                bFuncJac = true;
+            }
+            else
+            {
+                ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A matrix expected.\n"), L"impl", iPos+1);
+                DifferentialEquation::removeDifferentialEquationFunctions();
+                free(pdYData);free(YSize);
+                return types::Function::Error;
+            }
+        }
+        else if(in[iPos]->isString())
+        {
+            types::String* pStr = in[iPos]->getAs<types::String>();
+            bool bOK = false;
+
+            if(bFuncF == false)
+            {
+                bOK = deFunctionsManager->setFFunction(pStr);
+                bFuncF = true;
+            }
+            else if(bFuncG == false)
+            {
+                bOK = deFunctionsManager->setGFunction(pStr);
+                bFuncG = true;
+            }
+            else if(bFuncJac == false)
+            {
+                bOK = deFunctionsManager->setJacFunction(pStr);
+                bFuncJac = true;
+            }
+            else
+            {
+                ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A matrix expected.\n"), L"impl", iPos+1);
+                DifferentialEquation::removeDifferentialEquationFunctions();
+                free(pdYData);free(YSize);
+                return types::Function::Error;
+            }
+
+            if(bOK == false)
+            {
+                ScierrorW(50,_W("%ls: Subroutine not found: %ls\n"), L"impl", pStr->get(0));
+                DifferentialEquation::removeDifferentialEquationFunctions();
+                free(pdYData);free(YSize);
+                return types::Function::Error;
+            }
+        }
+        else if(in[iPos]->isList())
+        {
+            types::List* pList = in[iPos]->getAs<types::List>();
+
+            if(pList->getSize() == 0)
+            {
+                ScierrorW(50,_W("%ls: Argument #%d : Subroutine not found in list: %ls\n"), L"impl", iPos+1, L"(string empty)");
+                DifferentialEquation::removeDifferentialEquationFunctions();
+                free(pdYData);free(YSize);
+                return types::Function::Error;
+            }
+
+            if(bFuncF && bFuncG && bFuncJac)
+            {
+                ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A matrix expected.\n"), L"impl", iPos+1);
+                DifferentialEquation::removeDifferentialEquationFunctions();
+                free(pdYData);free(YSize);
+                return types::Function::Error;
+            }
+
+            if(pList->get(0)->isString())
+            {
+                types::String* pStr = pList->get(0)->getAs<types::String>();
+                bool bOK = false;
+
+                if(bFuncF == false)
+                {
+                    bFuncF = true;
+                    bOK = deFunctionsManager->setFFunction(pStr);
+                    sizeOfpdYData = *YSize;
+                }
+                else if(bFuncG == false)
+                {
+                    bFuncG = true;
+                    bOK = deFunctionsManager->setGFunction(pStr);
+                    if(sizeOfpdYData == 0)
+                    {
+                        sizeOfpdYData = *YSize;
+                    }
+                }
+                else if(bFuncJac == false)
+                {
+                    bFuncJac = true;
+                    bOK = deFunctionsManager->setJacFunction(pStr);
+                    if(sizeOfpdYData == 0)
+                    {
+                        sizeOfpdYData = *YSize;
+                    }
+                }
+
+                if(bOK == false)
+                {
+                    ScierrorW(50,_W("%ls: Argument #%d : Subroutine not found in list: %ls\n"), L"impl", iPos+1, pStr->get(0));
+                    DifferentialEquation::removeDifferentialEquationFunctions();
+                    free(pdYData);free(YSize);
+                    return types::Function::Error;
+                }
+
+                int* sizeTemp = YSize;
+                int totalSize = sizeOfpdYData;
+
+                YSize = (int*)malloc((sizeOfYSize + pList->getSize() - 1) * sizeof(int));
+                memcpy(YSize, sizeTemp, sizeOfYSize * sizeof(int));
+
+                std::vector<types::Double*> vpDbl;
+                for(int iter = 0; iter < pList->getSize() - 1; iter++)
+                {
+                    if(pList->get(iter + 1)->isDouble() == false)
+                    {
+                        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : Argument %d in the list must be a matrix.\n"), L"impl", iPos+1, iter+1);
+                        DifferentialEquation::removeDifferentialEquationFunctions();
+                        free(pdYData);free(YSize);
+                        return types::Function::Error;
+                    }
+
+                    vpDbl.push_back(pList->get(iter+1)->getAs<types::Double>());
+                    YSize[sizeOfYSize + iter] = vpDbl[iter]->getSize();
+                    totalSize += YSize[sizeOfYSize + iter];
+                }
+
+                double* pdYDataTemp = pdYData;
+                pdYData = (double*)malloc(totalSize * sizeof(double));
+                C2F(dcopy)(&sizeOfpdYData, pdYDataTemp, &one, pdYData, &one);
+
+                int position = sizeOfpdYData;
+                for(int iter = 0; iter < pList->getSize()-1; iter++)
+                {
+                    C2F(dcopy)(&YSize[sizeOfYSize + iter], vpDbl[iter]->get(), &one, &pdYData[position], &one);
+                    position += vpDbl[iter]->getSize();
+                }
+                vpDbl.clear();
+                sizeOfpdYData = totalSize;
+                sizeOfYSize += pList->getSize() - 1;
+                free(pdYDataTemp);
+                free(sizeTemp);
+            }
+            else if(pList->get(0)->isCallable())
+            {
+                if(bFuncF == false)
+                {
+                    bFuncF = true;
+                    deFunctionsManager->setFFunction(pList->get(0)->getAs<types::Callable>());
+                    for(int iter = 1; iter < pList->getSize(); iter++)
+                    {
+                        deFunctionsManager->setFArgs(pList->get(iter)->getAs<types::InternalType>());
+                    }
+                }
+                else if(bFuncG == false)
+                {
+                    bFuncG = true;
+                    deFunctionsManager->setGFunction(pList->get(0)->getAs<types::Callable>());
+                    for(int iter = 1; iter < pList->getSize(); iter++)
+                    {
+                        deFunctionsManager->setGArgs(pList->get(iter)->getAs<types::InternalType>());
+                    }
+                }
+                else if(bFuncJac == false)
+                {
+                    bFuncJac = true;
+                    deFunctionsManager->setJacFunction(pList->get(0)->getAs<types::Callable>());
+                    for(int iter = 1; iter < pList->getSize(); iter++)
+                    {
+                        deFunctionsManager->setJacArgs(pList->get(iter)->getAs<types::InternalType>());
+                    }
+                }
+            }
+            else
+            {
+                ScierrorW(999, _W("%ls: Wrong type for input argument #%d : The first argument in the list must be a string or a function.\n"), L"impl", iPos+1);
+                DifferentialEquation::removeDifferentialEquationFunctions();
+                free(pdYData);free(YSize);
+                return types::Function::Error;
+            }
+        }
+        else
+        {
+            ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A matrix or a function expected.\n"), L"impl", iPos+1);
+            DifferentialEquation::removeDifferentialEquationFunctions();
+            free(pdYData);free(YSize);
+            return types::Function::Error;
+        }
+    }
+
+    if(bFuncF == false)
+    {
+        ScierrorW(77, _W("%ls: Wrong number of input argument(s): %d expected.\n"), L"impl", in.size() + 1);
+        DifferentialEquation::removeDifferentialEquationFunctions();
+        free(pdYData);free(YSize);
+        return types::Function::Error;
+    }
+
+    if(bFuncG == false)
+    {
+        ScierrorW(77, _W("%ls: Wrong number of input argument(s): %d expected.\n"), L"impl", in.size() + 1);
+        DifferentialEquation::removeDifferentialEquationFunctions();
+        free(pdYData);free(YSize);
+        return types::Function::Error;
+    }
+
+// *** Initialization. ***
+    double t0   = pDblT0->get(0);
+    int itol    = 1;
+    int iopt    = 0;
+    int istate  = 1;
+    int itask   = 1;
+    int jt = bFuncJac ? 1 : 2;
+    int jacType = 10*meth + jt;
+
+    pDblYOut = new types::Double(pDblY0->getRows(), pDblT->getSize());
+
+    // work tab
+    double* rwork   = NULL;
+    int* iwork      = NULL;
+    int rworkSize   = 0;
+    int iworkSize   = 0;
+
+    // contain ls0001, lsa001 and eh0001 structures
+    double* dStructTab  = NULL;
+    int* iStructTab     = NULL;
+    int dStructTabSize  = 219;  // number of double in ls0001
+    int iStructTabSize  = 41;   // number of int in ls0001 (39) + eh0001 (2)
+
+    int rwSize  = 0; // rwSize = dStructTab + rworkSize
+    int iwSize  = 0; // iwSize = iStructTab + iworkSize
+
+    // structures used by lsoda and lsode
+    double* ls0001d = &(C2F(ls0001).tret);
+    int* ls0001i    = &(C2F(ls0001).illin);
+    int* eh0001i    = &(C2F(eh0001).mesflg);
+
+    //compute itol and set the tolerances rtol and atol.
+    double* rtol = NULL;
+    double* atol = NULL;
+
+    if(pDblRtol)
+    {
+        if(pDblRtol->isScalar())
+        {
+            rtol = (double*)malloc(sizeof(double));
+            *rtol = pDblRtol->get(0);
+        }
+        else
+        {
+            rtol = pDblRtol->get();
+            itol += 2;
+        }
+    }
+    else
+    {
+        rtol = (double*)malloc(sizeof(double));
+        *rtol = 1.e-9;
+    }
+
+    if(pDblAtol)
+    {
+        if(pDblAtol->isScalar())
+        {
+            atol = (double*)malloc(sizeof(double));
+            *atol = pDblAtol->get(0);
+        }
+        else
+        {
+            atol = pDblAtol->get();
+            itol ++;
+        }
+    }
+    else
+    {
+        atol = (double*)malloc(sizeof(double));
+        *atol = 1.e-7;
+    }
+
+    // Compute rwork, iwork size.
+    // Create them.
+
+    int nyh = (*YSize);
+    if(pDblW) // structure ls0001 have been restored.
+    {
+        nyh = C2F(ls0001).nyh;
+    }
+
+    rworkSize = 20 + nyh * (maxord + 1) + 3 * *YSize + *YSize * *YSize + 2;
+    iworkSize = 20 + *YSize;
+
+    rwSize = rworkSize + dStructTabSize;
+    iwSize = iworkSize + iStructTabSize;
+
+    rwork = (double*)malloc(rworkSize * sizeof(double));
+    iwork = (int*)malloc(iworkSize * sizeof(int));
+
+    if(pDblW && pDblIw)
+    {
+        if(pDblW->getSize() != rwSize || pDblIw->getSize() != iwSize)
+        {
+            ScierrorW(9999, _W("%ls: Wrong size for w and iw : w = %d and iw = %d expected.\n"), L"impl", rwSize, iwSize);
+            DifferentialEquation::removeDifferentialEquationFunctions();
+            free(pdYData);free(YSize);
+            free(rwork);free(iwork);
+            if(itol == 1 || itol == 3) free(atol);
+            if(itol < 3) free(rtol);
+            return types::Function::Error;
+        }
+
+        istate = 2; // 1 means this is the first call | 2  means this is not the first call
+
+        // restore rwork from pDblW
+        C2F(dcopy)(&rworkSize, pDblW->get(), &one, rwork, &one);
+
+        // restore iwork from pDblIw
+        iStructTab = (int*)malloc(iStructTabSize * sizeof(int));
+        for(int i = 0; i < iworkSize; i++)
+        {
+            iwork[i] = (int)pDblIw->get(i);
+        }
+
+        //restore ls0001d from pDblW
+        C2F(dcopy)(&dStructTabSize, pDblW->get() + rworkSize, &one, ls0001d, &one);
+
+        //restore ls0001i from pDblIw
+        for(int i = 0; i < iStructTabSize; i++)
+        {
+            iStructTab[i] = (int)pDblIw->get(i + iworkSize);
+        }
+        memcpy(ls0001i, iStructTab, 39 * sizeof(int));
+    }
+
+// *** Perform operation. ***
+    for(int i = 0; i < pDblT->getSize(); i++)
+    {
+        double t = pDblT->get(i);
+
+        C2F(lsodi)(impl_f, impl_g, impl_jac, YSize, pdYData, pDblYdot0->get(), &t0, &t, &itol, rtol, atol, &itask, &istate, &iopt, rwork, &rworkSize, iwork, &iworkSize, &jacType);
+
+        // check error
+        int err = 0;
+        if(istate == 3)
+        {
+            sciprintW(_W("The user-supplied subroutine res signalled lsodi to halt the integration and return (ires=2). Execution of the external function has failed.\n"));
+            err = 1;
+        }
+        else
+        {
+            err = checkOdeError(meth, istate);
+        }
+
+        if(err == 1)
+        {
+            ScierrorW(999, _W("%ls: %ls exit with state %d.\n"), L"impl", L"lsodi", istate);
+            DifferentialEquation::removeDifferentialEquationFunctions();
+            free(pdYData);free(YSize);
+            free(rwork);free(iwork);
+            if(iStructTab) free(iStructTab);
+            if(itol == 1 || itol == 3) free(atol);
+            if(itol < 3) free(rtol);
+            return types::Function::Error;
+        }
+
+        for(int j = 0; j < *YSize; j++)
+        {
+            pDblYOut->set(i*(*YSize) + j, pdYData[j]);
+        }
+    }
+
+    if(_iRetCount > 2)//save ls0001 and eh0001 following pDblW and pDblIw.
+    {
+        int dSize   = 219;
+
+        if(iStructTab == NULL)
+        {
+            iStructTab = (int*)malloc(iStructTabSize * sizeof(int));
+        }
+
+        if(dStructTab == NULL)
+        {
+            dStructTab = (double*)malloc(dStructTabSize * sizeof(double));
+        }
+
+        // save ls0001
+        C2F(dcopy)(&dSize, ls0001d, &one, dStructTab, &one);
+        memcpy(iStructTab, ls0001i, 39 * sizeof(int));
+
+        // save eh0001
+        memcpy(&iStructTab[39], eh0001i, 2 * sizeof(int));
+    }
+
+// *** Return result in Scilab. ***
+    out.push_back(pDblYOut);
+
+    if(_iRetCount > 2)
+    {
+        types::Double* pDblWOut = new types::Double(1,rwSize);
+        C2F(dcopy)(&rworkSize, rwork, &one, pDblWOut->get(), &one);
+        C2F(dcopy)(&dStructTabSize, dStructTab, &one, pDblWOut->get() + rworkSize, &one);
+
+        types::Double* pDblIwOut = new types::Double(1,iwSize);
+        for(int i = 0; i < iworkSize; i++)
+        {
+            pDblIwOut->set(i, (double)iwork[i]);
+        }
+
+        for(int i = 0; i < iStructTabSize; i++)
+        {
+            pDblIwOut->set(iworkSize + i, (double)iStructTab[i]);
+        }
+
+        out.push_back(pDblWOut);
+        out.push_back(pDblIwOut);
+    }
+
+// *** free. ***
+    if(itol == 1 || itol == 3) // atol is scalar
+    {
+        free(atol);
+    }
+
+    if(itol < 3) // rtol is scalar
+    {
+        free(rtol);
+    }
+
+    free(pdYData);
+    free(YSize);
+    free(rwork);
+    free(iwork);
+
+    if(dStructTab)
+    {
+        free(dStructTab);
+    }
+
+    if(iStructTab)
+    {
+        free(iStructTab);
+    }
+
+    DifferentialEquation::removeDifferentialEquationFunctions();
+
+    return types::Function::OK;
+}
+
diff --git a/scilab/modules/differential_equations/sci_gateway/cpp/sci_int2d.cpp b/scilab/modules/differential_equations/sci_gateway/cpp/sci_int2d.cpp
new file mode 100644 (file)
index 0000000..cc9d9b4
--- /dev/null
@@ -0,0 +1,296 @@
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) 2011 - DIGITEO - Cedric DELAMARRE
+*
+* 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-en.txt
+*
+*/
+/*--------------------------------------------------------------------------*/
+
+#include "differential_equations_gw.hxx"
+#include "function.hxx"
+#include "double.hxx"
+#include "string.hxx"
+#include "list.hxx"
+#include "callable.hxx"
+#include "differentialequationfunctions.hxx"
+
+extern "C"
+{
+#include "localization.h"
+#include "Scierror.h"
+#include "scifunctions.h"
+#include "sci_warning.h"
+#include "sciprint.h"
+}
+
+/*--------------------------------------------------------------------------*/
+types::Function::ReturnValue sci_int2d(types::typed_list &in, int _iRetCount, types::typed_list &out)
+{
+    //input
+    types::Double* pDblX        = NULL;
+    types::Double* pDblY        = NULL;
+    types::Double* pDblParams   = NULL;
+
+    double tol   = 1.0e-10;
+    int iclose   = 1;
+    int maxtri   = 50;
+    int mevals   = 4000;
+    int iflag    = 1;
+
+    // output
+    double result   = 0;
+    double err      = 0;
+    int nevals      = 0;
+    int nu          = 0;
+    int nd          = 0;
+
+// *** check the minimal number of input args. ***
+    if(in.size() < 3 || in.size() > 4)
+    {
+        ScierrorW(77, _W("%ls: Wrong number of input argument(s): %d to %d expected.\n"), L"int2d", 3, 4);
+        return types::Function::Error;
+    }
+
+// *** check number of output args according the methode. ***
+    if(_iRetCount > 3)
+    {
+        ScierrorW(78, _W("%ls: Wrong number of output argument(s): %d expected.\n"), L"int2d", 2);
+        return types::Function::Error;
+    }
+
+// *** check type of input args and get it. ***
+    // X
+    if(in[0]->isDouble() == false)
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A real matrix expected.\n"), L"int2d", 1);
+        return types::Function::Error;
+    }
+    pDblX = in[0]->getAs<types::Double>();//->clone()->getAs<types::Double>();
+    if(pDblX->isComplex())
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A real matrix expected.\n"), L"int2d", 1);
+        return types::Function::Error;
+    }
+
+    if(pDblX->getRows() != 3)
+    {
+        ScierrorW(999, _W("%ls: Wrong size for input argument #%d : A 3 by N matrix expected.\n"), L"int2d", 1);
+        return types::Function::Error;
+    }
+
+    // Y
+    if(in[1]->isDouble() == false)
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A real matrix expected.\n"), L"int2d", 2);
+        return types::Function::Error;
+    }
+    pDblY = in[1]->getAs<types::Double>();//->clone()->getAs<types::Double>();
+    if(pDblY->isComplex())
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A real matrix expected.\n"), L"int2d", 2);
+        return types::Function::Error;
+    }
+
+    if(pDblY->getRows() != 3)
+    {
+        ScierrorW(999, _W("%ls: Wrong size for input argument #%d : A 3 by N matrix expected.\n"), L"int2d", 2);
+        return types::Function::Error;
+    }
+
+    if(pDblY->getCols() != pDblX->getCols())
+    {
+        ScierrorW(999, _W("%ls: Wrong size for input argument #%d : Same size of input argument %d expected.\n"), L"int2d", 2, 1);
+        return types::Function::Error;
+    }
+
+
+    // function
+    DifferentialEquationFunctions* deFunctionsManager = new DifferentialEquationFunctions(L"int2d");
+    DifferentialEquation::addDifferentialEquationFunctions(deFunctionsManager);
+
+    if(in[2]->isCallable())
+    {
+        types::Callable* pCall = in[2]->getAs<types::Callable>();
+        deFunctionsManager->setFFunction(pCall);
+
+        // check function
+        double x = 1;
+        double y = 1;
+        double ret = int2d_f(&x, &y);
+        if(ret == 0)
+        {
+            ScierrorW(50,_W("%ls: Argument #%d : Variable returned by scilab argument function is incorrect.\n"), L"int2d", 3);
+            DifferentialEquation::removeDifferentialEquationFunctions();
+            return types::Function::Error;
+        }
+    }
+    else if(in[2]->isString())
+    {
+        bool bOK = false;
+        types::String* pStr = in[2]->getAs<types::String>();
+        bOK = deFunctionsManager->setFFunction(pStr);
+
+        if(bOK == false)
+        {
+            ScierrorW(50,_W("%ls: Subroutine not found: %ls\n"), L"int2d", pStr->get(0));
+            DifferentialEquation::removeDifferentialEquationFunctions();
+            return types::Function::Error;
+        }
+    }
+    else if(in[2]->isList())
+    {
+        types::List* pList = in[2]->getAs<types::List>();
+
+        if(pList->getSize() == 0)
+        {
+            ScierrorW(50,_W("%ls: Argument #%d : Subroutine not found in list: %ls\n"), L"int2d", 3, L"(string empty)");
+            DifferentialEquation::removeDifferentialEquationFunctions();
+            return types::Function::Error;
+        }
+
+        if(pList->get(0)->isCallable())
+        {
+            deFunctionsManager->setFFunction(pList->get(0)->getAs<types::Callable>());
+            for(int iter = 1; iter < pList->getSize(); iter++)
+            {
+                deFunctionsManager->setFArgs(pList->get(iter)->getAs<types::InternalType>());
+            }
+        }
+        else
+        {
+            ScierrorW(999, _W("%ls: Wrong type for input argument #%d : The first argument in the list must be a Scilab function.\n"), L"int2d", 3);
+            DifferentialEquation::removeDifferentialEquationFunctions();
+            return types::Function::Error;
+        }
+    }
+    else
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A function expected.\n"), L"int2d", 3);
+        DifferentialEquation::removeDifferentialEquationFunctions();
+        return types::Function::Error;
+    }
+
+    // params (optional)
+    if(in.size() == 4)
+    {
+        if(in[3]->isDouble() == false)
+        {
+            ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A real matrix expected.\n"), L"int2d", 4);
+            DifferentialEquation::removeDifferentialEquationFunctions();
+            return types::Function::Error;
+        }
+
+        pDblParams = in[3]->getAs<types::Double>();
+        if(pDblParams->isComplex())
+        {
+            ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A real matrix expected.\n"), L"int2d", 4);
+            DifferentialEquation::removeDifferentialEquationFunctions();
+            return types::Function::Error;
+        }
+
+        if(pDblParams->getSize() != 5)
+        {
+            ScierrorW(999, _W("%ls: Wrong size for input argument #%d : %d expected.\n"), L"int2d", 4, 5);
+            DifferentialEquation::removeDifferentialEquationFunctions();
+            return types::Function::Error;
+        }
+
+        if(getWarningMode())
+        {
+            if(pDblParams->get(0) < 0.0e0)
+            {
+                sciprintW(_W("%ls: Warning : Wrong value for the first element of argument #%d : The default value will be used.\n"),L"int2d", 4);
+            }
+
+            if(pDblParams->get(2) < 1)
+            {
+                sciprintW(_W("%ls: Warning : Wrong value for the third element of argument #%d : The default value will be used.\n"),L"int2d", 4);
+            }
+
+            if(pDblParams->get(3) < 1)
+            {
+                sciprintW(_W("%ls: Warning : Wrong value for the fourth element of argument #%d : The default value will be used.\n"),L"int2d", 4);
+            }
+        }
+
+        tol      = pDblParams->get(0) < 0.0e0 ? tol : pDblParams->get(0);
+        iclose   = (int)pDblParams->get(1);
+        maxtri   = pDblParams->get(2) < 1 ? maxtri : (int)pDblParams->get(2);
+        mevals   = pDblParams->get(3) < 1 ? mevals : (int)pDblParams->get(3);
+        iflag    = (int)pDblParams->get(4);
+    }
+
+// *** Perform operation. ***
+    int size = pDblX->getCols();
+
+    double* dwork   = (double*)malloc(9 * maxtri * sizeof(double));
+    int* iwork      = (int*)malloc(2 * maxtri * sizeof(int));
+
+    C2F(twodq)(int2d_f, &size, pDblX->get(), pDblY->get(), &tol, &iclose, &maxtri, &mevals, &result, &err, &nu, &nd, &nevals, &iflag, dwork, iwork);
+
+    free(dwork);
+    free(iwork);
+    DifferentialEquation::removeDifferentialEquationFunctions();
+
+    if(iflag)
+    {
+        switch(iflag)
+        {
+            case 1 :
+            {
+                ScierrorW(999, _W("%ls: Means termination for lack of space to divide another triangle.\n"), L"int2d");
+                break;
+            }
+            case 2 :
+            {
+                ScierrorW(999, _W("%ls: Means termination because of roundoff noise.\n"), L"int2d");
+                break;
+            }
+            case 3 :
+            {
+                ScierrorW(999, _W("%ls: means termination with relative error <= 5.0* machine epsilon.\n"), L"int2d");
+                break;
+            }
+            case 4 :
+            {
+                ScierrorW(999, _W("%ls: Means termination because the number of function evaluations has exceeded MEVALS.\n"), L"int2d");
+                break;
+            }
+            case 9 :
+            {
+                ScierrorW(999, _W("%ls: Means termination because of error in input flag.\n"), L"int2d");
+                break;
+            }
+            default :// normaly nerver call.
+            {
+                ScierrorW(999, _W("%ls: twodq return with error %d.\n"), L"int2d", iflag);
+            }
+        }
+        return types::Function::Error;
+    }
+
+// *** Return result in Scilab. ***
+    types::Double* pDblOut = new types::Double(result);
+    out.push_back(pDblOut);
+
+    if(_iRetCount > 1)
+    {
+        types::Double* pDblErrOut = new types::Double(err);
+        out.push_back(pDblErrOut);
+    }
+
+    if(_iRetCount == 3)
+    {
+        types::Double* pDblNevalsOut = new types::Double((double)nevals);
+        out.push_back(pDblNevalsOut);
+    }
+
+    return types::Function::OK;
+}
+/*--------------------------------------------------------------------------*/
+
diff --git a/scilab/modules/differential_equations/sci_gateway/cpp/sci_int3d.cpp b/scilab/modules/differential_equations/sci_gateway/cpp/sci_int3d.cpp
new file mode 100644 (file)
index 0000000..de3d682
--- /dev/null
@@ -0,0 +1,379 @@
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) 2011 - DIGITEO - Cedric DELAMARRE
+*
+* 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-en.txt
+*
+*/
+/*--------------------------------------------------------------------------*/
+
+#include "differential_equations_gw.hxx"
+#include "function.hxx"
+#include "double.hxx"
+#include "string.hxx"
+#include "list.hxx"
+#include "callable.hxx"
+#include "differentialequationfunctions.hxx"
+
+extern "C"
+{
+#include "elem_common.h"
+#include "localization.h"
+#include "Scierror.h"
+#include "scifunctions.h"
+#include "sci_warning.h"
+#include "sciprint.h"
+}
+
+/*--------------------------------------------------------------------------*/
+types::Function::ReturnValue sci_int3d(types::typed_list &in, int _iRetCount, types::typed_list &out)
+{
+    //input
+    types::Double* pDblX = NULL;
+    types::Double* pDblY = NULL;
+    types::Double* pDblZ = NULL;
+
+    int nf          = 1;
+    int minpts      = 0;
+    int maxpts      = 1000;
+    double epsabs   = 0.0;
+    double epsrel   = 1.0e-5;
+    int irestar     = 0;
+
+    // output
+    int ifail = 0;
+    int nevals = 0;
+
+// *** check the minimal number of input args. ***
+    if(in.size() < 4 || in.size() > 6)
+    {
+        ScierrorW(77, _W("%ls: Wrong number of input argument(s): %d to %d expected.\n"), L"int3d", 4, 6);
+        return types::Function::Error;
+    }
+
+// *** check number of output args according the methode. ***
+    if(_iRetCount > 3)
+    {
+        ScierrorW(78, _W("%ls: Wrong number of output argument(s): %d expected.\n"), L"int3d", 2);
+        return types::Function::Error;
+    }
+
+// *** check type of input args and get it. ***
+    // X
+    if(in[0]->isDouble() == false)
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A real matrix expected.\n"), L"int3d", 1);
+        return types::Function::Error;
+    }
+    pDblX = in[0]->getAs<types::Double>();
+    if(pDblX->isComplex())
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A real matrix expected.\n"), L"int3d", 1);
+        return types::Function::Error;
+    }
+
+    if(pDblX->getRows() != 4)
+    {
+        ScierrorW(999, _W("%ls: Wrong size for input argument #%d : A 4 by N matrix expected.\n"), L"int3d", 1);
+        return types::Function::Error;
+    }
+
+    // Y
+    if(in[1]->isDouble() == false)
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A real matrix expected.\n"), L"int3d", 2);
+        return types::Function::Error;
+    }
+    pDblY = in[1]->getAs<types::Double>();
+    if(pDblY->isComplex())
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A real matrix expected.\n"), L"int3d", 2);
+        return types::Function::Error;
+    }
+
+    if(pDblY->getRows() != 4)
+    {
+        ScierrorW(999, _W("%ls: Wrong size for input argument #%d : A 4 by N matrix expected.\n"), L"int3d", 2);
+        return types::Function::Error;
+    }
+
+    if(pDblY->getCols() != pDblX->getCols())
+    {
+        ScierrorW(999, _W("%ls: Wrong size for input argument #%d : Same size of input argument %d expected.\n"), L"int3d", 2, 1);
+        return types::Function::Error;
+    }
+
+    // Z
+    if(in[2]->isDouble() == false)
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A real matrix expected.\n"), L"int3d", 3);
+        return types::Function::Error;
+    }
+    pDblZ = in[2]->getAs<types::Double>();
+    if(pDblZ->isComplex())
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A real matrix expected.\n"), L"int3d", 3);
+        return types::Function::Error;
+    }
+
+    if(pDblZ->getRows() != 4)
+    {
+        ScierrorW(999, _W("%ls: Wrong size for input argument #%d : A 4 by N matrix expected.\n"), L"int3d", 4);
+        return types::Function::Error;
+    }
+
+    if(pDblZ->getCols() != pDblX->getCols())
+    {
+        ScierrorW(999, _W("%ls: Wrong size for input argument #%d : Same size of input argument %d expected.\n"), L"int3d", 3, 1);
+        return types::Function::Error;
+    }
+
+    // function
+    DifferentialEquationFunctions* deFunctionsManager = new DifferentialEquationFunctions(L"int3d");
+    DifferentialEquation::addDifferentialEquationFunctions(deFunctionsManager);
+
+    if(in[3]->isCallable())
+    {
+        types::Callable* pCall = in[3]->getAs<types::Callable>();
+        deFunctionsManager->setFFunction(pCall);
+
+        // check function
+        double xyz[3] = {1,1,1};
+        int numfun = 1;
+        double out;
+        double ret = int3d_f(xyz, &numfun, &out);
+        if(ret == 0)
+        {
+            ScierrorW(50,_W("%ls: Argument #%d : Variable returned by scilab argument function is incorrect.\n"), L"int3d", 4);
+            DifferentialEquation::removeDifferentialEquationFunctions();
+            return types::Function::Error;
+        }
+    }
+    else if(in[3]->isString())
+    {
+        bool bOK = false;
+        types::String* pStr = in[3]->getAs<types::String>();
+        bOK = deFunctionsManager->setFFunction(pStr);
+
+        if(bOK == false)
+        {
+            ScierrorW(50,_W("%ls: Subroutine not found: %ls\n"), L"int3d", pStr->get(0));
+            DifferentialEquation::removeDifferentialEquationFunctions();
+            return types::Function::Error;
+        }
+    }
+    else if(in[3]->isList())
+    {
+        types::List* pList = in[3]->getAs<types::List>();
+
+        if(pList->getSize() == 0)
+        {
+            ScierrorW(50,_W("%ls: Argument #%d : Subroutine not found in list: %ls\n"), L"int3d", 4, L"(string empty)");
+            DifferentialEquation::removeDifferentialEquationFunctions();
+            return types::Function::Error;
+        }
+
+        if(pList->get(0)->isCallable())
+        {
+            deFunctionsManager->setFFunction(pList->get(0)->getAs<types::Callable>());
+            for(int iter = 1; iter < pList->getSize(); iter++)
+            {
+                deFunctionsManager->setFArgs(pList->get(iter)->getAs<types::InternalType>());
+            }
+        }
+        else
+        {
+            ScierrorW(999, _W("%ls: Wrong type for input argument #%d : The first argument in the list must be a Scilab function.\n"), L"int3d", 4);
+            DifferentialEquation::removeDifferentialEquationFunctions();
+            return types::Function::Error;
+        }
+    }
+    else
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A function expected.\n"), L"int3d", 4);
+        DifferentialEquation::removeDifferentialEquationFunctions();
+        return types::Function::Error;
+    }
+
+    // nf (optional)
+    if(in.size() > 4)
+    {
+        if(in[4]->isDouble() == false)
+        {
+            ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A real matrix expected.\n"), L"int3d", 5);
+            DifferentialEquation::removeDifferentialEquationFunctions();
+            return types::Function::Error;
+        }
+        types::Double* pDblNf = in[4]->getAs<types::Double>();
+        if(pDblNf->isComplex())
+        {
+            ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A real matrix expected.\n"), L"int3d", 5);
+            DifferentialEquation::removeDifferentialEquationFunctions();
+            return types::Function::Error;
+        }
+
+        if(pDblNf->isScalar() == false)
+        {
+            ScierrorW(999, _W("%ls: Wrong size for input argument #%d : A scalar expected.\n"), L"int3d", 5);
+            DifferentialEquation::removeDifferentialEquationFunctions();
+            return types::Function::Error;
+        }
+        nf = (int)pDblNf->get(0);
+
+        if(nf < 1)
+        {
+            ScierrorW(999, _W("%ls: Wrong value for input argument #%d : A positive value expected.\n"), L"int3d", 5);
+            DifferentialEquation::removeDifferentialEquationFunctions();
+            return types::Function::Error;
+        }
+    }
+
+    // params (optional)
+    if(in.size() == 6)
+    {
+        if(in[5]->isDouble() == false)
+        {
+            ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A real matrix expected.\n"), L"int3d", 6);
+            DifferentialEquation::removeDifferentialEquationFunctions();
+            return types::Function::Error;
+        }
+
+        types::Double* pDblParams = in[5]->getAs<types::Double>();
+        if(pDblParams->isComplex())
+        {
+            ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A real matrix expected.\n"), L"int3d", 6);
+            DifferentialEquation::removeDifferentialEquationFunctions();
+            return types::Function::Error;
+        }
+
+        if(pDblParams->getSize() != 4)
+        {
+            ScierrorW(999, _W("%ls: Wrong size for input argument #%d : %d expected.\n"), L"int3d", 6, 4);
+            DifferentialEquation::removeDifferentialEquationFunctions();
+            return types::Function::Error;
+        }
+
+        if(getWarningMode())
+        {
+            for(int i = 0; i < 4; i++)
+            {
+                if(pDblParams->get(i) < 0)
+                {
+                    sciprintW(_W("%ls: Warning : Wrong value for the element %d of argument #%d : The default value will be used.\n"),L"int3d", i+1, 6);
+                }
+            }
+        }
+
+        minpts = pDblParams->get(0) < 0 ? minpts : (int)pDblParams->get(0);
+        maxpts = pDblParams->get(1) < 0 ? maxpts : (int)pDblParams->get(1);
+        epsabs = pDblParams->get(2) < 0.0 ? epsabs : pDblParams->get(2);
+        epsrel = pDblParams->get(3) < 0.0 ? epsrel : pDblParams->get(3);
+
+        if(pDblParams->get(2) == 0.0 && pDblParams->get(3) == 0.0)
+        {
+            if(getWarningMode())
+            {
+                sciprintW(_W("%ls: Warning : Wrong value for the element %d and %d of argument #%d : The default value will be used.\n"),L"int3d", 3, 4, 6);
+            }
+            epsabs = 0.0;
+            epsrel = 1.0e-5;
+        }
+
+        if(minpts > maxpts)
+        {
+            ScierrorW(999, _W("%ls: Wrong value for input argument #%d : minpts smaller than maxpts expected.\n"), L"int3d", 6);
+            DifferentialEquation::removeDifferentialEquationFunctions();
+            return types::Function::Error;
+        }
+    }
+
+    maxpts = Max(maxpts, 43 * pDblX->getCols());
+
+// *** Perform operation. ***
+    int one     = 1;
+    int three   = 3;
+    int maxsub  = 7 * (maxpts - 43 * pDblX->getCols()) / (8 * 43) + pDblX->getCols();
+    int size    = 4 * pDblX->getCols();
+
+    // input data : 3 rows, 4*maxsub cols
+    int dataSize = 3 * 4 * maxsub;
+    double* pdData = (double*)malloc(dataSize * sizeof(double));
+    C2F(dcopy)(&size, pDblX->get(), &one, pdData, &three);
+    C2F(dcopy)(&size, pDblY->get(), &one, pdData + 1, &three);
+    C2F(dcopy)(&size, pDblZ->get(), &one, pdData + 2, &three);
+
+    // output result
+    double* pdResult = (double*)malloc(nf * sizeof(double));
+
+    // output err
+    double* pdErr = (double*)malloc(nf * sizeof(double));
+
+    // workspace
+    int mdiv = 1; // default value, but can be changed on parallel computers. (see dcutet.f)
+    int dworkSize   = maxsub * (2 * nf + 1) + 7 * Max(8 * mdiv, pDblX->getCols()) * nf + 1;
+    int iworkSize   = maxsub + mdiv;
+    double* dwork   = (double*)malloc(dworkSize * sizeof(double));
+    int* iwork      = (int*)malloc(iworkSize * sizeof(int));
+
+    int cols = pDblX->getCols();
+    C2F(dcutet)(int3d_f, &nf, pdData, &cols, &minpts, &maxpts, &epsabs, &epsrel, &maxsub, &dworkSize, &irestar, pdResult, pdErr, &nevals, &ifail, dwork, iwork);
+
+    free(pdData);
+    free(dwork);
+    free(iwork);
+    DifferentialEquation::removeDifferentialEquationFunctions();
+
+    if(ifail)
+    {
+        if(ifail == 1)
+        {
+            if(getWarningMode())
+            {
+                sciprintW(_W("%ls: Warning : maxpts was too small to obtain the required accuracy.\n"),L"int3d");
+            }
+        }
+        else if(ifail == 3)
+        {
+            ScierrorW(999, _W("%ls: The volume of one of the initially given tetrahedrons is zero.\n"), L"int3d");
+            free(pdResult);
+            free(pdErr);
+            return types::Function::Error;
+        }
+        else // normaly nerver call.
+        {
+            ScierrorW(999, _W("%ls: dcutet return with error %d.\n"), L"int3d", ifail);
+            free(pdResult);
+            free(pdErr);
+            return types::Function::Error;
+        }
+    }
+
+// *** Return result in Scilab. ***
+    types::Double* pDblOut = new types::Double(nf, 1);
+    pDblOut->set(pdResult);
+    out.push_back(pDblOut);
+
+    if(_iRetCount > 1)
+    {
+        types::Double* pDblErrOut = new types::Double(nf, 1);
+        pDblErrOut->set(pdErr);
+        out.push_back(pDblErrOut);
+    }
+
+    if(_iRetCount == 3)
+    {
+        types::Double* pDblNevalsOut = new types::Double((double)nevals);
+        out.push_back(pDblNevalsOut);
+    }
+
+    free(pdResult);
+    free(pdErr);
+
+    return types::Function::OK;
+}
+/*--------------------------------------------------------------------------*/
+
diff --git a/scilab/modules/differential_equations/sci_gateway/cpp/sci_intg.cpp b/scilab/modules/differential_equations/sci_gateway/cpp/sci_intg.cpp
new file mode 100644 (file)
index 0000000..21b04c5
--- /dev/null
@@ -0,0 +1,273 @@
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) 2011 - DIGITEO - Cedric DELAMARRE
+*
+* 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-en.txt
+*
+*/
+/*--------------------------------------------------------------------------*/
+
+#include "differential_equations_gw.hxx"
+#include "function.hxx"
+#include "double.hxx"
+#include "string.hxx"
+#include "list.hxx"
+#include "callable.hxx"
+#include "differentialequationfunctions.hxx"
+
+extern "C"
+{
+#include "localization.h"
+#include "Scierror.h"
+#include "scifunctions.h"
+#include "sci_warning.h"
+#include "sciprint.h"
+}
+
+/*--------------------------------------------------------------------------*/
+types::Function::ReturnValue sci_intg(types::typed_list &in, int _iRetCount, types::typed_list &out)
+{
+    double pdA    = 0;
+    double pdB    = 0;
+    double pdEpsR = 1.0e-8;
+    double pdEpsA = 1.0e-14;
+
+    double result = 0;
+    double abserr = 0;
+
+// *** check the minimal number of input args. ***
+    if(in.size() < 3 || in.size() > 5)
+    {
+        ScierrorW(77, _W("%ls: Wrong number of input argument(s): %d expected.\n"), L"intg", 3);
+        return types::Function::Error;
+    }
+
+// *** check number of output args ***
+    if(_iRetCount > 2)
+    {
+        ScierrorW(78, _W("%ls: Wrong number of output argument(s): %d expected.\n"), L"intg", 2);
+        return types::Function::Error;
+    }
+
+// *** check type of input args and get it. ***
+    // A
+    if(in[0]->isDouble() == false)
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A matrix expected.\n"), L"intg", 1);
+        return types::Function::Error;
+    }
+
+    types::Double* pDblA = in[0]->getAs<types::Double>();
+
+    if(pDblA->isScalar() == false)
+    {
+        ScierrorW(999, _W("%ls: Wrong size for input argument #%d : A scalar expected.\n"), L"intg", 1);
+        return types::Function::Error;
+    }
+
+    pdA = pDblA->get(0);
+
+    // B
+    if(in[1]->isDouble() == false)
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A matrix expected.\n"), L"intg", 2);
+        return types::Function::Error;
+    }
+
+    types::Double* pDblB = in[1]->getAs<types::Double>();
+
+    if(pDblB->isScalar() == false)
+    {
+        ScierrorW(999, _W("%ls: Wrong size for input argument #%d : A scalar expected.\n"), L"intg", 2);
+        return types::Function::Error;
+    }
+
+    pdB = pDblB->get(0);
+
+    // function
+    DifferentialEquationFunctions* deFunctionsManager = new DifferentialEquationFunctions(L"intg");
+    DifferentialEquation::addDifferentialEquationFunctions(deFunctionsManager);
+
+    if(in[2]->isCallable())
+    {
+        types::Callable* pCall = in[2]->getAs<types::Callable>();
+        deFunctionsManager->setFFunction(pCall);
+
+        // check function
+        double t = 1;
+        double ret = intg_f(&t);
+        if(ret == 0)
+        {
+            ScierrorW(50,_W("%ls: Argument #%d : Variable returned by scilab argument function is incorrect.\n"), L"intg", 3);
+            DifferentialEquation::removeDifferentialEquationFunctions();
+            return types::Function::Error;
+        }
+    }
+    else if(in[2]->isString())
+    {
+        bool bOK = false;
+        types::String* pStr = in[2]->getAs<types::String>();
+        bOK = deFunctionsManager->setFFunction(pStr);
+
+        if(bOK == false)
+        {
+            ScierrorW(50,_W("%ls: Subroutine not found: %ls\n"), L"intg", pStr->get(0));
+            DifferentialEquation::removeDifferentialEquationFunctions();
+            return types::Function::Error;
+        }
+    }
+    else if(in[2]->isList())
+    {
+        types::List* pList = in[2]->getAs<types::List>();
+
+        if(pList->getSize() == 0)
+        {
+            ScierrorW(50,_W("%ls: Argument #%d : Subroutine not found in list: %ls\n"), L"intg", 3, L"(string empty)");
+            DifferentialEquation::removeDifferentialEquationFunctions();
+            return types::Function::Error;
+        }
+
+        if(pList->get(0)->isCallable())
+        {
+            deFunctionsManager->setFFunction(pList->get(0)->getAs<types::Callable>());
+            for(int iter = 1; iter < pList->getSize(); iter++)
+            {
+                deFunctionsManager->setFArgs(pList->get(iter)->getAs<types::InternalType>());
+            }
+        }
+        else
+        {
+            ScierrorW(999, _W("%ls: Wrong type for input argument #%d : The first argument in the list must be a Scilab function.\n"), L"intg", 3);
+            DifferentialEquation::removeDifferentialEquationFunctions();
+            return types::Function::Error;
+        }
+    }
+    else
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A function expected.\n"), L"intg", 3);
+        DifferentialEquation::removeDifferentialEquationFunctions();
+        return types::Function::Error;
+    }
+
+    if(in.size() > 3)
+    {
+        if(in[3]->isDouble() == false)
+        {
+            ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A matrix expected.\n"), L"intg", 4);
+            DifferentialEquation::removeDifferentialEquationFunctions();
+            return types::Function::Error;
+        }
+
+        types::Double* pDblEpsR = in[3]->getAs<types::Double>();
+
+        if(pDblEpsR->isScalar() == false)
+        {
+            ScierrorW(999, _W("%ls: Wrong size for input argument #%d : A scalar expected.\n"), L"intg", 4);
+            DifferentialEquation::removeDifferentialEquationFunctions();
+            return types::Function::Error;
+        }
+
+        pdEpsR = pDblEpsR->get(0);
+    }
+
+    if(in.size() == 5)
+    {
+        if(in[4]->isDouble() == false)
+        {
+            ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A matrix expected.\n"), L"intg", 5);
+            DifferentialEquation::removeDifferentialEquationFunctions();
+            return types::Function::Error;
+        }
+
+        types::Double* pDblEpsA = in[4]->getAs<types::Double>();
+
+        if(pDblEpsA->isScalar() == false)
+        {
+            ScierrorW(999, _W("%ls: Wrong size for input argument #%d : A scalar expected.\n"), L"intg", 5);
+            DifferentialEquation::removeDifferentialEquationFunctions();
+            return types::Function::Error;
+        }
+        pdEpsA = pDblEpsA->get(0);
+    }
+
+// *** Create working table. ***
+    int limit = 750;
+
+    // rwork
+    double* alist   = (double*)malloc(limit * sizeof(double));
+    double* blist   = (double*)malloc(limit * sizeof(double));
+    double* elist   = (double*)malloc(limit * sizeof(double));
+    double* rlist   = (double*)malloc(limit * sizeof(double));
+
+    int* iwork      = (int*)malloc(limit * sizeof(int));
+
+    double epsabs   = fabs(pdEpsA);
+    double epsrel   = fabs(pdEpsR);
+
+// *** Perform operation. ***
+    int ier = 0;
+    C2F(dqags)(intg_f, &pdA, &pdB, &epsabs, &epsrel, alist, blist, elist, rlist, &limit, iwork, &limit, &result, &abserr, &ier);
+
+    free(alist);
+    free(blist);
+    free(elist);
+    free(rlist);
+    free(iwork);
+    DifferentialEquation::removeDifferentialEquationFunctions();
+
+    if(ier)
+    {
+        switch(ier)
+        {
+            case 1 :
+            {
+                ScierrorW(999, _W("%ls: Maximum number of subdivisions allowed has been achieved.\n"), L"intg");
+                return types::Function::Error;
+            }
+            case 2 :
+            {
+                if(getWarningMode())
+                {
+                    sciprintW(_W("%ls: Warning : The occurrence of roundoff error is detected, which prevents the requested tolerance from being achieved. The error may be under-estimated.\n"),L"intg");
+                }
+                break;
+            }
+            case 3 :
+            {
+                ScierrorW(999, _W("%ls: Extremely bad integrand behaviour occurs at some points of the integration interval.\n"), L"intg");
+                return types::Function::Error;
+            }
+            case 4 :
+            {
+                if(getWarningMode())
+                {
+                    sciprintW(_W("%ls: Warning : The algorithm does not converge. Roundoff error is detected in the extrapolation table. It is presumed that the requested tolerance cannot be achieved, and that the returned result is the best which can be obtained.\n"),L"intg");
+                }
+                break;
+            }
+            case 5 :
+            {
+                ScierrorW(999, _W("%ls: The integral is probably divergent, or slowly convergent.\n"), L"intg");
+                return types::Function::Error;
+            }
+        }
+    }
+
+// *** Return result in Scilab. ***
+    types::Double* pDblOut = new types::Double(result);
+    out.push_back(pDblOut);
+
+    if(_iRetCount == 2)
+    {
+        types::Double* pDblErrOut = new types::Double(abserr);
+        out.push_back(pDblErrOut);
+    }
+
+    return types::Function::OK;
+}
+/*--------------------------------------------------------------------------*/
+
diff --git a/scilab/modules/differential_equations/sci_gateway/cpp/sci_intg2.cpp b/scilab/modules/differential_equations/sci_gateway/cpp/sci_intg2.cpp
new file mode 100644 (file)
index 0000000..7d4bf21
--- /dev/null
@@ -0,0 +1,306 @@
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) 2011 - DIGITEO - Cedric DELAMARRE
+*
+* 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-en.txt
+*
+*/
+/*--------------------------------------------------------------------------*/
+
+#include "differential_equations_gw.hxx"
+#include "function.hxx"
+#include "double.hxx"
+#include "overload.hxx"
+#include "execvisitor.hxx"
+#include "callable.hxx"
+
+extern "C"
+{
+#include "localization.h"
+#include "Scierror.h"
+#include "scifunctions.h"
+#include "sci_warning.h"
+#include "sciprint.h"
+}
+
+/*--------------------------------------------------------------------------*/
+types::Function::ReturnValue sci_intg(types::typed_list &in, int _iRetCount, types::typed_list &out)
+{
+    double pdA    = 0;
+    double pdB    = 0;
+    double pdEpsR = 1.0e-8;
+    double pdEpsA = 1.0e-14;
+
+    double result = 0;
+    double abserr = 0;
+
+    DifferentialEquationFunctions* deFunctionsManager = new DifferentialEquationFunctions(L"intg");
+    ConfigVariable::addDifferentialEquationFunctions(deFunctionsManager);
+
+// *** check the minimal number of input args. ***
+    if(in.size() < 3 || in.size() > 5)
+    {
+        ScierrorW(77, _W("%ls: Wrong number of input argument(s): %d expected.\n"), L"intg", 3);
+        return types::Function::Error;
+    }
+
+// *** check number of output args ***
+    if(_iRetCount > 2)
+    {
+        ScierrorW(78, _W("%ls: Wrong number of output argument(s): %d expected.\n"), L"intg", 2);
+        return types::Function::Error;
+    }
+
+// *** check type of input args and get it. ***
+    // A
+    if(in[0]->isDouble() == false)
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A matrix expected.\n"), L"intg", 1);
+        return types::Function::Error;
+    }
+
+    types::Double* pDblA = in[0]->getAs<types::Double>();
+
+    if(pDblA->isScalar() == false)
+    {
+        ScierrorW(999, _W("%ls: Wrong size for input argument #%d : A scalar expected.\n"), L"intg", 1);
+        return types::Function::Error;
+    }
+
+    pdA = pDblA->get(0);
+
+    // B
+    if(in[1]->isDouble() == false)
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A matrix expected.\n"), L"intg", 2);
+        return types::Function::Error;
+    }
+
+    types::Double* pDblB = in[1]->getAs<types::Double>();
+
+    if(pDblB->isScalar() == false)
+    {
+        ScierrorW(999, _W("%ls: Wrong size for input argument #%d : A scalar expected.\n"), L"intg", 2);
+        return types::Function::Error;
+    }
+
+    pdB = pDblB->get(0);
+
+    // function
+    if(in[2]->isCallable())
+    {
+        types::Callable* pCall = in[2]->getAs<types::Callable>();
+        deFunctionsManager->setFFunction(pCall);
+
+    }
+    else if(in[2]->isString())
+    {
+        bool bOK = false;
+        types::String* pStr = in[2]->getAs<types::String>();
+        bOK = deFunctionsManager->setFFunction(pStr);
+
+        if(bOK == false)
+        {
+            ScierrorW(50,_W("%ls: Subroutine not found: %ls\n"), L"intg", pStr->get(0));
+            return types::Function::Error;
+        }
+    }
+/*    else if(in[2]->isList())
+    {
+        types::List* pList = in[2]->getAs<types::List>();
+
+        if(pList->getSize() == 0)
+        {
+            ScierrorW(50,_W("%ls: Argument #%d : Subroutine not found in list: %ls\n"), L"intg", 3, L"(string empty)");
+            return types::Function::Error;
+        }
+
+        if(pList->get(0)->isString())
+        {
+            bool bOK = false;
+            types::String* pStr = pList->get(0)->getAs<types::String>();
+            bOK = deFunctionsManager->setOdeFFunction(pStr);
+
+            if(bOK == false)
+            {
+                ScierrorW(50,_W("%ls: Argument #%d : Subroutine not found in list: %ls\n"), L"intg", 3, pStr->get(0));
+                return types::Function::Error;
+            }
+
+            // realloc YSize to store the arguments size
+            int totalSize = *YSize;
+            free(YSize);
+            YSize = (int*)malloc((pList->getSize() - 1) * sizeof(int));
+            YSize[0] = totalSize;
+
+            // get arguments and store their size in YSize
+            std::vector<types::Double*> vpDbl;
+            for(int iter = 0; iter < pList->getSize() - 1; iter++)
+            {
+                if(pList->get(iter + 1)->isDouble() == false)
+                {
+                    ScierrorW(999, _W("%ls: Wrong type for input argument #%d : Argument %d in the list must be a matrix.\n"), L"intg", 3, iter+1);
+                    return types::Function::Error;
+                }
+
+                vpDbl.push_back(pList->get(iter+1)->getAs<types::Double>());
+                YSize[iter + 1] = vpDbl[iter]->getSize();
+                totalSize += YSize[iter + 1];
+            }
+
+            // realloc Y to store arguments data in pdYData
+            double* pdYDataTemp = pdYData;
+            pdYData = (double*)malloc(totalSize * sizeof(double));
+            C2F(dcopy)(&YSize[0], pdYDataTemp, &one, pdYData, &one);
+            free(pdYDataTemp);
+
+            int position = YSize[0];
+            for(int iter = 0; iter < pList->getSize()-1; iter++)
+            {
+                C2F(dcopy)(&YSize[iter + 1], vpDbl[iter]->get(), &one, &pdYData[position], &one);
+                position += vpDbl[iter]->getSize();
+            }
+            vpDbl.clear();
+        }
+        else if(pList->get(0)->isCallable())
+        {
+            deFunctionsManager->setOdeFFunction(pList->get(0)->getAs<types::Callable>());
+            for(int iter = 1; iter < pList->getSize(); iter++)
+            {
+                deFunctionsManager->setOdeFArgs(pList->get(iter)->getAs<types::InternalType>());
+            }
+        }
+        else
+        {
+            ScierrorW(999, _W("%ls: Wrong type for input argument #%d : The first argument in the list must be a string or a function.\n"), L"intg", 3);
+            return types::Function::Error;
+        }
+    }
+*/
+    else
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A function expected.\n"), L"intg", 3);
+        return types::Function::Error;
+    }
+
+    if(in.size() > 3)
+    {
+        if(in[3]->isDouble() == false)
+        {
+            ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A matrix expected.\n"), L"intg", 4);
+            return types::Function::Error;
+        }
+
+        types::Double* pDblEpsR = in[3]->getAs<types::Double>();
+
+        if(pDblEpsR->isScalar() == false)
+        {
+            ScierrorW(999, _W("%ls: Wrong size for input argument #%d : A scalar expected.\n"), L"intg", 4);
+            return types::Function::Error;
+        }
+
+        pdEpsR = pDblEpsR->get(0);
+    }
+
+    if(in.size() == 5)
+    {
+        if(in[4]->isDouble() == false)
+        {
+            ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A matrix expected.\n"), L"intg", 5);
+            return types::Function::Error;
+        }
+
+        types::Double* pDblEpsA = in[4]->getAs<types::Double>();
+
+        if(pDblEpsA->isScalar() == false)
+        {
+            ScierrorW(999, _W("%ls: Wrong size for input argument #%d : A scalar expected.\n"), L"intg", 5);
+            return types::Function::Error;
+        }
+        pdEpsA = pDblEpsA->get(0);
+    }
+
+// *** Create working table. ***
+    int limit = 3000/4;
+    int workSize = 3000;
+    int iworkSize = (3000/8 + 2) * 2 + 1;
+
+    double* work = (double*)malloc(workSize * sizeof(double));
+    int* iwork = (int*)malloc(iworkSize * sizeof(int));
+    double epsabs = fabs(pdEpsA);
+    double epsrel = fabs(pdEpsR);
+
+// *** Perform operation. ***
+//C2F(dqag0)(intg_f, &pdA, &pdB, &pdEpsa, &pdEpsr, val, abserr, stk(lpal), lw, stk(lpali), liw, ifail);
+
+    double* alist = work;
+    double* blist = work  + limit;
+    double* elist = blist + limit;
+    double* rlist = elist + limit;
+
+    int ier = 0;
+
+    C2F(dqags)(intg_f, &pdA, &pdB, &epsabs, &epsrel, alist, blist, elist, rlist, &limit, iwork, &iworkSize, &result, &abserr, &ier);
+
+    if(ier)
+    {
+        switch(ier)
+        {
+            case 1 :
+            {
+                ScierrorW(999, _W("%ls: Maximum number of subdivisions allowed has been achieved.\n"), L"intg");
+                return types::Function::Error;
+            }
+            case 2 :
+            {
+                if(getWarningMode())
+                {
+                    sciprintW(_W("%ls: Warning : The occurrence of roundoff error is detected, which prevents the requested tolerance from being achieved. The error may be under-estimated.\n"),L"intg");
+                }
+                break;
+            }
+            case 3 :
+            {
+                ScierrorW(999, _W("%ls: Extremely bad integrand behaviour occurs at some points of the integration interval.\n"), L"intg");
+                return types::Function::Error;
+            }
+            case 4 :
+            {
+                if(getWarningMode())
+                {
+                    sciprintW(_W("%ls: Warning : The algorithm does not converge. Roundoff error is detected in the extrapolation table. It is presumed that the requested tolerance cannot be achieved, and that the returned result is the best which can be obtained.\n"),L"intg");
+                }
+                break;
+            }
+            case 5 :
+            {
+                ScierrorW(999, _W("%ls: The integral is probably divergent, or slowly convergent.\n"), L"intg");
+                return types::Function::Error;
+            }
+        }
+    }
+
+// *** Return result in Scilab. ***
+    types::Double* pDblOut = new types::Double(result);
+    out.push_back(pDblOut);
+
+    if(_iRetCount == 2)
+    {
+        types::Double* pDblErrOut = new types::Double(abserr);
+        out.push_back(pDblErrOut);
+    }
+
+// *** free. ***
+    free(work);
+    free(iwork);
+
+    ConfigVariable::removeDifferentialEquationFunctions();
+
+    return types::Function::OK;
+}
+/*--------------------------------------------------------------------------*/
+
diff --git a/scilab/modules/differential_equations/sci_gateway/cpp/sci_ode.cpp b/scilab/modules/differential_equations/sci_gateway/cpp/sci_ode.cpp
new file mode 100644 (file)
index 0000000..c6503a5
--- /dev/null
@@ -0,0 +1,1434 @@
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) 2011 - DIGITEO - Cedric DELAMARRE
+*
+* 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-en.txt
+*
+*/
+/*--------------------------------------------------------------------------*/
+
+#include "differential_equations_gw.hxx"
+#include "function.hxx"
+#include "double.hxx"
+#include "string.hxx"
+#include "list.hxx"
+#include "callable.hxx"
+#include "differentialequationfunctions.hxx"
+#include "runvisitor.hxx"
+
+extern "C"
+{
+#include "localization.h"
+#include "Scierror.h"
+#include "scifunctions.h"
+#include "elem_common.h"
+#include "sci_warning.h"
+#include "sciprint.h"
+#include "common_structure.h"
+#include "checkodeerror.h"
+}
+/*--------------------------------------------------------------------------*/
+
+types::Function::ReturnValue sci_ode(types::typed_list &in, int _iRetCount, types::typed_list &out)
+{
+    // Methode
+    types::String* pStrType     = NULL;
+    wchar_t* wcsType            = L"lsoda";
+    int meth                    = 0;
+
+    // y0
+//    types::Polynom* pPolyY0     = NULL;
+    types::Double* pDblY0       = NULL;
+    double* pdYData             = NULL; // contain y0 following by all args data in list case.
+    int sizeOfpdYData           = 0;
+
+    // Other input args
+    types::Double* pDblT0       = NULL;
+    types::Double* pDblT        = NULL;
+    types::Double* pDblRtol     = NULL;
+    types::Double* pDblAtol     = NULL;
+    types::Double* pDblNg       = NULL;
+    types::Double* pDblW        = NULL;
+    types::Double* pDblIw       = NULL;
+
+    // %ODEOPTIONS
+    types::Double* pDblOdeOptions = NULL;
+
+    // Result
+    types::Double* pDblYOut     = NULL;
+//    types::Double* pDblTOut     = NULL;
+//    types::Polynom* pPolyYOut   = NULL;
+
+    // Indicate if the function is given.
+    bool bFuncF     = false;
+    bool bFuncJac   = false;
+    bool bFuncG     = false;
+
+    int iPos        = 0; // Position in types::typed_list in
+
+    int sizeOfYSize = 1;
+    int* YSize      = NULL;    // YSize(1) = size of y0, 
+                               // YSize(n) = size of Args(n) in list case.
+
+    C2F(eh0001).mesflg = 1; // flag to control printing of error messages in lapack routine.
+                            // 1 means print, 0 means no printing.
+    C2F(eh0001).lunit = 6;  // 6 = stdout
+
+    int one = 1; // used in C2F(dcopy)
+
+    // For root methode
+    int* jroot = NULL;
+
+// *** check the minimal number of input args. ***
+    if(in.size() < 4)
+    {
+        ScierrorW(77, _W("%ls: Wrong number of input argument(s): %d expected.\n"), L"ode", 4);
+        return types::Function::Error;
+    }
+
+// *** Get the methode. ***
+    if(in[0]->isString())
+    {
+        pStrType = in[0]->getAs<types::String>();
+        wcsType = pStrType->get(0);
+        iPos++;
+    }
+
+    if(iPos)
+    {
+        if(wcscmp(wcsType, L"adams") == 0)
+        {
+            meth = 1;
+        }
+        else if(wcscmp(wcsType, L"stiff") == 0)
+        {
+            meth = 2;
+        }
+        else if(wcscmp(wcsType, L"root") == 0)
+        {
+            meth = 3;
+        }
+        else if(wcscmp(wcsType, L"discrete") == 0)
+        {
+            meth = 4;
+        }
+        else if(wcscmp(wcsType, L"rk") == 0)
+        {
+            meth = 5;
+        }
+        else if(wcscmp(wcsType, L"rkf") == 0)
+        {
+            meth = 6;
+        }
+        else if(wcscmp(wcsType, L"fix") == 0)
+        {
+            meth = 7;
+        }
+        else
+        {
+            ScierrorW(999, _W("%ls: Wrong value for input argument #%d : It must be one of the following strings : adams, stiff, rk, rkf, fix, root or discrete.\n"), L"ode", 1);
+            return types::Function::Error;
+        }
+    }
+
+// *** check number of output args according the methode. ***
+    if(meth < 3)
+    {
+        if(_iRetCount != 1 && _iRetCount != 3)
+        {
+            ScierrorW(78, _W("%ls: Wrong number of output argument(s): %d or %d expected.\n"), L"ode", 1, 3);
+            return types::Function::Error;
+        }
+    }
+    else if(meth == 3)
+    {
+        if(_iRetCount == 3 || _iRetCount > 4)
+        {
+            ScierrorW(78, _W("%ls: Wrong number of output argument(s): %d, %d or %d expected.\n"), L"ode", 1, 2, 4);
+            return types::Function::Error;
+        }
+    }
+    else // meth > 3
+    {
+        if(_iRetCount != 1)
+        {
+            ScierrorW(78, _W("%ls: Wrong number of output argument(s): %d expected.\n"), L"ode", 1);
+            return types::Function::Error;
+        }
+    }
+
+// *** check type of input args and get it. ***
+    // y0
+    if(in[iPos]->isDouble())
+    {
+        pDblY0 = in[iPos]->getAs<types::Double>();
+        if(pDblY0->isComplex())
+        {
+            ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A real matrix expected.\n"), L"ode", iPos+1);
+            return types::Function::Error;
+        }
+
+        if(pDblY0->getCols() != 1)
+        {
+            ScierrorW(999, _W("%ls: Wrong size for input argument #%d : A real colunm vector expected (n x 1).\n"), L"ode", iPos+1);
+            return types::Function::Error;
+        }
+    }
+/*
+    else if(in[iPos]->isPoly())
+    {
+        pPolyY0 = in[iPos]->getAs<types::Polynom>();
+        if(pPolyY0->isComplex())
+        {
+            ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A real polynom expected.\n"), L"ode", iPos+1);
+            return types::Function::Error;
+        }
+
+        if(pPolyY0->isScalar() == false)
+        {
+            ScierrorW(999, _W("%ls: Wrong size for input argument #%d : A real scalar polynom expected.\n"), L"ode", iPos+1);
+            return types::Function::Error;
+        }
+
+        double* dbl = (double*)malloc(pPolyY0->getCoef()->getSize() * sizeof(double));
+        vTransposeRealMatrix(   pPolyY0->getCoef()->get(),
+                                pPolyY0->getCoef()->getRows(),
+                                pPolyY0->getCoef()->getCols(),
+                                dbl);
+
+        pDblY0 = new types::Double(pPolyY0->getCoef()->getCols(), pPolyY0->getCoef()->getRows());
+        pDblY0->set(dbl);
+    }
+*/
+    else
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A matrix expected.\n"), L"ode", iPos+1);
+        return types::Function::Error;
+    }
+
+    // t0
+    iPos++;
+    if(in[iPos]->isDouble() == false)
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A scalar expected.\n"), L"ode", iPos+1);
+        return types::Function::Error;
+    }
+
+    pDblT0 = in[iPos]->getAs<types::Double>();
+
+    if(pDblT0->isScalar() == false)
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A scalar expected.\n"), L"ode", iPos+1);
+        return types::Function::Error;
+    }
+
+    // t
+    iPos++;
+    if(in[iPos]->isDouble() == false)
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A matrix expected.\n"), L"ode", iPos+1);
+        return types::Function::Error;
+    }
+
+    pDblT = in[iPos]->getAs<types::Double>();
+
+    // get next inputs
+    DifferentialEquationFunctions* deFunctionsManager = new DifferentialEquationFunctions(L"ode");
+    DifferentialEquation::addDifferentialEquationFunctions(deFunctionsManager);
+    deFunctionsManager->setOdeYRows(pDblY0->getRows());
+    deFunctionsManager->setOdeYCols(pDblY0->getCols());
+
+    YSize = (int*)malloc(sizeOfYSize * sizeof(int));
+    *YSize = pDblY0->getSize();
+    pdYData = (double*)malloc(pDblY0->getSize() * sizeof(double));
+    C2F(dcopy)(YSize, pDblY0->get(), &one, pdYData, &one);
+
+    if(meth == 4)
+    {
+        if(in.size() != 5)
+        {
+            ScierrorW(77, _W("%ls: Wrong number of input argument(s): %d expected.\n"), L"ode", 5);
+            DifferentialEquation::removeDifferentialEquationFunctions();
+            free(pdYData);free(YSize);
+            return types::Function::Error;
+        }
+
+        if(in[4]->isCallable() == false && in[4]->isString() == false && in[4]->isList() == false)
+        {
+                ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A function expected.\n"), L"ode", 5);
+                DifferentialEquation::removeDifferentialEquationFunctions();
+                free(pdYData);free(YSize);
+                return types::Function::Error;
+        }
+    }
+
+    for(iPos++; iPos < in.size(); iPos++)
+    {
+        if(in[iPos]->isDouble())
+        {
+            if(pDblRtol == NULL && bFuncF == false)
+            {
+                pDblRtol = in[iPos]->getAs<types::Double>();
+                if(pDblRtol->getSize() != pDblY0->getSize() && pDblRtol->isScalar() == false)
+                {
+                    ScierrorW(267,_W("%ls: Arg %d and arg %d must have equal dimensions.\n"), L"ode", pStrType ? 2 : 1, iPos+1);
+                    DifferentialEquation::removeDifferentialEquationFunctions();
+                    free(pdYData);free(YSize);
+                    return types::Function::Error;
+                }
+            }
+            else if(pDblAtol == NULL && bFuncF == false)
+            {
+                pDblAtol = in[iPos]->getAs<types::Double>();
+                if(pDblAtol->getSize() != pDblY0->getSize() && pDblAtol->isScalar() == false)
+                {
+                    ScierrorW(267,_W("%ls: Arg %d and arg %d must have equal dimensions.\n"), L"ode", pStrType ? 2 : 1, iPos+1);
+                    DifferentialEquation::removeDifferentialEquationFunctions();
+                    free(pdYData);free(YSize);
+                    return types::Function::Error;
+                }
+            }
+            else if(pDblNg == NULL && bFuncF == true && meth == 3)
+            {
+                pDblNg = in[iPos]->getAs<types::Double>();
+            }
+            else if(pDblW == NULL && bFuncF == true && (bFuncG == true || meth != 3))
+            {
+                if(in.size() == iPos + 2)
+                {
+                    if(in[iPos+1]->isDouble() == false)
+                    {
+                        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A matrix expected.\n"), L"ode", iPos+2);
+                        DifferentialEquation::removeDifferentialEquationFunctions();
+                        free(pdYData);free(YSize);
+                        return types::Function::Error;
+                    }
+
+                    pDblW = in[iPos]->getAs<types::Double>();
+                    pDblIw = in[iPos+1]->getAs<types::Double>();
+                    iPos++;
+                }
+                else
+                {
+                    ScierrorW(77, _W("%ls: Wrong number of input argument(s): %d expected.\n"), L"ode", iPos+2);
+                    DifferentialEquation::removeDifferentialEquationFunctions();
+                    free(pdYData);free(YSize);
+                    return types::Function::Error;
+                }
+            }
+            else
+            {
+                ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A function expected.\n"), L"ode", iPos+1);
+                DifferentialEquation::removeDifferentialEquationFunctions();
+                free(pdYData);free(YSize);
+                return types::Function::Error;
+            }
+        }
+        else if(in[iPos]->isCallable())
+        {
+            types::Callable* pCall = in[iPos]->getAs<types::Callable>();
+            if(bFuncF == false)
+            {
+                deFunctionsManager->setFFunction(pCall);
+                bFuncF = true;
+            }
+            else if(bFuncJac == false && (pDblNg == NULL || meth != 3))
+            {
+                deFunctionsManager->setJacFunction(pCall);
+                bFuncJac = true;
+            }
+            else if(bFuncG == false && meth == 3)
+            {
+                deFunctionsManager->setGFunction(pCall);
+                bFuncG = true;
+            }
+            else
+            {
+                ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A matrix expected.\n"), L"ode", iPos+1);
+                DifferentialEquation::removeDifferentialEquationFunctions();
+                free(pdYData);free(YSize);
+                return types::Function::Error;
+            }
+        }
+        else if(in[iPos]->isString())
+        {
+            types::String* pStr = in[iPos]->getAs<types::String>();
+            bool bOK = false;
+
+            if(bFuncF == false)
+            {
+                bOK = deFunctionsManager->setFFunction(pStr);
+                bFuncF = true;
+            }
+            else if(bFuncJac == false && (pDblNg == NULL || meth != 3))
+            {
+                bOK = deFunctionsManager->setJacFunction(pStr);
+                bFuncJac = true;
+            }
+            else if(bFuncG == false && meth == 3)
+            {
+                bOK = deFunctionsManager->setGFunction(pStr);
+                bFuncG = true;
+            }
+            else
+            {
+                ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A matrix expected.\n"), L"ode", iPos+1);
+                DifferentialEquation::removeDifferentialEquationFunctions();
+                free(pdYData);free(YSize);
+                return types::Function::Error;
+            }
+
+            if(bOK == false)
+            {
+                ScierrorW(50,_W("%ls: Subroutine not found: %ls\n"), L"ode", pStr->get(0));
+                DifferentialEquation::removeDifferentialEquationFunctions();
+                free(pdYData);free(YSize);
+                return types::Function::Error;
+            }
+        }
+        else if(in[iPos]->isList())
+        {
+            types::List* pList = in[iPos]->getAs<types::List>();
+
+            if(pList->getSize() == 0)
+            {
+                ScierrorW(50,_W("%ls: Argument #%d : Subroutine not found in list: %ls\n"), L"ode", iPos+1, L"(string empty)");
+                DifferentialEquation::removeDifferentialEquationFunctions();
+                free(pdYData);free(YSize);
+                return types::Function::Error;
+            }
+
+            if(bFuncF && (bFuncJac || pDblNg) && (bFuncG || meth != 3))
+            {
+                ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A matrix expected.\n"), L"ode", iPos+1);
+                DifferentialEquation::removeDifferentialEquationFunctions();
+                free(pdYData);free(YSize);
+                return types::Function::Error;
+            }
+
+            if(pList->get(0)->isString())
+            {
+                types::String* pStr = pList->get(0)->getAs<types::String>();
+                bool bOK = false;
+
+                if(bFuncF == false)
+                {
+                    bFuncF = true;
+                    bOK = deFunctionsManager->setFFunction(pStr);
+                    sizeOfpdYData = *YSize;
+                }
+                else if(bFuncJac == false && (pDblNg == NULL || meth != 3))
+                {
+                    bFuncJac = true;
+                    bOK = deFunctionsManager->setJacFunction(pStr);
+                    if(sizeOfpdYData == 0)
+                    {
+                        sizeOfpdYData = *YSize;
+                    }
+                }
+                else if(bFuncG == false && meth == 3)
+                {
+                    bFuncG = true;
+                    bOK = deFunctionsManager->setGFunction(pStr);
+                    if(sizeOfpdYData == 0)
+                    {
+                        sizeOfpdYData = *YSize;
+                    }
+                }
+
+                if(bOK == false)
+                {
+                    ScierrorW(50,_W("%ls: Argument #%d : Subroutine not found in list: %ls\n"), L"ode", iPos+1, pStr->get(0));
+                    DifferentialEquation::removeDifferentialEquationFunctions();
+                    free(pdYData);free(YSize);
+                    return types::Function::Error;
+                }
+
+                int* sizeTemp = YSize;
+                int totalSize = sizeOfpdYData;
+
+                YSize = (int*)malloc((sizeOfYSize + pList->getSize() - 1) * sizeof(int));
+                memcpy(YSize, sizeTemp, sizeOfYSize * sizeof(int));
+
+                std::vector<types::Double*> vpDbl;
+                for(int iter = 0; iter < pList->getSize() - 1; iter++)
+                {
+                    if(pList->get(iter + 1)->isDouble() == false)
+                    {
+                        ScierrorW(999, _W("%ls: Wrong type for input argument #%d : Argument %d in the list must be a matrix.\n"), L"ode", iPos+1, iter+1);
+                        DifferentialEquation::removeDifferentialEquationFunctions();
+                        free(pdYData);free(YSize);
+                        return types::Function::Error;
+                    }
+
+                    vpDbl.push_back(pList->get(iter+1)->getAs<types::Double>());
+                    YSize[sizeOfYSize + iter] = vpDbl[iter]->getSize();
+                    totalSize += YSize[sizeOfYSize + iter];
+                }
+
+                double* pdYDataTemp = pdYData;
+                pdYData = (double*)malloc(totalSize * sizeof(double));
+                C2F(dcopy)(&sizeOfpdYData, pdYDataTemp, &one, pdYData, &one);
+
+                int position = sizeOfpdYData;
+                for(int iter = 0; iter < pList->getSize()-1; iter++)
+                {
+                    C2F(dcopy)(&YSize[sizeOfYSize + iter], vpDbl[iter]->get(), &one, &pdYData[position], &one);
+                    position += vpDbl[iter]->getSize();
+                }
+                vpDbl.clear();
+                sizeOfpdYData = totalSize;
+                sizeOfYSize += pList->getSize() - 1;
+                free(pdYDataTemp);
+                free(sizeTemp);
+            }
+            else if(pList->get(0)->isCallable())
+            {
+                if(bFuncF == false)
+                {
+                    bFuncF = true;
+                    deFunctionsManager->setFFunction(pList->get(0)->getAs<types::Callable>());
+                    for(int iter = 1; iter < pList->getSize(); iter++)
+                    {
+                        deFunctionsManager->setFArgs(pList->get(iter)->getAs<types::InternalType>());
+                    }
+                }
+                else if(bFuncJac == false && (pDblNg == NULL || meth != 3))
+                {
+                    bFuncJac = true;
+                    deFunctionsManager->setJacFunction(pList->get(0)->getAs<types::Callable>());
+                    for(int iter = 1; iter < pList->getSize(); iter++)
+                    {
+                        deFunctionsManager->setJacArgs(pList->get(iter)->getAs<types::InternalType>());
+                    }
+                }
+                else if(bFuncG == false && meth == 3)
+                {
+                    bFuncG = true;
+                    deFunctionsManager->setGFunction(pList->get(0)->getAs<types::Callable>());
+                    for(int iter = 1; iter < pList->getSize(); iter++)
+                    {
+                        deFunctionsManager->setGArgs(pList->get(iter)->getAs<types::InternalType>());
+                    }
+                }
+            }
+            else
+            {
+                ScierrorW(999, _W("%ls: Wrong type for input argument #%d : The first argument in the list must be a string or a function.\n"), L"ode", iPos+1);
+                DifferentialEquation::removeDifferentialEquationFunctions();
+                free(pdYData);free(YSize);
+                return types::Function::Error;
+            }
+        }
+        else
+        {
+            ScierrorW(999, _W("%ls: Wrong type for input argument #%d : A matrix or a function expected.\n"), L"ode", iPos+1);
+            DifferentialEquation::removeDifferentialEquationFunctions();
+            free(pdYData);free(YSize);
+            return types::Function::Error;
+        }
+    }
+
+    if(bFuncF == false)
+    {
+        int val = (meth == 3) ? 3 : 1;
+        ScierrorW(77, _W("%ls: Wrong number of input argument(s): %d expected.\n"), L"ode", in.size() + val);
+        DifferentialEquation::removeDifferentialEquationFunctions();
+        free(pdYData);free(YSize);
+        return types::Function::Error;
+    }
+    if(pDblNg == NULL && meth == 3)
+    {
+        ScierrorW(77, _W("%ls: Wrong number of input argument(s): %d expected.\n"), L"ode", in.size() + 2);
+        DifferentialEquation::removeDifferentialEquationFunctions();
+        free(pdYData);free(YSize);
+        return types::Function::Error;
+    }
+    if(bFuncG == false && meth == 3)
+    {
+        ScierrorW(77, _W("%ls: Wrong number of input argument(s): %d expected.\n"), L"ode", in.size() + 1);
+        DifferentialEquation::removeDifferentialEquationFunctions();
+        free(pdYData);free(YSize);
+        return types::Function::Error;
+    }
+
+// *** Initialization. ***
+
+    int itol        = 1;
+    int itask       = 1; // itask = 1 for normal computation of output values of y at t = tout.
+    int istate      = 1; // istate = integer flag (input and output).  set istate = 1.
+    int iopt        = 0; // iopt   = 0 to indicate no optional inputs used.
+    int jt          = 2; // jacobian type indicator.  set jt = 2.
+    int ml          = -1;
+    int mu          = -1;
+
+    // work tab
+    double* rwork   = NULL;
+    int* iwork      = NULL;
+    int rworkSize   = 0;
+    int iworkSize   = 0;
+
+    // contain ls0001, lsa001 and eh0001 structures
+    double* dStructTab  = NULL;
+    int* iStructTab     = NULL;
+    int dStructTabSize  = 0;
+    int iStructTabSize  = 0;
+
+    int rwSize  = 0; // rwSize = dStructTab + rworkSize
+    int iwSize  = 0; // iwSize = iStructTab + iworkSize
+
+    // structures used by lsoda and lsode
+    double* ls0001d = &(C2F(ls0001).tret);
+    int* ls0001i    = &(C2F(ls0001).illin);
+    double* lsa001d = &(C2F(lsa001).tsw);
+    int* lsa001i    = &(C2F(lsa001).insufr);
+    double* lsr001d = &(C2F(lsr001).rownr3[0]);
+    int* lsr001i    = &(C2F(lsr001).lg0);
+    int* eh0001i    = &(C2F(eh0001).mesflg);
+
+    // get %ODEOPTIONS
+    types::InternalType* pIT = symbol::Context::getInstance()->get(symbol::Symbol(L"%ODEOPTIONS"));
+    if(pIT != NULL && pIT->isDouble())
+    {
+        pDblOdeOptions = pIT->getAs<types::Double>();
+        if(pDblOdeOptions->getSize() == 12)
+        {
+            iopt    = 1;
+            itask   = (int)pDblOdeOptions->get(0);
+            jt      = (int)pDblOdeOptions->get(5);
+            ml      = (int)pDblOdeOptions->get(10);
+            mu      = (int)pDblOdeOptions->get(11);
+        }
+    }
+
+    if(iopt == 1 && (pDblOdeOptions->get(4) > pDblOdeOptions->get(3))) // hmin > hmax ?
+    {
+        ScierrorW(9999, _W("%ls: Wrong value of hmin and hmax : hmin = %d is greater than hmax = %d.\n"), L"ode", pDblOdeOptions->get(4), pDblOdeOptions->get(3));
+        DifferentialEquation::removeDifferentialEquationFunctions();
+        free(pdYData);free(YSize);
+        return types::Function::Error;
+    }
+
+    if(jt < 0 || jt > 5)
+    {
+        ScierrorW(9999, _W("%ls: Wrong value of Jacobian type : A number between %d and %d expected.\n"), L"ode", 0, 5);
+        DifferentialEquation::removeDifferentialEquationFunctions();
+        free(pdYData);free(YSize);
+        return types::Function::Error;
+    }
+
+    if(iopt == 0 && bFuncJac)
+    {
+        jt = 1;
+    }
+
+    if(bFuncJac && (jt == 2 || jt == 5) && getWarningMode())
+    {
+        sciprintW(_W("%ls: Warning: Jacobian is given, but not used.\n"), L"ode");
+    }
+
+    if(bFuncJac == false && (jt == 1 || jt == 4))
+    {
+        if(getWarningMode())
+        {
+            sciprintW(_W("%ls: Warning: No Jacobian external given, but one is required by %ODEOPTIONS(6) value. Jacobian will be estimated.\n"), L"ode");
+        }
+
+        jt = 2;
+    }
+
+    //compute itol and set the tolerances rtol and atol.
+    double* rtol = NULL;
+    double* atol = NULL;
+
+    if(pDblRtol)
+    {
+        if(pDblRtol->isScalar())
+        {
+            rtol = (double*)malloc(sizeof(double));
+            *rtol = pDblRtol->get(0);
+        }
+        else
+        {
+            rtol = pDblRtol->get();
+            itol += 2;
+        }
+    }
+    else
+    {
+        rtol = (double*)malloc(sizeof(double));
+        if(meth == 6 || meth == 7)
+        {
+            *rtol = 1.e-3;
+        }
+        else
+        {
+            *rtol = 1.0e-7;
+        }
+    }
+
+    if(pDblAtol)
+    {
+        if(pDblAtol->isScalar())
+        {
+            atol = (double*)malloc(sizeof(double));
+            *atol = pDblAtol->get(0);
+        }
+        else
+        {
+            atol = pDblAtol->get();
+            itol ++;
+        }
+    }
+    else
+    {
+        atol = (double*)malloc(sizeof(double));
+        if(meth == 6 || meth == 7)
+        {
+            *atol = 1.e-4;
+        }
+        else
+        {
+            *atol = 1.0e-9;
+        }
+    }
+
+    // Compute rwork, iwork size.
+    // Create them.
+    int nyh = (*YSize);
+    if(pDblW) // structure ls0001 have been restored.
+    {
+        nyh = C2F(ls0001).nyh;
+    }
+
+    int mxordn = 12;
+    int mxords = 5;
+
+    if(iopt == 1)
+    {
+        mxordn = (int)pDblOdeOptions->get(7);
+        mxords = (int)pDblOdeOptions->get(8);
+    }
+
+    if(mxordn > 12 || mxords > 5 || mxordn < 1 || mxords < 1)
+    {
+        if(getWarningMode())
+        {
+            sciprintW(_W("%ls: Warning: Wrong value for maximun stiff/non-stiff order allowed :\nAt most %d for mxordn, %d for mxords and no null value for both expected.\nWrong value will be reduced to the default value.\n"), L"ode", 12, 5);
+        }
+
+        mxordn = 12;
+        mxords = 5;
+    }
+
+    int maxord  = mxords;
+    int lmat    = 0;
+    int lrn     = 0;
+    int lrs     = 0;
+
+    switch(meth)
+    {
+        case 3 : // lsodar (root)
+        {
+//             lrn = 20 + nyh*(mxordn+1) + 3*neq + 3*ng,
+//             lrs = 20 + nyh*(mxords+1) + 3*neq + lmat + 3*ng,
+//          where
+//             nyh    = the initial value of neq,
+//             mxordn = 12, unless a smaller value is given as an
+//                      optional input,
+//             mxords = 5, unless a smaller value is given as an
+//                      optional input,
+//             lmat   = length of matrix work space..
+//             lmat   = neq**2 + 2              if jt = 1 or 2,
+//             lmat   = (2*ml + mu + 1)*neq + 2 if jt = 4 or 5.
+
+            lrn = 3 * (int)pDblNg->get(0);
+            lrs = lrn;
+            dStructTabSize = 246 - 241;
+            iStructTabSize = 59 - 50;
+            jroot = (int*)malloc((int)pDblNg->get(0) * sizeof(int));
+        }
+        case 0 : // lsoda
+        {
+//             lrn = 20 + nyh*(mxordn+1) + 3*neq,
+//             lrs = 20 + nyh*(mxords+1) + 3*neq + lmat,
+//          where
+//             nyh    = the initial value of neq,
+//             mxordn = 12, unless a smaller value is given as an
+//                      optional input,
+//             mxords = 5, unless a smaller value is given as an
+//                      optional input,
+//             lmat   = length of matrix work space..
+//             lmat   = neq**2 + 2              if jt = 1 or 2,
+//             lmat   = (2*ml + mu + 1)*neq + 2 if jt = 4 or 5.
+
+            if(jt == 1 || jt == 2)
+            {
+                lmat = (*YSize) * (*YSize) + 2;       //  if jt = 1 or 2,
+            }
+            else if(jt == 4 || jt == 5)
+            {   //ml and mu = -1 in all cases
+                lmat = (2 * ml + mu + 1) * (*YSize) + 2; //  if jt = 4 or 5. 
+            }
+
+            lrn += 20 + nyh * (mxordn + 1) + 3 * (*YSize);
+            lrs += 20 + nyh * (mxords + 1) + 3 * (*YSize) + lmat;
+
+            rworkSize   = max(lrn, lrs);
+            iworkSize   = 20 + *YSize;     
+
+            dStructTabSize += 241;
+            iStructTabSize += 50;
+
+            break;
+        }
+        case 1 : // lsode (adams) (non stiff)
+        {
+            maxord = mxordn;
+        }
+        case 2 : // lsode (stiff)
+        {
+//          20 + nyh*(maxord + 1) + 3*neq + lmat
+//        where
+//          nyh    = the initial value of neq,
+//          maxord = 12 (if meth = 1) or 5 (if meth = 2) (unless a
+//                   smaller value is given as an optional input),
+//          lmat   = 0             if miter = 0,
+//          lmat   = neq**2 + 2    if miter is 1 or 2,
+//          lmat   = neq + 2       if miter = 3, and
+//