Module polynom plugged to Scilab 6 42/9842/26
Cedric Delamarre [Wed, 28 Nov 2012 16:36:40 +0000 (17:36 +0100)]
test_run("polynomials",[],["no_check_error_output" "short_summary"]);

Change-Id: I6d3552ad852057c1c26a2e74f9d5c3960cf0f7a5

63 files changed:
scilab/CHANGES_6.0.X
scilab/etc/modules.xml.in
scilab/etc/modules.xml.vc
scilab/modules/ast/src/cpp/visitor_common.cpp
scilab/modules/core/includes/callinterf.h
scilab/modules/core/src/c/callinterf.c
scilab/modules/elementary_functions/Makefile.am
scilab/modules/elementary_functions/Makefile.in
scilab/modules/elementary_functions/includes/elem_func_gw.hxx
scilab/modules/elementary_functions/includes/gw_elementary_functions.h
scilab/modules/elementary_functions/sci_gateway/cpp/elem_func_gw/elem_func_gw.vcxproj
scilab/modules/elementary_functions/sci_gateway/cpp/elem_func_gw/elem_func_gw.vcxproj.filters
scilab/modules/elementary_functions/sci_gateway/cpp/sci_tril.cpp [new file with mode: 0644]
scilab/modules/elementary_functions/sci_gateway/cpp/sci_triu.cpp [new file with mode: 0644]
scilab/modules/elementary_functions/src/cpp/diag.cpp
scilab/modules/functions_manager/functions_manager.vcxproj
scilab/modules/functions_manager/includes/module_declaration.hxx
scilab/modules/functions_manager/src/cpp/funcmanager.cpp
scilab/modules/linear_algebra/sci_gateway/cpp/sci_spec.cpp
scilab/modules/operations/includes/types_multiplication.hxx
scilab/modules/operations/src/cpp/types_addition.cpp
scilab/modules/operations/src/cpp/types_multiplication.cpp
scilab/modules/overloading/macros/%r_simp.sci [deleted file]
scilab/modules/polynomials/Makefile.am
scilab/modules/polynomials/Makefile.in
scilab/modules/polynomials/help/en_US/pdiv.xml
scilab/modules/polynomials/help/fr_FR/pdiv.xml
scilab/modules/polynomials/includes/dynlib_polynomials_gw.h [new file with mode: 0644]
scilab/modules/polynomials/includes/gw_polynomials.h [deleted file]
scilab/modules/polynomials/includes/polynomials_gw.hxx [new file with mode: 0644]
scilab/modules/polynomials/macros/%p_r_p.sci [moved from scilab/modules/overloading/macros/%p_r_p.sci with 100% similarity]
scilab/modules/polynomials/macros/%p_simp.sci [moved from scilab/modules/overloading/macros/%p_simp.sci with 100% similarity]
scilab/modules/polynomials/macros/%r_simp.sci [new file with mode: 0644]
scilab/modules/polynomials/macros/%s_r_p.sci [moved from scilab/modules/overloading/macros/%s_r_p.sci with 86% similarity]
scilab/modules/polynomials/macros/%s_simp.sci [moved from scilab/modules/overloading/macros/%s_simp.sci with 100% similarity]
scilab/modules/polynomials/sci_gateway/c/gw_polynomials.c
scilab/modules/polynomials/sci_gateway/cpp/polynomials_gw.cpp [new file with mode: 0644]
scilab/modules/polynomials/sci_gateway/cpp/sci_bezout.cpp [new file with mode: 0644]
scilab/modules/polynomials/sci_gateway/cpp/sci_coeff.cpp [new file with mode: 0644]
scilab/modules/polynomials/sci_gateway/cpp/sci_degree.cpp [new file with mode: 0644]
scilab/modules/polynomials/sci_gateway/cpp/sci_poly.cpp [new file with mode: 0644]
scilab/modules/polynomials/sci_gateway/cpp/sci_pppdiv.cpp [new file with mode: 0644]
scilab/modules/polynomials/sci_gateway/cpp/sci_roots.cpp [new file with mode: 0644]
scilab/modules/polynomials/sci_gateway/cpp/sci_sfact.cpp [new file with mode: 0644]
scilab/modules/polynomials/sci_gateway/cpp/sci_simp.cpp [new file with mode: 0644]
scilab/modules/polynomials/sci_gateway/cpp/sci_simpMode.cpp [new file with mode: 0644]
scilab/modules/polynomials/sci_gateway/cpp/sci_varn.cpp [new file with mode: 0644]
scilab/modules/polynomials/src/c/Elementary_functions_f_Import.def [new file with mode: 0644]
scilab/modules/polynomials/src/c/polynomials.vcxproj
scilab/modules/polynomials/src/c/polynomials.vcxproj.filters
scilab/modules/polynomials/src/c/polynomials_f_Import.def
scilab/modules/polynomials/src/fortran/dpsimp.f
scilab/modules/polynomials/src/fortran/polynomials_f.vfproj
scilab/modules/polynomials/src/fortran/sfact1.f
scilab/modules/system_env/Makefile.am
scilab/modules/system_env/Makefile.in
scilab/modules/system_env/includes/configvariable.hxx
scilab/modules/system_env/includes/sci_simpMode.h [new file with mode: 0644]
scilab/modules/system_env/src/cpp/configvariable.cpp
scilab/modules/system_env/src/cpp/sci_simpMode.cpp [new file with mode: 0644]
scilab/modules/types/includes/polynom.hxx
scilab/modules/types/src/cpp/polynom.cpp
scilab/modules/types/src/cpp/singlepoly.cpp

index e4190b7..38fcb28 100644 (file)
@@ -18,6 +18,7 @@ Removed functions (previously declared as 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.
-
+* impl   : Recall impl with the same parameters as in its previous stop is now available.
+* ode    : y0 is restricted to a column vector.
+* pppdiv : return a scalar of type 'constant' when the rank is 0.
+* pdiv   : return a matrix of type 'constant' when all the rank are 0.
index 4e82c41..785a8d1 100644 (file)
@@ -59,4 +59,5 @@
     <module name="operations" activate="yes"/>
     <module name="api_scilab" activate="yes"/>
     <module name="ast" activate="yes"/>
+    <module name="polynomials" activate="yes"/>
 </modules>
index 8a1e673..425b49f 100644 (file)
@@ -60,4 +60,5 @@
     <module name="operations" activate="yes"/>
     <module name="api_scilab" activate="yes"/>
     <module name="ast" activate="yes"/>
+    <module name="polynomials" activate="yes"/>
 </modules>
index 8c353ce..538dd23 100644 (file)
@@ -368,18 +368,38 @@ types::InternalType* AddElementToVariable(types::InternalType* _poDest, types::I
                 {
                     //Add Source like coef of the new element
                     Double* pD = _poSource->getAs<Double>();
-                    for (int i = 0 ; i < pD->getRows() ; i++)
+                    types::Polynom* pPolyOut = poResult->getAs<types::Polynom>();
+
+                    if (pD->isComplex())
                     {
-                        for (int j = 0 ; j < pD->getCols() ; j++)
+                        pPolyOut->setComplex(true);
+                        for (int i = 0 ; i < pD->getRows() ; i++)
                         {
-                            types::SinglePoly* pPolyOut        = poResult->getAs<types::Polynom>()->get(iCurRow + i, iCurCol + j);
+                            for (int j = 0 ; j < pD->getCols() ; j++)
+                            {
+                                types::SinglePoly* pSPOut = pPolyOut->get(iCurRow + i, iCurCol + j);
 
-                            pPolyOut->setRank(1);
-                            double pDbl = pD->get(i, j);
-                            pPolyOut->setCoef(&pDbl, NULL);
+                                pSPOut->setRank(1);
+                                double pDblR = pD->get(i, j);
+                                double pDblI = pD->getImg(i, j);
+                                pSPOut->setCoef(&pDblR, &pDblI);
+                            }
                         }
                     }
+                    else
+                    {
+                        for (int i = 0 ; i < pD->getRows() ; i++)
+                        {
+                            for (int j = 0 ; j < pD->getCols() ; j++)
+                            {
+                                types::SinglePoly* pSPOut = pPolyOut->get(iCurRow + i, iCurCol + j);
 
+                                pSPOut->setRank(1);
+                                double pDbl = pD->get(i, j);
+                                pSPOut->setCoef(&pDbl, NULL);
+                            }
+                        }
+                    }
                 }
                 break;
             case types::GenericType::RealSparse :
@@ -1136,4 +1156,4 @@ List* getPropertyTree(Exp* e, List* pList)
     }
 
     return pList;
-}
\ No newline at end of file
+}
index 2210fcb..4200aed 100644 (file)
@@ -36,7 +36,7 @@
 /* 13 */                                               #include "gw_core.h"
 /* 14  gw_user(); RESERVED to gw_user (see callinter.h) */
 /* 15  gw_user(); FREE */
-/* 16 */                                               #include "../../polynomials/includes/gw_polynomials.h"
+/* 16                                          #include "../../polynomials/includes/gw_polynomials.h"*/
 /* 17 */                                               #include "../../data_structures/includes/gw_data_structures1.h"
 /* 18 */                                               #include "dynamic_gateways.h" /* signal_processing */
 /* 19 */                                               #include "dynamic_gateways.h" /* interpolation */
index 7a01608..06722cf 100644 (file)
@@ -52,7 +52,7 @@ static OpTab Interfaces[INTERFACES_MAX] =
     /* 13  */ {gw_core},
     /* 14  */ {gw_user}, /* RESERVED (see callinter.h) */
     /* 15  */ {gw_user}, /* free position may be used */
-    /* 16  */ {gw_polynomials},
+    /* 16  */ {NULL}, //gw_polynomials
     /* 17  */ {gw_data_structures1},
     /* 18  */ {NULL}, //gw_dynamic_signal_processing
     /* 19  */ {gw_dynamic_interpolation},
index 2af2310..ea6c5a3 100644 (file)
@@ -285,8 +285,6 @@ ELEMENTARIES_FUNCTIONS_FORTRAN_SOURCES = \
     src/fortran/danints.f
 
 GATEWAY_C_SOURCES = \
-    sci_gateway/c/sci_tril.c \
-    sci_gateway/c/sci_triu.c \
     sci_gateway/c/sci_sqrt.c \
     sci_gateway/c/sci_sign.c \
     sci_gateway/c/gw_elementary_functions.c \
@@ -304,13 +302,11 @@ GATEWAY_FORTRAN_SOURCES =  \
     sci_gateway/fortran/sci_f_testmatrix.f \
     sci_gateway/fortran/sci_f_matrix.f \
     sci_gateway/fortran/sci_f_size.f \
-    sci_gateway/fortran/sci_f_tril.f \
     sci_gateway/fortran/sci_f_ceil.f \
     sci_gateway/fortran/sci_f_clean.f \
     sci_gateway/fortran/sci_f_eye.f \
     sci_gateway/fortran/sci_f_tan.f \
     sci_gateway/fortran/sci_f_atan.f \
-    sci_gateway/fortran/sci_f_triu.f \
     sci_gateway/fortran/sci_f_cos.f \
     sci_gateway/fortran/sci_f_rand.f \
     sci_gateway/fortran/sci_f_acos.f \
@@ -367,7 +363,10 @@ GATEWAY_CXX_SOURCES =  \
     sci_gateway/cpp/sci_log1p.cpp \
     sci_gateway/cpp/sci_max.cpp \
     sci_gateway/cpp/sci_min.cpp \
-    sci_gateway/cpp/sci_rat.cpp
+    sci_gateway/cpp/sci_rat.cpp \
+    sci_gateway/cpp/sci_triu.cpp \
+    sci_gateway/cpp/sci_tril.cpp
+
 
 EISPACK_SOURCES = src/fortran/eispack/balbak.f
 
index 18aa37f..2d7e505 100644 (file)
@@ -242,9 +242,7 @@ libscielementary_functions_algo_la_OBJECTS =  \
 libscielementary_functions_la_DEPENDENCIES =  \
        libdummy-elementary_functions.la \
        libscielementary_functions-algo.la
-am__objects_7 = libscielementary_functions_la-sci_tril.lo \
-       libscielementary_functions_la-sci_triu.lo \
-       libscielementary_functions_la-sci_sqrt.lo \
+am__objects_7 = libscielementary_functions_la-sci_sqrt.lo \
        libscielementary_functions_la-sci_sign.lo \
        libscielementary_functions_la-gw_elementary_functions.lo \
        libscielementary_functions_la-sci_number_properties.lo \
@@ -257,12 +255,12 @@ am__objects_7 = libscielementary_functions_la-sci_tril.lo \
        libscielementary_functions_la-sci_base2dec.lo \
        libscielementary_functions_la-sci_dec2base.lo
 am__objects_8 = sci_f_testmatrix.lo sci_f_matrix.lo sci_f_size.lo \
-       sci_f_tril.lo sci_f_ceil.lo sci_f_clean.lo sci_f_eye.lo \
-       sci_f_tan.lo sci_f_atan.lo sci_f_triu.lo sci_f_cos.lo \
-       sci_f_rand.lo sci_f_acos.lo sci_f_sin.lo sci_f_sqrt.lo \
-       sci_f_asin.lo sci_f_sign.lo sci_f_zeros.lo sci_f_ones.lo \
-       sci_f_diag.lo sci_f_number_properties.lo sci_f_spones.lo \
-       sci_f_nearfloat.lo sci_f_real.lo sci_f_round.lo sci_f_conj.lo
+       sci_f_ceil.lo sci_f_clean.lo sci_f_eye.lo sci_f_tan.lo \
+       sci_f_atan.lo sci_f_cos.lo sci_f_rand.lo sci_f_acos.lo \
+       sci_f_sin.lo sci_f_sqrt.lo sci_f_asin.lo sci_f_sign.lo \
+       sci_f_zeros.lo sci_f_ones.lo sci_f_diag.lo \
+       sci_f_number_properties.lo sci_f_spones.lo sci_f_nearfloat.lo \
+       sci_f_real.lo sci_f_round.lo sci_f_conj.lo
 am__objects_9 = libscielementary_functions_la-sci_isequal.lo \
        libscielementary_functions_la-elem_func_gw.lo \
        libscielementary_functions_la-sci_size.lo \
@@ -301,7 +299,9 @@ am__objects_9 = libscielementary_functions_la-sci_isequal.lo \
        libscielementary_functions_la-sci_log1p.lo \
        libscielementary_functions_la-sci_max.lo \
        libscielementary_functions_la-sci_min.lo \
-       libscielementary_functions_la-sci_rat.lo
+       libscielementary_functions_la-sci_rat.lo \
+       libscielementary_functions_la-sci_triu.lo \
+       libscielementary_functions_la-sci_tril.lo
 am_libscielementary_functions_la_OBJECTS = $(am__objects_7) \
        $(am__objects_8) $(am__objects_9)
 libscielementary_functions_la_OBJECTS =  \
@@ -898,8 +898,6 @@ ELEMENTARIES_FUNCTIONS_FORTRAN_SOURCES = \
     src/fortran/danints.f
 
 GATEWAY_C_SOURCES = \
-    sci_gateway/c/sci_tril.c \
-    sci_gateway/c/sci_triu.c \
     sci_gateway/c/sci_sqrt.c \
     sci_gateway/c/sci_sign.c \
     sci_gateway/c/gw_elementary_functions.c \
@@ -917,13 +915,11 @@ GATEWAY_FORTRAN_SOURCES = \
     sci_gateway/fortran/sci_f_testmatrix.f \
     sci_gateway/fortran/sci_f_matrix.f \
     sci_gateway/fortran/sci_f_size.f \
-    sci_gateway/fortran/sci_f_tril.f \
     sci_gateway/fortran/sci_f_ceil.f \
     sci_gateway/fortran/sci_f_clean.f \
     sci_gateway/fortran/sci_f_eye.f \
     sci_gateway/fortran/sci_f_tan.f \
     sci_gateway/fortran/sci_f_atan.f \
-    sci_gateway/fortran/sci_f_triu.f \
     sci_gateway/fortran/sci_f_cos.f \
     sci_gateway/fortran/sci_f_rand.f \
     sci_gateway/fortran/sci_f_acos.f \
@@ -980,7 +976,9 @@ GATEWAY_CXX_SOURCES = \
     sci_gateway/cpp/sci_log1p.cpp \
     sci_gateway/cpp/sci_max.cpp \
     sci_gateway/cpp/sci_min.cpp \
-    sci_gateway/cpp/sci_rat.cpp
+    sci_gateway/cpp/sci_rat.cpp \
+    sci_gateway/cpp/sci_triu.cpp \
+    sci_gateway/cpp/sci_tril.cpp
 
 EISPACK_SOURCES = src/fortran/eispack/balbak.f
 
@@ -1651,20 +1649,6 @@ libscielementary_functions_algo_la-convertbase.lo: src/c/convertbase.c
 @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) $(libscielementary_functions_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libscielementary_functions_algo_la-convertbase.lo `test -f 'src/c/convertbase.c' || echo '$(srcdir)/'`src/c/convertbase.c
 
-libscielementary_functions_la-sci_tril.lo: sci_gateway/c/sci_tril.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscielementary_functions_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libscielementary_functions_la-sci_tril.lo -MD -MP -MF $(DEPDIR)/libscielementary_functions_la-sci_tril.Tpo -c -o libscielementary_functions_la-sci_tril.lo `test -f 'sci_gateway/c/sci_tril.c' || echo '$(srcdir)/'`sci_gateway/c/sci_tril.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscielementary_functions_la-sci_tril.Tpo $(DEPDIR)/libscielementary_functions_la-sci_tril.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_tril.c' object='libscielementary_functions_la-sci_tril.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) $(libscielementary_functions_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libscielementary_functions_la-sci_tril.lo `test -f 'sci_gateway/c/sci_tril.c' || echo '$(srcdir)/'`sci_gateway/c/sci_tril.c
-
-libscielementary_functions_la-sci_triu.lo: sci_gateway/c/sci_triu.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscielementary_functions_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libscielementary_functions_la-sci_triu.lo -MD -MP -MF $(DEPDIR)/libscielementary_functions_la-sci_triu.Tpo -c -o libscielementary_functions_la-sci_triu.lo `test -f 'sci_gateway/c/sci_triu.c' || echo '$(srcdir)/'`sci_gateway/c/sci_triu.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscielementary_functions_la-sci_triu.Tpo $(DEPDIR)/libscielementary_functions_la-sci_triu.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_triu.c' object='libscielementary_functions_la-sci_triu.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) $(libscielementary_functions_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libscielementary_functions_la-sci_triu.lo `test -f 'sci_gateway/c/sci_triu.c' || echo '$(srcdir)/'`sci_gateway/c/sci_triu.c
-
 libscielementary_functions_la-sci_sqrt.lo: sci_gateway/c/sci_sqrt.c
 @am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscielementary_functions_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libscielementary_functions_la-sci_sqrt.lo -MD -MP -MF $(DEPDIR)/libscielementary_functions_la-sci_sqrt.Tpo -c -o libscielementary_functions_la-sci_sqrt.lo `test -f 'sci_gateway/c/sci_sqrt.c' || echo '$(srcdir)/'`sci_gateway/c/sci_sqrt.c
 @am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscielementary_functions_la-sci_sqrt.Tpo $(DEPDIR)/libscielementary_functions_la-sci_sqrt.Plo
@@ -2106,6 +2090,20 @@ libscielementary_functions_la-sci_rat.lo: sci_gateway/cpp/sci_rat.cpp
 @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) $(libscielementary_functions_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscielementary_functions_la-sci_rat.lo `test -f 'sci_gateway/cpp/sci_rat.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_rat.cpp
 
+libscielementary_functions_la-sci_triu.lo: sci_gateway/cpp/sci_triu.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscielementary_functions_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscielementary_functions_la-sci_triu.lo -MD -MP -MF $(DEPDIR)/libscielementary_functions_la-sci_triu.Tpo -c -o libscielementary_functions_la-sci_triu.lo `test -f 'sci_gateway/cpp/sci_triu.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_triu.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscielementary_functions_la-sci_triu.Tpo $(DEPDIR)/libscielementary_functions_la-sci_triu.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_triu.cpp' object='libscielementary_functions_la-sci_triu.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) $(libscielementary_functions_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscielementary_functions_la-sci_triu.lo `test -f 'sci_gateway/cpp/sci_triu.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_triu.cpp
+
+libscielementary_functions_la-sci_tril.lo: sci_gateway/cpp/sci_tril.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscielementary_functions_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscielementary_functions_la-sci_tril.lo -MD -MP -MF $(DEPDIR)/libscielementary_functions_la-sci_tril.Tpo -c -o libscielementary_functions_la-sci_tril.lo `test -f 'sci_gateway/cpp/sci_tril.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_tril.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscielementary_functions_la-sci_tril.Tpo $(DEPDIR)/libscielementary_functions_la-sci_tril.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_tril.cpp' object='libscielementary_functions_la-sci_tril.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) $(libscielementary_functions_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscielementary_functions_la-sci_tril.lo `test -f 'sci_gateway/cpp/sci_tril.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_tril.cpp
+
 .f.o:
        $(F77COMPILE) -c -o $@ $<
 
@@ -2787,9 +2785,6 @@ sci_f_matrix.lo: sci_gateway/fortran/sci_f_matrix.f
 sci_f_size.lo: sci_gateway/fortran/sci_f_size.f
        $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o sci_f_size.lo `test -f 'sci_gateway/fortran/sci_f_size.f' || echo '$(srcdir)/'`sci_gateway/fortran/sci_f_size.f
 
-sci_f_tril.lo: sci_gateway/fortran/sci_f_tril.f
-       $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o sci_f_tril.lo `test -f 'sci_gateway/fortran/sci_f_tril.f' || echo '$(srcdir)/'`sci_gateway/fortran/sci_f_tril.f
-
 sci_f_ceil.lo: sci_gateway/fortran/sci_f_ceil.f
        $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o sci_f_ceil.lo `test -f 'sci_gateway/fortran/sci_f_ceil.f' || echo '$(srcdir)/'`sci_gateway/fortran/sci_f_ceil.f
 
@@ -2805,9 +2800,6 @@ sci_f_tan.lo: sci_gateway/fortran/sci_f_tan.f
 sci_f_atan.lo: sci_gateway/fortran/sci_f_atan.f
        $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o sci_f_atan.lo `test -f 'sci_gateway/fortran/sci_f_atan.f' || echo '$(srcdir)/'`sci_gateway/fortran/sci_f_atan.f
 
-sci_f_triu.lo: sci_gateway/fortran/sci_f_triu.f
-       $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o sci_f_triu.lo `test -f 'sci_gateway/fortran/sci_f_triu.f' || echo '$(srcdir)/'`sci_gateway/fortran/sci_f_triu.f
-
 sci_f_cos.lo: sci_gateway/fortran/sci_f_cos.f
        $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o sci_f_cos.lo `test -f 'sci_gateway/fortran/sci_f_cos.f' || echo '$(srcdir)/'`sci_gateway/fortran/sci_f_cos.f
 
index 78cc907..80354d0 100644 (file)
@@ -64,5 +64,7 @@ CPP_GATEWAY_PROTOTYPE(sci_log1p);
 CPP_GATEWAY_PROTOTYPE(sci_max); // Old name sci_maxi
 CPP_GATEWAY_PROTOTYPE(sci_min); // Old name sci_mini
 CPP_GATEWAY_PROTOTYPE(sci_rat);
+CPP_GATEWAY_PROTOTYPE(sci_triu);
+CPP_GATEWAY_PROTOTYPE(sci_tril);
 
 #endif /* __ELEM_FUNC_GW_HXX__ */
index 2f93a92..bdf805b 100644 (file)
@@ -61,8 +61,8 @@ C_GATEWAY_PROTOTYPE(sci_sign);
 C_GATEWAY_PROTOTYPE(sci_sqrt);
 //C_GATEWAY_PROTOTYPE(sci_tan);
 C_GATEWAY_PROTOTYPE(sci_testmatrix);
-C_GATEWAY_PROTOTYPE(sci_tril);
-C_GATEWAY_PROTOTYPE(sci_triu);
+//C_GATEWAY_PROTOTYPE(sci_tril);
+//C_GATEWAY_PROTOTYPE(sci_triu);
 C_GATEWAY_PROTOTYPE(sci_base2dec);
 C_GATEWAY_PROTOTYPE(sci_dec2base);
 
index 7397dc1..55d0cbe 100644 (file)
@@ -213,8 +213,6 @@ lib /DEF:"$(ProjectDir)elementary_functions_Import.def" /SUBSYSTEM:WINDOWS /MACH
     <ClCompile Include="..\..\c\sci_sign.c" />
     <ClCompile Include="..\..\c\sci_sqrt.c" />
     <ClCompile Include="..\..\c\sci_testmatrix.c" />
-    <ClCompile Include="..\..\c\sci_tril.c" />
-    <ClCompile Include="..\..\c\sci_triu.c" />
     <ClCompile Include="..\elem_func_gw.cpp" />
     <ClCompile Include="..\sci_abs.cpp" />
     <ClCompile Include="..\sci_acos.cpp" />
@@ -255,6 +253,8 @@ lib /DEF:"$(ProjectDir)elementary_functions_Import.def" /SUBSYSTEM:WINDOWS /MACH
     <ClCompile Include="..\sci_size.cpp" />
     <ClCompile Include="..\sci_sum.cpp" />
     <ClCompile Include="..\sci_tan.cpp" />
+    <ClCompile Include="..\sci_tril.cpp" />
+    <ClCompile Include="..\sci_triu.cpp" />
     <ClCompile Include="..\sci_zeros.cpp" />
   </ItemGroup>
   <ItemGroup>
index b50049a..349bc13 100644 (file)
     <ClCompile Include="..\..\c\sci_testmatrix.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\c\sci_tril.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\c\sci_triu.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="..\sci_abs.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
     <ClCompile Include="..\sci_prod.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="..\sci_tril.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\sci_triu.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\..\includes\elem_func_gw.hxx">
diff --git a/scilab/modules/elementary_functions/sci_gateway/cpp/sci_tril.cpp b/scilab/modules/elementary_functions/sci_gateway/cpp/sci_tril.cpp
new file mode 100644 (file)
index 0000000..4b2b7ea
--- /dev/null
@@ -0,0 +1,141 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2012 - Scilab Enterprises - 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 "elem_func_gw.hxx"
+#include "function.hxx"
+#include "double.hxx"
+#include "string.hxx"
+#include "overload.hxx"
+#include "execvisitor.hxx"
+
+extern "C"
+{
+#include "Scierror.h"
+#include "localization.h"
+}
+
+/*--------------------------------------------------------------------------*/
+types::Function::ReturnValue sci_tril(types::typed_list &in, int _iRetCount, types::typed_list &out)
+{
+    int iOffset = 0;
+
+    if (in.size() < 1 || in.size() > 2)
+    {
+        Scierror(77, _("%s: Wrong number of input argument(s): %d to %d expected.\n"), "tril", 1, 2);
+        return types::Function::Error;
+    }
+
+    if (_iRetCount > 1)
+    {
+        Scierror(78, _("%s: Wrong number of output argument(s): %d expected.\n"), "tril", 1);
+        return types::Function::Error;
+    }
+
+    // get offset
+    if (in.size() == 2)
+    {
+        if (in[1]->isDouble() == false)
+        {
+            Scierror(999, _("%s: Wrong type for input argument #%d : A real scalar expected.\n"), "tril", 2);
+            return types::Function::Error;
+        }
+
+        types::Double* pDblOffset = in[1]->getAs<types::Double>();
+
+        if (pDblOffset->isScalar() == false || pDblOffset->isComplex())
+        {
+            Scierror(999, _("%s: Wrong type for input argument #%d : A real scalar expected.\n"), "tril", 2);
+            return types::Function::Error;
+        }
+
+        iOffset = (int)pDblOffset->get(0);
+    }
+
+    // perform operation
+    if (in[0]->isDouble()) // double
+    {
+        types::Double* pDblOut = in[0]->getAs<types::Double>()->clone()->getAs<types::Double>();
+        int iRows = pDblOut->getRows();
+        int iCols = pDblOut->getCols();
+        double* pdblOutReal = pDblOut->get();
+
+        if (pDblOut->isComplex())
+        {
+            double* pdblOutImg = pDblOut->getImg();
+            for (int i = 0; i < iCols; i++)
+            {
+                int iSize = min(max(i - iOffset, 0), iRows);
+                memset(&pdblOutReal[i * iRows], 0x00, iSize * sizeof(double));
+                memset(&pdblOutImg[i * iRows],  0x00, iSize * sizeof(double));
+            }
+        }
+        else
+        {
+            for (int i = 0; i < iCols; i++)
+            {
+                int iSize = min(max(i - iOffset, 0), iRows);
+                memset(&pdblOutReal[i * iRows], 0x00, iSize * sizeof(double));
+            }
+        }
+
+        out.push_back(pDblOut);
+    }
+    else if (in[0]->isPoly()) // polynom
+    {
+        types::Polynom* pPolyOut = in[0]->getAs<types::Polynom>()->clone()->getAs<types::Polynom>();
+        int iRows = pPolyOut->getRows();
+        int iCols = pPolyOut->getCols();
+
+        if (pPolyOut->isComplex())
+        {
+            for (int i = 0; i < iCols; i++)
+            {
+                int iSize = min(max(i - iOffset, 0), iRows);
+                for (int j = 0; j < iSize; j++)
+                {
+                    double* dblReal = NULL;
+                    double* dblImg  = NULL;
+                    types::SinglePoly* pSP = new types::SinglePoly(&dblReal, &dblImg, 1);
+                    dblReal[0] = 0;
+                    dblImg[0]  = 0;
+                    pPolyOut->set(i * iRows + j, pSP);
+                    delete pSP;
+                }
+            }
+        }
+        else
+        {
+            for (int i = 0; i < iCols; i++)
+            {
+                int iSize = min(max(i - iOffset, 0), iRows);
+                for (int j = 0; j < iSize; j++)
+                {
+                    double* dbl = NULL;
+                    types::SinglePoly* pSP = new types::SinglePoly(&dbl, 1);
+                    dbl[0] = 0;
+                    pPolyOut->set(i * iRows + j, pSP);
+                    delete pSP;
+                }
+            }
+        }
+
+        out.push_back(pPolyOut);
+    }
+    else
+    {
+        std::wstring wstFuncName = L"%"  + in[0]->getShortTypeStr() + L"_tril";
+        return Overload::call(wstFuncName, in, _iRetCount, out, new ExecVisitor());
+    }
+
+    return types::Function::OK;
+}
+/*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/elementary_functions/sci_gateway/cpp/sci_triu.cpp b/scilab/modules/elementary_functions/sci_gateway/cpp/sci_triu.cpp
new file mode 100644 (file)
index 0000000..f13de48
--- /dev/null
@@ -0,0 +1,124 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2012 - Scilab Enterprises - 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 "elem_func_gw.hxx"
+#include "function.hxx"
+#include "double.hxx"
+#include "string.hxx"
+#include "overload.hxx"
+#include "execvisitor.hxx"
+
+extern "C"
+{
+#include "Scierror.h"
+#include "localization.h"
+}
+
+/*--------------------------------------------------------------------------*/
+types::Function::ReturnValue sci_triu(types::typed_list &in, int _iRetCount, types::typed_list &out)
+{
+    int iOffset = 0;
+
+    if (in.size() < 1 || in.size() > 2)
+    {
+        Scierror(77, _("%s: Wrong number of input argument(s): %d to %d expected.\n"), "triu", 1, 2);
+        return types::Function::Error;
+    }
+
+    if (_iRetCount > 1)
+    {
+        Scierror(78, _("%s: Wrong number of output argument(s): %d expected.\n"), "triu", 1);
+        return types::Function::Error;
+    }
+
+    if (in.size() == 2)
+    {
+        if (in[1]->isDouble() == false)
+        {
+            Scierror(999, _("%s: Wrong type for input argument #%d : A real scalar expected.\n"), "triu", 2);
+            return types::Function::Error;
+        }
+
+        types::Double* pDblOffset = in[1]->getAs<types::Double>();
+
+        if (pDblOffset->isScalar() == false || pDblOffset->isComplex())
+        {
+            Scierror(999, _("%s: Wrong type for input argument #%d : A real scalar expected.\n"), "triu", 2);
+            return types::Function::Error;
+        }
+
+        iOffset = (int)pDblOffset->get(0);
+    }
+
+    /***** get data *****/
+    if (in[0]->isDouble()) // double
+    {
+        types::Double* pDblIn  = in[0]->getAs<types::Double>();
+        int iCols = pDblIn->getCols();
+        int iRows = pDblIn->getRows();
+        double* pdblInReal = pDblIn->get();
+
+        types::Double* pDblOut = new types::Double(iRows, iCols, pDblIn->isComplex());
+        double* pdblOutReal = pDblOut->get();
+        memset(pdblOutReal, 0x00, iRows * iCols * sizeof(double));
+
+        if (pDblIn->isComplex())
+        {
+            double* pdblInImg  = pDblIn->getImg();
+            double* pdblOutImg = pDblOut->getImg();
+            memset(pdblOutImg, 0x00, iRows * iCols * sizeof(double));
+            for (int i = 0 ; i < iCols ; i++)
+            {
+                int iSize = min(max(i + 1 - iOffset, 0), iRows);
+                memcpy(&pdblOutReal[i * iRows], &pdblInReal[i * iRows], iSize * sizeof(double));
+                memcpy(&pdblOutImg[i * iRows], &pdblInImg[i * iRows], iSize * sizeof(double));
+            }
+        }
+        else
+        {
+            for (int i = 0 ; i < iCols ; i++)
+            {
+                int iSize = min(max(i + 1 - iOffset, 0), iRows);
+                memcpy(&pdblOutReal[i * iRows], &pdblInReal[i * iRows], iSize * sizeof(double));
+            }
+        }
+
+        out.push_back(pDblOut);
+    }
+    else if (in[0]->isPoly()) // polynom
+    {
+        types::Polynom* pPolyIn = in[0]->getAs<types::Polynom>();
+        int iRows = pPolyIn->getRows();
+        int iCols = pPolyIn->getCols();
+
+        types::Polynom* pPolyOut = new types::Polynom(pPolyIn->getVariableName(), iRows, iCols);
+        for (int i = 0 ; i < iCols ; i++)
+        {
+            int iSize = min(max(i + 1 - iOffset, 0), iRows);
+            for (int j = 0; j < iSize; j++)
+            {
+                int iPos = i * iRows + j;
+                pPolyOut->set(iPos, pPolyIn->get(iPos));
+            }
+        }
+
+        out.push_back(pPolyOut);
+    }
+    else
+    {
+        std::wstring wstFuncName = L"%"  + in[0]->getShortTypeStr() + L"_triu";
+        return Overload::call(wstFuncName, in, _iRetCount, out, new ExecVisitor());
+    }
+
+    return types::Function::OK;
+}
+/*--------------------------------------------------------------------------*/
index a063a65..4b729bd 100644 (file)
@@ -135,33 +135,42 @@ types::Polynom* diag(types::Polynom* pIn,  int iStartPos)
             return NULL;
         }
 
