AFAICS the attached patch fixes the problem:

-- 
                              Waldek Hebisch

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to fricas-devel+unsubscr...@googlegroups.com.
To post to this group, send email to fricas-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.
--- ../ax-build195/src/algebra/SIMPC.spad       2016-09-19 22:51:14.843152617 
+0000
+++ SIMPC.spad  2016-09-20 15:40:21.479430962 +0000
@@ -247,7 +247,7 @@
        reslt := concat(reslt, orderedPermutation(rst, len))
        reslt
 
-   -- local function used in listUnion in addImpliedFaces
+   -- local function used in unorientedUnion in addImpliedFaces
    isNewFace?(lst : List(OrientedFacet), b : OrientedFacet) : Boolean ==
        --print("isNewFace?(" << a << ", " << b << ")")
        for a in lst repeat
@@ -256,17 +256,17 @@
        true
 
    -- local function used in addImpliedFaces
-   listUnion(a : List(OrientedFacet), b : List(OrientedFacet)
+   unorientedUnion(a : List(OrientedFacet), b : List(OrientedFacet)
             ) : List(OrientedFacet) ==
-       res := []$List(OrientedFacet)
-       for a1 in a repeat
-           res := concat(res, a1)
+       res := a
        for b1 in b repeat
            if isNewFace?(a, b1) then
-               res := concat(res, b1)
-       --print("listUnion(" << a << ", " << b << ") = " << res)
+               res := cons(b1, res)
+       -- print("unorientedUnion(" << a << ", " << b << ") = " << res)
        res
 
+   import from OutputForm
+
    -- A function to take a set of faces and add those that are implied
    -- by the simplicial complex conventions (if they don't already exist).
    -- For example, if the input is a triangle ((1, 2, 3)) then we would add
@@ -280,27 +280,29 @@
            --print("addImpliedFaces return because maxGrade=" << maxGrade)
            return res
        -- create an empty list for each grade
-       for a in 1..(maxGrade) repeat
-           res := concat(res, []$List(OrientedFacet))
+       res := []$List(List(OrientedFacet))
        newFaces := []$List(OrientedFacet)
-       for gr in inputList for grn in 1..(maxGrade) repeat
+       for gr in inputList repeat
            --print("addImpliedFaces grade number grn=" << grn)
            -- add old faces
-           for face in gr repeat
-               res.grn := concat(res.grn, face)
-           -- add new faces
-           for face in newFaces repeat
-               res.grn := concat(res.grn, face)
+           all_faces := unorientedUnion(newFaces, gr)
+           -- print(message("all_faces = "))
+           -- print(all_faces::OutputForm)
+           res := cons(all_faces, res)
            --print("addImpliedFaces empty newFaces. res.grn=" << res.grn)
-           newFaces := []$List(OrientedFacet)
+           newFaces := []
            --print("addImpliedFaces res.grn=" << res.grn)
-           for face in res.grn repeat
+           for face in all_faces repeat
+               -- FIXME: handle order 1 too
                len : NNI := (order(face) -1) pretend NNI
                if len > 0 then
-                   newFaces := listUnion(newFaces, allSubsets(face, len, len))
+                   newFaces := unorientedUnion(newFaces,
+                                               allSubsets(face, len, len))
+           -- print(message("newFaces = "))
+           -- print(newFaces::OutputForm)
            --print("addImpliedFaces get next grade res=" << res)
        --print("addImpliedFaces result=" << reverse(res))
-       reverse(res)
+       res
 
    -- Step down to the next lower dimension, this is like hollowing out the 
complex.
    -- It takes the highest dimension entries and replaces them with their 
boundaries,

Reply via email to