Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation of the class ClusterQuiver #10538

Closed
stumpc5 opened this issue Dec 31, 2010 · 40 comments
Closed

Implementation of the class ClusterQuiver #10538

stumpc5 opened this issue Dec 31, 2010 · 40 comments

Comments

@stumpc5
Copy link
Contributor

stumpc5 commented Dec 31, 2010

This class implements quivers for skew-symmetrizable matrices.

The patch contains multiple examples.

sage: Q = ClusterQuiver(['A',3]); Q
Quiver on 3 vertices of type ['A', 3]

Apply the two patches below, in order. The version posted here is the current version; the one on the combinat queue is slightly out of date.

Depends on #10527

CC: @sagetrac-drupel

Component: combinatorics

Keywords: cluster algebra, quiver

Author: Christian Stump, Gregg Musiker

Reviewer: Dylan Rupel

Merged: sage-5.6.beta3

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

@stumpc5

This comment has been minimized.

@stumpc5
Copy link
Contributor Author

stumpc5 commented Jun 8, 2011

Dependencies: 10527

@fchapoton
Copy link
Contributor

Changed dependencies from 10527 to #10527

@stumpc5
Copy link
Contributor Author

stumpc5 commented Jun 11, 2011

comment:6

The failed doctest are related to the mulitple process doctesting. I get the same on my computer if I use multiple processes, but all tests pass with only a single process.

I guess that has to do with reading the exceptional types from an external file, which cannot be accessed simultaneously from different processes. I add a sentence to the documentation...

@sagetrac-JStarx
Copy link
Mannequin

sagetrac-JStarx mannequin commented Mar 6, 2012

comment:7

Is this dependent on anything other than #10527? After applying that and this patch I get the following:

sage: S = ClusterSeed(['A',3])
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (398, 0))

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)

/Users/Starx/sage/devel/sage-main/<ipython console> in <module>()

/Users/Starx/sage/local/lib/python2.6/site-packages/sage/combinat/cluster_algebra_quiver/cluster_seed.pyc in __init__(self, data, frozen)
     93         elif type( data ) in [list,tuple] and ( type( data[0] ) is str or all(type( comp ) in [list,tuple] and type( comp[0] ) is str for comp in data) ):
     94             mutation_type = QuiverMutationType( data )
---> 95             quiver = mutation_type.standard_quiver()
     96             self.__init__( quiver )
     97 

/Users/Starx/sage/local/lib/python2.6/site-packages/sage/misc/cachefunc.pyc in __call__(self, *args, **kwds)
    553             return self.cache[k]
    554         except KeyError:
--> 555             w = self._cachedmethod._instance_call(self._instance, *args, **kwds)
    556             self.cache[k] = w
    557             return w

/Users/Starx/sage/local/lib/python2.6/site-packages/sage/misc/cachefunc.pyc in _instance_call(self, inst, *args, **kwds)
    776 
    777         """
--> 778         return self._cachedfunc.f(inst, *args, **kwds)
    779 
    780     def _get_instance_cache(self, inst):

/Users/Starx/sage/local/lib/python2.6/site-packages/sage/combinat/cluster_algebra_quiver/quiver_mutation_type.pyc in standard_quiver(self)
   1211         """
   1212         from quiver import Quiver
-> 1213         Q = Quiver( self._digraph )
   1214         Q._mutation_type = self
   1215         return Q

/Users/Starx/sage/local/lib/python2.6/site-packages/sage/combinat/cluster_algebra_quiver/quiver.pyc in __init__(self, data, frozen)
    161 
    162             M = _edge_list_to_matrix( dg.edge_iterator(), n, m )
--> 163             if not _principal_part(M).is_skew_symmetrizable( positive=True ):
    164                 raise ValueError, "The input digraph must be skew-symmetrizable"
    165             self._digraph = dg

/Users/Starx/sage/local/lib/python2.6/site-packages/sage/structure/element.so in sage.structure.element.Element.__getattr__ (sage/structure/element.c:2884)()