-        for (int i = 0; i < iSize; i++)
+        if (pIn->isComplex())
         {
-            iRank = pIn->get(i)->getRank();
-
-            if (pIn->isComplex())
+            for (int i = 0; i < iSize; i++)
             {
+                iRank = pIn->get(i)->getRank();
                 pSP = new types::SinglePoly(&pdRData, &pdIData, iRank);
+                iPos = (i + iStartCol) * iRows + (i + iStartRow);
+
+                for (int j = 0; j < iRank; j++)
+                {
+                    pdRData[j] = pIn->get(iPos)->getCoefReal()[j];
+                    pdIData[j] = pIn->get(iPos)->getCoefImg()[j];
+                }
+
+                pPolyOut->set(i, pSP);
+                delete pSP;
+                pSP = NULL;
             }
-            else
+        }
+        else
+        {
+            for (int i = 0; i < iSize; i++)
             {
+                iRank = pIn->get(i)->getRank();
                 pSP = new types::SinglePoly(&pdRData, iRank);
-            }
-
-            iPos = (i + iStartCol) * iRows + (i + iStartRow);
+                iPos = (i + iStartCol) * iRows + (i + iStartRow);
 
-            for (int j = 0; j < iRank; j++)
-            {
-                pdRData[j] = pIn->get(iPos)->getCoefReal()[j];
-                if (pIn->isComplex())
+                for (int j = 0; j < iRank; j++)
                 {
-                    pdIData[j] = pIn->get(iPos)->getCoefImg()[j];
+                    pdRData[j] = pIn->get(iPos)->getCoefReal()[j];
                 }
-            }
 
-            pPolyOut->set(i, pSP);
-            delete pSP;
-            pSP = NULL;
+                pPolyOut->set(i, pSP);
+                delete pSP;
+                pSP = NULL;
+            }
         }
     }
     else // pIn is a vector
@@ -181,36 +190,46 @@ types::Polynom* diag(types::Polynom* pIn,  int iStartPos)
         pPolyOut = new types::Polynom(pIn->getVariableName(), iSize, iSize);
         pPolyOut->setComplex(pIn->isComplex());
 
-        for (int i = 0; i < iSizeOfVector; i++)
+        if (pIn->isComplex())
         {
-            iRank = pIn->get(i)->getRank();
-
-            if (pIn->isComplex())
+            for (int i = 0; i < iSizeOfVector; i++)
             {
+                iRank = pIn->get(i)->getRank();
                 pSP = new types::SinglePoly(&pdRData, &pdIData, iRank);
+                iPos = (i + iStartCol) * iSize + (i + iStartRow);
+
+                for (int j = 0; j < iRank; j++)
+                {
+                    pdRData[j] = pIn->get(i)->getCoefReal()[j];
+                    pdIData[j] = pIn->get(i)->getCoefImg()[j];
+                }
+
+                pPolyOut->set(iPos, pSP);
+                delete pSP;
+                pSP = NULL;
             }
-            else
+        }
+        else
+        {
+            for (int i = 0; i < iSizeOfVector; i++)
             {
+                iRank = pIn->get(i)->getRank();
                 pSP = new types::SinglePoly(&pdRData, iRank);
-            }
-
-            iPos = (i + iStartCol) * iSize + (i + iStartRow);
+                iPos = (i + iStartCol) * iSize + (i + iStartRow);
 
-            for (int j = 0; j < iRank; j++)
-            {
-                pdRData[j] = pIn->get(i)->getCoefReal()[j];
-                if (pIn->isComplex())
+                for (int j = 0; j < iRank; j++)
                 {
-                    pdIData[j] = pIn->get(i)->getCoefImg()[j];
+                    pdRData[j] = pIn->get(i)->getCoefReal()[j];
                 }
-            }
 
-            pPolyOut->set(iPos, pSP);
-            delete pSP;
-            pSP = NULL;
+                pPolyOut->set(iPos, pSP);
+                delete pSP;
+                pSP = NULL;
+            }
         }
     }
 
+    pPolyOut->updateRank();
     return pPolyOut;
 }
 
index 79b5789..5555176 100644 (file)
       <Project>{74d43792-dbfc-47f0-adbc-4d7a20cdada2}</Project>
       <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
     </ProjectReference>
+    <ProjectReference Include="..\polynomials\src\c\polynomials.vcxproj">
+      <Project>{620d8fa7-3704-438e-bb1e-391c84401a2e}</Project>
+    </ProjectReference>
     <ProjectReference Include="..\scinotes\src\c\scinotes.vcxproj">
       <Project>{bae68b54-2c1a-44d0-a0e9-05156a784e79}</Project>
       <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
index a1671f5..14ab16b 100644 (file)
@@ -45,4 +45,5 @@
 #include "../../randlib/includes/randlib_gw.hxx"
 #include "../../graphics/includes/graphics_gw.hxx"
 #include "../../interpolation/includes/interpolation_gw.hxx"
+#include "../../polynomials/includes/polynomials_gw.hxx"
 #endif /* !__MODULE_DECLARATION_HXX__ */
index 3a8bc60..61a9540 100644 (file)
@@ -324,6 +324,7 @@ bool FuncManager::CreateModuleList(void)
     m_ModuleMap.insert(pair<wstring, GW_MOD>(L"optimization", &OptimizationModule::Load));
     m_ModuleMap.insert(pair<wstring, GW_MOD>(L"special_functions", &SpecialFunctionModule::Load));
     m_ModuleMap.insert(pair<wstring, GW_MOD>(L"graphic_export", &GraphicExportModule::Load));
