sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.38k stars 469 forks source link

Substitutions over unit cube faces (Rauzy fractals) #8431

Closed videlec closed 13 years ago

videlec commented 14 years ago

This patch introduces unit cube faces and substitutions over them, as defined in the article Pisot substitutions and Rauzy fractals by Arnoux and Ito.

Three new classes are defined:

The plotting features enable us draw approximations of Rauzy fractals, or to generate patches of discrete planes.

The dimension of the faces can be of any dimension (and the substitutions work accordingly), but the plotting features work only in dimension three (with three-letter alphabet substitutions).

CC: @sagetrac-sage-combinat @seblabbe @sagetrac-abmasse @sagetrac-tmonteil

Component: combinatorics

Keywords: word morphism unit face generalized substitution rauzy fractal

Author: Vincent Delecroix, Timo Jolivet, Franco Saliola, Štěpán Starosta

Reviewer: Sébastien Labbé, Alexandre Blondin Massé

Merged: sage-4.6.1.alpha2

Issue created by migration from https://trac.sagemath.org/ticket/8431

a0e7ac7d-d8f3-4e97-aca8-5ab47a193e00 commented 13 years ago
comment:39

Hi, Timo !

I tried applying the various patches on a sage-4.6 clone and the patch trac_8431-smallfixes-tj.patch fails. Here's what I get.

labo [~/Applications/sage/devel/sage-t8431/sage/combinat]
 $ hg qseries
trac_8431_e_one_star.patch
trac_8431_review-sl.patch
trac_8431_might_be_final_tj.patch
trac_8431_colors_tikz-sl.patch
trac_8431_sigma_type_fix.patch
trac_8431-wordmorphism-sl.patch
trac_8431-smallfixes-tj.patch

labo [~/Applications/sage/devel/sage-t8431/sage/combinat]
 $ hg qtop
trac_8431-smallfixes-tj.patch

labo [~/Applications/sage/devel/sage-t8431/sage/combinat]
 $ hg qpop
now at: trac_8431-wordmorphism-sl.patch

labo [~/Applications/sage/devel/sage-t8431/sage/combinat]
 $ hg qpush
applying trac_8431-smallfixes-tj.patch
patching file sage/combinat/e_one_star.py
Hunk #6 FAILED at 1337
1 out of 7 hunks FAILED -- saving rejects to file sage/combinat/e_one_star.py.rej
patch failed, unable to continue (try -v)
patch failed, rejects left in working dir
errors during apply, please fix and refresh trac_8431-smallfixes-tj.patch

Could you please fix it? Or is it because the order is not correct? Here's the output for the rejected hunk:

labo [~/Applications/sage/devel/sage-t8431/sage/combinat]
 $ cat e_one_star.py.rej 
--- e_one_star.py
+++ e_one_star.py
@@ -1230,49 +1338,6 @@
                 X[letter].append((v, k))
         return X

