Changes http://wiki.axiom-developer.org/MantepseSpad2/diff
--

 
++added:
+  
     Implementation == add

 
++added:
+-- restrict to safety
+
+        len: Integer := #list
+        shortlist: List F := first(list, (len-safety(options)$GOPT0+1)::NNI)
+
 -- remove zeros from list

??changed:
         i: Integer := -1
-        for x in list repeat
+        for x in shortlist repeat
           i := i+1

??changed:
         i := -1
-        for x in list repeat
+        for x in shortlist repeat
           i := i+1

--removed:
         xValues := reverse xValues
-        len := i
 

??changed:
         
-        map([#1, checkResult(#1, xx, len, list, options)], res)
+        reslist := map([#1, checkResult(#1, xx, len, list, options)], res)
            $ListFunctions2(EXPRR, Record(function: EXPRR, order: NNI))

            $ListFunctions2(EXPRR, Record(function: EXPRR, order: NNI))
++added:
+
+        select(#1.order < len-safety(options)$GOPT0, reslist)
 

       testInterpolant(resi: List SUP S, 
++added:
+                      list: List F,
                       testList: List UFPSSUPF, 

??changed:
 
--- FIXME: this is likely incorrect
-        ((maxDegree(options)$GOPT0 = -1) and zero?(last resi))
-         => "failed"
-
--- Then we check all the coefficients that should be valid. 
-
-        resiSUPF := map(SUPF2SUPSUPF SUPS2SUPF #1, resi)
-                       $ListFunctions2(SUP S, SUP SUP F)
-
-        iterate? := true;
-        for d in guessDegree+1.. repeat
-          c: SUP F := generalCoefficient(D.AF, vector testList, 
-                                         d, vector resiSUPF)
-                                        $FFFG(SUP F, UFPSSUPF)
-
-          if not zero? c then 
-            iterate? := ground? c
-            break
-
-        iterate? => "failed"
+        ((maxDegree(options)$GOPT0 = -1) and 
+         (allDegrees(options)$GOPT0 = false) and 
+         zero?(last resi)) 
+         => return "failed"
+
+-- Then we check all the coefficients that should be valid.
+
+-- We want the zero solution only, if the function is really zero. Without 
+-- this test, every sequence ending with zero is interpreted as the zero 
+-- sequence, since the factor in front of the only non-vanishing term can 
+-- cancel everything else.
+
+        nonZeroCoefficient: Integer := 0
+
+-- nonZeroCoefficient is the only non zero coefficient or, if there are
+-- several, it is 0.
+
+        for i in 1..#resi repeat
+          if not zero? resi.i then
+            if zero? nonZeroCoefficient then
+              nonZeroCoefficient := i
+            else 
+              nonZeroCoefficient := 0
+              break
+
+        if not zero? nonZeroCoefficient then
+          (freeOf?(exprList.nonZeroCoefficient, name op)) => return "failed"
+
+          for e in list repeat
+            if not zero? e then return "failed"
+
+        else
+          resiSUPF := map(SUPF2SUPSUPF SUPS2SUPF #1, resi)
+                         $ListFunctions2(SUP S, SUP SUP F)
+
+          iterate? := true;
+          for d in guessDegree+1.. repeat
+            c: SUP F := generalCoefficient(D.AF, vector testList, 
+                                           d, vector resiSUPF)
+                                          $FFFG(SUP F, UFPSSUPF)
+
+            if not zero? c then 
+              iterate? := ground? c
+              break
+
+          iterate? => return "failed"
 

             res := testInterpolant(entries column(M, i), 
++added:
+                                   list,
                                    testList, 

             res := testInterpolant(entries column(M, i), 
++added:
+                                   list,
                                    testList, 

--removed:
                            coerce$Expression(Integer))
-
 \end{spad}

--
forwarded from http://wiki.axiom-developer.org/[EMAIL PROTECTED]

Reply via email to