/Users/Starx/sage/local/lib/python2.6/site-packages/sage/structure/parent.so in sage.structure.parent.getattr_from_other_class (sage/structure/parent.c:3236)()

AttributeError: 'sage.matrix.matrix_integer_sparse.Matrix_integer_sparse' object has no attribute 'is_skew_symmetrizable'

I think the patch was meant for 4.7.2, maybe it needs to be updated to work with the current version of sage?

@stumpc5
Copy link
Contributor Author

stumpc5 commented Mar 6, 2012

comment:8

Replying to @sagetrac-JStarx:

I think the patch was meant for 4.7.2, maybe it needs to be updated to work with the current version of sage?

maybe -- I will upload a new patch as soon as someone is willing to review it.

We have a notebook server running for all people that want to play with the combinatorial quivers and cluster algebras (which are quite a few!) -- you can log in and play with it at sage.lacim.uqam.ca.

@hughrthomas
Copy link

comment:9

Are the data files for the different mutation types really supposed to be part of the patch? It seems to me that it's a fairly large quantity of data, so maybe it would be better to set things up so that an interested user can reconstruct it (which wouldn't be too hard, right?). Or maybe I have the wrong idea about how receptive Sage is to including data like this. Are there guidelines for this anywhere? If not, maybe you could ask for feedback on sage-devel (or if you'd rather, I could)?

@stumpc5
Copy link
Contributor Author

stumpc5 commented May 9, 2012

comment:10

Replying to @hughrthomas:

Are the data files for the different mutation types really supposed to be part of the patch? It seems to me that it's a fairly large quantity of data, so maybe it would be better to set things up so that an interested user can reconstruct it (which wouldn't be too hard, right?). Or maybe I have the wrong idea about how receptive Sage is to including data like this. Are there guidelines for this anywhere? If not, maybe you could ask for feedback on sage-devel (or if you'd rather, I could)?

Hi Hugh,

I rearranged the patches, so that the functions

  • _construct_mutation_classes_by_rank
  • _construct_exceptional_mutation_classes
  • _save_exceptional_data

are now in #10538. I also added a function save_exceptional_data that saves the data to SAGE_ROOT/data/cluster_algebra/quiver. This function is supposed to be imported by the user if needed. The data files are now not part of the patch anymore, but can only be created by the user using this function.

Best, Christian

@hughrthomas
Copy link

comment:11

I have added a review patch, but I haven't put anything in it yet.

cheers,

Hugh

@hughrthomas
Copy link

comment:12

I think that what I have now posted in the review patch for #10538 (on the combinat server) makes the patch compatible with the changes I have introduced in reviewing #10527. (It also pointed out some mistakes in my "corrections" to #10527...) In particular, all doctests are passing for me. If you find anything that is not working, please let me know; I will try to get it so everything is running properly for Sage Days 40.

@stumpc5

This comment has been minimized.

@stumpc5 stumpc5 changed the title Implementation of the classes ClusterSeed and Quiver Implementation of the class Quiver Aug 15, 2012
@sagetrac-gmoose05
Copy link
Mannequin

sagetrac-gmoose05 mannequin commented Aug 15, 2012

Reviewer: Gregg Musiker

@robertwb
Copy link
Contributor

comment:16

With an eye towards startup time, can all these new modules be imported on demand?

@stumpc5
Copy link
Contributor Author

stumpc5 commented Aug 31, 2012

comment:17

Replying to @robertwb:

With an eye towards startup time, can all these new modules be imported on demand?

I am not very familiar with possible implications. Do you suggest that we should lazily import them?

@sagetrac-gmoose05
Copy link
Mannequin

sagetrac-gmoose05 mannequin commented Sep 2, 2012

comment:18

This patch fixes a number of issues and also gives the user more flexibility. Please see details below (especially 8c)

  1. For the .plot() and .show() commands, the default by source code and experimentation is circular = False.

I corrected the documentation to reflect this.

  1. standard_quiver was defined twice in a row, so I deleted one of the two copies.

  2. The auxiliary commands 

_construct_mutation_classes_by_rank,
_construct_exceptional_mutation_classes,
_save_exceptional_data, and
save_exceptional_data

do not work yet because they require the .mutation_class() command for quivers which were moved into a later patch.

I therefore deleted them from this patch.  We should make sure to remember to include these back into the "mutation_class" patch
that comes after quivers, cluster_seeds, ... in our sequence."

  1. The class 'Quiver' has been changed to 'ClusterQuiver' (Associated examples and function calls also changed so that all tests pass) Future patches would have to be updated accordingly.

  2. I edited the principal_extension command so that it adds n frozen variables (corresponding to an identity matrix in the bottom of the B-matrix) even if the quiver already contained frozen vertices.  This is important for examples like a cluster algebra from a surface with boundary.

  3. Renamed "principal_restriction" to "exchangeable_part".
    I think this name is a little more descriptive and also .tab will allow better shortcuts for both commands "principal_extension" and "exchangeable_part" this way.

  4. Rewrote __init__ command for ClusterQuiver so that it raises an error for unexpected input (e..g ClusterQuiver('whatever') or ClusterQuiver('12345') now raises an error instead of constructing an object as it did before).

8a) In QuiverMutationType.py:

Separated out the cases

['F', 4, [1,2] ] and ['F', 4, [2,1] ]
['G', 4, [1,3] ] as well as ['G', 4, [3,1] ]

in the class QuiverMutationType_Irreducible.

I also added the coercions ['F',4,[2,1]] -> ['F',4,[1,2]] and
['G',2,[3,1]] -> ['G',2,[1,3]] up front in the Mutation Type Casting list to make this clearer.

Similarly, the values ['GR', [2,n]] and ['TR',1], ['TR',2] are now allowed as inputs to QuiverMuationtType_Irreducible

8b) During this process, I realized that even with my slight edit to the
_mutation_type_error command in trac_10527-quiver_mutation_type-gm-additional.patch, it was still incorrect as I forgot to consider the syntax for elliptic G.

While we could make this one line edit to my old patch, it might be just as easy to green-light 10527 as is and then my recent
trac_10538-quiver-gm.patch fixes this.

8c) SIGNIFICANT CHANGE:

I have changed the behavior of ClusterQuiver(['C',2]),
ClusterQuiver(['GR',[3,7]]), ClusterQuiver(['F',4,[2,1]]), etc.

These are highlighted in the new doctests I added. The point is that this gives the savvy user an easier time to build common quivers, even though they are mutation-equivalent to the standard quiver of a quiver mutation type we already build.

Try it out, I think you'll like how it now works.

Note for Christian: I tried first using the method we recently discussed over IM, but in the end this seemed cleaner, and I didn't have to change the standard_quiver command in the end.

  1. Very subtle bug in mutate command fixed:

If one writes Q.mutate(0,0), Q.mutate(0,1), or Q.mutate(0,2), etc instead of
Q.mutate([0,0]), Q.mutate([0,1]), or Q.mutate([0,2]), there could be weird behavior as Sage interprets the second argument as the parameter 'inplace'. Warnings are now printed if the user possibly makes this mistake.

@sagetrac-gmoose05

This comment has been minimized.

@sagetrac-gmoose05 sagetrac-gmoose05 mannequin changed the title Implementation of the class Quiver Implementation of the class ClusterQuiver Sep 2, 2012
@robertwb
Copy link
Contributor

robertwb commented Sep 2, 2012

comment:20

Replying to @stumpc5:

Replying to @robertwb:

With an eye towards startup time, can all these new modules be imported on demand?

I am not very familiar with possible implications. Do you suggest that we should lazily import them?

Yes, exactly (whether using the lazy_import module or another mechanism).