-    def __call__(self, patch, iterations=1):
-        r"""
-        Apply a generalized substitution to a Patch; this returns a new
-        object.
-        
-        The color of every new face in the image is given the same color as its preimage.
-
-        INPUT:
-
-        - ``patch`` - a patch
-        - ``iterations`` - integer (optional, default: 1) number of iterations
-
-        OUTPUT:
-            
-            a patch
-
-        EXAMPLES::
-
-            sage: from sage.combinat.e_one_star import E1Star, Face, Patch
-            sage: P = Patch([Face((0,0,0),t) for t in [1,2,3]])
-            sage: sigma = WordMorphism({1:[1,2], 2:[1,3], 3:[1]})
-            sage: E = E1Star(sigma)
-            sage: R = E(P)
-            sage: len(R)
-            5
-
-        ::
-
-            sage: x = (0,0,0)
-            sage: p = Patch([Face(x, 1, 'red'), Face(x, 2, 'yellow'), Face(x, 3, 'green')])
-            sage: p = E(p, iterations=4)
-            sage: p
-            Patch of 31 faces
-        """
-        old_faces = patch
-        for i in xrange(iterations):
-            new_faces = []
-            for f in old_faces:
-                new_faces.extend(self._call_on_face(f, color=f.color()))
-            old_faces = new_faces
-
-        return Patch(new_faces)
-
     def _call_on_face(self, face, color=None):
         r"""
         Returns an iterator of faces obtained by applying self on the face.
5173d111-1d42-477d-8dcf-3dafadf95618 commented 13 years ago
comment:40

Hi !

Well, that's very strange: I just compiled 4.6, made a fresh clone, and I could apply all the patches without any problem:

timo@ukko:~/sage-4.6/devel/sage-haha$ ../../sage -hg qseries
trac_8431_e_one_star.patch
trac_8431_review-sl.patch
trac_8431_might_be_final_tj.patch
trac_8431_colors_tikz-sl.patch
trac_8431_sigma_type_fix.patch
trac_8431-wordmorphism-sl.patch
trac_8431-smallfixes-tj.patch
trac_8431-alphaset-tj.patch
timo@ukko:~/sage-4.6/devel/sage-haha$ ../../sage -hg qtop
trac_8431-alphaset-tj.patch
timo@ukko:~/sage-4.6/devel/sage-haha$ ../../sage -hg qpop
now at: trac_8431-smallfixes-tj.patch
timo@ukko:~/sage-4.6/devel/sage-haha$ ../../sage -hg qpop
now at: trac_8431-wordmorphism-sl.patch
timo@ukko:~/sage-4.6/devel/sage-haha$ ../../sage -hg qpush
applying trac_8431-smallfixes-tj.patch
now at: trac_8431-smallfixes-tj.patch
timo@ukko:~/sage-4.6/devel/sage-haha$ ../../sage -hg qpush
applying trac_8431-alphaset-tj.patch
now at: trac_8431-alphaset-tj.patch

Could you try it again? There's no reason that it works for me but not for you!

(And don't forget the last patch trac_8431-alphaset-tj.patch !)

To recap, the order is:

  1. trac_8431_e_one_star.patch
  2. trac_8431_review-sl.patch
  3. trac_8431_might_be_final_tj.patch
  4. trac_8431_colors_tikz-sl.patch
  5. trac_8431_sigma_type_fix.patch
  6. trac_8431-wordmorphism-sl.patch
  7. trac_8431-smallfixes-tj.patch
  8. trac_8431-alphaset-tj.patch

[BTW, a question: when I need to apply such a sequence of patches, do I have to do "import, qpush, import, qpush, import, qpush, ...", with an import and a qpush for each patch ?]

5173d111-1d42-477d-8dcf-3dafadf95618 commented 13 years ago
comment:41

Attachment: trac_new-fixes-final-tj.patch.gz

Hi. Sorry, this error message was because of a manipulation error from my part. (I misapplied the wordmorphism-sl patch, and my two last patches were based on this misapplying.)

I made a new patch that applies correctly over wordmorphism-sl, and that takes into account my two last patches (which should now be ignored; it's a shame that we can't delete patches from the ticket!).

Patches should be applied in this order:

  1. trac_8431_e_one_star.patch
  2. trac_8431_review-sl.patch
  3. trac_8431_might_be_final_tj.patch
  4. trac_8431_colors_tikz-sl.patch
  5. trac_8431_sigma_type_fix.patch
  6. trac_8431-wordmorphism-sl.patch
  7. trac_new-fixes-final-tj.patch

(Sorry for misnaming the last patch, I forgot "8431"... And sorry if this made you lose some time!)

5173d111-1d42-477d-8dcf-3dafadf95618 commented 13 years ago

Attachment: trac_8431_typos-docfix-tj.patch.gz

5173d111-1d42-477d-8dcf-3dafadf95618 commented 13 years ago
comment:42

Thanks for you final remarks. The last patch is trac_8431_typos-docfix-tj.patch, and the sequence is:

  1. trac_8431_e_one_star.patch
  2. trac_8431_review-sl.patch
  3. trac_8431_might_be_final_tj.patch
  4. trac_8431_colors_tikz-sl.patch
  5. trac_8431_sigma_type_fix.patch
  6. trac_8431-wordmorphism-sl.patch
  7. trac_new-fixes-final-tj.patch
  8. trac_8431_typos-docfix-tj.patch
a0e7ac7d-d8f3-4e97-aca8-5ab47a193e00 commented 13 years ago

Apply on top of preceding patches

a0e7ac7d-d8f3-4e97-aca8-5ab47a193e00 commented 13 years ago
comment:43

Attachment: trac_8431_doctest_fix-abm.patch.gz

Hi Timo and Sébastien !

I just uploaded a (I hope last) patch that fixes a minor doctest failure (decimal number, on my computer but not Timo's).

I tested all of it on sage-4.6. I'm satisfied with the code and the documentation looks good (no warning neither).

Before setting this ticket to "positive review", I want to know if Sébastien is ok with it, since he reviewed big parts, and if Timo agrees with my last patch (Timo, just make sure it still passes on your machine).

5173d111-1d42-477d-8dcf-3dafadf95618 commented 13 years ago
comment:44

Yes, the patch applies fine, and the doctest passes. Everything seems to be fine now.

Just a recap:

  1. trac_8431_e_one_star.patch
  2. trac_8431_review-sl.patch
  3. trac_8431_might_be_final_tj.patch
  4. trac_8431_colors_tikz-sl.patch
  5. trac_8431_sigma_type_fix.patch
  6. trac_8431-wordmorphism-sl.patch
  7. trac_new-fixes-final-tj.patch
  8. trac_8431_typos-docfix-tj.patch
  9. trac_8431_doctest_fix-abm.patch
seblabbe commented 13 years ago
comment:45

Before setting this ticket to "positive review", I want to know if Sébastien is ok with it, since he reviewed big parts, and if Timo agrees with my last patch (Timo, just make sure it still passes on your machine).

All test pass on my machine. Coverage is 100%. Documentation builds fine. Positive review!

I just folded the 9 patches into one : trac_8431_folded.patch. It might be easier for the release manager.

Great work!

jdemeyer commented 13 years ago
comment:46

1) Please update the commit message of the folded patch (use hg qrefresh -e for that). Make sure the first line contains the ticket number and a short summary of the whole patch. The next lines can contain a longer description.

2) The copyright message in the files MUST be changed to state

#  Distributed under the terms of the GNU General Public License (GPL) 
#  as published by the Free Software Foundation; either version 2 of 
#  the License, or (at your option) any later version.  
#                  http://www.gnu.org/licenses/  
#***************************************************************************** 
seblabbe commented 13 years ago

Folded all the 9 appropriate patches.

seblabbe commented 13 years ago
comment:47

Attachment: trac_8431_folded.patch.gz

I just re-uploaded the folded patch.

1) Please update the commit message of the folded patch (use hg qrefresh -e for that).

Done.

2) The copyright message in the files MUST be changed to state

Done. I did not know the copyright message changed.

Needs review.

a0e7ac7d-d8f3-4e97-aca8-5ab47a193e00 commented 13 years ago
comment:48

I just checked that the fixes required by the release manager have indeed been done.

All tests still pass.

Positive review.

jdemeyer commented 13 years ago

Merged: sage-4.6.1.alpha2

fchapoton commented 7 years ago

Changed author from Vincent Delecroix, Timo Jolivet, Franco Saliola, Stepan Starosta to Vincent Delecroix, Timo Jolivet, Franco Saliola, Štěpán Starosta