+    m_ModuleMap.insert(pair<wstring, GW_MOD>(L"polynomials", &PolynomialsModule::Load));
 
     if (ConfigVariable::getScilabMode() != SCILAB_NWNI)
     {
index 99f852e..2b44b42 100644 (file)
@@ -40,56 +40,56 @@ types::Function::ReturnValue sci_spec(types::typed_list &in, int _iRetCount, typ
     bool symmetric          = FALSE;
     int iRet                = 0;
 
-    if((in.size() != 1) && (in.size() != 2))
+    if ((in.size() != 1) && (in.size() != 2))
     {
         Scierror(77, _("%s: Wrong number of input argument(s): %d to %d expected.\n"), "spec", 1, 2);
         return types::Function::Error;
     }
 
-    if(_iRetCount > 2*in.size())
+    if (_iRetCount > 2 * in.size())
     {
-        Scierror(78, _("%s: Wrong number of output argument(s): %d to %d expected.\n"), "spec", 1, 2*in.size());
+        Scierror(78, _("%s: Wrong number of output argument(s): %d to %d expected.\n"), "spec", 1, 2 * in.size());
         return types::Function::Error;
     }
 
-    if((in[0]->isDouble() == false))
+    if ((in[0]->isDouble() == false))
     {
         std::wstring wstFuncName = L"%"  + in[0]->getShortTypeStr() + L"_spec";
         return Overload::call(wstFuncName, in, _iRetCount, out, new ExecVisitor());
     }
     pDblA = in[0]->getAs<types::Double>()->clone()->getAs<types::Double>();
 
-    if(pDblA->getCols() != pDblA->getRows())
+    if (pDblA->getCols() != pDblA->getRows())
     {
-               Scierror(20, _("%s: Wrong type for argument %d: Square matrix expected.\n"), "sped", 1);
-        return types::Function::Error;  
+        Scierror(20, _("%s: Wrong type for argument %d: Square matrix expected.\n"), "spec", 1);
+        return types::Function::Error;
     }
 
-    if((pDblA->getRows() == -1) || (pDblA->getCols() == -1)) // manage eye case
+    if ((pDblA->getRows() == -1) || (pDblA->getCols() == -1)) // manage eye case
     {
         Scierror(271, _("%s: Size varying argument a*eye(), (arg %d) not allowed here.\n"), "spec", 1);
         return types::Function::Error;
     }
 
-    if((pDblA->getCols() == 0) || (pDblA->getRows() == 0)) // size null
+    if ((pDblA->getCols() == 0) || (pDblA->getRows() == 0)) // size null
     {
         out.push_back(types::Double::Empty());
-        for(int i=1; i < _iRetCount; i++)
+        for (int i = 1; i < _iRetCount; i++)
         {
             out.push_back(types::Double::Empty());
         }
         return types::Function::OK;
     }
 
-    if(in.size() == 1)
+    if (in.size() == 1)
     {
         types::Double* pDblEigenValues  = NULL;
         types::Double* pDblEigenVectors = NULL;
 
-        if(pDblA->isComplex())
+        if (pDblA->isComplex())
         {
             pDataA = (double*)oGetDoubleComplexFromPointer(pDblA->getReal(), pDblA->getImg(), pDblA->getSize());
-            if(!pDataA)
+            if (!pDataA)
             {
                 Scierror(999, _("%s: Cannot allocate more memory.\n"), "spec");
                 return types::Function::Error;
@@ -101,19 +101,19 @@ types::Function::ReturnValue sci_spec(types::typed_list &in, int _iRetCount, typ
         }
 
         int totalSize = pDblA->getSize();
-        if((pDblA->isComplex() ? C2F(vfiniteComplex)(&totalSize, (doublecomplex*)pDataA) : C2F(vfinite)(&totalSize, pDataA)) == false)
+        if ((pDblA->isComplex() ? C2F(vfiniteComplex)(&totalSize, (doublecomplex*)pDataA) : C2F(vfinite)(&totalSize, pDataA)) == false)
         {
-                   Scierror(264, _("%s: Wrong value for argument %d: Must not contain NaN or Inf.\n"), "spec", 1);
-            return types::Function::Error;   
+            Scierror(264, _("%s: Wrong value for argument %d: Must not contain NaN or Inf.\n"), "spec", 1);
+            return types::Function::Error;
         }
 
         symmetric = isSymmetric(pDblA->getReal(), pDblA->getImg(), pDblA->isComplex(), pDblA->getRows(), pDblA->getCols()) == 1;
         int eigenValuesCols = (_iRetCount == 1) ? 1 : pDblA->getCols();
 
-        if(symmetric)
+        if (symmetric)
         {
             pDblEigenValues = new types::Double(pDblA->getCols(), eigenValuesCols);
-            if(_iRetCount == 2)
+            if (_iRetCount == 2)
             {
                 pDblEigenVectors = new types::Double(pDblA->getCols(), pDblA->getCols(), pDblA->isComplex());
             }
@@ -121,31 +121,31 @@ types::Function::ReturnValue sci_spec(types::typed_list &in, int _iRetCount, typ
         else
         {
             pDblEigenValues  = new types::Double(pDblA->getCols(), eigenValuesCols, true);
-            if(_iRetCount == 2)
+            if (_iRetCount == 2)
             {
                 pDblEigenVectors = new types::Double(pDblA->getCols(), pDblA->getCols(), true);
             }
         }
 
-        if(pDblA->isComplex())
+        if (pDblA->isComplex())
         {
-            if(symmetric)
+            if (symmetric)
             {
                 iRet = iEigen1ComplexSymmetricM((doublecomplex*)pDataA, pDblA->getCols(), (_iRetCount == 2), pDblEigenValues->getReal());
 
-                if(iRet < 0)
+                if (iRet < 0)
                 {
                     Scierror(998, _("%s: On entry to ZGEEV parameter number  3 had an illegal value (lapack library problem).\n"), "spec", iRet);
                     return types::Function::Error;
                 }
 
-                if(iRet > 0)
+                if (iRet > 0)
                 {
                     Scierror(24, _("%s: Convergence problem, %d off-diagonal elements of an intermediate tridiagonal form did not converge to zero.\n"), "spec", iRet);
                     return types::Function::Error;
                 }
 
-                if(_iRetCount == 2)
+                if (_iRetCount == 2)
                 {
                     vGetPointerFromDoubleComplex((doublecomplex*)pDataA, pDblA->getSize() , pDblEigenVectors->getReal(), pDblEigenVectors->getImg());
                     expandToDiagonalOfMatrix(pDblEigenValues->getReal(), pDblA->getCols());
@@ -157,20 +157,20 @@ types::Function::ReturnValue sci_spec(types::typed_list &in, int _iRetCount, typ
             {
                 doublecomplex* pEigenValues = (doublecomplex*)MALLOC(pDblA->getCols() * sizeof(doublecomplex));
                 doublecomplex* pEigenVectors = pDblEigenVectors ? (doublecomplex*)MALLOC(sizeof(doublecomplex) * pDblA->getSize()) : NULL;
-                iRet = iEigen1ComplexM((doublecomplex*)pDataA, pDblA->getCols(), pEigenValues,pEigenVectors);
-                if(iRet < 0)
+                iRet = iEigen1ComplexM((doublecomplex*)pDataA, pDblA->getCols(), pEigenValues, pEigenVectors);
+                if (iRet < 0)
                 {
                     Scierror(998, _("%s: On entry to ZHEEV parameter number  3 had an illegal value (lapack library problem).\n"), "spec", iRet);
                     return types::Function::Error;
                 }
 
-                if(iRet > 0)
+                if (iRet > 0)
                 {
                     Scierror(24, _("%s: The QR algorithm failed to compute all the eigenvalues, and no eigenvectors have been computed. Elements and %d+1:N of W contain eigenvalues which have converged.\n"), "spec", iRet);
                     return types::Function::Error;
                 }
 
-                if(_iRetCount == 2)
+                if (_iRetCount == 2)
                 {
                     expandZToDiagonalOfCMatrix(pEigenValues, pDblA->getCols(), pDblEigenValues->getReal(), pDblEigenValues->getImg());
                     vGetPointerFromDoubleComplex(pEigenVectors, pDblA->getSize(), pDblEigenVectors->getReal(), pDblEigenVectors->getImg());
@@ -188,23 +188,23 @@ types::Function::ReturnValue sci_spec(types::typed_list &in, int _iRetCount, typ
         }
         else // real
         {
-            if(symmetric)
+            if (symmetric)
             {
-                iRet= iEigen1RealSymmetricM(pDataA, pDblA->getCols(), (_iRetCount == 2), pDblEigenValues->getReal());
+                iRet = iEigen1RealSymmetricM(pDataA, pDblA->getCols(), (_iRetCount == 2), pDblEigenValues->getReal());
 
-                if(iRet < 0)
+                if (iRet < 0)
                 {
                     Scierror(998, _("%s: On entry to ZGEEV parameter number  3 had an illegal value (lapack library problem).\n"), "spec", iRet);
                     return types::Function::Error;
                 }
 
-                if(iRet > 0)
+                if (iRet > 0)
                 {
                     Scierror(24, _("%s: Convergence problem, %d off-diagonal elements of an intermediate tridiagonal form did not converge to zero.\n"), "spec", iRet);
                     return types::Function::Error;
                 }
 
-                if(_iRetCount == 2)
+                if (_iRetCount == 2)
                 {
                     expandToDiagonalOfMatrix(pDblEigenValues->getReal(), pDblA->getCols());
                     out.push_back(pDblA);
@@ -215,19 +215,19 @@ types::Function::ReturnValue sci_spec(types::typed_list &in, int _iRetCount, typ
             {
                 iRet = iEigen1RealM(pDataA, pDblA->getCols(), pDblEigenValues->getReal(), pDblEigenValues->getImg(), pDblEigenVectors ? pDblEigenVectors->getReal() : NULL, pDblEigenVectors ? pDblEigenVectors->getImg() : NULL);
 
-                if(iRet < 0)
+                if (iRet < 0)
                 {
                     Scierror(998, _("%s: On entry to ZHEEV parameter number  3 had an illegal value (lapack library problem).\n"), "spec", iRet);
                     return types::Function::Error;
                 }
 
-                if(iRet > 0)
+                if (iRet > 0)
                 {
                     Scierror(24, _("%s: The QR algorithm failed to compute all the eigenvalues, and no eigenvectors have been computed. Elements and %d+1:N of WR and WI contain eigenvalues which have converged.\n"), "spec", iRet);
                     return types::Function::Error;
                 }
 
-                if(_iRetCount == 2)
+                if (_iRetCount == 2)
                 {
                     expandToDiagonalOfMatrix(pDblEigenValues->getReal(), pDblA->getCols());
                     expandToDiagonalOfMatrix(pDblEigenValues->getImg(), pDblA->getCols());
@@ -238,7 +238,7 @@ types::Function::ReturnValue sci_spec(types::typed_list &in, int _iRetCount, typ
         }
     }
 
-    if(in.size() == 2)
+    if (in.size() == 2)
     {
         types::Double* pDblL            = NULL;
         types::Double* pDblR            = NULL;
@@ -250,21 +250,22 @@ types::Function::ReturnValue sci_spec(types::typed_list &in, int _iRetCount, typ
         doublecomplex* pAlpha           = NULL;
         bool bIsComplex                 = false;
 
-        if((in[1]->isDouble() == false))
+        if ((in[1]->isDouble() == false))
         {
             std::wstring wstFuncName = L"%"  + in[1]->getShortTypeStr() + L"_spec";
             return Overload::call(wstFuncName, in, _iRetCount, out, new ExecVisitor());
         }
         pDblB = in[1]->getAs<types::Double>()->clone()->getAs<types::Double>();
-        if((pDblA->getRows() != pDblB->getRows()) && (pDblA->getCols() != pDblB->getCols()))
+        if ((pDblA->getRows() != pDblB->getRows()) && (pDblA->getCols() != pDblB->getCols()))
         {
             Scierror(999, _("%s: Arguments %d and %d must have equal dimensions.\n"), "spec", 1, 2);
             return types::Function::Error;
         }
 
         //chekc if A and B are real complex or with imamg part at 0
-        if(isNoZeroImag(pDblA) == false && isNoZeroImag(pDblB) == false)
-        {//view A and B as real matrix
+        if (isNoZeroImag(pDblA) == false && isNoZeroImag(pDblB) == false)
+        {
+            //view A and B as real matrix
             bIsComplex = false;
         }
         else
@@ -272,14 +273,14 @@ types::Function::ReturnValue sci_spec(types::typed_list &in, int _iRetCount, typ
             bIsComplex = pDblA->isComplex() || pDblB->isComplex();
         }
 
-        if(bIsComplex)
+        if (bIsComplex)
         {
-            if(pDblA->isComplex() == false)
+            if (pDblA->isComplex() == false)
             {
                 pDblA->setComplex(true);
             }
 
-            if(pDblB->isComplex() == false)
+            if (pDblB->isComplex() == false)
             {
                 pDblB->setComplex(true);
             }
@@ -287,7 +288,7 @@ types::Function::ReturnValue sci_spec(types::typed_list &in, int _iRetCount, typ
             pDataA = (double*)oGetDoubleComplexFromPointer(pDblA->getReal(), pDblA->getImg(), pDblA->getSize());
             pDataB = (double*)oGetDoubleComplexFromPointer(pDblB->getReal(), pDblB->getImg(), pDblB->getSize());
 
-            if(!pDblA || !pDblB)
+            if (!pDblA || !pDblB)
             {
                 Scierror(999, _("%s: Cannot allocate more memory.\n"), "spec");
                 return types::Function::Error;
@@ -301,24 +302,24 @@ types::Function::ReturnValue sci_spec(types::typed_list &in, int _iRetCount, typ
 
         int totalSize = pDblA->getSize();
 
-        if((pDblA->isComplex() ? C2F(vfiniteComplex)(&totalSize, (doublecomplex*)pDataA) : C2F(vfinite)(&totalSize, pDataA)) == false)
+        if ((pDblA->isComplex() ? C2F(vfiniteComplex)(&totalSize, (doublecomplex*)pDataA) : C2F(vfinite)(&totalSize, pDataA)) == false)
         {
-                   Scierror(264, _("%s: Wrong value for argument %d: Must not contain NaN or Inf.\n"), "spec", 1);
-            return types::Function::Error;   
+            Scierror(264, _("%s: Wrong value for argument %d: Must not contain NaN or Inf.\n"), "spec", 1);
+            return types::Function::Error;
         }
 
-        if((pDblB->isComplex() ? C2F(vfiniteComplex)(&totalSize, (doublecomplex*)pDataB) : C2F(vfinite)(&totalSize, pDataB)) == false)
+        if ((pDblB->isComplex() ? C2F(vfiniteComplex)(&totalSize, (doublecomplex*)pDataB) : C2F(vfinite)(&totalSize, pDataB)) == false)
         {
-                   Scierror(264, _("%s: Wrong value for argument %d: Must not contain NaN or Inf.\n"), "spec", 2);
-            return types::Function::Error;   
+            Scierror(264, _("%s: Wrong value for argument %d: Must not contain NaN or Inf.\n"), "spec", 2);
+            return types::Function::Error;
         }
 
-        switch(_iRetCount)
+        switch (_iRetCount)
         {
             case 4:
             {
                 pDblL = new types::Double(pDblA->getRows(), pDblA->getCols(), true);
-                if(bIsComplex)
+                if (bIsComplex)
                 {
                     pL = (doublecomplex*)MALLOC(pDblA->getSize() * sizeof(doublecomplex));
                 }
@@ -326,14 +327,14 @@ types::Function::ReturnValue sci_spec(types::typed_list &in, int _iRetCount, typ
             case 3:
             {
                 pDblR = new types::Double(pDblA->getRows(), pDblA->getCols(), true);
-                if(bIsComplex)
+                if (bIsComplex)
                 {
                     pR = (doublecomplex*)MALLOC(pDblA->getSize() * sizeof(doublecomplex));
                 }
             }
             case 2:
             {
-                if(bIsComplex)
+                if (bIsComplex)
                 {
                     pBeta = (doublecomplex*)MALLOC(pDblA->getCols() * sizeof(doublecomplex));
                 }
@@ -341,7 +342,7 @@ types::Function::ReturnValue sci_spec(types::typed_list &in, int _iRetCount, typ
             }
             default : // case 1:
             {
-                if(bIsComplex)
+                if (bIsComplex)
                 {
                     pAlpha = (doublecomplex*)MALLOC(pDblA->getCols() * sizeof(doublecomplex));
                 }
@@ -349,46 +350,52 @@ types::Function::ReturnValue sci_spec(types::typed_list &in, int _iRetCount, typ
             }
         }
 
-        if(bIsComplex)
+        if (bIsComplex)
         {
             iRet = iEigen2ComplexM((doublecomplex*)pDataA, (doublecomplex*)pDataB, pDblA->getCols(), pAlpha, pBeta, pR, pL);
         }
         else
         {
-            iRet = iEigen2RealM(    pDataA, pDataB, pDblA->getCols(), 
-                                    pDblAlpha->getReal(), pDblAlpha->getImg(), 
-                                    pDblBeta ? pDblBeta->getReal()  : NULL, 
-                                    pDblR    ? pDblR->getReal()     : NULL, 
-                                    pDblR    ? pDblR->getImg()      : NULL, 
+            iRet = iEigen2RealM(    pDataA, pDataB, pDblA->getCols(),
+                                    pDblAlpha->getReal(), pDblAlpha->getImg(),
+                                    pDblBeta ? pDblBeta->getReal()  : NULL,
+                                    pDblR    ? pDblR->getReal()     : NULL,
+                                    pDblR    ? pDblR->getImg()      : NULL,
                                     pDblL    ? pDblL->getReal()     : NULL,
                                     pDblL    ? pDblL->getImg()      : NULL);
         }
 
-        if(iRet > 0)
+        if (iRet > 0)
         {
             sciprint(_("Warning :\n"));
             sciprint(_("Non convergence in the QZ algorithm.\n"));
             sciprint(_("The top %d  x %d blocks may not be in generalized Schur form.\n"), iRet);
         }
 
-        if(iRet < 0)
+        if (iRet < 0)
         {
             Scierror(998, _("%s: On entry to ZHEEV parameter number  3 had an illegal value (lapack library problem).\n"), "spec", iRet);
             return types::Function::Error;
         }
 
-        if(iRet > 0)
+        if (iRet > 0)
         {
-            if(bIsComplex)
+            if (bIsComplex)
             {
-                if(iRet <= pDblA->getCols())
+                if (iRet <= pDblA->getCols())
                 {
                     Scierror(24, _("%s: The QZ iteration failed in DGGEV.\n"), "spec");
                 }
                 else
                 {
-                    if(iRet ==  pDblA->getCols()+1) Scierror(999, _("%s: Other than QZ iteration failed in DHGEQZ.\n"), "spec");
-                    if(iRet ==  pDblA->getCols()+2) Scierror(999, _("%s: Error return from DTGEVC.\n"), "spec");
+                    if (iRet ==  pDblA->getCols() + 1)
+                    {
+                        Scierror(999, _("%s: Other than QZ iteration failed in DHGEQZ.\n"), "spec");
+                    }
+                    if (iRet ==  pDblA->getCols() + 2)
+                    {
+                        Scierror(999, _("%s: Error return from DTGEVC.\n"), "spec");
+                    }
                 }
             }
             else
@@ -398,19 +405,22 @@ types::Function::ReturnValue sci_spec(types::typed_list &in, int _iRetCount, typ
             return types::Function::Error;
         }
 
-        if(bIsComplex)
+        if (bIsComplex)
         {
-            switch(_iRetCount)
+            switch (_iRetCount)
             {
-                case 4: vGetPointerFromDoubleComplex(pL, pDblA->getSize(), pDblL->getReal(), pDblL->getImg());
-                case 3: vGetPointerFromDoubleComplex(pR, pDblA->getSize(), pDblR->getReal(), pDblR->getImg());
-                case 2: vGetPointerFromDoubleComplex(pBeta, pDblA->getCols(), pDblBeta->getReal(), pDblBeta->getImg());
+                case 4:
+                    vGetPointerFromDoubleComplex(pL, pDblA->getSize(), pDblL->getReal(), pDblL->getImg());
+                case 3:
+                    vGetPointerFromDoubleComplex(pR, pDblA->getSize(), pDblR->getReal(), pDblR->getImg());
+                case 2:
+                    vGetPointerFromDoubleComplex(pBeta, pDblA->getCols(), pDblBeta->getReal(), pDblBeta->getImg());
                 default : // case 1:
                     vGetPointerFromDoubleComplex(pAlpha, pDblA->getCols(), pDblAlpha->getReal(), pDblAlpha->getImg());
             }
         }
 
-        switch(_iRetCount)
+        switch (_iRetCount)
         {
             case 1:
             {
@@ -439,20 +449,30 @@ types::Function::ReturnValue sci_spec(types::typed_list &in, int _iRetCount, typ
             }
         }
 
-        if(pAlpha)
-                   vFreeDoubleComplexFromPointer(pAlpha);
-        if(pBeta)
-                   vFreeDoubleComplexFromPointer(pBeta);
-        if(pL)
-                   vFreeDoubleComplexFromPointer(pL);
-        if(pR)
-                   vFreeDoubleComplexFromPointer(pR);
-        if(pDblB->isComplex())
+        if (pAlpha)
+        {
+            vFreeDoubleComplexFromPointer(pAlpha);
+        }
+        if (pBeta)
+        {
+            vFreeDoubleComplexFromPointer(pBeta);
+        }
+        if (pL)
+        {
+            vFreeDoubleComplexFromPointer(pL);
+        }
+        if (pR)
+        {
+            vFreeDoubleComplexFromPointer(pR);
+        }
+        if (pDblB->isComplex())
+        {
             vFreeDoubleComplexFromPointer((doublecomplex*)pDataB);
+        }
 
     } // if(in.size() == 2)
 
-    if(pDblA->isComplex())
+    if (pDblA->isComplex())
     {
         vFreeDoubleComplexFromPointer((doublecomplex*)pDataA);
     }
@@ -461,15 +481,15 @@ types::Function::ReturnValue sci_spec(types::typed_list &in, int _iRetCount, typ
 }
 /*--------------------------------------------------------------------------*/
 bool isNoZeroImag(types::Double* _pDbl)
-{      
+{
     double* pdbl = _pDbl->getImg();
-    for(int i = 0 ; i < _pDbl->getSize() ; i++)
-       {
-               if (pdbl[i])
-               {
-                       return true;
-               }
-       }
-       return false;
+    for (int i = 0 ; i < _pDbl->getSize() ; i++)
+    {
+        if (pdbl[i])
+        {
+            return true;
+        }
+    }
+    return false;
 }
 /*--------------------------------------------------------------------------*/
index 24ca9fe..de3c31b 100644 (file)
@@ -17,9 +17,6 @@
 #include "polynom.hxx"
 #include "sparse.hxx"
 
-// FIXME : remove using namespace.
-using namespace types;
-
 int MultiplyDoubleByDouble(types::Double* _pDouble1, types::Double* _pDouble2, types::Double** _pDoubleOut);
 int MultiplyDoubleByPoly(types::Double* _pDouble, types::Polynom* _pPoly, types::Polynom** _pPolyOut);
 int MultiplyPolyByDouble(types::Polynom* _pPoly, types::Double* _pDouble, types::Polynom **_pPolyOut);
@@ -27,11 +24,15 @@ int MultiplyPolyByPoly(types::Polynom* _pPoly1, types::Polynom* _pPoly2, types::
 
 int DotMultiplyDoubleByDouble(types::Double* _pDouble1, types::Double* _pDouble2, types::Double** _pDoubleOut);
 
-int MultiplySparseBySparse(Sparse* _pSparse1, Sparse* _pSparse2, Sparse** _pSparseOut);
-int MultiplyDoubleBySparse(Double* _pDouble, Sparse *_pSparse, GenericType** _pDoubleOut);
-int MultiplySparseByDouble(Sparse *_pSparse, Double*_pDouble, GenericType** _pDoubleOut);
+int MultiplySparseBySparse(types::Sparse* _pSparse1, types::Sparse* _pSparse2, types::Sparse** _pSparseOut);
+int MultiplyDoubleBySparse(types::Double* _pDouble, types::Sparse *_pSparse, types::GenericType** _pDoubleOut);
+int MultiplySparseByDouble(types::Sparse *_pSparse, types::Double*_pDouble, types::GenericType** _pDoubleOut);
+
+int DotMultiplySparseBySparse(types::Sparse* _pSparse1, types::Sparse* _pSparse2, types::Sparse** _pSparseOut);
+int DotMultiplyDoubleBySparse(types::Double* _pDouble1, types::Sparse* _pSparse2, types::GenericType**  _pSparseOut);
+int DotMultiplySparseByDouble(types::Sparse* _pSparse1, types::Double* _pDouble2, types::GenericType** _pSparseOut);
 
-int DotMultiplySparseBySparse(Sparse* _pSparse1, Sparse* _pSparse2, Sparse** _pSparseOut);
-int DotMultiplyDoubleBySparse(Double* _pDouble1, Sparse* _pSparse2, GenericType**  _pSparseOut);
-int DotMultiplySparseByDouble(Sparse* _pSparse1, Double* _pDouble2, GenericType** _pSparseOut);
+int DotMultiplyDoubleByPoly(types::Double* _pDouble, types::Polynom* _pPoly, types::Polynom**  _pPolyOut);
+int DotMultiplyPolyByDouble(types::Polynom* _pPoly, types::Double* _pDouble, types::Polynom**  _pPolyOut);
+int DotMultiplyPolyByPoly(types::Polynom* _pPoly1, types::Polynom* _pPoly2, types::Polynom**  _pPolyOut);
 #endif /* __TYPES_MULTIPLICATION_HXX__ */
index 9aed3f3..bf23df6 100644 (file)
@@ -565,24 +565,41 @@ int AddDoubleToPoly(Polynom *_pPoly, Double *_pDouble, Polynom ** _pPolyOut)
 
     if (_pDouble->isScalar())
     {
-        //Clone original poly
         (*_pPolyOut) = _pPoly->clone()->getAs<Polynom>();
-        for (int i = 0 ; i < (*_pPolyOut)->getSize() ; i++)
+
+        if (bComplex1 && bComplex2)
         {
-            SinglePoly *pOutPoly    = (*_pPolyOut)->get(i);
-            double *pOutPolyR       = pOutPoly->getCoef()->get();
-            pOutPolyR[0]   += pInDblR[0];
-        }
+            for (int i = 0 ; i < (*_pPolyOut)->getSize() ; i++)
+            {
+                SinglePoly *pSPOut   = (*_pPolyOut)->get(i);
+                double *pOutPolyR    = pSPOut->getCoef()->getReal();
+                double *pOutPolyI    = pSPOut->getCoef()->getImg();
 
-        if ((*_pPolyOut)->isComplex() || _pDouble->isComplex())
+                pOutPolyR[0] += pInDblR[0];
+                pOutPolyI[0] += pInDblI[0];
+            }
+        }
+        else if (bComplex2)
         {
             (*_pPolyOut)->setComplex(true);
             for (int i = 0 ; i < (*_pPolyOut)->getSize() ; i++)
             {
-                SinglePoly *pOutPoly    = (*_pPolyOut)->get(i);
-                double *pOutPolyI       = pOutPoly->getCoef()->getImg();
+                SinglePoly *pSPOut   = (*_pPolyOut)->get(i);
+                double *pOutPolyR    = pSPOut->getCoef()->getReal();
+                double *pOutPolyI    = pSPOut->getCoef()->getImg();
+
+                pOutPolyR[0] += pInDblR[0];
+                pOutPolyI[0] = pInDblI[0];
+            }
+        }
+        else
+        {
+            for (int i = 0 ; i < (*_pPolyOut)->getSize() ; i++)
+            {
+                SinglePoly *pSPOut = (*_pPolyOut)->get(i);
+                double *pOutPolyR  = pSPOut->getCoef()->getReal();
 
-                pOutPolyI[0]            +=  (pInDblI == NULL ? 0 : pInDblI[0]);
+                pOutPolyR[0] += pInDblR[0];
             }
         }
 
@@ -608,33 +625,43 @@ int AddDoubleToPoly(Polynom *_pPoly, Double *_pDouble, Polynom ** _pPolyOut)
         }
     }
 
-    (*_pPolyOut) = new Polynom();
-    //Create new SinglePoly
-    **_pPolyOut = *_pPoly;
-
-    for (int i = 0 ; i < (*_pPolyOut)->getSize() ; i++)
+    (*_pPolyOut) = _pPoly->clone()->getAs<Polynom>();
+    if (bComplex1 && bComplex2)
     {
-        SinglePoly *pInPoly  = _pPoly->get(i);
-        SinglePoly *pOutPoly = (*_pPolyOut)->get(i);
-        double *pInPolyR     = pInPoly->getCoef()->getReal();
-        double *pOutPolyR    = pOutPoly->getCoef()->getReal();
+        for (int i = 0 ; i < (*_pPolyOut)->getSize() ; i++)
+        {
+            SinglePoly *pSPOut   = (*_pPolyOut)->get(i);
+            double *pOutPolyR    = pSPOut->getCoef()->getReal();
+            double *pOutPolyI    = pSPOut->getCoef()->getImg();
 
-        pOutPolyR[0] = pInDblR[i] + pInPolyR[0];
+            pOutPolyR[0] += pInDblR[i];
+            pOutPolyI[0] += pInDblI[i];
+        }
     }
-
-    if (bComplex1 || bComplex2)
+    else if (bComplex2)
     {
         (*_pPolyOut)->setComplex(true);
         for (int i = 0 ; i < (*_pPolyOut)->getSize() ; i++)
         {
-            SinglePoly *pInPoly  = _pPoly->get(i);
-            SinglePoly *pOutPoly = (*_pPolyOut)->get(i);
-            double *pInPolyI     = pInPoly->getCoef()->getImg();
-            double *pOutPolyI    = pOutPoly->getCoef()->getImg();
+            SinglePoly *pSPOut   = (*_pPolyOut)->get(i);
+            double *pOutPolyR    = pSPOut->getCoef()->getReal();
+            double *pOutPolyI    = pSPOut->getCoef()->getImg();
 
-            pOutPolyI[0] = (pInDblI != NULL ? pInDblI[i] : 0) + (pInPolyI != NULL ? pInPolyI[0] : 0);
+            pOutPolyR[0] += pInDblR[i];
+            pOutPolyI[0] = pInDblI[i];
         }
     }
+    else
+    {
+        for (int i = 0 ; i < (*_pPolyOut)->getSize() ; i++)
+        {
+            SinglePoly *pSPOut = (*_pPolyOut)->get(i);
+            double *pOutPolyR  = pSPOut->getCoef()->getReal();
+
+            pOutPolyR[0] += pInDblR[i];
+        }
+    }
+
     return 0;
 }
 
index 427d900..58e8702 100644 (file)
@@ -24,6 +24,7 @@ extern "C"
 #include "operation_f.h"
 #include "localization.h"
 #include "charEncoding.h"
+#include "elem_common.h"
 }
 
 using namespace types;
@@ -111,10 +112,60 @@ InternalType *GenericDotTimes(InternalType *_pLeftOperand, InternalType *_pRight
     }
 
     /*
+    ** DOUBLE .* POLY
+    */
+    if (_pLeftOperand->isDouble() && _pRightOperand->isPoly())
+    {
+        Double *pL   = _pLeftOperand->getAs<Double>();
+        Polynom *pR  = _pRightOperand->getAs<Polynom>();
+
+        int iResult = DotMultiplyDoubleByPoly(pL, pR, (Polynom**)&pResult);
+        if (iResult)
+        {
+            throw ast::ScilabError(_W("Inconsistent row/column dimensions.\n"));
+        }
+
+        return pResult;
+    }
+
+    /*
+    ** POLY .* DOUBLE
+    */
+    if (_pLeftOperand->isPoly() && _pRightOperand->isDouble())
+    {
+        Polynom *pL   = _pLeftOperand->getAs<Polynom>();
+        Double *pR    = _pRightOperand->getAs<Double>();
+
+        int iResult = DotMultiplyPolyByDouble(pL, pR, (Polynom**)&pResult);
+        if (iResult)
+        {
+            throw ast::ScilabError(_W("Inconsistent row/column dimensions.\n"));
+        }
+
+        return pResult;
+    }
+
+    /*
+    ** POLY .* POLY
+    */
+    if (_pLeftOperand->isPoly() && _pRightOperand->isPoly())
+    {
+        Polynom *pL   = _pLeftOperand->getAs<Polynom>();
+        Polynom *pR   = _pRightOperand->getAs<Polynom>();
+
+        int iResult = DotMultiplyPolyByPoly(pL, pR, (Polynom**)&pResult);
+        if (iResult)
+        {
+            throw ast::ScilabError(_W("Inconsistent row/column dimensions.\n"));
+        }
+
+        return pResult;
+    }
+
+    /*
     ** Default case : Return NULL will Call Overloading.
     */
     return NULL;
-
 }
 
 InternalType *GenericTimes(InternalType *_pLeftOperand, InternalType *_pRightOperand)
@@ -1614,3 +1665,121 @@ int DotMultiplySparseByDouble(Sparse* _pSparse, Double* _pDouble, GenericType**
 {
     return DotMultiplyDoubleBySparse(_pDouble, _pSparse, _pOut);
 }
+
+int DotMultiplyPolyByDouble(Polynom* _pPoly, Double* _pDouble, Polynom** _pPolyOut)
+{
+    return DotMultiplyDoubleByPoly(_pDouble, _pPoly, _pPolyOut);
+}
+
+int DotMultiplyDoubleByPoly(Double* _pDouble, Polynom* _pPoly, Polynom** _pPolyOut)
+{
+    if (_pDouble->isScalar() == false &&
+            _pPoly->isScalar() == false &&
+            _pDouble->getSize() != _pPoly->getSize())
+    {
+        return 1;
+    }
+
+    Polynom* pPolyTemp = new Polynom(_pPoly->getVariableName(), _pDouble->getDims(), _pDouble->getDimsArray());
+    pPolyTemp->setCoef(_pDouble);
+    int iErr = DotMultiplyPolyByPoly(pPolyTemp, _pPoly, _pPolyOut);
+    delete pPolyTemp;
+    return iErr;
+}
+
+int DotMultiplyPolyByPoly(Polynom* _pPoly1, Polynom* _pPoly2, Polynom** _pPolyOut)
+{
+    if (_pPoly1->isScalar() || _pPoly2->isScalar())
+    {
+        return MultiplyPolyByPoly(_pPoly1, _pPoly2, _pPolyOut);
+    }
+    else
+    {
+        if (_pPoly1->getSize() != _pPoly2->getSize())
+        {
+            return 1;
+        }
+
+        int* piRank = new int[_pPoly1->getSize()];
+        for (int i = 0 ; i < _pPoly1->getSize() ; i++)
+        {
+            piRank[i] = _pPoly1->get(i)->getRank() + _pPoly2->get(i)->getRank() - 1;
+        }
+
+        (*_pPolyOut) = new Polynom(_pPoly1->getVariableName(), _pPoly1->getDims(), _pPoly1->getDimsArray(), piRank);
+
+        if (_pPoly1->isComplex() && _pPoly2->isComplex())
+        {
+            (*_pPolyOut)->setComplex(true);
+            for (int i = 0; i < _pPoly1->getSize(); i++)
+            {
+                SinglePoly *pSP1    = _pPoly1->get(i);
+                SinglePoly *pSP2    = _pPoly2->get(i);
+                SinglePoly *pSPOut  = (*_pPolyOut)->get(i);
+                Double *pCoef1      = pSP1->getCoef();
+                Double *pCoef2      = pSP2->getCoef();
+                Double *pCoefOut    = pSPOut->getCoef();
+
+                pCoefOut->setZeros();
+
+                iMultiComplexPolyByComplexPoly(
+                    pCoef1->get(), pCoef1->getImg(), pSP1->getRank(),
+                    pCoef2->get(), pCoef2->getImg(), pSP2->getRank(),
+                    pCoefOut->get(), pCoefOut->getImg(), pSPOut->getRank());
+
+            }
+        }
+        else if (_pPoly1->isComplex())
+        {
+            (*_pPolyOut)->setComplex(true);
+            for (int i = 0; i < _pPoly1->getSize(); i++)
+            {
+                SinglePoly *pSP1   = _pPoly1->get(i);
+                SinglePoly *pSP2   = _pPoly2->get(i);
+                SinglePoly *pSPOut = (*_pPolyOut)->get(i);
+
+                pSPOut->getCoef()->setZeros();
+
+                iMultiComplexPolyByRealPoly(
+                    pSP1->getCoef()->get(), pSP1->getCoef()->getImg(), pSP1->getRank(),
+                    pSP2->getCoef()->get(), pSP2->getRank(),
+                    pSPOut->getCoef()->get(), pSPOut->getCoef()->getImg(), pSPOut->getRank());
+            }
+        }
+        else if (_pPoly2->isComplex())
+        {
+            (*_pPolyOut)->setComplex(true);
+            for (int i = 0; i < _pPoly1->getSize(); i++)
+            {
+                SinglePoly *pSP1   = _pPoly1->get(i);
+                SinglePoly *pSP2   = _pPoly2->get(i);
+                SinglePoly *pSPOut = (*_pPolyOut)->get(i);
+
+                pSPOut->getCoef()->setZeros();
+
+                iMultiRealPolyByComplexPoly(
+                    pSP1->getCoef()->get(), pSP1->getRank(),
+                    pSP2->getCoef()->get(), pSP2->getCoef()->getImg(), pSP2->getRank(),
+                    pSPOut->getCoef()->get(), pSPOut->getCoef()->getImg(), pSPOut->getRank());
+            }
+        }
+        else
+        {
+            for (int i = 0; i < _pPoly1->getSize(); i++)
+            {
+                SinglePoly *pSP1   = _pPoly1->get(i);
+                SinglePoly *pSP2   = _pPoly2->get(i);
+                SinglePoly *pSPOut = (*_pPolyOut)->get(i);
+
+                pSPOut->getCoef()->setZeros();
+
+                iMultiRealPolyByRealPoly(
+                    pSP1->getCoef()->get(), pSP1->getRank(),
+                    pSP2->getCoef()->get(), pSP2->getRank(),
+                    pSPOut->getCoef()->get(), pSPOut->getRank());
+            }
+        }
+    }
+
+    return 0;
+}
diff --git a/scilab/modules/overloading/macros/%r_simp.sci b/scilab/modules/overloading/macros/%r_simp.sci
deleted file mode 100644 (file)
index 684c7a8..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-// Copyright (C) INRIA
-// 
-// 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
-
-function h=%r_simp(h)
-// implement complex case
-
-endfunction
index 2d54c3f..19ddba8 100644 (file)
@@ -61,50 +61,36 @@ src/fortran/calcsc.f \
 src/fortran/writebufsfact.f \
 src/fortran/chkvar.f
 
-
-GATEWAY_C_SOURCES = sci_gateway/c/gw_polynomials.c \
-sci_gateway/c/sci_sfact.c \
-sci_gateway/c/sci_cleanp.c \
-sci_gateway/c/sci_sum.c \
-sci_gateway/c/sci_prod.c \
-sci_gateway/c/sci_diag.c \
-sci_gateway/c/sci_simp_mode.c \
-sci_gateway/c/sci_roots.c \
-sci_gateway/c/sci_varn.c \
-sci_gateway/c/sci_simp.c \
-sci_gateway/c/sci_bezout.c \
-sci_gateway/c/sci_tril.c \
-sci_gateway/c/sci_div.c \
-sci_gateway/c/sci_coeff.c \
-sci_gateway/c/sci_poly.c \
-sci_gateway/c/sci_triu.c \
-sci_gateway/c/sci_degree.c
-
-GATEWAY_FORTRAN_SOURCES =  sci_gateway/fortran/sci_f_simp.f \
-sci_gateway/fortran/sci_f_poly.f \
-sci_gateway/fortran/sci_f_varn.f \
-sci_gateway/fortran/sci_f_sum.f \
-sci_gateway/fortran/sci_f_div.f \
-sci_gateway/fortran/sci_f_diag.f \
-sci_gateway/fortran/sci_f_prod.f \
-sci_gateway/fortran/polops.f \
-sci_gateway/fortran/sci_f_bezout.f \
-sci_gateway/fortran/sci_f_triu_tril.f \
-sci_gateway/fortran/sci_f_roots.f \
-sci_gateway/fortran/sci_f_psimp.f \
-sci_gateway/fortran/sci_f_rsimp.f \
-sci_gateway/fortran/sci_f_coeff.f \
-sci_gateway/fortran/sci_f_degree.f \
-sci_gateway/fortran/sci_f_pclean.f \
-sci_gateway/fortran/sci_f_sfact.f \
-sci_gateway/fortran/sci_f_simpmd.f
+GATEWAY_CXX_SOURCES = \
+sci_gateway/cpp/polynomials_gw.cpp \
+sci_gateway/cpp/sci_poly.cpp \
+sci_gateway/cpp/sci_varn.cpp \
+sci_gateway/cpp/sci_roots.cpp \
+sci_gateway/cpp/sci_degree.cpp \
+sci_gateway/cpp/sci_coeff.cpp \
+sci_gateway/cpp/sci_pppdiv.cpp \
+sci_gateway/cpp/sci_simpMode.cpp \
+sci_gateway/cpp/sci_simp.cpp \
+sci_gateway/cpp/sci_sfact.cpp \
+sci_gateway/cpp/sci_bezout.cpp
 
 
 libscipolynomials_la_CPPFLAGS = -I$(srcdir)/includes/ \
                                -I$(top_srcdir)/libs/MALLOC/includes/ \
+                               -I$(top_srcdir)/libs/dynamiclibrary/includes/ \
                                -I$(top_srcdir)/modules/output_stream/includes \
                                -I$(top_srcdir)/modules/operations/includes \
                                -I$(top_srcdir)/modules/api_scilab/includes \
+                               -I$(top_srcdir)/modules/types/includes \
+                               -I$(top_srcdir)/modules/ast/includes \
+                               -I$(top_srcdir)/modules/localization/includes \
+                               -I$(top_srcdir)/modules/symbol/includes \
+                               -I$(top_srcdir)/modules/system_env/includes \
+                               -I$(top_srcdir)/modules/threads/includes \
+                               -I$(top_srcdir)/modules/string/includes \
+                               -I$(top_srcdir)/modules/console/includes \
+                -I$(top_srcdir)/modules/elementary_functions/includes/ \
+                               $(EIGEN_CPPFLAGS) \
                                $(AM_CPPFLAGS)
 
 if MAINTAINER_MODE
@@ -117,7 +103,7 @@ endif
 
 
 libscipolynomials_algo_la_SOURCES = $(POLYNOMIALS_FORTRAN_SOURCES)
-libscipolynomials_la_SOURCES = $(GATEWAY_FORTRAN_SOURCES) $(GATEWAY_C_SOURCES)
+libscipolynomials_la_SOURCES = $(GATEWAY_FORTRAN_SOURCES) $(GATEWAY_C_SOURCES) $(GATEWAY_CXX_SOURCES)
 libscipolynomials_algo_la_CPPFLAGS = $(libscipolynomials_la_CPPFLAGS)
 
 # For the code check (splint)
@@ -132,7 +118,7 @@ modulename=polynomials
 
 #### polynomials : Conf files ####
 libscipolynomials_la_rootdir = $(mydatadir)
-libscipolynomials_la_root_DATA =  license.txt 
+libscipolynomials_la_root_DATA =  license.txt
 
 
 #### polynomials : init scripts ####
index f009c76..2479327 100644 (file)
@@ -150,29 +150,18 @@ libscipolynomials_algo_la_OBJECTS =  \
 @MAINTAINER_MODE_FALSE@am_libscipolynomials_algo_la_rpath =
 @MAINTAINER_MODE_TRUE@am_libscipolynomials_algo_la_rpath =
 libscipolynomials_la_DEPENDENCIES = libscipolynomials-algo.la
-am__objects_2 = sci_f_simp.lo sci_f_poly.lo sci_f_varn.lo sci_f_sum.lo \
-       sci_f_div.lo sci_f_diag.lo sci_f_prod.lo polops.lo \
-       sci_f_bezout.lo sci_f_triu_tril.lo sci_f_roots.lo \
-       sci_f_psimp.lo sci_f_rsimp.lo sci_f_coeff.lo sci_f_degree.lo \
-       sci_f_pclean.lo sci_f_sfact.lo sci_f_simpmd.lo
-am__objects_3 = libscipolynomials_la-gw_polynomials.lo \
-       libscipolynomials_la-sci_sfact.lo \
-       libscipolynomials_la-sci_cleanp.lo \
-       libscipolynomials_la-sci_sum.lo \
-       libscipolynomials_la-sci_prod.lo \
-       libscipolynomials_la-sci_diag.lo \
-       libscipolynomials_la-sci_simp_mode.lo \
-       libscipolynomials_la-sci_roots.lo \
+am__objects_2 = libscipolynomials_la-polynomials_gw.lo \
+       libscipolynomials_la-sci_poly.lo \
        libscipolynomials_la-sci_varn.lo \
-       libscipolynomials_la-sci_simp.lo \
-       libscipolynomials_la-sci_bezout.lo \
-       libscipolynomials_la-sci_tril.lo \
-       libscipolynomials_la-sci_div.lo \
+       libscipolynomials_la-sci_roots.lo \
+       libscipolynomials_la-sci_degree.lo \
        libscipolynomials_la-sci_coeff.lo \
-       libscipolynomials_la-sci_poly.lo \
-       libscipolynomials_la-sci_triu.lo \
-       libscipolynomials_la-sci_degree.lo
-am_libscipolynomials_la_OBJECTS = $(am__objects_2) $(am__objects_3)
+       libscipolynomials_la-sci_pppdiv.lo \
+       libscipolynomials_la-sci_simpMode.lo \
+       libscipolynomials_la-sci_simp.lo \
+       libscipolynomials_la-sci_sfact.lo \
+       libscipolynomials_la-sci_bezout.lo
+am_libscipolynomials_la_OBJECTS = $(am__objects_2)
 libscipolynomials_la_OBJECTS = $(am_libscipolynomials_la_OBJECTS)
 @MAINTAINER_MODE_FALSE@am_libscipolynomials_la_rpath =
 @MAINTAINER_MODE_TRUE@am_libscipolynomials_la_rpath = -rpath \
@@ -181,14 +170,14 @@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/modules/core/includes
 depcomp = $(SHELL) $(top_srcdir)/config/depcomp
 am__depfiles_maybe = depfiles
 am__mv = mv -f
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
-       $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-       --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
-       $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-       --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+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) \
@@ -530,55 +519,42 @@ src/fortran/calcsc.f \
 src/fortran/writebufsfact.f \
 src/fortran/chkvar.f
 
-GATEWAY_C_SOURCES = sci_gateway/c/gw_polynomials.c \
-sci_gateway/c/sci_sfact.c \
-sci_gateway/c/sci_cleanp.c \
-sci_gateway/c/sci_sum.c \
-sci_gateway/c/sci_prod.c \
-sci_gateway/c/sci_diag.c \
-sci_gateway/c/sci_simp_mode.c \
-sci_gateway/c/sci_roots.c \
-sci_gateway/c/sci_varn.c \
-sci_gateway/c/sci_simp.c \
-sci_gateway/c/sci_bezout.c \
-sci_gateway/c/sci_tril.c \
-sci_gateway/c/sci_div.c \
-sci_gateway/c/sci_coeff.c \
-sci_gateway/c/sci_poly.c \
-sci_gateway/c/sci_triu.c \
-sci_gateway/c/sci_degree.c
-
-GATEWAY_FORTRAN_SOURCES = sci_gateway/fortran/sci_f_simp.f \
-sci_gateway/fortran/sci_f_poly.f \
-sci_gateway/fortran/sci_f_varn.f \
-sci_gateway/fortran/sci_f_sum.f \
-sci_gateway/fortran/sci_f_div.f \
-sci_gateway/fortran/sci_f_diag.f \
-sci_gateway/fortran/sci_f_prod.f \
-sci_gateway/fortran/polops.f \
-sci_gateway/fortran/sci_f_bezout.f \
-sci_gateway/fortran/sci_f_triu_tril.f \
-sci_gateway/fortran/sci_f_roots.f \
-sci_gateway/fortran/sci_f_psimp.f \
-sci_gateway/fortran/sci_f_rsimp.f \
-sci_gateway/fortran/sci_f_coeff.f \
-sci_gateway/fortran/sci_f_degree.f \
-sci_gateway/fortran/sci_f_pclean.f \
-sci_gateway/fortran/sci_f_sfact.f \
-sci_gateway/fortran/sci_f_simpmd.f
+GATEWAY_CXX_SOURCES = \
+sci_gateway/cpp/polynomials_gw.cpp \
+sci_gateway/cpp/sci_poly.cpp \
+sci_gateway/cpp/sci_varn.cpp \
+sci_gateway/cpp/sci_roots.cpp \
+sci_gateway/cpp/sci_degree.cpp \
+sci_gateway/cpp/sci_coeff.cpp \
+sci_gateway/cpp/sci_pppdiv.cpp \
+sci_gateway/cpp/sci_simpMode.cpp \
+sci_gateway/cpp/sci_simp.cpp \
+sci_gateway/cpp/sci_sfact.cpp \
+sci_gateway/cpp/sci_bezout.cpp
 
 libscipolynomials_la_CPPFLAGS = -I$(srcdir)/includes/ \
                                -I$(top_srcdir)/libs/MALLOC/includes/ \
+                               -I$(top_srcdir)/libs/dynamiclibrary/includes/ \
                                -I$(top_srcdir)/modules/output_stream/includes \
                                -I$(top_srcdir)/modules/operations/includes \
                                -I$(top_srcdir)/modules/api_scilab/includes \
+                               -I$(top_srcdir)/modules/types/includes \
+                               -I$(top_srcdir)/modules/ast/includes \
+                               -I$(top_srcdir)/modules/localization/includes \
+                               -I$(top_srcdir)/modules/symbol/includes \
+                               -I$(top_srcdir)/modules/system_env/includes \
+                               -I$(top_srcdir)/modules/threads/includes \
+                               -I$(top_srcdir)/modules/string/includes \
+                               -I$(top_srcdir)/modules/console/includes \
+                -I$(top_srcdir)/modules/elementary_functions/includes/ \
+                               $(EIGEN_CPPFLAGS) \
                                $(AM_CPPFLAGS)
 
 @MAINTAINER_MODE_TRUE@pkglib_LTLIBRARIES = libscipolynomials.la
 @MAINTAINER_MODE_FALSE@noinst_LTLIBRARIES = libscipolynomials-algo.la libscipolynomials.la
 @MAINTAINER_MODE_TRUE@noinst_LTLIBRARIES = libscipolynomials-algo.la
 libscipolynomials_algo_la_SOURCES = $(POLYNOMIALS_FORTRAN_SOURCES)
-libscipolynomials_la_SOURCES = $(GATEWAY_FORTRAN_SOURCES) $(GATEWAY_C_SOURCES)
+libscipolynomials_la_SOURCES = $(GATEWAY_FORTRAN_SOURCES) $(GATEWAY_C_SOURCES) $(GATEWAY_CXX_SOURCES)
 libscipolynomials_algo_la_CPPFLAGS = $(libscipolynomials_la_CPPFLAGS)
 
 # For the code check (splint)
@@ -591,7 +567,7 @@ modulename = polynomials
 
 #### polynomials : Conf files ####
 libscipolynomials_la_rootdir = $(mydatadir)
-libscipolynomials_la_root_DATA = license.txt 
+libscipolynomials_la_root_DATA = license.txt
 
 #### polynomials : init scripts ####
 libscipolynomials_la_etcdir = $(mydatadir)/etc
@@ -676,7 +652,7 @@ HELP_CHAPTERLANG = en_US fr_FR pt_BR
 all: all-am
 
 .SUFFIXES:
-.SUFFIXES: .sci .bin .c .f .lo .o .obj
+.SUFFIXES: .sci .bin .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 \
@@ -752,7 +728,7 @@ clean-pkglibLTLIBRARIES:
 libscipolynomials-algo.la: $(libscipolynomials_algo_la_OBJECTS) $(libscipolynomials_algo_la_DEPENDENCIES) $(EXTRA_libscipolynomials_algo_la_DEPENDENCIES) 
        $(F77LINK) $(am_libscipolynomials_algo_la_rpath) $(libscipolynomials_algo_la_OBJECTS) $(libscipolynomials_algo_la_LIBADD) $(LIBS)
 libscipolynomials.la: $(libscipolynomials_la_OBJECTS) $(libscipolynomials_la_DEPENDENCIES) $(EXTRA_libscipolynomials_la_DEPENDENCIES) 
-       $(F77LINK) $(am_libscipolynomials_la_rpath) $(libscipolynomials_la_OBJECTS) $(libscipolynomials_la_LIBADD) $(LIBS)
+       $(CXXLINK) $(am_libscipolynomials_la_rpath) $(libscipolynomials_la_OBJECTS) $(libscipolynomials_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
        -rm -f *.$(OBJEXT)
@@ -760,163 +736,115 @@ mostlyclean-compile:
 distclean-compile:
        -rm -f *.tab.c
 
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscipolynomials_la-gw_polynomials.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscipolynomials_la-polynomials_gw.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscipolynomials_la-sci_bezout.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscipolynomials_la-sci_cleanp.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscipolynomials_la-sci_coeff.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscipolynomials_la-sci_degree.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscipolynomials_la-sci_diag.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscipolynomials_la-sci_div.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscipolynomials_la-sci_poly.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscipolynomials_la-sci_prod.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscipolynomials_la-sci_pppdiv.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscipolynomials_la-sci_roots.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscipolynomials_la-sci_sfact.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscipolynomials_la-sci_simp.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscipolynomials_la-sci_simp_mode.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscipolynomials_la-sci_sum.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscipolynomials_la-sci_tril.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscipolynomials_la-sci_triu.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscipolynomials_la-sci_simpMode.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscipolynomials_la-sci_varn.Plo@am__quote@
 
-.c.o:
-@am__fastdepCC_TRUE@   $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(COMPILE) -c $<
-
-.c.obj:
-@am__fastdepCC_TRUE@   $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(COMPILE) -c `$(CYGPATH_W) '$<'`
-
-.c.lo:
-@am__fastdepCC_TRUE@   $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LTCOMPILE) -c -o $@ $<
-
-libscipolynomials_la-gw_polynomials.lo: sci_gateway/c/gw_polynomials.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libscipolynomials_la-gw_polynomials.lo -MD -MP -MF $(DEPDIR)/libscipolynomials_la-gw_polynomials.Tpo -c -o libscipolynomials_la-gw_polynomials.lo `test -f 'sci_gateway/c/gw_polynomials.c' || echo '$(srcdir)/'`sci_gateway/c/gw_polynomials.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscipolynomials_la-gw_polynomials.Tpo $(DEPDIR)/libscipolynomials_la-gw_polynomials.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/gw_polynomials.c' object='libscipolynomials_la-gw_polynomials.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) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libscipolynomials_la-gw_polynomials.lo `test -f 'sci_gateway/c/gw_polynomials.c' || echo '$(srcdir)/'`sci_gateway/c/gw_polynomials.c
-
-libscipolynomials_la-sci_sfact.lo: sci_gateway/c/sci_sfact.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libscipolynomials_la-sci_sfact.lo -MD -MP -MF $(DEPDIR)/libscipolynomials_la-sci_sfact.Tpo -c -o libscipolynomials_la-sci_sfact.lo `test -f 'sci_gateway/c/sci_sfact.c' || echo '$(srcdir)/'`sci_gateway/c/sci_sfact.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscipolynomials_la-sci_sfact.Tpo $(DEPDIR)/libscipolynomials_la-sci_sfact.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_sfact.c' object='libscipolynomials_la-sci_sfact.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) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libscipolynomials_la-sci_sfact.lo `test -f 'sci_gateway/c/sci_sfact.c' || echo '$(srcdir)/'`sci_gateway/c/sci_sfact.c
-
-libscipolynomials_la-sci_cleanp.lo: sci_gateway/c/sci_cleanp.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libscipolynomials_la-sci_cleanp.lo -MD -MP -MF $(DEPDIR)/libscipolynomials_la-sci_cleanp.Tpo -c -o libscipolynomials_la-sci_cleanp.lo `test -f 'sci_gateway/c/sci_cleanp.c' || echo '$(srcdir)/'`sci_gateway/c/sci_cleanp.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscipolynomials_la-sci_cleanp.Tpo $(DEPDIR)/libscipolynomials_la-sci_cleanp.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_cleanp.c' object='libscipolynomials_la-sci_cleanp.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) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libscipolynomials_la-sci_cleanp.lo `test -f 'sci_gateway/c/sci_cleanp.c' || echo '$(srcdir)/'`sci_gateway/c/sci_cleanp.c
-
-libscipolynomials_la-sci_sum.lo: sci_gateway/c/sci_sum.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libscipolynomials_la-sci_sum.lo -MD -MP -MF $(DEPDIR)/libscipolynomials_la-sci_sum.Tpo -c -o libscipolynomials_la-sci_sum.lo `test -f 'sci_gateway/c/sci_sum.c' || echo '$(srcdir)/'`sci_gateway/c/sci_sum.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscipolynomials_la-sci_sum.Tpo $(DEPDIR)/libscipolynomials_la-sci_sum.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_sum.c' object='libscipolynomials_la-sci_sum.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) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libscipolynomials_la-sci_sum.lo `test -f 'sci_gateway/c/sci_sum.c' || echo '$(srcdir)/'`sci_gateway/c/sci_sum.c
-
-libscipolynomials_la-sci_prod.lo: sci_gateway/c/sci_prod.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libscipolynomials_la-sci_prod.lo -MD -MP -MF $(DEPDIR)/libscipolynomials_la-sci_prod.Tpo -c -o libscipolynomials_la-sci_prod.lo `test -f 'sci_gateway/c/sci_prod.c' || echo '$(srcdir)/'`sci_gateway/c/sci_prod.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscipolynomials_la-sci_prod.Tpo $(DEPDIR)/libscipolynomials_la-sci_prod.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_prod.c' object='libscipolynomials_la-sci_prod.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) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libscipolynomials_la-sci_prod.lo `test -f 'sci_gateway/c/sci_prod.c' || echo '$(srcdir)/'`sci_gateway/c/sci_prod.c
-
-libscipolynomials_la-sci_diag.lo: sci_gateway/c/sci_diag.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libscipolynomials_la-sci_diag.lo -MD -MP -MF $(DEPDIR)/libscipolynomials_la-sci_diag.Tpo -c -o libscipolynomials_la-sci_diag.lo `test -f 'sci_gateway/c/sci_diag.c' || echo '$(srcdir)/'`sci_gateway/c/sci_diag.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscipolynomials_la-sci_diag.Tpo $(DEPDIR)/libscipolynomials_la-sci_diag.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_diag.c' object='libscipolynomials_la-sci_diag.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) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libscipolynomials_la-sci_diag.lo `test -f 'sci_gateway/c/sci_diag.c' || echo '$(srcdir)/'`sci_gateway/c/sci_diag.c
-
-libscipolynomials_la-sci_simp_mode.lo: sci_gateway/c/sci_simp_mode.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libscipolynomials_la-sci_simp_mode.lo -MD -MP -MF $(DEPDIR)/libscipolynomials_la-sci_simp_mode.Tpo -c -o libscipolynomials_la-sci_simp_mode.lo `test -f 'sci_gateway/c/sci_simp_mode.c' || echo '$(srcdir)/'`sci_gateway/c/sci_simp_mode.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscipolynomials_la-sci_simp_mode.Tpo $(DEPDIR)/libscipolynomials_la-sci_simp_mode.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_simp_mode.c' object='libscipolynomials_la-sci_simp_mode.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) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libscipolynomials_la-sci_simp_mode.lo `test -f 'sci_gateway/c/sci_simp_mode.c' || echo '$(srcdir)/'`sci_gateway/c/sci_simp_mode.c
-
-libscipolynomials_la-sci_roots.lo: sci_gateway/c/sci_roots.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libscipolynomials_la-sci_roots.lo -MD -MP -MF $(DEPDIR)/libscipolynomials_la-sci_roots.Tpo -c -o libscipolynomials_la-sci_roots.lo `test -f 'sci_gateway/c/sci_roots.c' || echo '$(srcdir)/'`sci_gateway/c/sci_roots.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscipolynomials_la-sci_roots.Tpo $(DEPDIR)/libscipolynomials_la-sci_roots.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_roots.c' object='libscipolynomials_la-sci_roots.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) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libscipolynomials_la-sci_roots.lo `test -f 'sci_gateway/c/sci_roots.c' || echo '$(srcdir)/'`sci_gateway/c/sci_roots.c
-
-libscipolynomials_la-sci_varn.lo: sci_gateway/c/sci_varn.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libscipolynomials_la-sci_varn.lo -MD -MP -MF $(DEPDIR)/libscipolynomials_la-sci_varn.Tpo -c -o libscipolynomials_la-sci_varn.lo `test -f 'sci_gateway/c/sci_varn.c' || echo '$(srcdir)/'`sci_gateway/c/sci_varn.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscipolynomials_la-sci_varn.Tpo $(DEPDIR)/libscipolynomials_la-sci_varn.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_varn.c' object='libscipolynomials_la-sci_varn.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) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libscipolynomials_la-sci_varn.lo `test -f 'sci_gateway/c/sci_varn.c' || echo '$(srcdir)/'`sci_gateway/c/sci_varn.c
-
-libscipolynomials_la-sci_simp.lo: sci_gateway/c/sci_simp.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libscipolynomials_la-sci_simp.lo -MD -MP -MF $(DEPDIR)/libscipolynomials_la-sci_simp.Tpo -c -o libscipolynomials_la-sci_simp.lo `test -f 'sci_gateway/c/sci_simp.c' || echo '$(srcdir)/'`sci_gateway/c/sci_simp.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscipolynomials_la-sci_simp.Tpo $(DEPDIR)/libscipolynomials_la-sci_simp.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_simp.c' object='libscipolynomials_la-sci_simp.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) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libscipolynomials_la-sci_simp.lo `test -f 'sci_gateway/c/sci_simp.c' || echo '$(srcdir)/'`sci_gateway/c/sci_simp.c
-
-libscipolynomials_la-sci_bezout.lo: sci_gateway/c/sci_bezout.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libscipolynomials_la-sci_bezout.lo -MD -MP -MF $(DEPDIR)/libscipolynomials_la-sci_bezout.Tpo -c -o libscipolynomials_la-sci_bezout.lo `test -f 'sci_gateway/c/sci_bezout.c' || echo '$(srcdir)/'`sci_gateway/c/sci_bezout.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscipolynomials_la-sci_bezout.Tpo $(DEPDIR)/libscipolynomials_la-sci_bezout.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_bezout.c' object='libscipolynomials_la-sci_bezout.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) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libscipolynomials_la-sci_bezout.lo `test -f 'sci_gateway/c/sci_bezout.c' || echo '$(srcdir)/'`sci_gateway/c/sci_bezout.c
-
-libscipolynomials_la-sci_tril.lo: sci_gateway/c/sci_tril.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libscipolynomials_la-sci_tril.lo -MD -MP -MF $(DEPDIR)/libscipolynomials_la-sci_tril.Tpo -c -o libscipolynomials_la-sci_tril.lo `test -f 'sci_gateway/c/sci_tril.c' || echo '$(srcdir)/'`sci_gateway/c/sci_tril.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscipolynomials_la-sci_tril.Tpo $(DEPDIR)/libscipolynomials_la-sci_tril.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_tril.c' object='libscipolynomials_la-sci_tril.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) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libscipolynomials_la-sci_tril.lo `test -f 'sci_gateway/c/sci_tril.c' || echo '$(srcdir)/'`sci_gateway/c/sci_tril.c
-
-libscipolynomials_la-sci_div.lo: sci_gateway/c/sci_div.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libscipolynomials_la-sci_div.lo -MD -MP -MF $(DEPDIR)/libscipolynomials_la-sci_div.Tpo -c -o libscipolynomials_la-sci_div.lo `test -f 'sci_gateway/c/sci_div.c' || echo '$(srcdir)/'`sci_gateway/c/sci_div.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscipolynomials_la-sci_div.Tpo $(DEPDIR)/libscipolynomials_la-sci_div.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_div.c' object='libscipolynomials_la-sci_div.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) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libscipolynomials_la-sci_div.lo `test -f 'sci_gateway/c/sci_div.c' || echo '$(srcdir)/'`sci_gateway/c/sci_div.c
-
-libscipolynomials_la-sci_coeff.lo: sci_gateway/c/sci_coeff.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libscipolynomials_la-sci_coeff.lo -MD -MP -MF $(DEPDIR)/libscipolynomials_la-sci_coeff.Tpo -c -o libscipolynomials_la-sci_coeff.lo `test -f 'sci_gateway/c/sci_coeff.c' || echo '$(srcdir)/'`sci_gateway/c/sci_coeff.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscipolynomials_la-sci_coeff.Tpo $(DEPDIR)/libscipolynomials_la-sci_coeff.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_coeff.c' object='libscipolynomials_la-sci_coeff.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) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libscipolynomials_la-sci_coeff.lo `test -f 'sci_gateway/c/sci_coeff.c' || echo '$(srcdir)/'`sci_gateway/c/sci_coeff.c
-
-libscipolynomials_la-sci_poly.lo: sci_gateway/c/sci_poly.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libscipolynomials_la-sci_poly.lo -MD -MP -MF $(DEPDIR)/libscipolynomials_la-sci_poly.Tpo -c -o libscipolynomials_la-sci_poly.lo `test -f 'sci_gateway/c/sci_poly.c' || echo '$(srcdir)/'`sci_gateway/c/sci_poly.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscipolynomials_la-sci_poly.Tpo $(DEPDIR)/libscipolynomials_la-sci_poly.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_poly.c' object='libscipolynomials_la-sci_poly.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) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libscipolynomials_la-sci_poly.lo `test -f 'sci_gateway/c/sci_poly.c' || echo '$(srcdir)/'`sci_gateway/c/sci_poly.c
-
-libscipolynomials_la-sci_triu.lo: sci_gateway/c/sci_triu.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libscipolynomials_la-sci_triu.lo -MD -MP -MF $(DEPDIR)/libscipolynomials_la-sci_triu.Tpo -c -o libscipolynomials_la-sci_triu.lo `test -f 'sci_gateway/c/sci_triu.c' || echo '$(srcdir)/'`sci_gateway/c/sci_triu.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscipolynomials_la-sci_triu.Tpo $(DEPDIR)/libscipolynomials_la-sci_triu.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_triu.c' object='libscipolynomials_la-sci_triu.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) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libscipolynomials_la-sci_triu.lo `test -f 'sci_gateway/c/sci_triu.c' || echo '$(srcdir)/'`sci_gateway/c/sci_triu.c
-
-libscipolynomials_la-sci_degree.lo: sci_gateway/c/sci_degree.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libscipolynomials_la-sci_degree.lo -MD -MP -MF $(DEPDIR)/libscipolynomials_la-sci_degree.Tpo -c -o libscipolynomials_la-sci_degree.lo `test -f 'sci_gateway/c/sci_degree.c' || echo '$(srcdir)/'`sci_gateway/c/sci_degree.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscipolynomials_la-sci_degree.Tpo $(DEPDIR)/libscipolynomials_la-sci_degree.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_degree.c' object='libscipolynomials_la-sci_degree.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) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libscipolynomials_la-sci_degree.lo `test -f 'sci_gateway/c/sci_degree.c' || echo '$(srcdir)/'`sci_gateway/c/sci_degree.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 $@ $<
+
+libscipolynomials_la-polynomials_gw.lo: sci_gateway/cpp/polynomials_gw.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscipolynomials_la-polynomials_gw.lo -MD -MP -MF $(DEPDIR)/libscipolynomials_la-polynomials_gw.Tpo -c -o libscipolynomials_la-polynomials_gw.lo `test -f 'sci_gateway/cpp/polynomials_gw.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/polynomials_gw.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscipolynomials_la-polynomials_gw.Tpo $(DEPDIR)/libscipolynomials_la-polynomials_gw.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/polynomials_gw.cpp' object='libscipolynomials_la-polynomials_gw.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) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscipolynomials_la-polynomials_gw.lo `test -f 'sci_gateway/cpp/polynomials_gw.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/polynomials_gw.cpp
+
+libscipolynomials_la-sci_poly.lo: sci_gateway/cpp/sci_poly.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscipolynomials_la-sci_poly.lo -MD -MP -MF $(DEPDIR)/libscipolynomials_la-sci_poly.Tpo -c -o libscipolynomials_la-sci_poly.lo `test -f 'sci_gateway/cpp/sci_poly.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_poly.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscipolynomials_la-sci_poly.Tpo $(DEPDIR)/libscipolynomials_la-sci_poly.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_poly.cpp' object='libscipolynomials_la-sci_poly.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) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscipolynomials_la-sci_poly.lo `test -f 'sci_gateway/cpp/sci_poly.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_poly.cpp
+
+libscipolynomials_la-sci_varn.lo: sci_gateway/cpp/sci_varn.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscipolynomials_la-sci_varn.lo -MD -MP -MF $(DEPDIR)/libscipolynomials_la-sci_varn.Tpo -c -o libscipolynomials_la-sci_varn.lo `test -f 'sci_gateway/cpp/sci_varn.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_varn.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscipolynomials_la-sci_varn.Tpo $(DEPDIR)/libscipolynomials_la-sci_varn.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_varn.cpp' object='libscipolynomials_la-sci_varn.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) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscipolynomials_la-sci_varn.lo `test -f 'sci_gateway/cpp/sci_varn.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_varn.cpp
+
+libscipolynomials_la-sci_roots.lo: sci_gateway/cpp/sci_roots.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscipolynomials_la-sci_roots.lo -MD -MP -MF $(DEPDIR)/libscipolynomials_la-sci_roots.Tpo -c -o libscipolynomials_la-sci_roots.lo `test -f 'sci_gateway/cpp/sci_roots.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_roots.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscipolynomials_la-sci_roots.Tpo $(DEPDIR)/libscipolynomials_la-sci_roots.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_roots.cpp' object='libscipolynomials_la-sci_roots.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) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscipolynomials_la-sci_roots.lo `test -f 'sci_gateway/cpp/sci_roots.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_roots.cpp
+
+libscipolynomials_la-sci_degree.lo: sci_gateway/cpp/sci_degree.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscipolynomials_la-sci_degree.lo -MD -MP -MF $(DEPDIR)/libscipolynomials_la-sci_degree.Tpo -c -o libscipolynomials_la-sci_degree.lo `test -f 'sci_gateway/cpp/sci_degree.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_degree.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscipolynomials_la-sci_degree.Tpo $(DEPDIR)/libscipolynomials_la-sci_degree.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_degree.cpp' object='libscipolynomials_la-sci_degree.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) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscipolynomials_la-sci_degree.lo `test -f 'sci_gateway/cpp/sci_degree.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_degree.cpp
+
+libscipolynomials_la-sci_coeff.lo: sci_gateway/cpp/sci_coeff.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscipolynomials_la-sci_coeff.lo -MD -MP -MF $(DEPDIR)/libscipolynomials_la-sci_coeff.Tpo -c -o libscipolynomials_la-sci_coeff.lo `test -f 'sci_gateway/cpp/sci_coeff.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_coeff.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscipolynomials_la-sci_coeff.Tpo $(DEPDIR)/libscipolynomials_la-sci_coeff.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_coeff.cpp' object='libscipolynomials_la-sci_coeff.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) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscipolynomials_la-sci_coeff.lo `test -f 'sci_gateway/cpp/sci_coeff.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_coeff.cpp
+
+libscipolynomials_la-sci_pppdiv.lo: sci_gateway/cpp/sci_pppdiv.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscipolynomials_la-sci_pppdiv.lo -MD -MP -MF $(DEPDIR)/libscipolynomials_la-sci_pppdiv.Tpo -c -o libscipolynomials_la-sci_pppdiv.lo `test -f 'sci_gateway/cpp/sci_pppdiv.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_pppdiv.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscipolynomials_la-sci_pppdiv.Tpo $(DEPDIR)/libscipolynomials_la-sci_pppdiv.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_pppdiv.cpp' object='libscipolynomials_la-sci_pppdiv.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) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscipolynomials_la-sci_pppdiv.lo `test -f 'sci_gateway/cpp/sci_pppdiv.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_pppdiv.cpp
+
+libscipolynomials_la-sci_simpMode.lo: sci_gateway/cpp/sci_simpMode.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscipolynomials_la-sci_simpMode.lo -MD -MP -MF $(DEPDIR)/libscipolynomials_la-sci_simpMode.Tpo -c -o libscipolynomials_la-sci_simpMode.lo `test -f 'sci_gateway/cpp/sci_simpMode.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_simpMode.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscipolynomials_la-sci_simpMode.Tpo $(DEPDIR)/libscipolynomials_la-sci_simpMode.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_simpMode.cpp' object='libscipolynomials_la-sci_simpMode.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) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscipolynomials_la-sci_simpMode.lo `test -f 'sci_gateway/cpp/sci_simpMode.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_simpMode.cpp
+
+libscipolynomials_la-sci_simp.lo: sci_gateway/cpp/sci_simp.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscipolynomials_la-sci_simp.lo -MD -MP -MF $(DEPDIR)/libscipolynomials_la-sci_simp.Tpo -c -o libscipolynomials_la-sci_simp.lo `test -f 'sci_gateway/cpp/sci_simp.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_simp.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscipolynomials_la-sci_simp.Tpo $(DEPDIR)/libscipolynomials_la-sci_simp.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_simp.cpp' object='libscipolynomials_la-sci_simp.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) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscipolynomials_la-sci_simp.lo `test -f 'sci_gateway/cpp/sci_simp.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_simp.cpp
+
+libscipolynomials_la-sci_sfact.lo: sci_gateway/cpp/sci_sfact.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscipolynomials_la-sci_sfact.lo -MD -MP -MF $(DEPDIR)/libscipolynomials_la-sci_sfact.Tpo -c -o libscipolynomials_la-sci_sfact.lo `test -f 'sci_gateway/cpp/sci_sfact.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_sfact.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscipolynomials_la-sci_sfact.Tpo $(DEPDIR)/libscipolynomials_la-sci_sfact.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_sfact.cpp' object='libscipolynomials_la-sci_sfact.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) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscipolynomials_la-sci_sfact.lo `test -f 'sci_gateway/cpp/sci_sfact.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_sfact.cpp
+
+libscipolynomials_la-sci_bezout.lo: sci_gateway/cpp/sci_bezout.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscipolynomials_la-sci_bezout.lo -MD -MP -MF $(DEPDIR)/libscipolynomials_la-sci_bezout.Tpo -c -o libscipolynomials_la-sci_bezout.lo `test -f 'sci_gateway/cpp/sci_bezout.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_bezout.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscipolynomials_la-sci_bezout.Tpo $(DEPDIR)/libscipolynomials_la-sci_bezout.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_bezout.cpp' object='libscipolynomials_la-sci_bezout.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) $(libscipolynomials_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscipolynomials_la-sci_bezout.lo `test -f 'sci_gateway/cpp/sci_bezout.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_bezout.cpp
 
 .f.o:
        $(F77COMPILE) -c -o $@ $<
@@ -1098,60 +1026,6 @@ writebufsfact.lo: src/fortran/writebufsfact.f
 chkvar.lo: src/fortran/chkvar.f
        $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o chkvar.lo `test -f 'src/fortran/chkvar.f' || echo '$(srcdir)/'`src/fortran/chkvar.f
 
-sci_f_simp.lo: sci_gateway/fortran/sci_f_simp.f
-       $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o sci_f_simp.lo `test -f 'sci_gateway/fortran/sci_f_simp.f' || echo '$(srcdir)/'`sci_gateway/fortran/sci_f_simp.f
-
-sci_f_poly.lo: sci_gateway/fortran/sci_f_poly.f
-       $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o sci_f_poly.lo `test -f 'sci_gateway/fortran/sci_f_poly.f' || echo '$(srcdir)/'`sci_gateway/fortran/sci_f_poly.f
-
-sci_f_varn.lo: sci_gateway/fortran/sci_f_varn.f
-       $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o sci_f_varn.lo `test -f 'sci_gateway/fortran/sci_f_varn.f' || echo '$(srcdir)/'`sci_gateway/fortran/sci_f_varn.f
-
-sci_f_sum.lo: sci_gateway/fortran/sci_f_sum.f
-       $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o sci_f_sum.lo `test -f 'sci_gateway/fortran/sci_f_sum.f' || echo '$(srcdir)/'`sci_gateway/fortran/sci_f_sum.f
-
-sci_f_div.lo: sci_gateway/fortran/sci_f_div.f
-       $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o sci_f_div.lo `test -f 'sci_gateway/fortran/sci_f_div.f' || echo '$(srcdir)/'`sci_gateway/fortran/sci_f_div.f
-
-sci_f_diag.lo: sci_gateway/fortran/sci_f_diag.f
-       $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o sci_f_diag.lo `test -f 'sci_gateway/fortran/sci_f_diag.f' || echo '$(srcdir)/'`sci_gateway/fortran/sci_f_diag.f
-
-sci_f_prod.lo: sci_gateway/fortran/sci_f_prod.f
-       $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o sci_f_prod.lo `test -f 'sci_gateway/fortran/sci_f_prod.f' || echo '$(srcdir)/'`sci_gateway/fortran/sci_f_prod.f
-
-polops.lo: sci_gateway/fortran/polops.f
-       $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o polops.lo `test -f 'sci_gateway/fortran/polops.f' || echo '$(srcdir)/'`sci_gateway/fortran/polops.f
-
-sci_f_bezout.lo: sci_gateway/fortran/sci_f_bezout.f
-       $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o sci_f_bezout.lo `test -f 'sci_gateway/fortran/sci_f_bezout.f' || echo '$(srcdir)/'`sci_gateway/fortran/sci_f_bezout.f
-
-sci_f_triu_tril.lo: sci_gateway/fortran/sci_f_triu_tril.f
-       $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o sci_f_triu_tril.lo `test -f 'sci_gateway/fortran/sci_f_triu_tril.f' || echo '$(srcdir)/'`sci_gateway/fortran/sci_f_triu_tril.f
-
-sci_f_roots.lo: sci_gateway/fortran/sci_f_roots.f
-       $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o sci_f_roots.lo `test -f 'sci_gateway/fortran/sci_f_roots.f' || echo '$(srcdir)/'`sci_gateway/fortran/sci_f_roots.f
-
-sci_f_psimp.lo: sci_gateway/fortran/sci_f_psimp.f
-       $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o sci_f_psimp.lo `test -f 'sci_gateway/fortran/sci_f_psimp.f' || echo '$(srcdir)/'`sci_gateway/fortran/sci_f_psimp.f
-
-sci_f_rsimp.lo: sci_gateway/fortran/sci_f_rsimp.f
-       $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o sci_f_rsimp.lo `test -f 'sci_gateway/fortran/sci_f_rsimp.f' || echo '$(srcdir)/'`sci_gateway/fortran/sci_f_rsimp.f
-
-sci_f_coeff.lo: sci_gateway/fortran/sci_f_coeff.f
-       $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o sci_f_coeff.lo `test -f 'sci_gateway/fortran/sci_f_coeff.f' || echo '$(srcdir)/'`sci_gateway/fortran/sci_f_coeff.f
-
-sci_f_degree.lo: sci_gateway/fortran/sci_f_degree.f
-       $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o sci_f_degree.lo `test -f 'sci_gateway/fortran/sci_f_degree.f' || echo '$(srcdir)/'`sci_gateway/fortran/sci_f_degree.f
-
-sci_f_pclean.lo: sci_gateway/fortran/sci_f_pclean.f
-       $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o sci_f_pclean.lo `test -f 'sci_gateway/fortran/sci_f_pclean.f' || echo '$(srcdir)/'`sci_gateway/fortran/sci_f_pclean.f
-
-sci_f_sfact.lo: sci_gateway/fortran/sci_f_sfact.f
-       $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o sci_f_sfact.lo `test -f 'sci_gateway/fortran/sci_f_sfact.f' || echo '$(srcdir)/'`sci_gateway/fortran/sci_f_sfact.f
-
-sci_f_simpmd.lo: sci_gateway/fortran/sci_f_simpmd.f
-       $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o sci_f_simpmd.lo `test -f 'sci_gateway/fortran/sci_f_simpmd.f' || echo '$(srcdir)/'`sci_gateway/fortran/sci_f_simpmd.f
-
 mostlyclean-libtool:
        -rm -f *.lo
 
index 226ddd0..d2e6280 100644 (file)
@@ -55,7 +55,7 @@
     </refsection>
     <refsection>
         <title>Examples</title>
-        <programlisting role="example"><![CDATA[ 
+        <programlisting role="example"><![CDATA[
 x=poly(0,'x');
 p1=(1+x^2)*(1-x);p2=1-x;
 [r,q]=pdiv(p1,p2)
@@ -76,4 +76,10 @@ p2*q+r-p1
             </member>
         </simplelist>
     </refsection>
+    <revhistory>
+        <revision>
+            <revnumber>6.0.0</revnumber>
+            <revremark>pdiv return a matrix of type 'constant' when all ranks are 0.</revremark>
+        </revision>
+    </revhistory>
 </refentry>
index e36ec36..fb5fc49 100644 (file)
@@ -47,7 +47,7 @@
     </refsection>
     <refsection>
         <title>Exemples</title>
-        <programlisting role="example"><![CDATA[ 
+        <programlisting role="example"><![CDATA[
 x=poly(0,'x');
 p1=(1+x^2)*(1-x);p2=1-x;
 [r,q]=pdiv(p1,p2)
@@ -68,4 +68,10 @@ p2*q+r-p1
             </member>
         </simplelist>
     </refsection>
+    <revhistory>
+        <revision>
+            <revnumber>6.0.0</revnumber>
+            <revremark>pdiv retourne une matrice de 'constant' quand tous les rangs sont nuls.</revremark>
+        </revision>
+    </revhistory>
 </refentry>
diff --git a/scilab/modules/polynomials/includes/dynlib_polynomials_gw.h b/scilab/modules/polynomials/includes/dynlib_polynomials_gw.h
new file mode 100644 (file)
index 0000000..dad34ac
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2012 - Scilab Enterprises - 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
+ *
+ */
+/*--------------------------------------------------------------------------*/
+#ifdef _MSC_VER
+#if POLYNOMIALS_GW_EXPORTS
+#define EXTERN_POLYNOMIALS_GW __declspec (dllexport)
+#else
+#define EXTERN_POLYNOMIALS_GW __declspec (dllimport)
+#endif
+#else
+#define EXTERN_POLYNOMIALS_GW
+#endif
diff --git a/scilab/modules/polynomials/includes/gw_polynomials.h b/scilab/modules/polynomials/includes/gw_polynomials.h
deleted file mode 100644 (file)
index 3cb02db..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2006-2008 - INRIA - Allan CORNET
- *
- * This file must be used under the terms of the CeCILL.
- * This source file is licensed as described in the file COPYING, which
- * you should have received as part of this distribution.  The terms
- * are also available at
- * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
- *
- */
-
-/*--------------------------------------------------------------------------*/
-#ifndef __GW_POLYNOMIALS__
-#define __GW_POLYNOMIALS__
-/*--------------------------------------------------------------------------*/
-#include "dynlib_polynomials.h"
-/*--------------------------------------------------------------------------*/
-POLYNOMIALS_IMPEXP int gw_polynomials(void);
-/*--------------------------------------------------------------------------*/
-POLYNOMIALS_IMPEXP int sci_poly_primitive(char *fname,unsigned long fname_len);
-POLYNOMIALS_IMPEXP int sci_roots(char *fname,unsigned long fname_len);
-POLYNOMIALS_IMPEXP int sci_degree(char *fname,unsigned long fname_len);
-POLYNOMIALS_IMPEXP int sci_coeff(char *fname,unsigned long fname_len);
-POLYNOMIALS_IMPEXP int sci_pppdiv(char *fname,unsigned long fname_len);
-POLYNOMIALS_IMPEXP int sci_simp(char *fname,unsigned long fname_len);
-POLYNOMIALS_IMPEXP int sci_psum(char *fname,unsigned long fname_len);
-POLYNOMIALS_IMPEXP int sci_pprod(char *fname,unsigned long fname_len);
-POLYNOMIALS_IMPEXP int sci_pdiag(char *fname,unsigned long fname_len);
-POLYNOMIALS_IMPEXP int sci_ptriu(char *fname,unsigned long fname_len);
-POLYNOMIALS_IMPEXP int sci_ptril(char *fname,unsigned long fname_len);
-POLYNOMIALS_IMPEXP int sci_bezout(char *fname,unsigned long fname_len);
-POLYNOMIALS_IMPEXP int sci_sfact(char *fname,unsigned long fname_len);
-POLYNOMIALS_IMPEXP int sci_simp_mode(char *fname,unsigned long fname_len);
-POLYNOMIALS_IMPEXP int sci_varn(char *fname,unsigned long fname_len);
-POLYNOMIALS_IMPEXP int sci_cleanp(char *fname,unsigned long fname_len);
-/*--------------------------------------------------------------------------*/
-#endif /*  __GW_POLYNOMIALS__ */
-/*--------------------------------------------------------------------------*/
-
diff --git a/scilab/modules/polynomials/includes/polynomials_gw.hxx b/scilab/modules/polynomials/includes/polynomials_gw.hxx
new file mode 100644 (file)
index 0000000..ffe558a
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2012 - Scilab Enterprises - 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 __POLYNOMIALS_GW_HXX__
+#define __POLYNOMIALS_GW_HXX__
+
+#include "cpp_gateway_prototype.hxx"
+#include "dynlib_polynomials_gw.h"
+
+class PolynomialsModule
+{
+private :
+    PolynomialsModule() {};
+    ~PolynomialsModule() {};
+public :
+    EXTERN_POLYNOMIALS_GW static int Load();
+};
+
+CPP_GATEWAY_PROTOTYPE(sci_poly);
+CPP_GATEWAY_PROTOTYPE(sci_varn);
+CPP_GATEWAY_PROTOTYPE(sci_roots);
+CPP_GATEWAY_PROTOTYPE(sci_coeff);
+CPP_GATEWAY_PROTOTYPE(sci_degree);
+CPP_GATEWAY_PROTOTYPE(sci_pppdiv);
+CPP_GATEWAY_PROTOTYPE(sci_simpMode);
+CPP_GATEWAY_PROTOTYPE(sci_simp);
+CPP_GATEWAY_PROTOTYPE(sci_sfact);
+CPP_GATEWAY_PROTOTYPE(sci_bezout);
+
+#endif /* __POLYNOMIALS_GW_HXX__ */
diff --git a/scilab/modules/polynomials/macros/%r_simp.sci b/scilab/modules/polynomials/macros/%r_simp.sci
new file mode 100644 (file)
index 0000000..4a105da
--- /dev/null
@@ -0,0 +1,27 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+//
+// 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
+
+function r=%r_simp(h)
+    if simp_mode() == %f then
+        r=h;
+        return;
+    end
+
+    if typeof(h) <> "rational"
+        error(msprintf(gettext("%s : Wrong type for input arguments #%d: A rational expected.\n"), "simp", 1));
+    end
+
+    r=h;
+    if isreal(h) == %f then
+        // implement complex case
+        return;
+    end
+
+    [r(2), r(3)] = simp(r(2), r(3));
+endfunction
similarity index 86%
rename from scilab/modules/overloading/macros/%s_r_p.sci
rename to scilab/modules/polynomials/macros/%s_r_p.sci
index cf70c0b..d4d97ae 100644 (file)
@@ -1,10 +1,10 @@
 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 // Copyright (C) INRIA
-// 
+//
 // 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    
+// are also available at
 // http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
 
 function f=%s_r_p(m,p)
@@ -13,11 +13,11 @@ function f=%s_r_p(m,p)
 
 
 [mp,np]=size(p)
-if mp*np<>1 then 
+if mp*np<>1 then
   f=m*invr(p),
 else
   [l,c]=size(m)
-  if m<>[] then m=m+poly(0,varn(p),'c'),end
+  if m<>[] then m=m+poly(0,varn(p),'coeff'),end
   if mp==-1&l*c==1|l==-1 then
     f=rlist(m,p*eye(),[])
   else
index 14e03d8..e90f395 100644 (file)
 #include "api_scilab.h"
 #include "MALLOC.h"
 /*--------------------------------------------------------------------------*/
-static int sci_notused(char *fname,unsigned long fname_len)
+static int sci_notused(char *fname, unsigned long fname_len)
 {
-       /* not used */
-       return 0;
+    /* not used */
+    return 0;
 }
 /*--------------------------------------------------------------------------*/
-static gw_generic_table Tab[] = {
-{sci_poly_primitive,"poly"},
-{sci_roots, "roots"},
-{sci_degree, "degree"},
-{sci_coeff, "coeff"},
-{sci_notused, ""}, /* not used but required primitives order (short cut fin,fun) */
-{sci_pppdiv, "pppdiv"},
-{sci_simp, "simp"},
-{sci_psum, "sum"},
-{sci_pprod, "prod"},
-{NULL, ""}, //"diag"
-{sci_ptriu, "triu"},
-{sci_ptril, "tril"},
-{sci_bezout, "bezout"},
-{sci_sfact, "sfact"},
-{sci_simp_mode, "simp_mode"},
-{sci_varn, "varn"},
-{sci_cleanp, "cleanp"}
-};
-/*--------------------------------------------------------------------------*/
 int gw_polynomials(void)
 {
-       return 0;
+    return 0;
 }
 /*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/polynomials/sci_gateway/cpp/polynomials_gw.cpp b/scilab/modules/polynomials/sci_gateway/cpp/polynomials_gw.cpp
new file mode 100644 (file)
index 0000000..5c4c492
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2012 - Scilab Enterprises - 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 "polynomials_gw.hxx"
+#include "context.hxx"
+
+#define MODULE_NAME L"polynomials"
+
+int PolynomialsModule::Load()
+{
+    symbol::Context::getInstance()->AddFunction(types::Function::createFunction(L"poly", &sci_poly, MODULE_NAME));
+    symbol::Context::getInstance()->AddFunction(types::Function::createFunction(L"varn", &sci_varn, MODULE_NAME));
+    symbol::Context::getInstance()->AddFunction(types::Function::createFunction(L"roots", &sci_roots, MODULE_NAME));
+    symbol::Context::getInstance()->AddFunction(types::Function::createFunction(L"coeff", &sci_coeff, MODULE_NAME));
+    symbol::Context::getInstance()->AddFunction(types::Function::createFunction(L"degree", &sci_degree, MODULE_NAME));
+    symbol::Context::getInstance()->AddFunction(types::Function::createFunction(L"pppdiv", &sci_pppdiv, MODULE_NAME));
+    symbol::Context::getInstance()->AddFunction(types::Function::createFunction(L"simp_mode", &sci_simpMode, MODULE_NAME));
+    symbol::Context::getInstance()->AddFunction(types::Function::createFunction(L"simp", &sci_simp, MODULE_NAME));
+    symbol::Context::getInstance()->AddFunction(types::Function::createFunction(L"sfact", &sci_sfact, MODULE_NAME));
+    symbol::Context::getInstance()->AddFunction(types::Function::createFunction(L"bezout", &sci_bezout, MODULE_NAME));
+    return 1;
+}
+
+
diff --git a/scilab/modules/polynomials/sci_gateway/cpp/sci_bezout.cpp b/scilab/modules/polynomials/sci_gateway/cpp/sci_bezout.cpp
new file mode 100644 (file)
index 0000000..0546bce
--- /dev/null
@@ -0,0 +1,141 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2012 - Scilab Enterprises - 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 "polynomials_gw.hxx"
+#include "function.hxx"
+#include "double.hxx"
+#include "polynom.hxx"
+#include "overload.hxx"
+#include "execvisitor.hxx"
+
+extern "C"
+{
+#include "Scierror.h"
+#include "localization.h"
+    extern int C2F(recbez)(double*, int*, double*, int*, double*, int*, double*, int*);
+}
+/*--------------------------------------------------------------------------*/
+types::Function::ReturnValue sci_bezout(types::typed_list &in, int _iRetCount, types::typed_list &out)
+{
+    bool bComplex     = false;
+    double* pdblIn[2] = {NULL, NULL};
+    int piDegree[2]   = {0, 0};
+    int iErr          = 0;
+    int iOne          = 1;
+
+    std::wstring wstrName = L"";
+
+    if (in.size() != 2)
+    {
+        Scierror(77, _("%s: Wrong number of input argument(s): %d expected.\n"), "bezout", 2);
+        return types::Function::Error;
+    }
+
+    if (_iRetCount != 2 && _iRetCount != 3)
+    {
+        Scierror(78, _("%s: Wrong number of output argument(s): %d to %d expected.\n"), "bezout", 2, 3);
+        return types::Function::Error;
+    }
+
+    // get input arguments
+    for (int i = 0; i < in.size(); i++)
+    {
+        if (in[i]->isPoly() == false && in[i]->isDouble() == false)
+        {
+            std::wstring wstFuncName = L"%"  + in[0]->getShortTypeStr() + L"_bezout";
+            return Overload::call(wstFuncName, in, _iRetCount, out, new ExecVisitor());
+        }
+
+        types::GenericType* pGT = in[i]->getAs<types::GenericType>();
+
+        if (pGT->isComplex())
+        {
+            Scierror(999, _("%s: Wrong type for input argument #%d: A real scalar expected.\n"), "bezout", i + 1);
+            return types::Function::Error;
+        }
+
+        if (pGT->isScalar() == false)
+        {
+            Scierror(999, _("%s: Wrong size for input argument #%d: A real scalar expected.\n"), "bezout", i + 1);
+            return types::Function::Error;
+        }
+
+        if (in[i]->isDouble())
+        {
+            pdblIn[i] = in[i]->getAs<types::Double>()->get();
+        }
+        else // polynom
+        {
+            types::Polynom* pPolyIn = in[i]->getAs<types::Polynom>();
+            if (wstrName != L"" && wstrName != pPolyIn->getVariableName())
+            {
+                Scierror(999, _("%s: Wrong value for input argument #%d: A polynom '%ls' expected.\n"), "bezout", i + 1, wstrName.c_str());
+                return types::Function::Error;
+            }
+
+            wstrName    = pPolyIn->getVariableName();
+            pdblIn[i]   = pPolyIn->get(0)->getCoefReal();
+            piDegree[i] = pPolyIn->get(0)->getRank() - 1;
+        }
+    }
+
+    // perform operation
+    int iMaxRank     = max(piDegree[0], piDegree[1]) + 1;
+    double* pdblWork = new double[10 * iMaxRank + 3 * iMaxRank * iMaxRank];
+    double* pdblOut  = new double[piDegree[0] + 9];
+    int ipb[6];
+
+    C2F(recbez)(pdblIn[0], &piDegree[0], pdblIn[1], &piDegree[1], pdblOut, ipb, pdblWork, &iErr);
+    delete pdblWork;
+
+    // create result
+    int np = ipb[1] - ipb[0];
+    double* pdblSP = NULL;
+    types::SinglePoly* pSP = new types::SinglePoly(&pdblSP, np);
+    memcpy(pdblSP, pdblOut + ipb[0] - 1, np * sizeof(double));
+
+    if (wstrName == L"")
+    {
+        wstrName = L"s";
+    }
+
+    types::Polynom* pPolyGCD = new types::Polynom(wstrName, 1, 1);
+    pPolyGCD->set(0, pSP);
+    delete pSP;
+
+    types::Polynom* pPolyU = new types::Polynom(wstrName, 2, 2);
+    for (int i = 0; i < 4; i++)
+    {
+        int ii     = i + 1;
+        int iRankU = ipb[ii + 1] - ipb[ii];
+        double* pdblU = NULL;
+        types::SinglePoly* pSPU = new types::SinglePoly(&pdblU, iRankU);
+        memcpy(pdblU, pdblOut + ipb[ii] - 1, iRankU * sizeof(double));
+        pPolyU->set(i, pSPU);
+        delete pSPU;
+    }
+
+    delete pdblOut;
+
+    // return result
+    out.push_back(pPolyGCD);
+    out.push_back(pPolyU);
+
+    if (_iRetCount == 3)
+    {
+        out.push_back(new types::Double((double)iErr));
+    }
+
+    return types::Function::OK;
+}
+/*--------------------------------------------------------------------------*/
+
diff --git a/scilab/modules/polynomials/sci_gateway/cpp/sci_coeff.cpp b/scilab/modules/polynomials/sci_gateway/cpp/sci_coeff.cpp
new file mode 100644 (file)
index 0000000..4a0ecee
--- /dev/null
@@ -0,0 +1,221 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2012 - Scilab Enterprises - 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 "polynomials_gw.hxx"
+#include "function.hxx"
+#include "double.hxx"
+#include "string.hxx"
+#include "polynom.hxx"
+#include "overload.hxx"
+#include "execvisitor.hxx"
+
+extern "C"
+{
+#include "Scierror.h"
+#include "localization.h"
+#include "elem_common.h"
+}
+/*--------------------------------------------------------------------------*/
+types::Function::ReturnValue sci_coeff(types::typed_list &in, int _iRetCount, types::typed_list &out)
+{
+    types::Double* pDblV    = NULL;
+    types::Double* pDblOut  = NULL;
+    types::Double* pDblIn   = NULL;
+    types::Polynom* pPolyIn = NULL;
+
+    double* pdblV = NULL;
+    int iVSize    = 1;
+    int iOne      = 1;
+    double dZero  = 1;
+
+    if (in.size() < 1 || in.size() > 2)
+    {
+        Scierror(77, _("%s: Wrong number of input argument(s): %d to %d expected.\n"), "coeff", 1, 2);
+        return types::Function::Error;
+    }
+
+    if (_iRetCount > 1)
+    {
+        Scierror(78, _("%s: Wrong number of output argument(s): %d expected.\n"), "coeff", 1);
+        return types::Function::Error;
+    }
+
+    if (in.size() == 2)
+    {
+        if (in[1]->isDouble() == false)
+        {
+            Scierror(999, _("%s: Wrong type for input argument #%d: A real vector expected.\n"), "coeff", 2);
+            return types::Function::Error;
+        }
+
+        pDblV = in[1]->getAs<types::Double>();
+
+        if (pDblV->isComplex())
+        {
+            Scierror(999, _("%s: Wrong type for input argument #%d: A real vector expected.\n"), "coeff", 2);
+            return types::Function::Error;
+        }
+
+        if (pDblV->isEmpty())
+        {
+            out.push_back(types::Double::Empty());
+            return types::Function::OK;
+        }
+
+        if (pDblV->getRows() != 1 && pDblV->getCols() != 1)
+        {
+            Scierror(999, _("%s: Wrong size for input argument #%d: A real vector expected.\n"), "coeff", 2);
+            return types::Function::Error;
+        }
+
+        pdblV = pDblV->get();
+
+        for (int i = 0; i < pDblV->getSize(); i++)
+        {
+            if (pdblV[i] < 0)
+            {
+                Scierror(999, _("%s: Wrong value for input argument #%d: Positive vector expected.\n"), "coeff", 2);
+                return types::Function::Error;
+            }
+        }
+
+        iVSize = pDblV->getSize();
+    }
+
+    if (in[0]->isDouble())
+    {
+        if (in.size() == 1)
+        {
+            out.push_back(in[0]);
+            return types::Function::OK;
+        }
+
+        pDblIn = in[0]->getAs<types::Double>();
+        pDblOut = new Double(pDblIn->getRows(), pDblIn->getCols() * iVSize, pDblIn->isComplex());
+        int iSize = pDblIn->getSize();
+        for (int i = 0; i < iVSize; i++)
+        {
+            if (pdblV[i] == 0)
+            {
+                C2F(dcopy)(&iSize, pDblIn->get(), &iOne, pDblOut->get() + i * iSize, &iOne);
+                if (pDblIn->isComplex())
+                {
+                    C2F(dcopy)(&iSize, pDblIn->getImg(), &iOne, pDblOut->getImg() + i * iSize, &iOne);
+                }
+            }
+            else
+            {
+                memset(pDblOut->get() + i * iSize, 0x00, pDblIn->getSize() * sizeof(double));
+                if (pDblIn->isComplex())
+                {
+                    memset(pDblOut->getImg() + i * iSize, 0x00, pDblIn->getSize() * sizeof(double));
+                }
+            }
+        }
+    }
+    else if (in[0]->isPoly())
+    {
+        pPolyIn = in[0]->getAs<types::Polynom>();
+
+        if (in.size() == 1)
+        {
+            pDblOut = new types::Double(pPolyIn->getRows(), pPolyIn->getCols() * pPolyIn->getMaxRank(), pPolyIn->isComplex());
+            double* pdblOut = pDblOut->get();
+            memset(pdblOut, 0x00, pDblOut->getSize() * sizeof(double));
+            if (pPolyIn->isComplex())
+            {
+                double* pdblOutI = pDblOut->getImg();
+                memset(pdblOutI, 0x00, pDblOut->getSize() * sizeof(double));
+                for (int i = 0; i < pPolyIn->getSize(); i++)
+                {
+                    double* pdblcoeffR = pPolyIn->get(i)->getCoefReal();
+                    double* pdblcoeffI = pPolyIn->get(i)->getCoefImg();
+                    for (int j = 0; j < pPolyIn->get(i)->getRank(); j++)
+                    {
+                        pdblOut[j * pPolyIn->getSize() + i] = pdblcoeffR[j];
+                        pdblOutI[j * pPolyIn->getSize() + i] = pdblcoeffI[j];
+                    }
+                }
+            }
+            else
+            {
+                for (int i = 0; i < pPolyIn->getSize(); i++)
+                {
+                    double* pdblcoeff = pPolyIn->get(i)->getCoefReal();
+                    for (int j = 0; j < pPolyIn->get(i)->getRank(); j++)
+                    {
+                        pdblOut[j * pPolyIn->getSize() + i] = pdblcoeff[j];
+                    }
+                }
+            }
+        }
+        else
+        {
+            pDblOut = new types::Double(pPolyIn->getRows(), pPolyIn->getCols() * iVSize, pPolyIn->isComplex());
+            double* pdblOut = pDblOut->get();
+            memset(pdblOut, 0x00, pDblOut->getSize() * sizeof(double));
+            if (pPolyIn->isComplex())
+            {
+                double* pdblOutI = pDblOut->getImg();
+                memset(pdblOutI, 0x00, pDblOut->getSize() * sizeof(double));
+                for (int i = 0; i < pPolyIn->getSize(); i++)
+                {
+                    double* pdblcoeffR = pPolyIn->get(i)->getCoefReal();
+                    double* pdblcoeffI = pPolyIn->get(i)->getCoefImg();
+                    for (int j = 0; j < iVSize; j++)
+                    {
+                        int iCoeffPos = (int)pdblV[j];
+                        if (iCoeffPos > pPolyIn->get(i)->getRank())
+                        {
+                            pdblOut[j * pPolyIn->getSize() + i] = 0;
+                            pdblOutI[j * pPolyIn->getSize() + i] = 0;
+                        }
+                        else
+                        {
+                            pdblOut[j * pPolyIn->getSize() + i] = pdblcoeffR[iCoeffPos];
+                            pdblOutI[j * pPolyIn->getSize() + i] = pdblcoeffI[iCoeffPos];
+                        }
+                    }
+                }
+            }
+            else
+            {
+                for (int i = 0; i < pPolyIn->getSize(); i++)
+                {
+                    double* pdblcoeff = pPolyIn->get(i)->getCoefReal();
+                    for (int j = 0; j < iVSize; j++)
+                    {
+                        int iCoeffPos = (int)pdblV[j];
+                        if (iCoeffPos > pPolyIn->get(i)->getRank())
+                        {
+                            pdblOut[j * pPolyIn->getSize() + i] = 0;
+                        }
+                        else
+                        {
+                            pdblOut[j * pPolyIn->getSize() + i] = pdblcoeff[iCoeffPos];
+                        }
+                    }
+                }
+            }
+        }
+    }
+    else
+    {
+        std::wstring wstFuncName = L"%"  + in[0]->getShortTypeStr() + L"_coeff";
+        return Overload::call(wstFuncName, in, _iRetCount, out, new ExecVisitor());
+    }
+
+    out.push_back(pDblOut);
+    return types::Function::OK;
+}
+/*--------------------------------------------------------------------------*/
+
diff --git a/scilab/modules/polynomials/sci_gateway/cpp/sci_degree.cpp b/scilab/modules/polynomials/sci_gateway/cpp/sci_degree.cpp
new file mode 100644 (file)
index 0000000..28620a9
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2012 - Scilab Enterprises - 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 "polynomials_gw.hxx"
+#include "function.hxx"
+#include "double.hxx"
+#include "string.hxx"
+#include "polynom.hxx"
+#include "overload.hxx"
+#include "execvisitor.hxx"
+
+extern "C"
+{
+#include "Scierror.h"
+#include "localization.h"
+}
+/*--------------------------------------------------------------------------*/
+types::Function::ReturnValue sci_degree(types::typed_list &in, int _iRetCount, types::typed_list &out)
+{
+    types::Double* pDblOut = NULL;
+
+    if (in.size() != 1)
+    {
+        Scierror(77, _("%s: Wrong number of input argument(s): %d expected.\n"), "degree", 1);
+        return types::Function::Error;
+    }
+
+    if (_iRetCount > 1)
+    {
+        Scierror(78, _("%s: Wrong number of output argument(s): %d expected.\n"), "degree", 1);
+        return types::Function::Error;
+    }
+
+    if (in[0]->isDouble())
+    {
+        types::Double* pDblIn = in[0]->getAs<types::Double>();
+        pDblOut = new types::Double(pDblIn->getDims(), pDblIn->getDimsArray());
+        double* pdblOut = pDblOut->get();
+        memset(pdblOut, 0x00, pDblOut->getSize() * sizeof(double));
+    }
+    else if (in[0]->isPoly())
+    {
+        types::Polynom* pPolyIn = in[0]->getAs<types::Polynom>();
+        pDblOut = new types::Double(pPolyIn->getDims(), pPolyIn->getDimsArray());
+        double* pdblOut = pDblOut->get();
+
+        for (int i = 0; i < pDblOut->getSize(); i++)
+        {
+            pdblOut[i] = (double)pPolyIn->get(i)->getRank() - 1;
+        }
+    }
+    else
+    {
+        std::wstring wstFuncName = L"%"  + in[0]->getShortTypeStr() + L"_coeff";
+        return Overload::call(wstFuncName, in, _iRetCount, out, new ExecVisitor());
+    }
+
+    out.push_back(pDblOut);
+    return types::Function::OK;
+}
+/*--------------------------------------------------------------------------*/
+
diff --git a/scilab/modules/polynomials/sci_gateway/cpp/sci_poly.cpp b/scilab/modules/polynomials/sci_gateway/cpp/sci_poly.cpp
new file mode 100644 (file)
index 0000000..82952ac
--- /dev/null
@@ -0,0 +1,178 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2012 - Scilab Enterprises - 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 "polynomials_gw.hxx"
+#include "function.hxx"
+#include "double.hxx"
+#include "polynom.hxx"
+#include "overload.hxx"
+#include "execvisitor.hxx"
+
+extern "C"
+{
+#include <math.h>
+#include "Scierror.h"
+#include "localization.h"
+
+    extern int C2F(dprxc)(int*, double*, double*);
+    extern int C2F(wprxc)(int*, double*, double*, double*, double*);
+    extern double C2F(dasum)(int*, double*, int*);
+}
+/*--------------------------------------------------------------------------*/
+types::Function::ReturnValue sci_poly(types::typed_list &in, int _iRetCount, types::typed_list &out)
+{
+    types::Double* pDblIn    = NULL;
+    types::String* pStrName  = NULL;
+    types::Polynom* pPolyOut = NULL;
+
+    std::wstring wstrFlag = L"roots"; // roots (default), coeff
+
+    if (in.size() < 2 || in.size() > 3)
+    {
+        Scierror(77, _("%s: Wrong number of input argument(s): %d to %d expected.\n"), "poly", 2, 3);
+        return types::Function::Error;
+    }
+
+    if (_iRetCount > 1)
+    {
+        Scierror(78, _("%s: Wrong number of output argument(s): %d expected.\n"), "poly", 1);
+        return types::Function::Error;
+    }
+
+    if (in[0]->isDouble() == false)
+    {
+        std::wstring wstFuncName = L"%"  + in[0]->getShortTypeStr() + L"_poly";
+        return Overload::call(wstFuncName, in, _iRetCount, out, new ExecVisitor());
+    }
+
+    pDblIn = in[0]->getAs<types::Double>();
+
+    if (in.size() == 3)
+    {
+        if (in[2]->isString() == false)
+        {
+            Scierror(999, _("%s: Wrong type for input argument #%d : A string expected.\n"), "poly", 3);
+            return types::Function::Error;
+        }
+
+        wstrFlag = in[2]->getAs<types::String>()->get(0);
+        if (wstrFlag != L"roots" && wstrFlag != L"coeff" && wstrFlag != L"r" && wstrFlag != L"c")
+        {
+            Scierror(999, _("%s: Wrong value for input argument #%d : ""%s"" or ""%s"" expected.\n"), "poly", 3, "roots", "coeff");
+            return types::Function::Error;
+        }
+    }
+
+    if (in[1]->isString() == false)
+    {
+        Scierror(999, _("%s: Wrong type for input argument #%d : A string expected.\n"), "poly", 2);
+        return types::Function::Error;
+    }
+
+    pStrName = in[1]->getAs<types::String>();
+    if (pStrName->isScalar() == false)
+    {
+        Scierror(999, _("%s: Wrong size for input argument #%d : A scalar expected.\n"), "poly", 2);
+        return types::Function::Error;
+    }
+
+    std::wstring wstrName = pStrName->get(0);
+    size_t badpos = wstrName.find_first_not_of(L"$abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
+    if (badpos != wstring::npos)
+    {
+        Scierror(999, _("%s: Wrong value for input argument #%d : Valid variable name expected.\n"), "poly", 2);
+        return types::Function::Error;
+    }
+
+    if (wstrFlag == L"roots" || wstrFlag == L"r") // roots
+    {
+        // [] case
+        if (pDblIn->getSize() == 0)
+        {
+            types::Polynom* pPolyOut = new types::Polynom(wstrName, 1, 1);
+            types::Double* pDblCoef = new types::Double(1);
+            pPolyOut->setCoef(0, pDblCoef);
+            out.push_back(pPolyOut);
+            return types::Function::OK;
+        }
+
+        bool bDeleteInput = false;
+        if (pDblIn->getSize() != 1 && pDblIn->getCols() == pDblIn->getRows())
+        {
+            //call spec
+            types::typed_list tlInput;
+            types::typed_list tlOutput;
+            types::optional_list tlOpt;
+            tlInput.push_back(pDblIn);
+            types::Function *funcSpec = symbol::Context::getInstance()->get(symbol::Symbol(L"spec"))->getAs<types::Function>();
+            funcSpec->call(tlInput, tlOpt, 1, tlOutput, new ExecVisitor());
+            pDblIn = tlOutput[0]->getAs<types::Double>();
+            bDeleteInput = true;
+        }
+
+        int iOne = 1;
+        double* pdblInReal = pDblIn->get();
+        int piDimsArray[2] = {1, 1};
+        int iSize = pDblIn->getSize();
+        int iRanks = iSize + 1;
+        pPolyOut = new types::Polynom(wstrName, 2, piDimsArray, &iRanks);
+        double* pdblCoefReal = pPolyOut->get(0)->getCoefReal();
+        if (pDblIn->isComplex())
+        {
+            pPolyOut->setComplex(true);
+            double* pdblInImg   = pDblIn->getImg();
+            double* pdblCoefImg = pPolyOut->get(0)->getCoefImg();
+            C2F(wprxc)(&iSize, pdblInReal, pdblInImg, pdblCoefReal, pdblCoefImg);
+
+            // if imaginary part is null, set polynom real
+            if (C2F(dasum)(&iRanks, pdblCoefImg, &iOne) == 0)
+            {
+                pPolyOut->setComplex(false);
+            }
+        }
+        else
+        {
+            C2F(dprxc)(&iSize, pdblInReal, pdblCoefReal);
+        }
+
+        if (bDeleteInput)
+        {
+            delete pDblIn;
+        }
+    }
+    else // coeff
+    {
+        // [] case
+        if (pDblIn->getSize() == 0)
+        {
+            out.push_back(types::Double::Empty());
+            return types::Function::OK;
+        }
+
+        if (pDblIn->getRows() != 1 && pDblIn->getCols() != 1)
+        {
+            Scierror(999, _("%s: Wrong size for input argument #%d : A vector expected.\n"), "poly", 1);
+            return types::Function::Error;
+        }
+
+        int piDimsArray[2] = {1, 1};
+        int iRanks = pDblIn->getSize();
+        pPolyOut = new types::Polynom(wstrName, 2, piDimsArray, &iRanks);
+        pPolyOut->setComplex(pDblIn->isComplex());
+        pPolyOut->setCoef(0, pDblIn);
+    }
+
+    out.push_back(pPolyOut);
+    return types::Function::OK;
+}
+/*--------------------------------------------------------------------------*/
+
diff --git a/scilab/modules/polynomials/sci_gateway/cpp/sci_pppdiv.cpp b/scilab/modules/polynomials/sci_gateway/cpp/sci_pppdiv.cpp
new file mode 100644 (file)
index 0000000..403e126
--- /dev/null
@@ -0,0 +1,302 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2012 - Scilab Enterprises - 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 "polynomials_gw.hxx"
+#include "function.hxx"
+#include "double.hxx"
+#include "string.hxx"
+#include "polynom.hxx"
+#include "overload.hxx"
+#include "execvisitor.hxx"
+
+extern "C"
+{
+#include "Scierror.h"
+#include "localization.h"
+
+    extern double C2F(dasum)(int*, double*, int*);
+    extern int C2F(dpodiv)(double*, double*, int*, int*, int*);
+    extern int C2F(wpodiv)(double*, double*, double*, double*, int*, int*, int*);
+}
+/*--------------------------------------------------------------------------*/
+types::Function::ReturnValue sci_pppdiv(types::typed_list &in, int _iRetCount, types::typed_list &out)
+{
+    double* pdblInR[2]  = {NULL, NULL};// real part of denominator and numerator
+    double* pdblInI[2]  = {NULL, NULL};// rimaginary part
+    bool bDouble        = false;
+    bool pbComplex[2]   = {false, false};
+    int piRank[2]       = {0, 0}; // rank of denominator and numerator
+    int iErr            = 0;
+    int iOne            = 1;
+
+    std::wstring wstrName = L"";
+
+    if (in.size() != 2)
+    {
+        Scierror(77, _("%s: Wrong number of input argument(s): %d expected.\n"), "pppdiv", 2);
+        return types::Function::Error;
+    }
+
+    if (_iRetCount > 2)
+    {
+        Scierror(78, _("%s: Wrong number of output argument(s): %d to %d expected.\n"), "pppdiv", 1, 2);
+        return types::Function::Error;
+    }
+
+    // get numerator and denominator
+    for (int i = 0; i < 2; i++)
+    {
+        if (in[i]->isDouble())
+        {
+            if (bDouble)
+            {
+                Scierror(999, _("%s: Wrong type for input argument #%d: A polynom expected.\n"), "pppdiv", i + 1);
+                return types::Function::Error;
+            }
+
+            types::Double* pDblIn = in[i]->getAs<types::Double>();
+            if (pDblIn->isScalar() == false)
+            {
+                Scierror(999, _("%s: Wrong size for input argument #%d: A scalar expected.\n"), "pppdiv", i + 1);
+                return types::Function::Error;
+            }
+
+            piRank[i] = 1;
+            pdblInR[i] = pDblIn->get();
+            if (pDblIn->isComplex())
+            {
+                pbComplex[i] = true;
+                pdblInI[i] = pDblIn->getImg();
+            }
+        }
+        else if (in[i]->isPoly())
+        {
+            types::Polynom* pPolyIn = in[i]->getAs<types::Polynom>();
+            if (pPolyIn->isScalar() == false)
+            {
+                Scierror(999, _("%s: Wrong size for input argument #%d: A scalar expected.\n"), "pppdiv", i + 1);
+                return types::Function::Error;
+            }
+
+            if (wstrName != L"" && wstrName != pPolyIn->getVariableName())
+            {
+                Scierror(999, _("%s: Wrong value for input argument #%d: A polynom '%ls' expected.\n"), "pppdiv", i + 1, wstrName.c_str());
+                return types::Function::Error;
+            }
+
+            wstrName = pPolyIn->getVariableName();
+            piRank[i] = pPolyIn->getMaxRank();
+            pdblInR[i] = pPolyIn->get(0)->getCoefReal();
+            if (pPolyIn->isComplex())
+            {
+                pbComplex[i] = true;
+                pdblInI[i] = pPolyIn->get(0)->getCoefImg();
+            }
+        }
+        else
+        {
+            std::wstring wstFuncName = L"%"  + in[i]->getShortTypeStr() + L"_pppdiv";
+            return Overload::call(wstFuncName, in, _iRetCount, out, new ExecVisitor());
+        }
+    }
+
+    // manage the case where the rank of the denominator
+    // is less than the rank of numerator. x / x² = 0 , rest = s.
+    if (piRank[0] < piRank[1])
+    {
+        if (_iRetCount == 2)
+        {
+            out.push_back(in[0]);
+        }
+        out.push_back(new types::Double(0));
+        return types::Function::OK;
+    }
+
+    // perform operation and set the result in pdblInR/I[0]
+    double* temp = pdblInR[0];
+    pdblInR[0] = new double[piRank[0]];
+    memcpy(pdblInR[0], temp, piRank[0] * sizeof(double));
+    if (pbComplex[0])
+    {
+        temp = pdblInI[0];
+        pdblInI[0] = new double[piRank[0]];
+        memcpy(pdblInI[0], temp, piRank[0] * sizeof(double));
+    }
+
+    int iDegreeNum = piRank[0] - 1;
+    int iDegreeDen = piRank[1] - 1;
+    if (pbComplex[0] == false && pbComplex[1] == false)
+    {
+        C2F(dpodiv)(pdblInR[0], pdblInR[1], &iDegreeNum, &iDegreeDen, &iErr);
+    }
+    else
+    {
+        if (pbComplex[0] == false)
+        {
+            pdblInI[0] = new double[piRank[0]];
+            memset(pdblInI[0], 0x00, piRank[0] * sizeof(double));
+        }
+        else if (pbComplex[1] == false)
+        {
+            pdblInI[1] = new double[piRank[1]];
+            memset(pdblInI[1], 0x00, piRank[1] * sizeof(double));
+        }
+
+        C2F(wpodiv)(pdblInR[0], pdblInI[0], pdblInR[1], pdblInI[1], &iDegreeNum, &iDegreeDen, &iErr);
+    }
+
+    // after execution : pdblInR[0](1 -> iDegreeDen) is the rest
+    //                   pdblInR[0](iDegreeDen -> end) is the coeff
+    int iSizeRest      = iDegreeDen;
+    int iSizeCoeff     = iDegreeNum - iDegreeDen + 1;
+    double* pdblRestR  = pdblInR[0];
+    double* pdblCoeffR = pdblInR[0] + iDegreeDen;
+    double* pdblRestI  = NULL;
+    double* pdblCoeffI = NULL;
+    bool bComplex      = pbComplex[0] || pbComplex[1];
+
+    if (bComplex)
+    {
+        pdblRestI  = pdblInI[0];
+        pdblCoeffI = pdblInI[0] + iDegreeDen;
+    }
+
+    // compute the real rank
+    if (bComplex) // complex case
+    {
+        for (int i = iSizeCoeff - 1; i >= 0; i--)
+        {
+            iSizeCoeff--;
+            if (std::abs(pdblCoeffR[i]) + std::abs(pdblCoeffI[i]))
+            {
+                break;
+            }
+        }
+
+        for (int i = iSizeRest - 1; i >= 0; i--)
+        {
+            iSizeRest--;
+            if (std::abs(pdblRestR[i]) + std::abs(pdblRestI[i]))
+            {
+                break;
+            }
+        }
+    }
+    else // real case
+    {
+        for (int i = iSizeCoeff - 1; i >= 0; i--)
+        {
+            iSizeCoeff--;
+            if (pdblCoeffR[i])
+            {
+                break;
+            }
+        }
+
+        for (int i = iSizeRest - 1; i >= 0; i--)
+        {
+            iSizeRest--;
+            if (pdblRestR[i])
+            {
+                break;
+            }
+        }
+    }
+
+    // set the rest of divide in output
+    if (_iRetCount == 2)
+    {
+        if (iSizeRest == 0) // return a types::Double
+        {
+            if (bComplex)
+            {
+                out.push_back(new types::Double(pdblRestR[0], pdblRestI[0]));
+            }
+            else
+            {
+                out.push_back(new types::Double(pdblRestR[0]));
+            }
+        }
+        else // return a types::Polynom
+        {
+            double* pdblReal = NULL;
+            types::Polynom* pPolyOut = new types::Polynom(wstrName, 1, 1);
+            types::SinglePoly* pSP = NULL;
+            int iSize = iSizeRest + 1;
+            if (bComplex && C2F(dasum)(&iSize, pdblRestI, &iOne) != 0)
+            {
+                double* pdblImg = NULL;
+                pSP = new types::SinglePoly(&pdblReal, &pdblImg, iSize);
+                memcpy(pdblImg, pdblRestI, iSize * sizeof(double));
+            }
+            else
+            {
+                pSP = new types::SinglePoly(&pdblReal, iSize);
+            }
+
+            memcpy(pdblReal, pdblRestR, iSize * sizeof(double));
+            pPolyOut->set(0, pSP);
+            delete pSP;
+            out.push_back(pPolyOut);
+        }
+    }
+
+    // set the result of divide in output
+    if (iSizeCoeff == 0) // return a types::Double
+    {
+        if (bComplex)
+        {
+            out.push_back(new types::Double(pdblCoeffR[0], pdblCoeffI[0]));
+        }
+        else
+        {
+            out.push_back(new types::Double(pdblCoeffR[0]));
+        }
+    }
+    else // return a types::Polynom
+    {
+        double* pdblReal = NULL;
+        types::Polynom* pPolyOut = new types::Polynom(wstrName, 1, 1);
+        types::SinglePoly* pSP = NULL;
+        int iSize = iSizeCoeff + 1;
+        if (bComplex && C2F(dasum)(&iSize, pdblCoeffI, &iOne) != 0)
+        {
+            double* pdblImg = NULL;
+            pSP = new types::SinglePoly(&pdblReal, &pdblImg, iSize);
+            memcpy(pdblImg, pdblCoeffI, iSize * sizeof(double));
+        }
+        else
+        {
+            pSP = new types::SinglePoly(&pdblReal, iSize);
+        }
+
+        memcpy(pdblReal, pdblCoeffR, iSize * sizeof(double));
+        pPolyOut->set(0, pSP);
+        delete pSP;
+        out.push_back(pPolyOut);
+    }
+
+    delete pdblInR[0];
+    if (pbComplex[0] || pbComplex[1])
+    {
+        delete pdblInI[0];
+    }
+
+    if (pbComplex[1] == false)
+    {
+        delete pdblInI[1];
+    }
+
+    return types::Function::OK;
+}
+/*--------------------------------------------------------------------------*/
+
diff --git a/scilab/modules/polynomials/sci_gateway/cpp/sci_roots.cpp b/scilab/modules/polynomials/sci_gateway/cpp/sci_roots.cpp
new file mode 100644 (file)
index 0000000..f55f291
--- /dev/null
@@ -0,0 +1,268 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2012 - Scilab Enterprises - 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 "polynomials_gw.hxx"
+#include "function.hxx"
+#include "double.hxx"
+#include "string.hxx"
+#include "polynom.hxx"
+#include "overload.hxx"
+#include "execvisitor.hxx"
+#include "context.hxx"
+
+extern "C"
+{
+#include "Scierror.h"
+#include "localization.h"
+#include "elem_common.h"
+    extern int C2F(rpoly)(double*, int*, double*, double*, int*);
+    extern int C2F(wscal)(int*, double*, double*, double*, double*, int*);
+}
+/*--------------------------------------------------------------------------*/
+types::Function::ReturnValue sci_roots(types::typed_list &in, int _iRetCount, types::typed_list &out)
+{
+    std::wstring wstrAlgo   = L"e"; // e = eigen (default), f = fast
+    types::Double* pDblIn   = NULL;
+    types::Double* pDblOut  = NULL;
+    types::Polynom* pPolyIn = NULL;
+
+    double* pdblInReal   = NULL;
+    double* pdblInImg    = NULL;
+    double* pdblTempReal = NULL;
+    double* pdblTempImg  = NULL;
+
+    int iOne = 1;
+    int imOne = -1;
+    int iSize = 0;
+    bool bComplex = false;
+
+    if (in.size() < 1 || in.size() > 2)
+    {
+        Scierror(77, _("%s: Wrong number of input argument(s): %d to %d expected.\n"), "roots", 1, 2);
+        return types::Function::Error;
+    }
+
+    if (_iRetCount > 1)
+    {
+        Scierror(78, _("%s: Wrong number of output argument(s): %d expected.\n"), "roots", 1);
+        return types::Function::Error;
+    }
+
+    // get algo type
+    if (in.size() == 2)
+    {
+        if (in[1]->isString() == false)
+        {
+            Scierror(999, _("%s: Wrong type for input argument #%d : A string expected.\n"), "roots", 2);
+            return types::Function::Error;
+        }
+
+        types::String* pStrAlgo = in[1]->getAs<types::String>();
+        if (pStrAlgo->isScalar() == false)
+        {
+            Scierror(999, _("%s: Wrong size for input argument #%d : A scalar expected.\n"), "roots", 2);
+            return types::Function::Error;
+        }
+
+        wstrAlgo = pStrAlgo->get(0);
+        if (wstrAlgo != L"e" && wstrAlgo != L"f")
+        {
+            Scierror(999, _("%s: Wrong value for input argument #%d : ""%s"" or ""%s"" expected.\n"), "roots", 2, "e", "f");
+            return types::Function::Error;
+        }
+    }
+
+    if (in[0]->isDouble())
+    {
+        // for Matlab compatibility root of the vector of coefficients
+        pDblIn = in[0]->getAs<types::Double>();
+        if (pDblIn->isEmpty())
+        {
+            out.push_back(types::Double::Empty());
+            return types::Function::OK;
+        }
+
+        iSize = pDblIn->getSize();
+
+        // old fortran function dtild
+        // switch elements of a vector. [1 2 3] => [3 2 1]
+        pdblInReal = new double[iSize];
+        C2F(dcopy)(&iSize, pDblIn->get(), &iOne, pdblInReal, &imOne);
+        if (pDblIn->isComplex())
+        {
+            bComplex = true;
+            pdblInImg = new double[iSize];
+            C2F(dcopy)(&iSize, pDblIn->getImg(), &iOne, pdblInImg, &imOne);
+        }
+    }
+    else if (in[0]->isPoly())
+    {
+        pPolyIn = in[0]->getAs<types::Polynom>();
+
+        if (pPolyIn->isScalar() == false)
+        {
+            Scierror(999, _("%s: Wrong size for input argument #%d : A scalar expected.\n"), "roots", 1);
+            return types::Function::Error;
+        }
+
+        iSize      = pPolyIn->getMaxRank();
+        pdblInReal = pPolyIn->get(0)->getCoefReal();
+
+        if (pPolyIn->isComplex())
+        {
+            bComplex = true;
+            pdblInImg = pPolyIn->get(0)->getCoefImg();
+        }
+    }
+    else
+    {
+        std::wstring wstFuncName = L"%"  + in[0]->getShortTypeStr() + L"_roots";
+        return Overload::call(wstFuncName, in, _iRetCount, out, new ExecVisitor());
+    }
+
+    // If "fast" algo was chosen and polynomial is complex,
+    // then produce an error.
+    if (wstrAlgo == L"f" && bComplex)
+    {
+        Scierror(999, _("%s: Wrong value for input argument #%d : If algo is ""%s"", a real is expected.\n"), "roots", 2, "f");
+        return types::Function::Error;
+    }
+
+    double t = 0;
+    while (t == 0)
+    {
+        iSize--;
+        if (iSize < 0)
+        {
+            out.push_back(types::Double::Empty());
+            return types::Function::OK;
+        }
+
+        t = std::abs(pdblInReal[iSize]);
+        if (bComplex)
+        {
+            t += std::abs(pdblInImg[iSize]);
+        }
+    }
+
+    // If "fast" algo was chosen and polynomial has degree greater than 100,
+    // then produce an error.
+    if (wstrAlgo == L"f" && iSize > 100)
+    {
+        Scierror(999, _("%s: Wrong value for input argument #%d : If algo is ""%s"", a degree less than %d expected.\n"), "roots", 2, "f", 100);
+        return types::Function::Error;
+    }
+
+    if (wstrAlgo == L"f")
+    {
+        // real polynomial: rpoly algorithm
+        // this alg is much more speedy, but it may happens that it gives
+        // erroneous results without messages : example
+        // roots(%s^31-8*%s^30+9*%s^29+0.995) should have two real roots near
+        // 1.355 and 6.65 and the other ones inside a circle centered in 0
+        // with radius 1
+
+        pDblOut = new types::Double(iSize, 1, true);
+        int iFail = 0;
+        int iSizeP1 = iSize + 1;
+
+        double* pdblTempReal = new double[iSize + 1];
+        C2F(dcopy)(&iSizeP1, pdblInReal, &iOne, pdblTempReal, &imOne);
+        C2F(rpoly)(pdblTempReal, &iSize, pDblOut->get(), pDblOut->getImg(), &iFail);
+        delete pdblTempReal;
+
+        if (iFail)
+        {
+            if (iFail == 1)
+            {
+                Scierror(999, _("%s: Convergence problem...\n"), "roots");
+            }
+            else if (iFail == 2)
+            {
+                Scierror(999, _("%s: Leading coefficient is zero.\n"), "roots");
+            }
+            else if (iFail == 3)
+            {
+                Scierror(999, _("%s: Too high degree (max 100).\n"), "roots");
+            }
+
+            return types::Function::Error;
+        }
+
+        out.push_back(pDblOut);
+    }
+    else // wstrAlgo == L"e"
+    {
+        // Companion matrix method
+        int iSizeM1 = iSize - 1;
+        int iSizeP1 = iSize + 1;
+        double dblOne = 1;
+        double* pdblTempReal = new double[iSize];
+        double* pdblTempImg = NULL;
+        double sr = pdblInReal[iSize];
+
+        C2F(dcopy)(&iSize, pdblInReal, &iOne, pdblTempReal, &imOne);
+
+        if (bComplex)
+        {
+            pdblTempImg = new double[iSize];
+            C2F(dcopy)(&iSize, pdblInImg, &iOne, pdblTempImg, &imOne);
+
+            double si = pdblInImg[iSize];
+            double t = sr * sr + si * si;
+            sr = -sr / t;
+            si = si / t;
+
+            C2F(wscal)(&iSize, &sr, &si, pdblTempReal, pdblTempImg, &iOne);
+        }
+        else
+        {
+            double dbl = -1 / sr;
+            C2F(dscal)(&iSize, &dbl, pdblTempReal, &iOne);
+        }
+
+        pDblOut = new types::Double(iSize, iSize, bComplex);
+        double* pdblOutReal = pDblOut->get();
+        double* pdblOutImg = NULL;
+
+        memset(pdblOutReal, 0x00, pDblOut->getSize() * sizeof(double));
+        C2F(dset)(&iSizeM1, &dblOne, &pdblOutReal[iSize], &iSizeP1);
+        C2F(dcopy)(&iSize, pdblTempReal, &iOne, pdblOutReal, &iOne);
+
+        if (bComplex)
+        {
+            pdblOutImg = pDblOut->getImg();
+            memset(pdblOutImg, 0x00, pDblOut->getSize() * sizeof(double));
+            C2F(dcopy)(&iSize, pdblTempImg, &iOne, pdblOutImg, &iOne);
+        }
+
+        //call spec
+        types::typed_list tlInput;
+        types::optional_list tlOpt;
+        tlInput.push_back(pDblOut);
+        types::Function *funcSpec = symbol::Context::getInstance()->get(symbol::Symbol(L"spec"))->getAs<types::Function>();
+        funcSpec->call(tlInput, tlOpt, 1, out, new ExecVisitor());
+    }
+
+    if (pDblIn)
+    {
+        delete pdblInReal;
+        if (bComplex)
+        {
+            delete pdblInImg;
+        }
+    }
+
+    return types::Function::OK;
+}
+/*--------------------------------------------------------------------------*/
+
diff --git a/scilab/modules/polynomials/sci_gateway/cpp/sci_sfact.cpp b/scilab/modules/polynomials/sci_gateway/cpp/sci_sfact.cpp
new file mode 100644 (file)
index 0000000..eeda98f
--- /dev/null
@@ -0,0 +1,184 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2012 - Scilab Enterprises - 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 "polynomials_gw.hxx"
+#include "function.hxx"
+#include "double.hxx"
+#include "polynom.hxx"
+#include "overload.hxx"
+#include "execvisitor.hxx"
+
+extern "C"
+{
+#include "Scierror.h"
+#include "localization.h"
+#include "sciprint.h"
+#include "elem_common.h"
+    extern int C2F(sfact1)(double*, int*, double*, int*, int*);
+    extern int C2F(sfact2)(double*, int*, int*, double*, int*, int*);
+}
+/*--------------------------------------------------------------------------*/
+types::Function::ReturnValue sci_sfact(types::typed_list &in, int _iRetCount, types::typed_list &out)
+{
+    types::Polynom* pPolyIn  = NULL;
+    types::Polynom* pPolyOut = NULL;
+
+    int iMaxIt = 100;
+    int iErr   = 0;
+    int iOne   = 1;
+
+    if (in.size() != 1)
+    {
+        Scierror(77, _("%s: Wrong number of input argument(s): %d expected.\n"), "sfact", 1);
+        return types::Function::Error;
+    }
+
+    if (_iRetCount > 1)
+    {
+        Scierror(78, _("%s: Wrong number of output argument(s): %d expected.\n"), "sfact", 1);
+        return types::Function::Error;
+    }
+
+    if (in[0]->isPoly() == false)
+    {
+        std::wstring wstFuncName = L"%"  + in[0]->getShortTypeStr() + L"_sfact";
+        return Overload::call(wstFuncName, in, _iRetCount, out, new ExecVisitor());
+    }
+
+    pPolyIn = in[0]->getAs<types::Polynom>();
+
+    if (pPolyIn->isComplex())
+    {
+        Scierror(999, _("%s: Wrong value for input argument #%d: A real matrix expected.\n"), "sfact", 1);
+        return types::Function::Error;
+    }
+
+    if (pPolyIn->isScalar())
+    {
+        double* pdblCoef = pPolyIn->get(0)->getCoefReal();
+
+        // check symmetry
+        int iRank   = pPolyIn->get(0)->getRank();
+        int iDegree = iRank - 1;
+        int iDegD2  = (int)(iDegree / 2);
+        int n       = 1 + iDegD2;
+
+        if (2 * iDegD2 != iDegree)
+        {
+            Scierror(999, _("%s: Wrong value for input argument #%d: A symetric polynom expected.\n"), "sfact", 1);
+            return types::Function::Error;
+        }
+
+        for (int i = 0; i < n; i++)
+        {
+            if (pdblCoef[i] != pdblCoef[iDegree - i])
+            {
+                Scierror(999, _("%s: Wrong value for input argument #%d: A symetric polynom expected.\n"), "sfact", 1);
+                return types::Function::Error;
+            }
+        }
+
+        // create result
+        pPolyOut = new types::Polynom(pPolyIn->getVariableName(), 1, 1);
+        double* pdblCoefOut = NULL;
+        types::SinglePoly* pSP = new types::SinglePoly(&pdblCoefOut, n + 1);
+        C2F(dcopy)(&n, pdblCoef, &iOne, pdblCoefOut, &iOne);
+
+        // perform operation
+        double* pdblWork = new double[7 * n];
+        C2F(sfact1)(pdblCoefOut, &iDegD2, pdblWork, &iMaxIt, &iErr);
+        delete pdblWork;
+        if (iErr == 2)
+        {
+            delete pSP;
+            delete pPolyOut;
+            Scierror(999, _("%s: Wrong value for input argument #%d: Non negative or null value expected at degree %d.\n"), "sfact", 1, n);
+            return types::Function::Error;
+        }
+        else if (iErr == 1)
+        {
+            delete pSP;
+            delete pPolyOut;
+            Scierror(999, _("%s: Wrong value for input argument #%d: Convergence problem.\n"), "sfact", 1);
+            return types::Function::Error;
+        }
+        else if (iErr < 0)
+        {
+            sciprint("%s: warning: Convergence at 10^%d near.\n", "sfact", iErr);
+        }
+
+        // return result
+        pPolyOut->set(0, pSP);
+        delete pSP;
+    }
+    else
+    {
+        if (pPolyIn->getRows() != pPolyIn->getCols())
+        {
+            Scierror(999, _("%s: Wrong size for input argument #%d: Square matrix expected.\n"), "sfact", 1);
+            return types::Function::Error;
+        }
+
+        int iSize   = pPolyIn->getSize();
+        int iRows   = pPolyIn->getRows();
+        int iRank   = pPolyIn->getMaxRank();
+        int iDegree = iRank - 1;
+        int iDegD2  = (int)(iDegree / 2);
+        int n       = 1 + iDegD2;
+
+        double* pdblOut  = new double[iSize * n];
+        double* pdblWork = new double[(n + 1) * iRows * ((n + 1)*iRows) + 1];
+
+        memset(pdblOut, 0x00, iSize * n * sizeof(double));
+
+        for (int i = 0; i < iSize; i++)
+        {
+            double* pdblIn = pPolyIn->get(i)->getCoefReal();
+            int iSizeToCpy = 2 + pPolyIn->get(i)->getRank() - 1 - n;
+            if (iSizeToCpy > 0)
+            {
+                C2F(dcopy)(&iSizeToCpy, pdblIn + n - 1, &iOne, pdblOut + i, &iSize);
+            }
+        }
+
+        int nm1 = n - 1;
+        iMaxIt += n;
+        C2F(sfact2)(pdblOut, &iRows, &nm1, pdblWork, &iMaxIt, &iErr);
+        delete pdblWork;
+
+        if (iErr < 0)
+        {
+            Scierror(999, _("%s: Wrong value for input argument #%d: Convergence problem.\n"), "sfact", 1);
+            return types::Function::Error;
+        }
+        else if (iErr > 0)
+        {
+            Scierror(999, _("%s: Wrong value for input argument #%d: singular or asymmetric problem.\n"), "sfact", 1);
+            return types::Function::Error;
+        }
+
+        pPolyOut = new types::Polynom(pPolyIn->getVariableName(), pPolyIn->getDims(), pPolyIn->getDimsArray());
+        for (int i = 0; i < iSize; i++)
+        {
+            double* pdblCoefOut = NULL;
+            types::SinglePoly* pSP = new types::SinglePoly(&pdblCoefOut, n);
+            C2F(dcopy)(&n, pdblOut + i, &iSize, pdblCoefOut, &iOne);
+            pPolyOut->set(i, pSP);
+            delete pSP;
+        }
+    }
+
+    out.push_back(pPolyOut);
+    return types::Function::OK;
+}
+/*--------------------------------------------------------------------------*/
+
diff --git a/scilab/modules/polynomials/sci_gateway/cpp/sci_simp.cpp b/scilab/modules/polynomials/sci_gateway/cpp/sci_simp.cpp
new file mode 100644 (file)
index 0000000..3481e0b
--- /dev/null
@@ -0,0 +1,328 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2012 - Scilab Enterprises - 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 "polynomials_gw.hxx"
+#include "function.hxx"
+#include "double.hxx"
+#include "polynom.hxx"
+#include "overload.hxx"
+#include "execvisitor.hxx"
+#include "configvariable.hxx"
+
+extern "C"
+{
+#include "Scierror.h"
+#include "localization.h"
+    extern int C2F(dpsimp)(double*, int*, double*, int*, double*, int*, double*, int*, double*, int*);
+}
+/*--------------------------------------------------------------------------*/
+types::Function::ReturnValue sci_simp(types::typed_list &in, int _iRetCount, types::typed_list &out)
+{
+    types::Polynom* pNumOut = NULL;
+    types::Polynom* pDenOut = NULL;
+
+    bool bComplex   = false;
+    int iDouble     = 0;
+    int iSize       = 0;
+    int iMaxDegrNum = 0;
+    int iMaxDegrDen = 0;
+    int iErr        = 0;
+
+    std::wstring wstrName = L"";
+
+    if (in.size() < 1 || in.size() > 2)
+    {
+        Scierror(77, _("%s: Wrong number of input argument(s): %d to %d expected.\n"), "simp", 1, 2);
+        return types::Function::Error;
+    }
+
+    if (_iRetCount > 2)
+    {
+        Scierror(78, _("%s: Wrong number of output argument(s): %d to %d expected.\n"), "simp", 1, 2);
+        return types::Function::Error;
+    }
+
+    if (ConfigVariable::getSimpMode() == 0)
+    {
+        for (int i = 0; i < _iRetCount; i++)
+        {
+            out.push_back(in[i]);
+        }
+    }
+
+    if (in.size() == 1)
+    {
+        // rational case
+        std::wstring wstFuncName = L"%r_simp";
+        return Overload::call(wstFuncName, in, _iRetCount, out, new ExecVisitor());
+    }
+    else // simp(num, den)
+    {
+        if (_iRetCount != 2)
+        {
+            Scierror(78, _("%s: Wrong number of output argument(s): %d expected.\n"), "simp", 2);
+            return types::Function::Error;
+        }
+
+        for (int i = 0; i < in.size(); i++)
+        {
+            if (in[i]->isPoly() == false && in[i]->isDouble() == false)
+            {
+                Scierror(999, _("%s: Wrong type for input argument #%d: A polynom expected.\n"), "simp", i + 1);
+                return types::Function::Error;
+            }
+
+            types::GenericType* pGT = in[i]->getAs<types::GenericType>();
+            bComplex |= pGT->isComplex();
+            iDouble  += in[i]->isDouble() ? i + 1 : 0;
+
+            if (i == 1 && pGT->getSize() != iSize)
+            {
+                Scierror(999, _("%s: Wrong size for input argument #%d: Same size expected.\n"), "simp", 2);
+                return types::Function::Error;
+            }
+
+            iSize = pGT->getSize();
+        }
+
+        if (bComplex)
+        {
+            std::wstring wstFuncName = L"%p_simp";
+            return Overload::call(wstFuncName, in, _iRetCount, out, new ExecVisitor());
+        }
+
+        if (iDouble == 3) // simp(double, double)
+        {
+            std::wstring wstFuncName = L"%s_simp";
+            return Overload::call(wstFuncName, in, _iRetCount, out, new ExecVisitor());
+        }
+
+        switch (iDouble)
+        {
+            case 0 : // sim(poly, poly)
+            {
+                types::Polynom* pNum = in[0]->getAs<types::Polynom>();
+                types::Polynom* pDen = in[1]->getAs<types::Polynom>();
+
+                wstrName = pNum->getVariableName();
+
+                if (wstrName != pDen->getVariableName())
+                {
+                    Scierror(999, _("%s: Wrong value for input argument #%d: A polynom '%ls' expected.\n"), "simp", 2, wstrName.c_str());
+                    return types::Function::Error;
+                }
+
+                pNumOut = new types::Polynom(wstrName, pNum->getRows(), pNum->getCols());
+                pDenOut = new types::Polynom(wstrName, pNum->getRows(), pNum->getCols());
+
+                iMaxDegrNum = pNum->getMaxRank() - 1;
+                iMaxDegrDen = pDen->getMaxRank() - 1;
+
+                int iMax = max(iMaxDegrNum, iMaxDegrDen) + 1;
+                int iSizeWork = 2 * (iMaxDegrNum + iMaxDegrDen) +
+                                min(iMaxDegrNum, iMaxDegrDen) +
+                                10 * iMax + 3 * iMax * iMax + 4;
+                double* pdblWork = new double[iSizeWork];
+
+                for (int i = 0; i < iSize; i++)
+                {
+                    double* pdblNum = pNum->get(i)->getCoefReal();
+                    double* pdblDen = pDen->get(i)->getCoefReal();
+                    int iDegreeNum  = pNum->get(i)->getRank() - 1;
+                    int iDegreeDen  = pDen->get(i)->getRank() - 1;
+
+                    double* pdblNumOut = NULL;
+                    double* pdblDenOut = NULL;
+
+                    double* pdblNumTmp = new double[iDegreeNum + 1];
+                    double* pdblDenTmp = new double[iDegreeDen + 1];
+
+                    int iRankNumOut = 0;
+                    int iRankDenOut = 0;
+
+                    iErr = iSizeWork;
+
+                    C2F(dpsimp)(pdblNum, &iDegreeNum, pdblDen, &iDegreeDen,
+                                pdblNumTmp, &iRankNumOut, pdblDenTmp, &iRankDenOut,
+                                pdblWork, &iErr);
+
+                    if (iErr)
+                    {
+                        delete pdblNumTmp;
+                        delete pdblDenTmp;
+                        break;
+                    }
+
+                    types::SinglePoly* pSPNum = new types::SinglePoly(&pdblNumOut, iRankNumOut);
+                    types::SinglePoly* pSPDen = new types::SinglePoly(&pdblDenOut, iRankDenOut);
+
+                    memcpy(pdblNumOut, pdblNumTmp, iRankNumOut * sizeof(double));
+                    memcpy(pdblDenOut, pdblDenTmp, iRankDenOut * sizeof(double));
+
+                    pNumOut->set(i, pSPNum);
+                    pDenOut->set(i, pSPDen);
+
+                    delete pdblNumTmp;
+                    delete pdblDenTmp;
+                    delete pSPNum;
+                    delete pSPDen;
+                }
+
+                delete pdblWork;
+                break;
+            }
+            case 1 : // sim(double, poly)
+            {
+                types::Double* pNum  = in[0]->getAs<types::Double>();
+                types::Polynom* pDen = in[1]->getAs<types::Polynom>();
+
+                wstrName    = pDen->getVariableName();
+                iMaxDegrDen = pDen->getMaxRank() - 1;
+
+                pNumOut = new types::Polynom(wstrName, pNum->getRows(), pNum->getCols());
+                pDenOut = new types::Polynom(wstrName, pNum->getRows(), pNum->getCols());
+
+                int iMax = max(iMaxDegrNum, iMaxDegrDen) + 1;
+                int iSizeWork = 2 * (iMaxDegrNum + iMaxDegrDen) +
+                                min(iMaxDegrNum, iMaxDegrDen) +
+                                10 * iMax + 3 * iMax * iMax + 4;
+                double* pdblWork = new double[iSizeWork];
+
+                for (int i = 0; i < iSize; i++)
+                {
+                    double dblNum   = pNum->get(i);
+                    double* pdblDen = pDen->get(i)->getCoefReal();
+                    int iDegreeNum  = 0;
+                    int iDegreeDen  = pDen->get(i)->getRank() - 1;
+
+                    double* pdblNumOut = NULL;
+                    double* pdblDenOut = NULL;
+
+                    double* pdblNumTmp = new double[1];
+                    double* pdblDenTmp = new double[iDegreeDen + 1];
+
+                    int iRankNumOut = 0;
+                    int iRankDenOut = 0;
+
+                    iErr = iSizeWork;
+
+                    C2F(dpsimp)(&dblNum, &iDegreeNum, pdblDen, &iDegreeDen,
+                                pdblNumTmp, &iRankNumOut, pdblDenTmp, &iRankDenOut,
+                                pdblWork, &iErr);
+
+                    if (iErr)
+                    {
+                        delete pdblNumTmp;
+                        delete pdblDenTmp;
+                        break;
+                    }
+
+                    types::SinglePoly* pSPNum = new types::SinglePoly(&pdblNumOut, iRankNumOut);
+                    types::SinglePoly* pSPDen = new types::SinglePoly(&pdblDenOut, iRankDenOut);
+
+                    memcpy(pdblNumOut, pdblNumTmp, iRankNumOut * sizeof(double));
+                    memcpy(pdblDenOut, pdblDenTmp, iRankDenOut * sizeof(double));
+
+                    pNumOut->set(i, pSPNum);
+                    pDenOut->set(i, pSPDen);
+
+                    delete pdblNumTmp;
+                    delete pdblDenTmp;
+                    delete pSPNum;
+                    delete pSPDen;
+                }
+
+                delete pdblWork;
+                break;
+            }
+            case 2 : // sim(poly, double)
+            {
+                types::Polynom* pNum = in[0]->getAs<types::Polynom>();
+                types::Double* pDen  = in[1]->getAs<types::Double>();
+
+                wstrName    = pNum->getVariableName();
+                iMaxDegrNum = pNum->getMaxRank() - 1;
+
+                pNumOut = new types::Polynom(wstrName, pNum->getRows(), pNum->getCols());
+                pDenOut = new types::Polynom(wstrName, pNum->getRows(), pNum->getCols());
+
+                int iMax = max(iMaxDegrNum, iMaxDegrDen) + 1;
+                int iSizeWork = 2 * (iMaxDegrNum + iMaxDegrDen) +
+                                min(iMaxDegrNum, iMaxDegrDen) +
+                                10 * iMax + 3 * iMax * iMax + 4;
+                double* pdblWork = new double[iSizeWork];
+
+                for (int i = 0; i < iSize; i++)
+                {
+                    double* pdblNum = pNum->get(i)->getCoefReal();
+                    double dblDen   = pDen->get(i);
+                    int iDegreeNum  = pNum->get(i)->getRank() - 1;
+                    int iDegreeDen  = 0;
+
+                    double* pdblNumOut = NULL;
+                    double* pdblDenOut = NULL;
+
+                    double* pdblNumTmp = new double[iDegreeNum + 1];
+                    double* pdblDenTmp = new double[1];
+
+                    int iRankNumOut = 0;
+                    int iRankDenOut = 0;
+
+                    iErr = iSizeWork;
+
+                    C2F(dpsimp)(pdblNum, &iDegreeNum, &dblDen, &iDegreeDen,
+                                pdblNumTmp, &iRankNumOut, pdblDenTmp, &iRankDenOut,
+                                pdblWork, &iErr);
+
+                    if (iErr)
+                    {
+                        delete pdblNumTmp;
+                        delete pdblDenTmp;
+                        break;
+                    }
+
+                    types::SinglePoly* pSPNum = new types::SinglePoly(&pdblNumOut, iRankNumOut);
+                    types::SinglePoly* pSPDen = new types::SinglePoly(&pdblDenOut, iRankDenOut);
+
+                    memcpy(pdblNumOut, pdblNumTmp, iRankNumOut * sizeof(double));
+                    memcpy(pdblDenOut, pdblDenTmp, iRankDenOut * sizeof(double));
+
+                    pNumOut->set(i, pSPNum);
+                    pDenOut->set(i, pSPDen);
+
+                    delete pdblNumTmp;
+                    delete pdblDenTmp;
+                    delete pSPNum;
+                    delete pSPDen;
+                }
+
+                delete pdblWork;
+                break;
+            }
+        }
+    }
+
+    if (iErr)
+    {
+        delete pNumOut;
+        delete pDenOut;
+
+        Scierror(999, _("%s: Wrong value for input argument #%d: A non null denominator expected.\n"), "simp", 2);
+        return types::Function::Error;
+    }
+
+    out.push_back(pNumOut);
+    out.push_back(pDenOut);
+    return types::Function::OK;
+}
+/*--------------------------------------------------------------------------*/
+
diff --git a/scilab/modules/polynomials/sci_gateway/cpp/sci_simpMode.cpp b/scilab/modules/polynomials/sci_gateway/cpp/sci_simpMode.cpp
new file mode 100644 (file)
index 0000000..c786f62
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2012 - Scilab Enterprises - 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 "polynomials_gw.hxx"
+#include "function.hxx"
+#include "bool.hxx"
+#include "configvariable.hxx"
+
+extern "C"
+{
+#include "Scierror.h"
+#include "localization.h"
+}
+/*--------------------------------------------------------------------------*/
+types::Function::ReturnValue sci_simpMode(types::typed_list &in, int _iRetCount, types::typed_list &out)
+{
+    if (in.size() > 1)
+    {
+        Scierror(77, _("%s: Wrong number of input argument(s): %d to %d expected.\n"), "simp_mode", 0, 1);
+        return types::Function::Error;
+    }
+
+    if (_iRetCount > 1)
+    {
+        Scierror(78, _("%s: Wrong number of output argument(s): %d expected.\n"), "simp_mode", 1);
+        return types::Function::Error;
+    }
+
+    // set simp mode
+    if (in.size() == 1)
+    {
+        if (in[0]->isBool() == false)
+        {
+            Scierror(999, _("%s: Wrong type for input argument #%d: A boolean expected.\n"), "simp_mode", 1);
+            return types::Function::Error;
+        }
+
+        types::Bool* pBIn = in[0]->getAs<types::Bool>();
+
+        if (pBIn->isScalar() == false)
+        {
+            Scierror(999, _("%s: Wrong size for input argument #%d: A boolean scalar expected.\n"), "simp_mode", 1);
+            return types::Function::Error;
+        }
+
+        ConfigVariable::setSimpMode(pBIn->get(0));
+    }
+    else // if (in.size() == 0) get simp mode
+    {
+        out.push_back(new types::Bool(ConfigVariable::getSimpMode()));
+    }
+
+    return types::Function::OK;
+}
+/*--------------------------------------------------------------------------*/
+
diff --git a/scilab/modules/polynomials/sci_gateway/cpp/sci_varn.cpp b/scilab/modules/polynomials/sci_gateway/cpp/sci_varn.cpp
new file mode 100644 (file)
index 0000000..7d9118c
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2012 - Scilab Enterprises - 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 "polynomials_gw.hxx"
+#include "function.hxx"
+#include "double.hxx"
+#include "string.hxx"
+#include "polynom.hxx"
+#include "overload.hxx"
+#include "execvisitor.hxx"
+
+extern "C"
+{
+#include "Scierror.h"
+#include "localization.h"
+}
+/*--------------------------------------------------------------------------*/
+types::Function::ReturnValue sci_varn(types::typed_list &in, int _iRetCount, types::typed_list &out)
+{
+    types::Polynom* pPolyIn  = NULL;
+    types::String* pStrName  = NULL;
+    types::Polynom* pPolyOut = NULL;
+
+    if (in.size() < 1 || in.size() > 2)
+    {
+        Scierror(77, _("%s: Wrong number of input argument(s): %d to %d expected.\n"), "varn", 1, 2);
+        return types::Function::Error;
+    }
+
+    if (_iRetCount > 1)
+    {
+        Scierror(78, _("%s: Wrong number of output argument(s): %d expected.\n"), "varn", 1);
+        return types::Function::Error;
+    }
+
+    if (in[0]->isPoly() == false)
+    {
+        if (in[0]->isDouble() && in[0]->getAs<types::Double>()->isEmpty())
+        {
+            out.push_back(types::Double::Empty());
+            return types::Function::OK;
+        }
+
+        std::wstring wstFuncName = L"%"  + in[0]->getShortTypeStr() + L"_varn";
+        return Overload::call(wstFuncName, in, _iRetCount, out, new ExecVisitor());
+    }
+
+    pPolyIn = in[0]->getAs<types::Polynom>();
+
+    if (in.size() == 1)
+    {
+        out.push_back(new types::String(pPolyIn->getVariableName().c_str()));
+    }
+    else // if (in.size() == 2)
+    {
+        if (in[1]->isString() == false)
+        {
+            Scierror(999, _("%s: Wrong type for input argument #%d : A string expected.\n"), "varn", 2);
+            return types::Function::Error;
+        }
+
+        pStrName = in[1]->getAs<types::String>();
+        if (pStrName->isScalar() == false)
+        {
+            Scierror(999, _("%s: Wrong size for input argument #%d : A scalar expected.\n"), "varn", 2);
+            return types::Function::Error;
+        }
+
+        std::wstring wstrName = pStrName->get(0);
+        // search blank
+        size_t blankpos = wstrName.find_first_of(L" ");
+        if ((int)blankpos != -1)
+        {
+            // blank found
+            Scierror(999, _("%s: Wrong value for input argument #%d : Valid variable name expected.\n"), "varn", 2);
+            return types::Function::Error;
+        }
+
+        pPolyOut = pPolyIn->clone()->getAs<types::Polynom>();
+        pPolyOut->setVariableName(std::wstring(wstrName));
+        out.push_back(pPolyOut);
+    }
+
+    return types::Function::OK;
+}
+/*--------------------------------------------------------------------------*/
+
diff --git a/scilab/modules/polynomials/src/c/Elementary_functions_f_Import.def b/scilab/modules/polynomials/src/c/Elementary_functions_f_Import.def
new file mode 100644 (file)
index 0000000..ca91d14
--- /dev/null
@@ -0,0 +1,8 @@
+       LIBRARY    elementary_functions_f.dll
+
+
+EXPORTS
+;
+;elementary_functions_f
+wscal_
+dset_
index a31c7df..ee19220 100644 (file)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
 <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <ItemGroup Label="ProjectConfigurations">
     <ProjectConfiguration Include="Debug|Win32">
@@ -76,7 +76,7 @@
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>../../includes;../../../../libs/MALLOC/includes;../../../output_stream/includes;../../../localization/includes;../../../core/includes;../../../../libs/hashtable;../../../../libs/intl;../../../api_scilab/includes;../../../operations/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../../includes;../../../../libs/MALLOC/includes;../../../output_stream/includes;../../../localization/includes;../../../core/includes;../../../../libs/hashtable;../../../../libs/intl;../../../api_scilab/includes;../../../operations/includes;../../../types/includes;../../../ast/includes;../../../symbol/includes;../../../system_env/includes;../../../threads/includes;../../../string/includes;../../../console/includes;../../../libs/dynamiclibrary/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;POLYNOMIALS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <WarningLevel>Level3</WarningLevel>
       <Message>Make dependencies</Message>
       <Command>lib /DEF:"$(ProjectDir)core_import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)core.lib" 1&gt;NUL 2&gt;NUL
 lib /DEF:"$(ProjectDir)polynomials_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)polynomials_f.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)elementary_functions_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)elementary_functions_f.lib" 1&gt;NUL 2&gt;NUL
 </Command>
     </PreLinkEvent>
     <Link>
-      <AdditionalDependencies>core.lib;polynomials_f.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>core.lib;polynomials_f.lib;elementary_functions_f.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <OutputFile>$(SolutionDir)bin\$(ProjectName).dll</OutputFile>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <SubSystem>Windows</SubSystem>
@@ -104,7 +105,7 @@ lib /DEF:"$(ProjectDir)polynomials_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(P
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>../../includes;../../../../libs/MALLOC/includes;../../../output_stream/includes;../../../localization/includes;../../../core/includes;../../../../libs/hashtable;../../../../libs/intl;../../../api_scilab/includes;../../../operations/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../../includes;../../../../libs/MALLOC/includes;../../../../libs/dynamiclibrary/includes;../../../../libs/Eigen/includes;../../../../libs/intl;../../../localization/includes;../../../core/includes;../../../output_stream/includes;../../../api_scilab/includes;../../../operations/includes;../../../types/includes;../../../ast/includes;../../../symbol/includes;../../../system_env/includes;../../../threads/includes;../../../string/includes;../../../console/includes;../../../elementary_functions/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;POLYNOMIALS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <WarningLevel>Level3</WarningLevel>
@@ -113,10 +114,11 @@ lib /DEF:"$(ProjectDir)polynomials_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(P
       <Message>Make dependencies</Message>
       <Command>lib /DEF:"$(ProjectDir)core_import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)core.lib" 1&gt;NUL 2&gt;NUL
 lib /DEF:"$(ProjectDir)polynomials_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)polynomials_f.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)elementary_functions_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)elementary_functions_f.lib" 1&gt;NUL 2&gt;NUL
 </Command>
     </PreLinkEvent>
     <Link>
-      <AdditionalDependencies>core.lib;polynomials_f.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>core.lib;polynomials_f.lib;elementary_functions_f.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <OutputFile>$(SolutionDir)bin\$(ProjectName).dll</OutputFile>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <SubSystem>Windows</SubSystem>
@@ -130,7 +132,7 @@ lib /DEF:"$(ProjectDir)polynomials_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(P
     <ClCompile>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
       <WholeProgramOptimization>false</WholeProgramOptimization>
-      <AdditionalIncludeDirectories>../../includes;../../../../libs/MALLOC/includes;../../../output_stream/includes;../../../localization/includes;../../../core/includes;../../../../libs/hashtable;../../../../libs/intl;../../../api_scilab/includes;../../../operations/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../../includes;../../../../libs/MALLOC/includes;../../../output_stream/includes;../../../localization/includes;../../../core/includes;../../../../libs/hashtable;../../../../libs/intl;../../../api_scilab/includes;../../../operations/includes;../../../types/includes;../../../ast/includes;../../../symbol/includes;../../../system_env/includes;../../../threads/includes;../../../string/includes;../../../console/includes;../../../libs/dynamiclibrary/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;POLYNOMIALS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -141,10 +143,11 @@ lib /DEF:"$(ProjectDir)polynomials_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(P
       <Message>Make dependencies</Message>
       <Command>lib /DEF:"$(ProjectDir)core_import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)core.lib" 1&gt;NUL 2&gt;NUL
 lib /DEF:"$(ProjectDir)polynomials_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)polynomials_f.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)elementary_functions_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)elementary_functions_f.lib" 1&gt;NUL 2&gt;NUL
 </Command>
     </PreLinkEvent>
     <Link>
-      <AdditionalDependencies>core.lib;polynomials_f.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>core.lib;polynomials_f.lib;elementary_functions_f.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <OutputFile>$(SolutionDir)bin\$(ProjectName).dll</OutputFile>
       <GenerateDebugInformation>false</GenerateDebugInformation>
       <SubSystem>Windows</SubSystem>
@@ -163,7 +166,7 @@ lib /DEF:"$(ProjectDir)polynomials_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(P
     <ClCompile>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
       <WholeProgramOptimization>false</WholeProgramOptimization>
-      <AdditionalIncludeDirectories>../../includes;../../../../libs/MALLOC/includes;../../../output_stream/includes;../../../localization/includes;../../../core/includes;../../../../libs/hashtable;../../../../libs/intl;../../../api_scilab/includes;../../../operations/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../../includes;../../../../libs/MALLOC/includes;../../../output_stream/includes;../../../localization/includes;../../../core/includes;../../../../libs/hashtable;../../../../libs/intl;../../../api_scilab/includes;../../../operations/includes;../../../types/includes;../../../ast/includes;../../../symbol/includes;../../../system_env/includes;../../../threads/includes;../../../string/includes;../../../console/includes;../../../libs/dynamiclibrary/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;POLYNOMIALS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -174,10 +177,11 @@ lib /DEF:"$(ProjectDir)polynomials_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(P
       <Message>Make dependencies</Message>
       <Command>lib /DEF:"$(ProjectDir)core_import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)core.lib" 1&gt;NUL 2&gt;NUL
 lib /DEF:"$(ProjectDir)polynomials_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)polynomials_f.lib" 1&gt;NUL 2&gt;NUL
+lib /DEF:"$(ProjectDir)elementary_functions_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)elementary_functions_f.lib" 1&gt;NUL 2&gt;NUL
 </Command>
     </PreLinkEvent>
     <Link>
-      <AdditionalDependencies>core.lib;polynomials_f.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>core.lib;polynomials_f.lib;elementary_functions_f.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <OutputFile>$(SolutionDir)bin\$(ProjectName).dll</OutputFile>
       <GenerateDebugInformation>false</GenerateDebugInformation>
       <SubSystem>Windows</SubSystem>
@@ -190,32 +194,28 @@ lib /DEF:"$(ProjectDir)polynomials_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(P
     </Link>
   </ItemDefinitionGroup>
   <ItemGroup>
+    <ClCompile Include="..\..\sci_gateway\cpp\polynomials_gw.cpp" />
+    <ClCompile Include="..\..\sci_gateway\cpp\sci_bezout.cpp" />
+    <ClCompile Include="..\..\sci_gateway\cpp\sci_coeff.cpp" />
+    <ClCompile Include="..\..\sci_gateway\cpp\sci_degree.cpp" />
+    <ClCompile Include="..\..\sci_gateway\cpp\sci_poly.cpp" />
+    <ClCompile Include="..\..\sci_gateway\cpp\sci_pppdiv.cpp" />
+    <ClCompile Include="..\..\sci_gateway\cpp\sci_roots.cpp" />
+    <ClCompile Include="..\..\sci_gateway\cpp\sci_sfact.cpp" />
+    <ClCompile Include="..\..\sci_gateway\cpp\sci_simp.cpp" />
+    <ClCompile Include="..\..\sci_gateway\cpp\sci_simpMode.cpp" />
+    <ClCompile Include="..\..\sci_gateway\cpp\sci_varn.cpp" />
     <ClCompile Include="DllmainPolynomial.c" />
-    <ClCompile Include="..\..\sci_gateway\c\gw_polynomials.c" />
-    <ClCompile Include="..\..\sci_gateway\c\sci_bezout.c" />
-    <ClCompile Include="..\..\sci_gateway\c\sci_cleanp.c" />
-    <ClCompile Include="..\..\sci_gateway\c\sci_coeff.c" />
-    <ClCompile Include="..\..\sci_gateway\c\sci_degree.c" />
-    <ClCompile Include="..\..\sci_gateway\c\sci_diag.c" />
-    <ClCompile Include="..\..\sci_gateway\c\sci_div.c" />
-    <ClCompile Include="..\..\sci_gateway\c\sci_poly.c" />
-    <ClCompile Include="..\..\sci_gateway\c\sci_prod.c" />
-    <ClCompile Include="..\..\sci_gateway\c\sci_roots.c" />
-    <ClCompile Include="..\..\sci_gateway\c\sci_sfact.c" />
-    <ClCompile Include="..\..\sci_gateway\c\sci_simp.c" />
-    <ClCompile Include="..\..\sci_gateway\c\sci_simp_mode.c" />
-    <ClCompile Include="..\..\sci_gateway\c\sci_sum.c" />
-    <ClCompile Include="..\..\sci_gateway\c\sci_tril.c" />
-    <ClCompile Include="..\..\sci_gateway\c\sci_triu.c" />
-    <ClCompile Include="..\..\sci_gateway\c\sci_varn.c" />
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\includes\dynlib_polynomials.h" />
     <ClInclude Include="..\..\includes\gw_polynomials.h" />
+    <ClInclude Include="..\..\includes\polynomials_gw.hxx" />
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\locales\polynomials.pot" />
     <None Include="core_import.def" />
+    <None Include="Elementary_functions_f_Import.def" />
     <None Include="polynomials_f_Import.def" />
     <None Include="..\..\Makefile.am" />
     <None Include="..\..\polynomials.iss" />
@@ -236,6 +236,39 @@ lib /DEF:"$(ProjectDir)polynomials_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(P
     <ProjectReference Include="..\..\..\api_scilab\api_scilab.vcxproj">
       <Project>{43c5bab1-1dca-4743-a183-77e0d42fe7d0}</Project>
     </ProjectReference>
+    <ProjectReference Include="..\..\..\ast\ast-tools\ast-tools.vcxproj">
+      <Project>{1f4a0344-99ed-461b-bd53-1593788fb34d}</Project>
+    </ProjectReference>
+    <ProjectReference Include="..\..\..\ast\ast.vcxproj">
+      <Project>{0d3fa25b-8116-44ec-a45e-260789daa3d9}</Project>
+    </ProjectReference>
+    <ProjectReference Include="..\..\..\console\src\c\console.vcxproj">
+      <Project>{445d3b85-c9b1-498b-9c88-0a3c2390b1cc}</Project>
+    </ProjectReference>
+    <ProjectReference Include="..\..\..\localization\src\localization.vcxproj">
+      <Project>{ecffeb0c-1eda-45ee-9a10-b18143852e17}</Project>
+    </ProjectReference>
+    <ProjectReference Include="..\..\..\operations\operations.vcxproj">
+      <Project>{1bb396f7-ce61-4cfc-9c22-266b2cfb2e74}</Project>
+    </ProjectReference>
+    <ProjectReference Include="..\..\..\output_stream\src\c\output_stream.vcxproj">
+      <Project>{a5911cd7-f8e8-440c-a23e-4843a0636f3a}</Project>
+    </ProjectReference>
+    <ProjectReference Include="..\..\..\symbol\symbol.vcxproj">
+      <Project>{2c60033b-0dbd-4ca4-80d3-176c9be9ce2f}</Project>
+    </ProjectReference>
+    <ProjectReference Include="..\..\..\system_env\system_env.vcxproj">
+      <Project>{7ca60aef-9afa-4d06-af28-613c0aa27640}</Project>
+    </ProjectReference>
+    <ProjectReference Include="..\..\..\types\types.vcxproj">
+      <Project>{64e090da-dcb5-4f4d-93d7-e88ddec9c2ef}</Project>
+    </ProjectReference>
+    <ProjectReference Include="..\..\..\types\typesmacro\typesmacro.vcxproj">
+      <Project>{9252a034-7f22-4cb1-a634-4577da69f2d0}</Project>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <Library Include="..\..\..\..\bin\blasplus.lib" />
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
index e7d400a..c452d28 100644 (file)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
 <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <ItemGroup>
     <Filter Include="Source Files">
     <ClCompile Include="DllmainPolynomial.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\sci_gateway\c\gw_polynomials.c">
+    <ClCompile Include="..\..\sci_gateway\cpp\polynomials_gw.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\sci_gateway\c\sci_bezout.c">
+    <ClCompile Include="..\..\sci_gateway\cpp\sci_coeff.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\sci_gateway\c\sci_cleanp.c">
+    <ClCompile Include="..\..\sci_gateway\cpp\sci_degree.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\sci_gateway\c\sci_coeff.c">
+    <ClCompile Include="..\..\sci_gateway\cpp\sci_poly.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\sci_gateway\c\sci_degree.c">
+    <ClCompile Include="..\..\sci_gateway\cpp\sci_pppdiv.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\sci_gateway\c\sci_diag.c">
+    <ClCompile Include="..\..\sci_gateway\cpp\sci_roots.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\sci_gateway\c\sci_div.c">
+    <ClCompile Include="..\..\sci_gateway\cpp\sci_varn.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\sci_gateway\c\sci_poly.c">
+    <ClCompile Include="..\..\sci_gateway\cpp\sci_bezout.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\sci_gateway\c\sci_prod.c">
+    <ClCompile Include="..\..\sci_gateway\cpp\sci_sfact.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\sci_gateway\c\sci_roots.c">
+    <ClCompile Include="..\..\sci_gateway\cpp\sci_simp.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\sci_gateway\c\sci_sfact.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\sci_gateway\c\sci_simp.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\sci_gateway\c\sci_simp_mode.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\sci_gateway\c\sci_sum.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\sci_gateway\c\sci_tril.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\sci_gateway\c\sci_triu.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\sci_gateway\c\sci_varn.c">
+    <ClCompile Include="..\..\sci_gateway\cpp\sci_simpMode.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
   </ItemGroup>
@@ -85,6 +67,9 @@
     <ClInclude Include="..\..\includes\gw_polynomials.h">
       <Filter>Header Files</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\includes\polynomials_gw.hxx">
+      <Filter>Header Files</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="core_import.def">
     <None Include="..\..\locales\polynomials.pot">
       <Filter>localization</Filter>
     </None>
+    <None Include="Elementary_functions_f_Import.def">
+      <Filter>Libraries Dependencies\Imports</Filter>
+    </None>
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="polynomials.rc">
       <Filter>Resource Files</Filter>
     </ResourceCompile>
   </ItemGroup>
+  <ItemGroup>
+    <Library Include="..\..\..\..\bin\blasplus.lib" />
+  </ItemGroup>
 </Project>
\ No newline at end of file
index ee11de6..3d3e8be 100644 (file)
@@ -5,19 +5,12 @@ EXPORTS
 ; --------------------------------------- 
 ; polynomials_f
 ; --------------------------------------- 
-intbez_
-intpclean_
-intcoeff_
-intdegree_
-intpdiag_
-intpdiv_
-intpoly_
-intpprod_
-introots_
-intsfact_
-intsimp_
-intsimpmd_
-intpsum_
-intptriu_
-intvarn_
-
+rpoly_
+wpodiv_
+dpodiv_
+wprxc_
+dprxc_
+recbez_
+dpsimp_
+sfact1_
+sfact2_
\ No newline at end of file
index 5857a3d..a9f224c 100644 (file)
@@ -37,7 +37,8 @@ c     chevauchent, l'adresse de a1 (resp b1) doit etre au moins egale a
 c     l'adresse de a  (resp b)
 c
 c     w    :  tableau de travail de taille:
-c             2*(na+nb)+min(na,nb)+10*max(na,nb)+3*max(na,nb)**2+4
+c             n0 = max(na,nb) + 1
+c             2*(na+nb)+min(na,nb)+10*n0+3*n0**2+4
 c     ierr :
 c             en entree ierr specifie l'espace memoire disponible dans w
 c             en sortie:
@@ -89,8 +90,8 @@ c
 
       n0=max(na1,nb1)+1
       lfree=lw+10*n0+3*n0*n0
-      if(lfree.ge.maxw.and.na1.gt.0.and.nb1.gt.0) ierr=2
-      if(lfree.ge.maxw.or.na1.eq.0.or.nb1.eq.0) then
+      if(lfree.gt.maxw.and.na1.gt.0.and.nb1.gt.0) ierr=2
+      if(lfree.gt.maxw.or.na1.eq.0.or.nb1.eq.0) then
          if(nz.eq.0) then
             call dcopy(na1+1,a(la0),1,a1,1)
             call dcopy(nb1+1,b(lb0),1,b1,1)
index e795962..a75e526 100644 (file)
@@ -161,27 +161,6 @@ lib /DEF:&quot;$(InputDir)core_f_Import.def&quot; /SUBSYSTEM:WINDOWS /MACHINE:X6
                <File RelativePath=".\recbez.f"/>
                <File RelativePath=".\residu.f"/>
                <File RelativePath=".\rpoly.f"/>
-               <File RelativePath="..\..\sci_gateway\fortran\sci_f_bezout.f">
-                       <FileConfiguration Name="Release|x64">
-                               <Tool Name="VFFortranCompilerTool" Optimization="optimizeDisabled"/></FileConfiguration>
-                       <FileConfiguration Name="Release|Win32">
-                               <Tool Name="VFFortranCompilerTool" Optimization="optimizeDisabled"/></FileConfiguration></File>
-               <File RelativePath="..\..\sci_gateway\fortran\sci_f_coeff.f"/>
-               <File RelativePath="..\..\sci_gateway\fortran\sci_f_degree.f"/>
-               <File RelativePath="..\..\sci_gateway\fortran\sci_f_diag.f"/>
-               <File RelativePath="..\..\sci_gateway\fortran\sci_f_div.f"/>
-               <File RelativePath="..\..\sci_gateway\fortran\sci_f_pclean.f"/>
-               <File RelativePath="..\..\sci_gateway\fortran\sci_f_poly.f"/>
-               <File RelativePath="..\..\sci_gateway\fortran\sci_f_prod.f"/>
-               <File RelativePath="..\..\sci_gateway\fortran\sci_f_psimp.f"/>
-               <File RelativePath="..\..\sci_gateway\fortran\sci_f_roots.f"/>
-               <File RelativePath="..\..\sci_gateway\fortran\sci_f_rsimp.f"/>
-               <File RelativePath="..\..\sci_gateway\fortran\sci_f_sfact.f"/>
-               <File RelativePath="..\..\sci_gateway\fortran\sci_f_simp.f"/>
-               <File RelativePath="..\..\sci_gateway\fortran\sci_f_simpmd.f"/>
-               <File RelativePath="..\..\sci_gateway\fortran\sci_f_sum.f"/>
-               <File RelativePath="..\..\sci_gateway\fortran\sci_f_triu_tril.f"/>
-               <File RelativePath="..\..\sci_gateway\fortran\sci_f_varn.f"/>
                <File RelativePath=".\sfact1.f"/>
                <File RelativePath=".\sfact2.f"/>
                <File RelativePath=".\wdmpad.f"/>
index 33778d5..2a6749c 100644 (file)
@@ -14,19 +14,19 @@ c     par : a*(a(1/z) = b(n)*z**-n+....+b(0)+ ... +b(n)*z**n
 c!liste d'appel
 c     subroutine sfact1(b,n,w,maxit,ierr)
 c
-c     double precision b(n+1),w(6*(n+1))
+c     double precision b(n+1),w(7*(n+1))
 c     integer n,maxit,ierr
 c
-c     b : contient les coeffs b(n),b(n-1),....,b(0)
+c     b : contient les coeffs b(0),b(1),....,b(n)
 c         apres execution b contient les coeff du resultat
 c     n : degre de a
-c     w : tableau de travail de taille 6*(n+1)
+c     w : tableau de travail de taille 7*(n+1)
 c     maxit : nombre maxi d'iterations admis
 c     ierr : indicateur d'erreur
 c             si ierr=0 : ok
 c             si ierr<0 : convergence a 10**ierr pres
 c             si ierr=1 : non convergence
-c             si ierr=2 : b(0) est negatif ou nul.
+c             si ierr=2 : b(n) est negatif ou nul.
 c
 c!origine
 c     V Kucera : Discrete Linear control (john Wiley& Sons) 1979
index 16a2318..c75a6f0 100644 (file)
@@ -22,7 +22,8 @@ SYSTEM_ENV_CPP_SOURCES = \
        src/cpp/lasterror.cpp \
        src/cpp/promptmode.cpp \
        src/cpp/formatmode.cpp \
-       src/cpp/sci_ieee.cpp
+       src/cpp/sci_ieee.cpp \
+       src/cpp/sci_simpMode.cpp
 
 pkglib_LTLIBRARIES = libscisystem_env.la
 
index 17f86e9..2f484ad 100644 (file)
@@ -120,7 +120,8 @@ am__objects_1 = libscisystem_env_la-setenvvar.lo \
        libscisystem_env_la-lasterror.lo \
        libscisystem_env_la-promptmode.lo \
        libscisystem_env_la-formatmode.lo \
-       libscisystem_env_la-sci_ieee.lo
+       libscisystem_env_la-sci_ieee.lo \
+       libscisystem_env_la-sci_simpMode.lo
 am_libscisystem_env_la_OBJECTS = $(am__objects_1)
 libscisystem_env_la_OBJECTS = $(am_libscisystem_env_la_OBJECTS)
 DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/modules/core/includes
@@ -419,7 +420,8 @@ SYSTEM_ENV_CPP_SOURCES = \
        src/cpp/lasterror.cpp \
        src/cpp/promptmode.cpp \
        src/cpp/formatmode.cpp \
-       src/cpp/sci_ieee.cpp
+       src/cpp/sci_ieee.cpp \
+       src/cpp/sci_simpMode.cpp
 
 pkglib_LTLIBRARIES = libscisystem_env.la
 libscisystem_env_la_SOURCES = $(SYSTEM_ENV_CPP_SOURCES)
@@ -531,6 +533,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscisystem_env_la-sci_ieee.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscisystem_env_la-sci_mode.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscisystem_env_la-sci_path.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscisystem_env_la-sci_simpMode.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscisystem_env_la-sci_tmpdir.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscisystem_env_la-sci_warning.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscisystem_env_la-setenvvar.Plo@am__quote@
@@ -640,6 +643,13 @@ libscisystem_env_la-sci_ieee.lo: src/cpp/sci_ieee.cpp
 @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) $(libscisystem_env_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscisystem_env_la-sci_ieee.lo `test -f 'src/cpp/sci_ieee.cpp' || echo '$(srcdir)/'`src/cpp/sci_ieee.cpp
 
+libscisystem_env_la-sci_simpMode.lo: src/cpp/sci_simpMode.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscisystem_env_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscisystem_env_la-sci_simpMode.lo -MD -MP -MF $(DEPDIR)/libscisystem_env_la-sci_simpMode.Tpo -c -o libscisystem_env_la-sci_simpMode.lo `test -f 'src/cpp/sci_simpMode.cpp' || echo '$(srcdir)/'`src/cpp/sci_simpMode.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscisystem_env_la-sci_simpMode.Tpo $(DEPDIR)/libscisystem_env_la-sci_simpMode.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='src/cpp/sci_simpMode.cpp' object='libscisystem_env_la-sci_simpMode.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) $(libscisystem_env_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscisystem_env_la-sci_simpMode.lo `test -f 'src/cpp/sci_simpMode.cpp' || echo '$(srcdir)/'`src/cpp/sci_simpMode.cpp
+
 mostlyclean-libtool:
        -rm -f *.lo
 
index 3512535..62df317 100644 (file)
@@ -315,6 +315,14 @@ private :
 public :
     static void setIeee(int _iIeee);
     static int getIeee();
+
+    // simp mode
+private :
+    static int m_iSimpMode;
+
+public :
+    static void setSimpMode(int _iSimpMode);
+    static int getSimpMode();
 };
 
 #endif /* !__CONFIGVARIABLE_HXX__ */
diff --git a/scilab/modules/system_env/includes/sci_simpMode.h b/scilab/modules/system_env/includes/sci_simpMode.h
new file mode 100644 (file)
index 0000000..ebd0d0f
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+*  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+*  Copyright (C) 2012 - Scilab Enterprises - 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 __SCI_SIMPMODE_H__
+#define __SCI_SIMPMODE_H__
+
+#include "dynlib_system_env.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    EXTERN_SYSTEM_ENV int getSimpMode(void);
+    EXTERN_SYSTEM_ENV void setSimpMode(int);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ! __SCI_SIMPMODE_H__
index eb2c416..2b2435f 100644 (file)
@@ -902,3 +902,22 @@ int ConfigVariable::getIeee()
 /*
 ** \}
 */
+
+/*
+** simp Mode
+** \{
+*/
+int ConfigVariable::m_iSimpMode = 1;
+
+void ConfigVariable::setSimpMode(int _iSimpMode)
+{
+    m_iSimpMode = _iSimpMode;
+}
+
+int ConfigVariable::getSimpMode()
+{
+    return m_iSimpMode;
+}
+/*
+** \}
+*/
diff --git a/scilab/modules/system_env/src/cpp/sci_simpMode.cpp b/scilab/modules/system_env/src/cpp/sci_simpMode.cpp
new file mode 100644 (file)
index 0000000..60c3df8
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) 2012 - Scilab Enterprises - 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 "configvariable.hxx"
+
+extern "C"
+{
+#include "sci_simpMode.h"
+}
+
+int getSimpMode()
+{
+    return ConfigVariable::getSimpMode();
+}
+
+void setSimpMode(int _isimpmd)
+{
+    ConfigVariable::setSimpMode(_isimpmd);
+}
index 6379afb..3a9382d 100644 (file)
 
 namespace types
 {
-    class TYPES_IMPEXP Polynom : public ArrayOf<SinglePoly*>
+class TYPES_IMPEXP Polynom : public ArrayOf<SinglePoly*>
+{
+public :
+    Polynom();
+    Polynom(std::wstring _szVarName, int _iRows, int _iCols);
+    Polynom(std::wstring _szVarName, int _iRows, int _iCols, const int *_piRank);
+    Polynom(std::wstring _szVarName, int _iDims, int* _piDims);
+    Polynom(std::wstring _szVarName, int _iDims, int* _piDims, const int *_piRank);
+
+    virtual                 ~Polynom();
+
+    // FIXME : Should not return NULL
+    InternalType*           clone();
+
+    bool                    setCoef(int _iRows, int _iCols, Double *_pdblCoef);
+    bool                    setCoef(int _iIdx, Double *_pdblCoef);
+
+    virtual void            setComplex(bool _bComplex);
+
+    virtual RealType        getType();
+    bool                    isPoly()
     {
-    public :
-                                Polynom();
-                                Polynom(std::wstring _szVarName, int _iRows, int _iCols);
-                                Polynom(std::wstring _szVarName, int _iRows, int _iCols, const int *_piRank);
-                                Polynom(std::wstring _szVarName, int _iDims, int* _piDims);
-                                Polynom(std::wstring _szVarName, int _iDims, int* _piDims, const int *_piRank);
-
-        virtual                 ~Polynom();
-
-        // FIXME : Should not return NULL
-        InternalType*           clone();
-
-        bool                    setCoef(int _iRows, int _iCols, Double *_pdblCoef);
-        bool                    setCoef(int _iIdx, Double *_pdblCoef);
-
-           virtual void            setComplex(bool _bComplex);
-
-        virtual RealType        getType();
-        bool                    isPoly() { return true; }
-        void                    whoAmI(void);
-        std::wstring            getVariableName();
-        bool                    getRank(int *_piRank);
-        int                     getMaxRank(void);
-        Double*                 evaluate(Double* _pdblValue);
-        void                    updateRank(void);
-        Double*                 getCoef(void);
-        void                    setCoef(Double *_pCoef);
-        Double*                 extractCoef(int _iRank);
-        bool                    insertCoef(int _iRank, Double* _pCoef);
-        bool                    set(int _iPos, SinglePoly* _pS);
-        bool                    set(int _iRows, int _iCols, SinglePoly* _pS);
-        bool                    set(SinglePoly** _pS);
-
-        std::wstring            getRowString(int* _piDims, int _iDims, bool _bComplex);
-        std::wstring            getColString(int* _piDims, int _iDims, bool _bComplex);
-        std::wstring            getMatrixString(int* _piDims, int _iDims, bool _bComplex);
-
-
-        bool                    operator==(const InternalType& it);
-        bool                    operator!=(const InternalType& it);
-
-        /* return type as string ( double, int, cell, list, ... )*/
-        virtual std::wstring    getTypeStr() {return L"polynomial";}
-        /* return type as short string ( s, i, ce, l, ... )*/
-        virtual std::wstring    getShortTypeStr() {return L"p";}
-
-    protected :
-        std::wstring            m_szVarName;
-        void                    createPoly(std::wstring _szVarName, int _iDims, int* _piDims, const int *_piRank);
-
-    private :
-        virtual bool            subMatrixToString(std::wostringstream& ostr, int* _piDims, int _iDims);
-
-        virtual SinglePoly*     getNullValue();
-        virtual Polynom*        createEmpty(int _iDims, int* _piDims, bool _bComplex = false);
-        virtual SinglePoly*     copyValue(SinglePoly* _pData);
-        virtual void            deleteAll();
-        virtual void            deleteImg();
-        virtual SinglePoly**    allocData(int _iSize);
-
-    };
+        return true;
+    }
+    void                    whoAmI(void);
+    std::wstring            getVariableName();
+    void                    setVariableName(std::wstring);
+    bool                    getRank(int *_piRank);
+    int                     getMaxRank(void);
+    Double*                 evaluate(Double* _pdblValue);
+    void                    updateRank(void);
+    Double*                 getCoef(void);
+    void                    setCoef(Double *_pCoef);
+    Double*                 extractCoef(int _iRank);
+    bool                    insertCoef(int _iRank, Double* _pCoef);
+    bool                    set(int _iPos, SinglePoly* _pS);
+    bool                    set(int _iRows, int _iCols, SinglePoly* _pS);
+    bool                    set(SinglePoly** _pS);
+
+    std::wstring            getRowString(int* _piDims, int _iDims, bool _bComplex);
+    std::wstring            getColString(int* _piDims, int _iDims, bool _bComplex);
+    std::wstring            getMatrixString(int* _piDims, int _iDims, bool _bComplex);
+
+
+    bool                    operator==(const InternalType& it);
+    bool                    operator!=(const InternalType& it);
+
+    /* return type as string ( double, int, cell, list, ... )*/
+    virtual std::wstring    getTypeStr()
+    {
+        return L"polynomial";
+    }
+    /* return type as short string ( s, i, ce, l, ... )*/
+    virtual std::wstring    getShortTypeStr()
+    {
+        return L"p";
+    }
+
+protected :
+    std::wstring            m_szVarName;
+    void                    createPoly(std::wstring _szVarName, int _iDims, int* _piDims, const int *_piRank);
+
+private :
+    virtual bool            subMatrixToString(std::wostringstream& ostr, int* _piDims, int _iDims);
+
+    virtual SinglePoly*     getNullValue();
+    virtual Polynom*        createEmpty(int _iDims, int* _piDims, bool _bComplex = false);
+    virtual SinglePoly*     copyValue(SinglePoly* _pData);
+    virtual void            deleteAll();
+    virtual void            deleteImg();
+    virtual SinglePoly**    allocData(int _iSize);
+
+};
 }
 
 #ifdef _MSC_VER
index 8320283..d744c7f 100644 (file)
@@ -21,899 +21,909 @@ using namespace std;
 
 namespace types
 {
-    Polynom::Polynom()
-    {
+Polynom::Polynom()
+{
 #ifndef NDEBUG
-        Inspector::addItem(this);
+    Inspector::addItem(this);
 #endif
-    }
+}
 
-    Polynom::Polynom(wstring _szVarName, int _iRows, int _iCols)
-    {
-        int piDims[2]   = {_iRows, _iCols};
-        createPoly(_szVarName, 2, piDims, NULL);
-    }
+Polynom::Polynom(wstring _szVarName, int _iRows, int _iCols)
+{
+    int piDims[2]   = {_iRows, _iCols};
+    createPoly(_szVarName, 2, piDims, NULL);
+}
 
-    Polynom::Polynom(wstring _szVarName, int _iRows, int _iCols, const int *_piRank)
-    {
-        int piDims[2]   = {_iRows, _iCols};
-        createPoly(_szVarName, 2, piDims, _piRank);
-    }
+Polynom::Polynom(wstring _szVarName, int _iRows, int _iCols, const int *_piRank)
+{
+    int piDims[2]   = {_iRows, _iCols};
+    createPoly(_szVarName, 2, piDims, _piRank);
+}
 
-    Polynom::Polynom(std::wstring _szVarName, int _iDims, int* _piDims)
-    {
-        createPoly(_szVarName, _iDims, _piDims, NULL);
-    }
+Polynom::Polynom(std::wstring _szVarName, int _iDims, int* _piDims)
+{
+    createPoly(_szVarName, _iDims, _piDims, NULL);
+}
 
-    Polynom::Polynom(std::wstring _szVarName, int _iDims, int* _piDims, const int *_piRank)
-    {
-        createPoly(_szVarName, _iDims, _piDims, _piRank);
-    }
+Polynom::Polynom(std::wstring _szVarName, int _iDims, int* _piDims, const int *_piRank)
+{
+    createPoly(_szVarName, _iDims, _piDims, _piRank);
+}
 
-    Polynom::~Polynom()
+Polynom::~Polynom()
+{
+    if (isDeletable() == true)
     {
-        if(isDeletable() == true)
-        {
-            deleteAll();
-        }
+        deleteAll();
+    }
 #ifndef NDEBUG
-        Inspector::removeItem(this);
+    Inspector::removeItem(this);
 #endif
-    }
+}
 
-    void Polynom::createPoly(std::wstring _szVarName, int _iDims, int* _piDims, const int *_piRank)
-    {
-        m_szVarName    = _szVarName;
-        m_bComplex     = false;
-        SinglePoly** pPoly = NULL;
-        create(_piDims, _iDims, &pPoly, NULL);
+void Polynom::createPoly(std::wstring _szVarName, int _iDims, int* _piDims, const int *_piRank)
+{
+    m_szVarName        = _szVarName;
+    m_bComplex = false;
+    SinglePoly** pPoly = NULL;
+    create(_piDims, _iDims, &pPoly, NULL);
 
-        if(_piRank)
-        {
-            for(int i = 0 ; i < getSize() ; i++)
-            {
-                double* pReal = NULL;
-                m_pRealData[i] = new SinglePoly(&pReal, _piRank[i]);
-            }
-        }
-        else
+    if (_piRank)
+    {
+        for (int i = 0 ; i < getSize() ; i++)
         {
-            for(int i = 0 ; i < getSize() ; i++)
-            {
-                double* pReal = NULL;
-                m_pRealData[i] = new SinglePoly(&pReal, 1);
-            }
+            double* pReal = NULL;
+            m_pRealData[i] = new SinglePoly(&pReal, _piRank[i]);
         }
-#ifndef NDEBUG
-        Inspector::addItem(this);
-#endif
     }
-
-    bool Polynom::set(int _iPos, SinglePoly* _pS)
+    else
     {
-        if(m_pRealData == NULL || _iPos >= m_iSize)
-        {
-            return false;
-        }
-
-        if(m_pRealData[_iPos])
+        for (int i = 0 ; i < getSize() ; i++)
         {
-            delete m_pRealData[_iPos];
+            double* pReal = NULL;
+            m_pRealData[i] = new SinglePoly(&pReal, 1);
         }
-
-        m_pRealData[_iPos] = copyValue(_pS);
-
-        if(_pS->isComplex())
-        {
-            setComplex(true);
-        }
-        return true;
     }
+#ifndef NDEBUG
+    Inspector::addItem(this);
+#endif
+}
 
-    bool Polynom::set(int _iRows, int _iCols, SinglePoly* _pS)
+bool Polynom::set(int _iPos, SinglePoly* _pS)
+{
+    if (m_pRealData == NULL || _iPos >= m_iSize)
     {
-        return set(_iCols * getRows() + _iRows, _pS);
+        return false;
     }
 
-    bool Polynom::set(SinglePoly** _pS)
+    if (m_pRealData[_iPos])
     {
-        for(int i = 0 ; i < m_iSize ; i++)
-        {
-            set(i, _pS[i]);
-        }
-        return true;
+        delete m_pRealData[_iPos];
     }
 
-    bool Polynom::setCoef(int _iRows, int _iCols, Double *_pdblCoef)
+    m_pRealData[_iPos] = copyValue(_pS);
+
+    if (_pS->isComplex())
     {
-        int piDims[] = {_iRows, _iCols};
-        int iPos = getIndex(piDims);
-        return setCoef(iPos, _pdblCoef);
+        setComplex(true);
     }
+    return true;
+}
 
-    bool Polynom::setCoef(int _iIdx, Double *_pdblCoef)
-    {
-        if(_iIdx < getSize())
-        {
-            /*Get old SinglePoly*/
-            SinglePoly *poPoly = get(_iIdx);
-            poPoly->setRank(_pdblCoef->getSize());
-            poPoly->setCoef(_pdblCoef);
-        }
-        else
-        {
-            return false;
-        }
+bool Polynom::set(int _iRows, int _iCols, SinglePoly* _pS)
+{
+    return set(_iCols * getRows() + _iRows, _pS);
+}
 
-        return true;
+bool Polynom::set(SinglePoly** _pS)
+{
+    for (int i = 0 ; i < m_iSize ; i++)
+    {
+        set(i, _pS[i]);
     }
+    return true;
+}
 
-    bool Polynom::getRank(int *_piRank)
-    {
-        if(_piRank == NULL || m_pRealData == NULL)
-        {
-            return false;
-        }
+bool Polynom::setCoef(int _iRows, int _iCols, Double *_pdblCoef)
+{
+    int piDims[] = {_iRows, _iCols};
+    int iPos = getIndex(piDims);
+    return setCoef(iPos, _pdblCoef);
+}
 
-        for(int i = 0 ; i < getSize() ; i++)
-        {
-            _piRank[i] = m_pRealData[i]->getRank();
-        }
-        return true;
+bool Polynom::setCoef(int _iIdx, Double *_pdblCoef)
+{
+    if (_iIdx < getSize())
+    {
+        /*Get old SinglePoly*/
+        SinglePoly *poPoly = get(_iIdx);
+        poPoly->setRank(_pdblCoef->getSize());
+        poPoly->setCoef(_pdblCoef);
     }
-
-    GenericType::RealType Polynom::getType()
+    else
     {
-        return RealPoly;
+        return false;
     }
 
-    void Polynom::whoAmI(void)
+    return true;
+}
+
+bool Polynom::getRank(int *_piRank)
+{
+    if (_piRank == NULL || m_pRealData == NULL)
     {
-        std::cout << "types::SinglePoly";
+        return false;
     }
 
-    wstring Polynom::getVariableName()
+    for (int i = 0 ; i < getSize() ; i++)
     {
-        return m_szVarName;
+        _piRank[i] = m_pRealData[i]->getRank();
     }
+    return true;
+}
+
+GenericType::RealType Polynom::getType()
+{
+    return RealPoly;
+}
+
+void Polynom::whoAmI(void)
+{
+    std::cout << "types::SinglePoly";
+}
+
+wstring Polynom::getVariableName()
+{
+    return m_szVarName;
+}
 
-    void Polynom::setComplex(bool _bComplex)
+void Polynom::setVariableName(wstring _szVarName)
+{
+    m_szVarName = _szVarName;
+}
+
+void Polynom::setComplex(bool _bComplex)
+{
+    if (_bComplex != m_bComplex)
     {
-        if(_bComplex != m_bComplex)
+        for (int i = 0 ; i < getSize() ; i++)
         {
-            for(int i = 0 ; i < getSize() ; i++)
-            {
-                get(i)->setComplex(_bComplex);
-            }
-            m_bComplex = _bComplex;
+            get(i)->setComplex(_bComplex);
         }
+        m_bComplex = _bComplex;
     }
+}
 
-    InternalType* Polynom::clone()
+InternalType* Polynom::clone()
+{
+    int* piRank = new int[getSize()];
+    getRank(piRank);
+
+    Polynom* pMP = new Polynom(getVariableName(), getDims(), getDimsArray(), piRank);
+    pMP->setComplex(isComplex());
+    for (int i = 0 ; i < getSize() ; i++)
     {
-        int* piRank = new int[getSize()];
-        getRank(piRank);
+        pMP->set(i, get(i));
+    }
 
-        Polynom* pMP = new Polynom(getVariableName(), getDims(), getDimsArray(), piRank);
-        pMP->setComplex(isComplex());
-        for(int i = 0 ; i < getSize() ; i++)
-        {
-            pMP->set(i, get(i));
-        }
+    delete piRank;
+    return pMP;
+}
 
-        delete piRank;
-        return pMP;
-    }
+Double* Polynom::evaluate(Double* _pdblValue)
+{
+    double *pR = _pdblValue->getReal();
+    double *pI = _pdblValue->getImg();
+    int iRows          = _pdblValue->getRows();
+    int iCols          = _pdblValue->getCols();
 
-    Double* Polynom::evaluate(Double* _pdblValue)
+    double *pReturnR   = NULL;
+    double *pReturnI   = NULL;
+    Double *pReturn            = new Double(getRows() * iRows, getCols() * iCols, &pReturnR, &pReturnI);
+    if (pI != NULL)
     {
-        double *pR     = _pdblValue->getReal();
-        double *pI     = _pdblValue->getImg();
-        int iRows              = _pdblValue->getRows();
-        int iCols              = _pdblValue->getCols();
-
-        double *pReturnR       = NULL;
-        double *pReturnI       = NULL;
-        Double *pReturn                = new Double(getRows() * iRows, getCols() * iCols, &pReturnR, &pReturnI);
-        if(pI != NULL)
-        {
-            pReturn->setComplex(true);
-        }
-        else
-        {
-            pReturn->setComplex(false);
-        }
+        pReturn->setComplex(true);
+    }
+    else
+    {
+        pReturn->setComplex(false);
+    }
 
-        int i = 0;
-        //all lines of the matrix remplacement
-        for(int iCol = 0 ; iCol < iCols ; iCol++)
+    int i = 0;
+    //all lines of the matrix remplacement
+    for (int iCol = 0 ; iCol < iCols ; iCol++)
+    {
+        for (int iPolyCol = 0 ; iPolyCol < getCols() ; iPolyCol++)
         {
-            for(int iPolyCol = 0 ; iPolyCol < getCols() ; iPolyCol++)
+            for (int iRow = 0 ; iRow < iRows ; iRow++)
             {
-                for(int iRow = 0 ; iRow < iRows ; iRow++)
+                for (int iPolyRow = 0 ; iPolyRow < getRows() ; iPolyRow++)
                 {
-                    for(int iPolyRow = 0 ; iPolyRow < getRows() ; iPolyRow++)
-                    {
-                        double OutR    = 0;
-                        double OutI    = 0;
+                    double OutR        = 0;
+                    double OutI        = 0;
 
-                        SinglePoly *pPoly = get(iPolyRow, iPolyCol);
-                        if(pReturn->isComplex())
-                        {
-                            pPoly->evaluate(pR[iCol * iRows + iRow], pI[iCol * iRows + iRow], &OutR, &OutI);
-                            pReturnR[i]        = OutR;
-                            pReturnI[i]        = OutI;
-                        }
-                        else
-                        {
-                            pPoly->evaluate(pR[iCol * iRows + iRow], 0, &OutR, &OutI);
-                            pReturnR[i]        = OutR;
-                        }
-                        i++;
+                    SinglePoly *pPoly = get(iPolyRow, iPolyCol);
+                    if (pReturn->isComplex())
+                    {
+                        pPoly->evaluate(pR[iCol * iRows + iRow], pI[iCol * iRows + iRow], &OutR, &OutI);
+                        pReturnR[i]    = OutR;
+                        pReturnI[i]    = OutI;
                     }
+                    else
+                    {
+                        pPoly->evaluate(pR[iCol * iRows + iRow], 0, &OutR, &OutI);
+                        pReturnR[i]    = OutR;
+                    }
+                    i++;
                 }
             }
         }
-        return pReturn;
     }
+    return pReturn;
+}
 
-    void Polynom::updateRank(void)
+void Polynom::updateRank(void)
+{
+    for (int i = 0 ; i < getSize() ; i++)
     {
-        for(int i = 0 ; i < getSize() ; i++)
-        {
-            SinglePoly *pPoly = get(i);
-            pPoly->updateRank();
-        }
+        SinglePoly *pPoly = get(i);
+        pPoly->updateRank();
     }
+}
 
-    int Polynom::getMaxRank(void)
+int Polynom::getMaxRank(void)
+{
+    int *piRank = new int[getSize()];
+    getRank(piRank);
+    int iMaxRank = 0;
+    for (int i = 0 ; i < getSize() ; i++)
     {
-        int *piRank = new int[getSize()];
-        getRank(piRank);
-        int iMaxRank = 0;
-        for(int i = 0 ; i < getSize() ; i++)
-        {
-            iMaxRank = Max(iMaxRank, piRank[i]);
-        }
-        delete[] piRank;
-        return iMaxRank;
+        iMaxRank = Max(iMaxRank, piRank[i]);
     }
+    delete[] piRank;
+    return iMaxRank;
+}
 
-    Double* Polynom::getCoef(void)
+Double* Polynom::getCoef(void)
+{
+    int iMaxRank = getMaxRank();
+    Double *pCoef = new Double(getRows(), getCols() * iMaxRank, false);
+    if (isComplex())
     {
-        int iMaxRank = getMaxRank();
-        Double *pCoef = new Double(getRows(), getCols() * iMaxRank, false);
-        if(isComplex())
-        {
-            pCoef->setComplex(true);
-        }
+        pCoef->setComplex(true);
+    }
 
-        double *pCoefR = pCoef->getReal();
-        double *pCoefI = pCoef->getImg();
+    double *pCoefR     = pCoef->getReal();
+    double *pCoefI     = pCoef->getImg();
 
-        for(int iRank = 0 ; iRank < iMaxRank ; iRank++)
+    for (int iRank = 0 ; iRank < iMaxRank ; iRank++)
+    {
+        for (int i = 0 ; i < getSize() ; i++)
         {
-            for(int i = 0 ; i < getSize() ; i++)
+            SinglePoly *pPoly  = get(i);
+            if (iRank > pPoly->getRank())
             {
-                SinglePoly *pPoly      = get(i);
-                if(iRank > pPoly->getRank())
+                pCoefR[iRank * getSize() + i] = 0;
+                if (isComplex())
                 {
-                    pCoefR[iRank * getSize() + i] = 0;
-                    if(isComplex())
-                    {
-                        pCoefI[iRank * getSize() + i] = 0;
-                    }
+                    pCoefI[iRank * getSize() + i] = 0;
                 }
-                else
-                {
-                    double *pR = pPoly->getCoef()->getReal();
-                    double *pI = pPoly->getCoef()->getImg();
+            }
+            else
+            {
+                double *pR     = pPoly->getCoef()->getReal();
+                double *pI     = pPoly->getCoef()->getImg();
 
-                    pCoefR[iRank * getSize() + i] = pR[iRank];
-                    if(isComplex())
-                    {
-                        pCoefI[iRank * getSize() + i] = pI[iRank];
-                    }
+                pCoefR[iRank * getSize() + i] = pR[iRank];
+                if (isComplex())
+                {
+                    pCoefI[iRank * getSize() + i] = pI[iRank];
                 }
             }
         }
-        return pCoef;
     }
+    return pCoef;
+}
 
-    void Polynom::setCoef(Double *_pCoef)
-    {
-        int iMaxRank = getMaxRank();
+void Polynom::setCoef(Double *_pCoef)
+{
+    int iMaxRank = getMaxRank();
 
-        setComplex(_pCoef->isComplex());
-        double *pR = _pCoef->getReal();
-        double *pI = _pCoef->getImg();
-        for(int i = 0 ; i < getSize() ; i++)
+    setComplex(_pCoef->isComplex());
+    double *pR = _pCoef->getReal();
+    double *pI = _pCoef->getImg();
+    for (int i = 0 ; i < getSize() ; i++)
+    {
+        Double *pTemp = new Double(1, iMaxRank, _pCoef->isComplex());
+        SinglePoly *pPoly = get(i);
+        for (int iRank = 0 ; iRank < iMaxRank ; iRank++)
         {
-            Double *pTemp = new Double(1, iMaxRank, _pCoef->isComplex());
-            SinglePoly *pPoly = get(i);
-            for(int iRank = 0 ; iRank < iMaxRank ; iRank++)
-            {
-                pTemp->getReal()[iRank] = pR[iRank * getSize() + i];
-            }
-            if(isComplex())
+            pTemp->getReal()[iRank] = pR[iRank * getSize() + i];
+        }
+        if (isComplex())
+        {
+            for (int iRank = 0 ; iRank < iMaxRank ; iRank++)
             {
-                for(int iRank = 0 ; iRank < iMaxRank ; iRank++)
-                {
-                    pTemp->getImg()[iRank] = pI[iRank * getSize() + i];
-                }
+                pTemp->getImg()[iRank] = pI[iRank * getSize() + i];
             }
-
-            pPoly->setCoef(pTemp);
         }
+
+        pPoly->setCoef(pTemp);
     }
+}
 
-    bool Polynom::subMatrixToString(std::wostringstream& ostr, int* _piDims, int _iDims)
-    {
-        int iPrecision = getFormatSize();
-        int iLineLen = getConsoleWidth();
+bool Polynom::subMatrixToString(std::wostringstream& ostr, int* _piDims, int _iDims)
+{
+    int iPrecision = getFormatSize();
+    int iLineLen = getConsoleWidth();
 
-        wostringstream osExp;
-        wostringstream osCoef;
+    wostringstream osExp;
+    wostringstream osCoef;
 
-        list<wstring>::const_iterator it_Exp;
-        list<wstring>::const_iterator it_Coef;
-        list<wstring> listExpR, listCoefR, listExpI, listCoefI;
+    list<wstring>::const_iterator it_Exp;
+    list<wstring>::const_iterator it_Coef;
+    list<wstring> listExpR, listCoefR, listExpI, listCoefI;
 
-        if(isScalar())
+    if (isScalar())
+    {
+        if (isComplex())
         {
-            if(isComplex())
+            ostr << L"Real part" << endl << endl << endl;
+            get(0)->toStringReal(getVariableName(), &listExpR, &listCoefR);
+            for (it_Coef = listCoefR.begin(), it_Exp = listExpR.begin() ; it_Coef != listCoefR.end() ; it_Coef++, it_Exp++)
             {
-                ostr << L"Real part" << endl << endl << endl;
-                get(0)->toStringReal(getVariableName(), &listExpR, &listCoefR);
-                for(it_Coef = listCoefR.begin(), it_Exp = listExpR.begin() ; it_Coef != listCoefR.end() ; it_Coef++,it_Exp++)
-                {
-                    ostr << *it_Exp << endl << *it_Coef << endl;
-                }
-
-                ostr << L"Imaginary part" << endl << endl << endl ;
-                get(0)->toStringImg(getVariableName(), &listExpI, &listCoefI);
-                for(it_Coef = listCoefI.begin(), it_Exp = listExpI.begin() ; it_Coef != listCoefI.end() ; it_Coef++,it_Exp++)
-                {
-                    ostr << *it_Exp << endl << *it_Coef << endl;
-                }
+                ostr << *it_Exp << endl << *it_Coef << endl;
             }
-            else
-            {
-                get(0)->toStringReal(getVariableName(), &listExpR, &listCoefR);
 
-                for(it_Coef = listCoefR.begin(), it_Exp = listExpR.begin() ; it_Coef != listCoefR.end() ; it_Coef++,it_Exp++)
-                {
-                    ostr << *it_Exp << endl << *it_Coef << endl;
-                }
+            ostr << L"Imaginary part" << endl << endl << endl ;
+            get(0)->toStringImg(getVariableName(), &listExpI, &listCoefI);
+            for (it_Coef = listCoefI.begin(), it_Exp = listExpI.begin() ; it_Coef != listCoefI.end() ; it_Coef++, it_Exp++)
+            {
+                ostr << *it_Exp << endl << *it_Coef << endl;
             }
         }
-        else if(getRows() == 1)
+        else
         {
-            if(isComplex())
-            {
-                ostr << L"Real part" << endl << endl;
-                ostr << getRowString(_piDims, _iDims, false);
-                ostr << L"Imaginary part" << endl << endl;
-                ostr << getRowString(_piDims, _iDims, true);
-            }
-            else
+            get(0)->toStringReal(getVariableName(), &listExpR, &listCoefR);
+
+            for (it_Coef = listCoefR.begin(), it_Exp = listExpR.begin() ; it_Coef != listCoefR.end() ; it_Coef++, it_Exp++)
             {
-                ostr << getRowString(_piDims, _iDims, false);
+                ostr << *it_Exp << endl << *it_Coef << endl;
             }
         }
-        else if(getCols() == 1)
+    }
+    else if (getRows() == 1)
+    {
+        if (isComplex())
         {
-            if(isComplex())
-            {
-                ostr << L"Real part" << endl << endl;
-                ostr << getColString(_piDims, _iDims, false);
-                ostr << L"Imaginary part" << endl << endl;
-                ostr << getColString(_piDims, _iDims, true);
-            }
-            else
-            {
-                ostr << getColString(_piDims, _iDims, false);
-            }
+            ostr << L"Real part" << endl << endl;
+            ostr << getRowString(_piDims, _iDims, false);
+            ostr << L"Imaginary part" << endl << endl;
+            ostr << getRowString(_piDims, _iDims, true);
         }
         else
-        {//Matrix
-            if(isComplex())
-            {
-                ostr << L"Real part" << endl << endl;
-                ostr << getMatrixString(_piDims, _iDims, false);
-                ostr << L"Imaginary part" << endl << endl;
-                ostr << getMatrixString(_piDims, _iDims, true);
-            }
-            else
-            {
-                ostr << getMatrixString(_piDims, _iDims, false);
-            }
+        {
+            ostr << getRowString(_piDims, _iDims, false);
         }
-        return true;
     }
-
-    wstring Polynom::getMatrixString(int* _piDims, int _iDims, bool _bComplex)
+    else if (getCols() == 1)
+    {
+        if (isComplex())
+        {
+            ostr << L"Real part" << endl << endl;
+            ostr << getColString(_piDims, _iDims, false);
+            ostr << L"Imaginary part" << endl << endl;
+            ostr << getColString(_piDims, _iDims, true);
+        }
+        else
+        {
+            ostr << getColString(_piDims, _iDims, false);
+        }
+    }
+    else
     {
-        int iLineLen = getConsoleWidth();
+        //Matrix
+        if (isComplex())
+        {
+            ostr << L"Real part" << endl << endl;
+            ostr << getMatrixString(_piDims, _iDims, false);
+            ostr << L"Imaginary part" << endl << endl;
+            ostr << getMatrixString(_piDims, _iDims, true);
+        }
+        else
+        {
+            ostr << getMatrixString(_piDims, _iDims, false);
+        }
+    }
+    return true;
+}
+
+wstring Polynom::getMatrixString(int* _piDims, int _iDims, bool _bComplex)
+{
+    int iLineLen = getConsoleWidth();
 
-        wostringstream ostr;
-        wostringstream osExp;
-        wostringstream osCoef;
+    wostringstream ostr;
+    wostringstream osExp;
+    wostringstream osCoef;
 
-        list<wstring>::const_iterator it_Exp;
-        list<wstring>::const_iterator it_Coef;
-        list<wstring> listExpR, listCoefR, listExpI, listCoefI;
+    list<wstring>::const_iterator it_Exp;
+    list<wstring>::const_iterator it_Coef;
+    list<wstring> listExpR, listCoefR, listExpI, listCoefI;
 
-        int iLen        = 0;
-        int iLastCol    = 0;
-        bool bWordWarp  = false;
+    int iLen        = 0;
+    int iLastCol    = 0;
+    bool bWordWarp  = false;
 
-        wstring szExp, szCoef;
+    wstring szExp, szCoef;
 
-        int *piMaxLen = new int[getCols()];
-        memset(piMaxLen, 0x00, sizeof(int) * getCols());
+    int *piMaxLen = new int[getCols()];
+    memset(piMaxLen, 0x00, sizeof(int) * getCols());
 
-        //find the largest row for each col
-        for(int iCols1 = 0 ; iCols1 < getCols() ; iCols1++)
+    //find the largest row for each col
+    for (int iCols1 = 0 ; iCols1 < getCols() ; iCols1++)
+    {
+        for (int iRows1 = 0 ; iRows1 < getRows() ; iRows1++)
         {
-            for(int iRows1 = 0 ; iRows1 < getRows() ; iRows1++)
+            // FIXME : iLen shadow previous declaration
+            int iLen = 0;
+            _piDims[0] = iRows1;
+            _piDims[1] = iCols1;
+            int iPos = getIndex(_piDims);
+            if (_bComplex)
+            {
+                get(iPos)->toStringImg(getVariableName(), &listExpR, &listCoefR);
+            }
+            else
+            {
+                get(iPos)->toStringReal(getVariableName(), &listExpR, &listCoefR);
+            }
+
+            if (listExpR.size() > 1)
             {
-                // FIXME : iLen shadow previous declaration
-                int iLen = 0;
-                _piDims[0] = iRows1;
-                _piDims[1] = iCols1;
-                int iPos = getIndex(_piDims);
-                if(_bComplex)
+                for (it_Exp = listExpR.begin() ; it_Exp != listExpR.end() ; it_Exp++)
                 {
-                    get(iPos)->toStringImg(getVariableName(), &listExpR, &listCoefR);
+                    iLen += static_cast<int>((*it_Exp).size());
                 }
-                else
+            }
+            else
+            {
+                if (listExpR.front().size() != 0)
                 {
-                    get(iPos)->toStringReal(getVariableName(), &listExpR, &listCoefR);
+                    iLen = static_cast<int>(listExpR.front().size());
                 }
-
-                if(listExpR.size() > 1)
+                else
                 {
-                    for(it_Exp = listExpR.begin() ; it_Exp != listExpR.end() ; it_Exp++)
-                    {
-                        iLen += static_cast<int>((*it_Exp).size());
-                    }
+                    iLen = static_cast<int>(listCoefR.front().size());
                 }
-                else
+            }
+            piMaxLen[iCols1] = Min(Max(piMaxLen[iCols1], iLen), iLineLen);
+            listExpR.clear();
+            listCoefR.clear();
+        }
+
+        //We know the length of the column
+
+        if (static_cast<int>(iLen + piMaxLen[iCols1]) >= iLineLen && iLen != 0)
+        {
+            //if the max length exceeded
+            wostringstream ostemp;
+            bWordWarp = true;
+            for (int iRows2 = 0 ; iRows2 < getRows() ; iRows2++)
+            {
+                bool bMultiLine = false;
+                for (int iCols2 = iLastCol ; iCols2 < iCols1; iCols2++)
                 {
-                    if(listExpR.front().size() != 0)
+                    _piDims[0] = iRows2;
+                    _piDims[1] = iCols2;
+
+                    int iPos = getIndex(_piDims);
+                    if (_bComplex)
                     {
-                        iLen = static_cast<int>(listExpR.front().size());
+                        get(iPos)->toStringImg(getVariableName(), &listExpR, &listCoefR);
                     }
                     else
                     {
-                        iLen = static_cast<int>(listCoefR.front().size());
+                        get(iPos)->toStringReal(getVariableName(), &listExpR, &listCoefR);
                     }
-                }
-                piMaxLen[iCols1] = Min(Max(piMaxLen[iCols1], iLen), iLineLen);
-                listExpR.clear();
-                listCoefR.clear();
-            }
-
-            //We know the length of the column
 
-            if(static_cast<int>(iLen + piMaxLen[iCols1]) >= iLineLen && iLen != 0)
-            {//if the max length exceeded
-                wostringstream ostemp;
-                bWordWarp = true;
-                for(int iRows2 = 0 ; iRows2 < getRows() ; iRows2++)
-                {
-                    bool bMultiLine = false;
-                    for(int iCols2 = iLastCol ; iCols2 < iCols1; iCols2++)
+                    if (listCoefR.size() > 1)
                     {
-                        _piDims[0] = iRows2;
-                        _piDims[1] = iCols2;
-
-                        int iPos = getIndex(_piDims);
-                        if(_bComplex)
-                        {
-                            get(iPos)->toStringImg(getVariableName(), &listExpR, &listCoefR);
-                        }
-                        else
-                        {
-                            get(iPos)->toStringReal(getVariableName(), &listExpR, &listCoefR);
-                        }
-
-                        if(listCoefR.size() > 1)
+                        for (it_Coef = listCoefR.begin(), it_Exp = listExpR.begin() ; it_Coef != listCoefR.end() ; it_Coef++, it_Exp++)
                         {
-                            for(it_Coef = listCoefR.begin(), it_Exp = listExpR.begin() ; it_Coef != listCoefR.end() ; it_Coef++,it_Exp++)
-                            {
-                                osExp << *it_Exp;
-                                addSpaces(&osExp, piMaxLen[iCols2] - static_cast<int>((*it_Exp).size()));
-                                osExp << endl;
-
-                                osExp << *it_Coef;
-                                addSpaces(&osExp, piMaxLen[iCols2] - static_cast<int>((*it_Coef).size()));
-                                osExp << endl;
-                                bMultiLine = true;
-                            }
+                            osExp << *it_Exp;
+                            addSpaces(&osExp, piMaxLen[iCols2] - static_cast<int>((*it_Exp).size()));
+                            osExp << endl;
+
+                            osExp << *it_Coef;
+                            addSpaces(&osExp, piMaxLen[iCols2] - static_cast<int>((*it_Coef).size()));
+                            osExp << endl;
+                            bMultiLine = true;
                         }
-                        else
-                        {
-                            osExp << listExpR.front();
-                            addSpaces(&osExp, piMaxLen[iCols2] - static_cast<int>(listExpR.front().size()));
-                            osCoef << listCoefR.front();
-                            addSpaces(&osCoef, piMaxLen[iCols2] - static_cast<int>(listCoefR.front().size()));
-                            bMultiLine = false;
-                        }
-                        listExpR.clear();
-                        listCoefR.clear();
                     }
-
-                    if(bMultiLine == false)
+                    else
                     {
-                        osExp << endl;
-                        osCoef << endl;
+                        osExp << listExpR.front();
+                        addSpaces(&osExp, piMaxLen[iCols2] - static_cast<int>(listExpR.front().size()));
+                        osCoef << listCoefR.front();
+                        addSpaces(&osCoef, piMaxLen[iCols2] - static_cast<int>(listCoefR.front().size()));
+                        bMultiLine = false;
                     }
-                    ostemp << osExp.str();
-                    ostemp << osCoef.str() << endl;
-                    osExp.str(L"");
-                    osCoef.str(L"");
-
+                    listExpR.clear();
+                    listCoefR.clear();
                 }
-                iLen   = piMaxLen[iCols1];
 
-                //write "column x to y"
-                if(iLastCol + 1 == iCols1)
-                {
-                    ostr << endl << L"         Column " << iCols1 << endl << endl;
-                }
-                else
+                if (bMultiLine == false)
                 {
-                    ostr << endl << L"         Column " << iLastCol + 1 << L" to " << iCols1 << endl << endl;
+                    osExp << endl;
+                    osCoef << endl;
                 }
+                ostemp << osExp.str();
+                ostemp << osCoef.str() << endl;
+                osExp.str(L"");
+                osCoef.str(L"");
 
-                ostr << ostemp.str() << endl;
-
-                iLastCol = iCols1;
-            }
-            else //if((int)(iLen + piMaxLen[iCols1]) <= iLineLen)
-            {
-                iLen += piMaxLen[iCols1];
             }
-        }//for(int iCols1 = 0 ; iCols1 < getCols() ; iCols1++)
+            iLen       = piMaxLen[iCols1];
 
-        if(bWordWarp)
-        {
-            if(iLastCol + 1 == getCols())
+            //write "column x to y"
+            if (iLastCol + 1 == iCols1)
             {
-                ostr << endl << L"         Column " << getCols() << endl << endl;
+                ostr << endl << L"         Column " << iCols1 << endl << endl;
             }
             else
             {
-                ostr << endl << L"         Column " << iLastCol + 1 << L" to " << getCols() << endl << endl;
+                ostr << endl << L"         Column " << iLastCol + 1 << L" to " << iCols1 << endl << endl;
             }
-        }
-
-        //print the end
-        for(int iRows2 = 0 ; iRows2 < getRows() ; iRows2++)
-        {
-            for(int iCols2 = iLastCol ; iCols2 < getCols() ; iCols2++)
-            {
-                _piDims[0] = iRows2;
-                _piDims[1] = iCols2;
-
-                int iPos = getIndex(_piDims);
-                if(_bComplex)
-                {
-                    get(iPos)->toStringImg( getVariableName(), &listExpR, &listCoefR);
-                }
-                else
-                {
-                    get(iPos)->toStringReal(getVariableName(), &listExpR, &listCoefR);
-                }
 
-                if(listCoefR.size() > 1)
-                {
-                    for(it_Coef = listCoefR.begin(), it_Exp = listExpR.begin() ; it_Coef != listCoefR.end() ; it_Coef++,it_Exp++)
-                    {//normally useless ...
-                        osExp << *it_Exp;
-                        addSpaces(&osExp, piMaxLen[iCols2] - static_cast<int>((*it_Exp).size()));
-                        osExp << endl;
-
-                        osExp << *it_Coef;
-                        addSpaces(&osExp, piMaxLen[iCols2] - static_cast<int>((*it_Coef).size()));
-                        osExp << endl;
-                    }
-                }
-                else
-                {
-                    if(listExpR.front().size() != 0)
-                    {
-                        osExp << listExpR.front();
-                    }
+            ostr << ostemp.str() << endl;
 
-                    addSpaces(&osExp, piMaxLen[iCols2] - static_cast<int>(listExpR.front().size()));
-                    osCoef << listCoefR.front();
-                    addSpaces(&osCoef, piMaxLen[iCols2] - static_cast<int>(listCoefR.front().size()));
-                }
-                listExpR.clear();
-                listCoefR.clear();
-            }
+            iLastCol = iCols1;
+        }
+        else //if((int)(iLen + piMaxLen[iCols1]) <= iLineLen)
+        {
+            iLen += piMaxLen[iCols1];
+        }
+    }//for(int iCols1 = 0 ; iCols1 < getCols() ; iCols1++)
 
-            if(osExp.str().size() != 0)
-            {
-                osExp << endl;
-            }
-            osCoef << endl;
-            ostr << osExp.str();
-            ostr << osCoef.str() << endl;
-            osExp.str(L"");
-            osCoef.str(L"");
+    if (bWordWarp)
+    {
+        if (iLastCol + 1 == getCols())
+        {
+            ostr << endl << L"         Column " << getCols() << endl << endl;
+        }
+        else
+        {
+            ostr << endl << L"         Column " << iLastCol + 1 << L" to " << getCols() << endl << endl;
         }
-        return ostr.str();
     }
 
-    wstring Polynom::getRowString(int* _piDims, int _iDims, bool _bComplex)
+    //print the end
+    for (int iRows2 = 0 ; iRows2 < getRows() ; iRows2++)
     {
-        int iLineLen = getConsoleWidth();
-
-        int iLen        = 0;
-        int iLastFlush  = 0;
-
-        wostringstream ostr;
-        wostringstream osExp;
-        wostringstream osCoef;
-
-        list<wstring>::const_iterator it_Exp;
-        list<wstring>::const_iterator it_Coef;
-        list<wstring> listExpR, listCoefR, listExpI, listCoefI;
-
-        for(int i = 0 ; i < getCols() ; i++)
+        for (int iCols2 = iLastCol ; iCols2 < getCols() ; iCols2++)
         {
-            wstring szExp, szCoef;
+            _piDims[0] = iRows2;
+            _piDims[1] = iCols2;
 
-            _piDims[1] = 0;
-            _piDims[0] = i;
             int iPos = getIndex(_piDims);
-            if(_bComplex)
+            if (_bComplex)
             {
-                get(iPos)->toStringImg(getVariableName(), &listExpR, &listCoefR);
+                get(iPos)->toStringImg( getVariableName(), &listExpR, &listCoefR);
             }
             else
             {
                 get(iPos)->toStringReal(getVariableName(), &listExpR, &listCoefR);
             }
 
-            if(iLen != 0 && static_cast<int>(iLen + listExpR.front().size()) > iLineLen)
-            {//flush strean
-                if(i == iLastFlush + 1)
-                {
-                    ostr << endl << L"         Column " << i << endl << endl;
-                }
-                else
-                {
-                    ostr << endl << L"         Column " << iLastFlush + 1 /* 2 is better than 1, no ? */<< L" to " << i << endl << endl;
-                }
-
-                iLastFlush     = i;
-                iLen                           = 0;
-                ostr << osExp.str() << endl;
-                ostr << osCoef.str() << endl;
-                osExp.str(L"");
-                osCoef.str(L"");
-            }
-
-            if(listCoefR.size() > 1)
+            if (listCoefR.size() > 1)
             {
-                for(it_Coef = listCoefR.begin(), it_Exp = listExpR.begin() ; it_Coef != listCoefR.end() ; it_Coef++,it_Exp++)
+                for (it_Coef = listCoefR.begin(), it_Exp = listExpR.begin() ; it_Coef != listCoefR.end() ; it_Coef++, it_Exp++)
                 {
-                    osExp << *it_Exp << endl << *it_Coef << endl;
+                    //normally useless ...
+                    osExp << *it_Exp;
+                    addSpaces(&osExp, piMaxLen[iCols2] - static_cast<int>((*it_Exp).size()));
+                    osExp << endl;
+
+                    osExp << *it_Coef;
+                    addSpaces(&osExp, piMaxLen[iCols2] - static_cast<int>((*it_Coef).size()));
+                    osExp << endl;
                 }
             }
             else
             {
-                osExp << listExpR.front();
-                osCoef << listCoefR.front();
-            }
+                if (listExpR.front().size() != 0)
+                {
+                    osExp << listExpR.front();
+                }
 
-            if(osExp.str().size() != 0)
-            {
-                iLen = static_cast<int>(osExp.str().size());
-            }
-            else
-            {
-                iLen = static_cast<int>(osCoef.str().size());
+                addSpaces(&osExp, piMaxLen[iCols2] - static_cast<int>(listExpR.front().size()));
+                osCoef << listCoefR.front();
+                addSpaces(&osCoef, piMaxLen[iCols2] - static_cast<int>(listCoefR.front().size()));
             }
-
-            listCoefR.clear();
             listExpR.clear();
+            listCoefR.clear();
         }
 
-        if(iLastFlush != 0)
-        {//last line of a multiline output
-            if(iLastFlush + 1 == getSize())
-            {
-                ostr << endl << L"         Column " << getSize() << endl << endl;
-            }
-            else
-            {
-                ostr << endl << L"         Column " << iLastFlush + 1 << L" to " << getSize() << endl << endl;
-            }
+        if (osExp.str().size() != 0)
+        {
+            osExp << endl;
         }
-        ostr << osExp.str() << endl;
+        osCoef << endl;
+        ostr << osExp.str();
         ostr << osCoef.str() << endl;
-        return ostr.str();
+        osExp.str(L"");
+        osCoef.str(L"");
     }
+    return ostr.str();
+}
 
-    wstring Polynom::getColString(int* _piDims, int _iDims, bool _bComplex)
-    {
-        wostringstream ostr;
-        wostringstream osExp;
-        wostringstream osCoef;
+wstring Polynom::getRowString(int* _piDims, int _iDims, bool _bComplex)
+{
+    int iLineLen = getConsoleWidth();
 
-        list<wstring>::const_iterator it_Exp;
-        list<wstring>::const_iterator it_Coef;
-        list<wstring> listExpR, listCoefR, listExpI, listCoefI;
+    int iLen        = 0;
+    int iLastFlush  = 0;
 
-        for(int i = 0 ; i < getRows() ; i++)
+    wostringstream ostr;
+    wostringstream osExp;
+    wostringstream osCoef;
+
+    list<wstring>::const_iterator it_Exp;
+    list<wstring>::const_iterator it_Coef;
+    list<wstring> listExpR, listCoefR, listExpI, listCoefI;
+
+    for (int i = 0 ; i < getCols() ; i++)
+    {
+        wstring szExp, szCoef;
+
+        _piDims[1] = 0;
+        _piDims[0] = i;
+        int iPos = getIndex(_piDims);
+        if (_bComplex)
+        {
+            get(iPos)->toStringImg(getVariableName(), &listExpR, &listCoefR);
+        }
+        else
         {
-            wstring szExp, szCoef;
+            get(iPos)->toStringReal(getVariableName(), &listExpR, &listCoefR);
+        }
 
-            _piDims[0] = i;
-            _piDims[1] = 0;
-            int iPos = getIndex(_piDims);
-            if(_bComplex)
+        if (iLen != 0 && static_cast<int>(iLen + listExpR.front().size()) > iLineLen)
+        {
+            //flush strean
+            if (i == iLastFlush + 1)
             {
-                get(iPos)->toStringImg(getVariableName(), &listExpR, &listCoefR);
+                ostr << endl << L"         Column " << i << endl << endl;
             }
             else
             {
-                get(iPos)->toStringReal(getVariableName(), &listExpR, &listCoefR);
+                ostr << endl << L"         Column " << iLastFlush + 1 /* 2 is better than 1, no ? */ << L" to " << i << endl << endl;
             }
 
-            for(it_Coef = listCoefR.begin(), it_Exp = listExpR.begin() ; it_Coef != listCoefR.end() ; it_Coef++,it_Exp++)
+            iLastFlush = i;
+            iLen                               = 0;
+            ostr << osExp.str() << endl;
+            ostr << osCoef.str() << endl;
+            osExp.str(L"");
+            osCoef.str(L"");
+        }
+
+        if (listCoefR.size() > 1)
+        {
+            for (it_Coef = listCoefR.begin(), it_Exp = listExpR.begin() ; it_Coef != listCoefR.end() ; it_Coef++, it_Exp++)
             {
-                ostr << *it_Exp << endl << *it_Coef << endl;
+                osExp << *it_Exp << endl << *it_Coef << endl;
             }
-            ostr << endl;
-            listCoefR.clear();
-            listExpR.clear();
         }
-        return ostr.str();
+        else
+        {
+            osExp << listExpR.front();
+            osCoef << listCoefR.front();
+        }
+
+        if (osExp.str().size() != 0)
+        {
+            iLen = static_cast<int>(osExp.str().size());
+        }
+        else
+        {
+            iLen = static_cast<int>(osCoef.str().size());
+        }
+
+        listCoefR.clear();
+        listExpR.clear();
     }
 
-    Double* Polynom::extractCoef(int _iRank)
+    if (iLastFlush != 0)
     {
-        Double *pdbl   = new Double(getRows(), getCols(), m_bComplex);
-        double *pReal  = pdbl->getReal();
-        double *pImg   = pdbl->getImg();
-
-        for(int i = 0 ; i < getSize() ; i++)
+        //last line of a multiline output
+        if (iLastFlush + 1 == getSize())
         {
-            SinglePoly *pPoly = get(i);
-
-            if(pPoly->getRank() <= _iRank)
-            {
-                pReal[i] = 0;
-                if(m_bComplex)
-                {
-                    pImg[i]            = 0;
-                }
-            }
-            else
-            {
-                pReal[i]               = pPoly->getCoef()->getReal()[_iRank];
-                if(m_bComplex)
-                {
-                    pImg[i]            = pPoly->getCoef()->getImg()[_iRank];
-                }
-            }
+            ostr << endl << L"         Column " << getSize() << endl << endl;
+        }
+        else
+        {
+            ostr << endl << L"         Column " << iLastFlush + 1 << L" to " << getSize() << endl << endl;
         }
-
-        return pdbl;
     }
-    bool Polynom::insertCoef(int _iRank, Double* _pCoef)
+    ostr << osExp.str() << endl;
+    ostr << osCoef.str() << endl;
+    return ostr.str();
+}
+
+wstring Polynom::getColString(int* _piDims, int _iDims, bool _bComplex)
+{
+    wostringstream ostr;
+    wostringstream osExp;
+    wostringstream osCoef;
+
+    list<wstring>::const_iterator it_Exp;
+    list<wstring>::const_iterator it_Coef;
+    list<wstring> listExpR, listCoefR, listExpI, listCoefI;
+
+    for (int i = 0 ; i < getRows() ; i++)
     {
-        double *pReal  = _pCoef->getReal();
-        double *pImg   = _pCoef->getImg();
+        wstring szExp, szCoef;
 
-        for(int i = 0 ; i < getSize() ; i++)
+        _piDims[0] = i;
+        _piDims[1] = 0;
+        int iPos = getIndex(_piDims);
+        if (_bComplex)
         {
-            SinglePoly *pPoly = get(i);
-            if(pPoly->getRank() <= _iRank)
-            {
-                return false;
-            }
+            get(iPos)->toStringImg(getVariableName(), &listExpR, &listCoefR);
+        }
+        else
+        {
+            get(iPos)->toStringReal(getVariableName(), &listExpR, &listCoefR);
+        }
 
-            pPoly->getCoef()->getReal()[_iRank] = pReal[i];
-            if(m_bComplex)
-            {
-                pPoly->getCoef()->getImg()[_iRank] = pImg[i];
-            }
+        for (it_Coef = listCoefR.begin(), it_Exp = listExpR.begin() ; it_Coef != listCoefR.end() ; it_Coef++, it_Exp++)
+        {
+            ostr << *it_Exp << endl << *it_Coef << endl;
         }
-        return true;
+        ostr << endl;
+        listCoefR.clear();
+        listExpR.clear();
     }
+    return ostr.str();
+}
 
-    bool Polynom::operator==(const InternalType& it)
+Double* Polynom::extractCoef(int _iRank)
+{
+    Double *pdbl       = new Double(getRows(), getCols(), m_bComplex);
+    double *pReal      = pdbl->getReal();
+    double *pImg       = pdbl->getImg();
+
+    for (int i = 0 ; i < getSize() ; i++)
     {
-        if(const_cast<InternalType &>(it).isPoly() == false)
+        SinglePoly *pPoly = get(i);
+
+        if (pPoly->getRank() <= _iRank)
         {
-            return false;
+            pReal[i] = 0;
+            if (m_bComplex)
+            {
+                pImg[i]                = 0;
+            }
         }
-
-        Polynom* pM = const_cast<InternalType &>(it).getAs<types::Polynom>();
-
-        if(pM->getRows() != getRows() || pM->getCols() != getCols())
+        else
         {
-            return false;
+            pReal[i]           = pPoly->getCoef()->getReal()[_iRank];
+            if (m_bComplex)
+            {
+                pImg[i]                = pPoly->getCoef()->getImg()[_iRank];
+            }
         }
+    }
+
+    return pdbl;
+}
+bool Polynom::insertCoef(int _iRank, Double* _pCoef)
+{
+    double *pReal      = _pCoef->getReal();
+    double *pImg       = _pCoef->getImg();
 
-        if(pM->isComplex() != isComplex())
+    for (int i = 0 ; i < getSize() ; i++)
+    {
+        SinglePoly *pPoly = get(i);
+        if (pPoly->getRank() <= _iRank)
         {
             return false;
         }
 
-        for(int i = 0 ; i < getSize() ; i++)
+        pPoly->getCoef()->getReal()[_iRank] = pReal[i];
+        if (m_bComplex)
         {
-            SinglePoly* p1 = get(i);
-            SinglePoly* p2 = pM->get(i);
-
-            if(*p1 != *p2)
-            {
-                return false;
-            }
+            pPoly->getCoef()->getImg()[_iRank] = pImg[i];
         }
-        return true;
     }
+    return true;
+}
 
-    bool Polynom::operator!=(const InternalType& it)
+bool Polynom::operator==(const InternalType& it)
+{
+    if (const_cast<InternalType &>(it).isPoly() == false)
     {
-        return !(*this == it);
+        return false;
     }
 
-    SinglePoly* Polynom::getNullValue()
+    Polynom* pM = const_cast<InternalType &>(it).getAs<types::Polynom>();
+
+    if (pM->getRows() != getRows() || pM->getCols() != getCols())
     {
-        double* pR = NULL;
-        SinglePoly* pData = new SinglePoly(&pR, 1);
-        pR[0] = 0;
-        return pData;
+        return false;
     }
 
-    Polynom* Polynom::createEmpty(int _iDims, int* _piDims, bool _bComplex)
+    if (pM->isComplex() != isComplex())
     {
-        return new Polynom(getVariableName(), _iDims, _piDims, NULL);
+        return false;
     }
 
-    SinglePoly* Polynom::copyValue(SinglePoly* _pData)
+    for (int i = 0 ; i < getSize() ; i++)
     {
-        if(_pData == NULL)
+        SinglePoly* p1 = get(i);
+        SinglePoly* p2 = pM->get(i);
+
+        if (*p1 != *p2)
         {
-            return NULL;
+            return false;
         }
-        return _pData->clone();
     }
+    return true;
+}
+
+bool Polynom::operator!=(const InternalType& it)
+{
+    return !(*this == it);
+}
+
+SinglePoly* Polynom::getNullValue()
+{
+    double* pR = NULL;
+    SinglePoly* pData = new SinglePoly(&pR, 1);
+    pR[0] = 0;
+    return pData;
+}
+
+Polynom* Polynom::createEmpty(int _iDims, int* _piDims, bool _bComplex)
+{
+    return new Polynom(getVariableName(), _iDims, _piDims, NULL);
+}
 
-    void Polynom::deleteAll()
+SinglePoly* Polynom::copyValue(SinglePoly* _pData)
+{
+    if (_pData == NULL)
     {
-        for(int i = 0 ; i < getSize() ; i++)
-        {
-            delete m_pRealData[i];
-        }
-        delete[] m_pRealData;
-        m_pRealData = NULL;
-        deleteImg();
+        return NULL;
     }
+    return _pData->clone();
+}
 
-    void Polynom::deleteImg()
+void Polynom::deleteAll()
+{
+    for (int i = 0 ; i < getSize() ; i++)
     {
+        delete m_pRealData[i];
     }
+    delete[] m_pRealData;
+    m_pRealData = NULL;
+    deleteImg();
+}
 
-    SinglePoly** Polynom::allocData(int _iSize)
+void Polynom::deleteImg()
+{
+}
+
+SinglePoly** Polynom::allocData(int _iSize)
+{
+    SinglePoly** pData = new SinglePoly*[_iSize];
+    for (int i = 0 ; i < _iSize ; i++)
     {
-        SinglePoly** pData = new SinglePoly*[_iSize];
-        for(int i = 0 ; i < _iSize ; i++)
-        {
-            double* pReal;
-            pData[i] = new SinglePoly(&pReal, 1);
-            pReal[0] = 0;
-        }
-        return pData;
+        double* pReal;
+        pData[i] = new SinglePoly(&pReal, 1);
+        pReal[0] = 0;
     }
+    return pData;
+}
 }
 
index 50ed4e1..cc8354b 100644 (file)
@@ -324,7 +324,7 @@ void SinglePoly::updateRank(void)
     int iNewRank = m_iRank;
     double *pCoefR = getCoef()->getReal();
     double *pCoefI = getCoef()->getImg();
-    for (int i = m_iRank - 1; i >= 0 ; i--)
+    for (int i = m_iRank - 1; i > 0 ; i--)
     {
         if (fabs(pCoefR[i]) <= dblEps && (pCoefI != NULL ? fabs(pCoefI[i]) : 0) <= dblEps)
         {
@@ -335,7 +335,6 @@ void SinglePoly::updateRank(void)
             break;
         }
     }
-
     if (iNewRank < m_iRank)
     {
         setRank(iNewRank, true);