@sagetrac-gmoose05
Copy link
Mannequin

sagetrac-gmoose05 mannequin commented Sep 2, 2012

comment:25

Christian, the changes we discussed have now been essentially made:

  • The ClusterQuiver constructor passes along all inputs which are of the form QuiverMutationType to .standard_quiver()

  • However, does case-by-case handling of (C,2), (F,4, [2,1]), (G,2, (3,1)), 'GR' type, and 'TR' type.

Note that I employed a strategy slightly different than we discussed: I use QuiverMutationType_Irreducible._digraph to get
the desired directed graph rather than repeating these lines here.

If you want to move some of these lines from QuiverMutationType_Irreducible to here, we can do that, but I wanted to make sure it worked first before trying to pull those lines over. Also, I'm perfectly happy leaving the lines in QuiverMutationType_Irreducible since it is not a globally defined class, but am open to further discussion.

  • I also now allow an input of
sage: QuiverMutationType(['A',[n,0],1])
['D', n]

with special cases for small n.

However

sage: ClusterQuiver(['A',[n,0],1])

yields the directed cycle quiver of type D_n rather than the standard Dynkin D_n.

  • ClusterQuiver now also has the command .mutation_type() which yields the _mutation_type, but without trying to compute it when it is not already known.

  • I found out where in our code we are missing doctests. It is really only for the graphical commands: .plot(), .show() in QuiverMutationType.py and .show(), .interact(), and .save_image() in Quiver.py.

I added a dummy example for .plot() in QuiverMutationType but didn't update the others. Hopefully adding this one function changed the coverage percentage so that we increase it rather than decrease it (I think that's what made the patchbot unhappy).

We also have bad coverage in the mutation_class.py file, but state that at the top of the sheet, and I will worry about this another day.

@stumpc5
Copy link
Contributor Author

stumpc5 commented Sep 7, 2012

comment:26

I rebased the patches according to the new lazy import in #10527.

@sagetrac-gmoose05
Copy link
Mannequin

sagetrac-gmoose05 mannequin commented Sep 11, 2012

comment:27

Recent changes to #10527 led to apply errors when my patch trac_10538-quiver-gm.patch is applied after the new #10527 patches. I just uploaded a new version of my patch to eliminate these errors.

Christian, please delete my old (39.1 KB) patch and keep my (35.4 KB) patch in its place. I no longer had permissions to replace my old patch.

For better or worse, the patchbot is down at the moment so we won't get any apply failures for the time being anyway.

By the way, Dylan, this patch should be ready for reviewing shortly. Once you have a trac account, I can change the reviewer field accordingly.

@stumpc5
Copy link
Contributor Author

stumpc5 commented Sep 11, 2012

comment:28

Replying to @sagetrac-gmoose05:

Christian, please delete my old (39.1 KB) patch and keep my (35.4 KB) patch in its place. I no longer had permissions to replace my old patch.

Done.

@sagetrac-drupel
Copy link
Mannequin

sagetrac-drupel mannequin commented Nov 19, 2012

Changed reviewer from Gregg Musiker to Dylan Rupel

@sagetrac-gmoose05
Copy link
Mannequin

sagetrac-gmoose05 mannequin commented Nov 29, 2012

comment:30

Just added an updated version of my patch.

This includes all of the earlier changes and added a single method to the ClusterQuiver class, qmu_save(), that allows one to save a ClusterQuiver to a .qmu file so that it can uploaded directly into Bernhard Keller's Java Applet for Quiver Mutation.

@sagetrac-drupel
Copy link
Mannequin

sagetrac-drupel mannequin commented Dec 10, 2012

comment:31

I made some small changes to the init() method. In particular there was some undesirable behavior when 'data' was a list of edges or an empty digraph. I added examples and tests which illustrate the changes. When 'data' is a digraph it will now warn the user if loops are present rather than referring to the loops as two-cycles. I also added an 'inplace' option (not default) to the principal_extension() method.

