* Bug 16118 fixed: now %s <> 1+%s returns %t
[scilab.git] / scilab / modules / ast / src / cpp / operations / types_comparison_eq.cpp
index 1d0eb51..62397b7 100644 (file)
@@ -2950,10 +2950,6 @@ template<>
 InternalType* compequal_M_M<Polynom, Polynom, Bool>(Polynom* _pL, Polynom* _pR)
 {
     Bool* pbOut = NULL;
-    bool bPoise = true;
-
-    SinglePoly** pSPL = _pL->get();
-    SinglePoly** pSPR = _pR->get();
 
     if (_pL->getVariableName() != _pR->getVariableName())
     {
@@ -2964,182 +2960,18 @@ InternalType* compequal_M_M<Polynom, Polynom, Bool>(Polynom* _pL, Polynom* _pR)
     {
         pbOut = new Bool(_pL->getDims(), _pL->getDimsArray());
         int iSize = pbOut->getSize();
-
-        if (_pL->isComplex())
+        for (int i = 0; i < iSize; i++)
         {
-            if (_pR->isComplex())
-            {
-                for (int i = 0; i < iSize; i++)
-                {
-                    if (pSPL[i]->getSize() != pSPR[0]->getSize())
-                    {
-                        bPoise = false;
-                    }
-                    else
-                    {
-                        bPoise = true;
-                        for (int j = 0; j < pSPL[0]->getSize() && (bPoise == true); j++)
-                        {
-                            compequal(pSPR[0]->get(j), pSPR[0]->getImg(j), pSPL[i]->get(j), pSPL[i]->getImg(j), &bPoise);
-                        }
-                    }
-                    pbOut->set(i, bPoise);
-
-                }
-            }
-            else
-            {
-                for (int i = 0; i < iSize; i++)
-                {
-                    if (pSPL[i]->getSize() != pSPR[0]->getSize())
-                    {
-                        bPoise = false;
-                    }
-                    else
-                    {
-                        bPoise = true;
-                        for (int j = 0; j < pSPL[0]->getSize() && (bPoise == true); j++)
-                        {
-                            compequal(pSPR[0]->get(j), (double)0, pSPL[i]->get(j), pSPL[i]->getImg(j), &bPoise);
-                        }
-                    }
-                    pbOut->set(i, bPoise);
-                }
-            }
-        }
-        else
-        {
-            if (_pR->isComplex())
-            {
-                for (int i = 0; i < iSize; i++)
-                {
-                    if (pSPL[i]->getSize() != pSPR[0]->getSize())
-                    {
-                        bPoise = false;
-                    }
-                    else
-                    {
-                        bPoise = true;
-                        for (int j = 0; j < pSPL[0]->getSize() && (bPoise == true); j++)
-                        {
-                            compequal(pSPR[0]->get(j), pSPR[0]->getImg(j), pSPL[i]->get(j), (double)0, &bPoise);
-                        }
-                    }
-                    pbOut->set(i, bPoise);
-                }
-            }
-            else
-            {
-                for (int i = 0; i < iSize; i++)
-                {
-                    if (pSPL[i]->getSize() != pSPR[0]->getSize())
-                    {
-                        bPoise = false;
-                    }
-                    else
-                    {
-                        bPoise = true;
-                        for (int j = 0; j < pSPL[0]->getSize() && (bPoise == true); j++)
-                        {
-                            compequal(pSPR[0]->get(j), pSPL[i]->get(j), &bPoise);
-                        }
-                    }
-                    pbOut->set(i, bPoise);
-                }
-            }
+            pbOut->set(i, *(_pL->get(i)) == *( _pR->get(0)));
         }
     }
     else if (_pL->isScalar())
     {
         pbOut = new Bool(_pR->getDims(), _pR->getDimsArray());
         int iSize = pbOut->getSize();
-
-        if (pSPR[0]->getSize() != 1)
+        for (int i = 0; i < iSize; i++)
         {
-            if (_pL->isComplex())
-            {
-                if (_pR->isComplex())
-                {
-                    for (int i = 0; i < iSize; i++)
-                    {
-                        if (pSPL[0]->getSize() != pSPR[i]->getSize())
-                        {
-                            bPoise = false;
-                        }
-                        else
-                        {
-                            bPoise = true;
-                            for (int j = 0; j < pSPL[0]->getSize() && (bPoise == true); j++)
-                            {
-                                compequal(pSPL[0]->get(j), pSPL[0]->getImg(j), pSPR[i]->get(j), pSPR[i]->getImg(j), &bPoise);
-                            }
-                        }
-                        pbOut->set(i, bPoise);
-                    }
-                }
-                else
-                {
-                    for (int i = 0; i < iSize; i++)
-                    {
-                        if (pSPL[0]->getSize() != pSPR[i]->getSize())
-                        {
-                            bPoise = false;
-                        }
-                        else
-                        {
-                            bPoise = true;
-                            for (int j = 0; j < pSPL[0]->getSize() && (bPoise == true); j++)
-                            {
-                                compequal(pSPL[0]->get(j), pSPL[0]->getImg(j), pSPR[i]->get(j), (double)0, &bPoise);
-                            }
-                        }
-                        pbOut->set(i, bPoise);
-                    }
-                }
-            }
-            else
-            {
-
-                if (_pR->isComplex())
-                {
-                    for (int i = 0; i < iSize; i++)
-                    {
-                        if (pSPL[0]->getSize() != pSPR[i]->getSize())
-                        {
-                            bPoise = false;
-                        }
-                        else
-                        {
-                            bPoise = true;
-                            for (int j = 0; j < pSPL[0]->getSize() && (bPoise == true); j++)
-                            {
-                                compequal(pSPL[0]->get(j), (double)0, pSPR[i]->get(j), pSPR[i]->get(j), &bPoise);
-                            }
-                        }
-                        pbOut->set(i, bPoise);
-                    }
-                }
-                else
-                {
-                    for (int i = 0; i < iSize; i++)
-                    {
-                        if (pSPL[0]->getSize() != pSPR[i]->getSize())
-                        {
-                            bPoise = false;
-                        }
-                        else
-                        {
-                            bPoise = true;
-                            for (int j = 0; j < pSPR[i]->getSize() && (bPoise == true); j++)
-                            {
-                                compequal(pSPL[0]->get(j), pSPR[i]->get(j), &bPoise);
-                            }
-                        }
-                        pbOut->set(i, bPoise);
-                    }
-                }
-
-            }
+            pbOut->set(i, *(_pL->get(0)) == *(_pR->get(i)));
         }
     }
     else
@@ -3160,88 +2992,9 @@ InternalType* compequal_M_M<Polynom, Polynom, Bool>(Polynom* _pL, Polynom* _pR)
 
         pbOut = new Bool(_pL->getDims(), _pL->getDimsArray());
         int iSize = pbOut->getSize();
-
-        if (_pL->isComplex())
-        {
-            if (_pR->isComplex())
-            {
-                for (int i = 0; i < iSize; i++)
-                {
-                    if (pSPL[i]->getSize() != pSPR[i]->getSize())
-                    {
-                        bPoise = false;
-                    }
-                    else
-                    {
-                        bPoise = true;
-                        for (int j = 0; j < pSPR[i]->getSize() && (bPoise == true); j++)
-                        {
-                            compequal(pSPR[i]->get(j), pSPR[i]->getImg(j), pSPL[i]->get(j), pSPL[i]->getImg(j), &bPoise);
-                        }
-                    }
-                    pbOut->set(i, bPoise);
-                }
-            }
-            else
-            {
-                for (int i = 0; i < iSize; i++)
-                {
-                    if (pSPL[i]->getSize() != pSPR[i]->getSize())
-                    {
-                        bPoise = false;
-                    }
-                    else
-                    {
-                        bPoise = true;
-                        for (int j = 0; j < pSPR[i]->getSize() && (bPoise == true); j++)
-                        {
-                            compequal(pSPL[i]->get(j), pSPL[i]->getImg(j), pSPR[i]->get(j), (double)0, &bPoise);
-                        }
-                    }
-                    pbOut->set(i, bPoise);
-                }
-            }
-        }
-        else
+        for (int i = 0; i < iSize; i++)
         {
-            if (_pR->isComplex())
-            {
-                for (int i = 0; i < iSize; i++)
-                {
-                    if (pSPL[i]->getSize() != pSPR[i]->getSize())
-                    {
-                        bPoise = false;
-                    }
-                    else
-                    {
-                        bPoise = true;
-                        for (int j = 0; j < pSPR[i]->getSize() && (bPoise == true); j++)
-                        {
-                            compequal(pSPR[i]->get(j), pSPR[i]->getImg(j), pSPL[i]->get(j), (double)0, &bPoise);
-                        }
-                    }
-                    pbOut->set(i, bPoise);
-                }
-            }
-            else
-            {
-                for (int i = 0; i < iSize; i++)
-                {
-                    if (pSPL[i]->getSize() != pSPR[i]->getSize())
-                    {
-                        bPoise = false;
-                    }
-                    else
-                    {
-                        bPoise = true;
-                        for (int j = 0; j < pSPR[i]->getSize() && (bPoise == true); j++)
-                        {
-                            compequal(pSPR[i]->get(j), pSPL[i]->get(j), &bPoise);
-                        }
-                    }
-                    pbOut->set(i, bPoise);
-                }
-            }
+            pbOut->set(i, *(_pL->get(i)) == *(_pR->get(i)));
         }
     }