summaryrefslogtreecommitdiff
path: root/sci-mathematics/polymake/files/polymake-4.11-singular-sat.patch
blob: 739e503ac246d655bbd059a3e1865228c5b300a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
commit 4ce0549f510d246c8f69c85c509fc2d13d882442
Author: Benjamin Lorenz <lorenz@math.tu-berlin.de>
Date:   Thu Nov 9 11:15:06 2023 +0100

    singular: support new return types for saturation command
    
    This was changed from (ideal, exponent) to just the ideal in singular 4-3-2p5.
    To allow older versions we keep using sat but support both return types
    instead of switching to the new sat_with_exp.

diff --git a/bundled/singular/apps/ideal/src/singularIdeal.cc b/bundled/singular/apps/ideal/src/singularIdeal.cc
index 4cbc00a6f4..bdade5c29d 100644
--- a/bundled/singular/apps/ideal/src/singularIdeal.cc
+++ b/bundled/singular/apps/ideal/src/singularIdeal.cc
@@ -236,22 +236,24 @@ public:
       arg.next->data=(void *)idCopy(J);
       // call primdecSY
       BOOLEAN res=iiMake_proc(sathdl, nullptr ,&arg);
-      if(!res && (iiRETURNEXPR.Typ() == LIST_CMD)){
-         lists L = (lists)iiRETURNEXPR.Data();
-         SingularIdeal_wrap* result;
-         if(L->m[0].Typ() == IDEAL_CMD){
-            result = new SingularIdeal_impl((::ideal) (L->m[0].Data()),singRing);
-         } else {
-            throw std::runtime_error("Something went wrong for the primary decomposition");
+      if(!res) {
+         ::ideal iddata = nullptr;
+         if (iiRETURNEXPR.Typ() == LIST_CMD) {
+            lists L = (lists)iiRETURNEXPR.Data();
+            if(L->m[0].Typ() == IDEAL_CMD)
+               iddata = (::ideal) L->m[0].Data();
+         } else if (iiRETURNEXPR.Typ() == IDEAL_CMD) {
+            iddata = (::ideal) iiRETURNEXPR.Data();
+         }
+         if (iddata != nullptr) {
+            SingularIdeal_wrap* result = new SingularIdeal_impl(iddata, singRing);
+            iiRETURNEXPR.CleanUp();
+            iiRETURNEXPR.Init();
+            return result;
          }
-         iiRETURNEXPR.CleanUp();
-         iiRETURNEXPR.Init();
-         return result;
-      } else {
-         iiRETURNEXPR.Init();
-         throw std::runtime_error("Something went wrong for the saturation");
       }
-
+      iiRETURNEXPR.Init();
+      throw std::runtime_error("saturation: unable to parse ideal from return value");
    }
 
    Array<SingularIdeal_wrap*> primary_decomposition() const