@stumpc5
Copy link
Contributor Author

stumpc5 commented Dec 15, 2012

comment:32

I uploaded a new version of the patch with all missing doctests added. Let's see what the patchbot says...

@stumpc5
Copy link
Contributor Author

stumpc5 commented Dec 16, 2012

comment:33

Okay, I had another look and made some last minor changes in the documentation -- I think it is ready to go once we can convince the patchbot to give us a green light!

@sagetrac-drupel
Copy link
Mannequin

sagetrac-drupel mannequin commented Dec 17, 2012

comment:34

I did some reorganizing of the examples, is the placement of my colons correct?

I made a small change in the mutate() method so that it remembers the QuiverMutationType when inplace=False.

@stumpc5
Copy link
Contributor Author

stumpc5 commented Dec 18, 2012

comment:35

Replying to @sagetrac-drupel:

I did some reorganizing of the examples, is the placement of my colons correct?

You can figure out how the documetation looks like by using

# sage -docbuild reference html

and then look at the index.html specified at the end. I will do it myself but don't have time today to do it anymore...

I made a small change in the mutate() method so that it remembers the QuiverMutationType when inplace=False.

good call, thanks!

@stumpc5
Copy link
Contributor Author

stumpc5 commented Dec 20, 2012

comment:36

Hi Dylan --

I folded your review into my patch. I did that because patchbot doesn't run patches by people it "doesn't know" (I don't have a proper definition here), and it is better if we see the green light before actually setting the positive review.

From my side, you can go forward and do so, as soon as the patchbot is done without finding anything.

Thanks for looking closely at the patch!

Christian

@sagetrac-gmoose05
Copy link
Mannequin

sagetrac-gmoose05 mannequin commented Dec 25, 2012

Changed author from Christian Stump to Christian Stump, Gregg Musiker

@jdemeyer
Copy link

comment:39
sage -t  --long -force_lib devel/sage/sage/combinat/cluster_algebra_quiver/quiver.py
**********************************************************************
File "/release/merger/sage-5.6.beta2/devel/sage-main/sage/combinat/cluster_algebra_quiver/quiver.py", line 501:
    sage: Q.interact() # long time
Expected nothing
Got:
    'The interactive mode only runs in the Sage notebook.'
**********************************************************************

@stumpc5
Copy link
Contributor Author

stumpc5 commented Dec 31, 2012

comment:40

Attachment: trac_10538-quiver-cs.patch.gz

Replying to @jdemeyer:

Fixed!

@jdemeyer
Copy link

jdemeyer commented Jan 7, 2013

Merged: sage-5.6.beta3

@jdemeyer jdemeyer closed this as completed Jan 7, 2013
@Etn40ff Etn40ff self-assigned this Jul 3, 2013
@Etn40ff
Copy link
Contributor

Etn40ff commented Jul 3, 2013

comment:43

Attachment: trac_10538_qmu_save.patch.gz

There is a minor issue in qmu_save: it does not work whenever the quiver has 0<m!=n frozen vertices.
Please include the attached patch.

@sagetrac-gmoose05
Copy link
Mannequin

sagetrac-gmoose05 mannequin commented Jul 3, 2013

comment:44

Replying to @Etn40ff:

There is a minor issue in qmu_save: it does not work whenever the quiver has 0<m!=n frozen vertices.
Please include the attached patch.

Hi Salvatore,

Thanks for finding the bug with qmu_save with frozen vertices. Since this ticket has already closed, I suggest opening up a new ticket which is simply the trac_10538_qmu_save.patch.

Since it is small, I can review this quickly and then it should be able to be merged into the latest sage quickly.

See Ticket #14638 for a similar example.

Gregg

@Etn40ff
Copy link
Contributor

Etn40ff commented Jul 4, 2013

comment:45

Hi Gregg,
I just did as you suggested: the new ticket is #14851; you are in cc.
Best
S.

PS: you might be interested in #14844 too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants