#14089: Speed improvements in affine crystals and fix of optional doctest 
failure
---------------------------------+------------------------------------------
   Reporter:  aschilling         |             Owner:  sage-combinat 
       Type:  defect             |            Status:  new           
   Priority:  major              |         Milestone:  sage-5.8      
  Component:  combinatorics      |          Keywords:  crystals      
Work issues:                     |   Report Upstream:  N/A           
  Reviewers:  Nicolas M. Thiery  |           Authors:  Anne Schilling
  Merged in:                     |      Dependencies:  #14052        
   Stopgaps:                     |  
---------------------------------+------------------------------------------
 This patch caches all methods in KirillovReshetikhin crystals that compute
 crystal morphisms. This yields a significant speed-up of all methods
 involving the affine crystal operators.

 With the patch applied:
 {{{
 sage: K = KirillovReshetikhinCrystal(['C',3,1],1,1)
 sage: L = KirillovReshetikhinCrystal(['C',3,1],2,2)
 sage: %timeit f = K.R_matrix(L)
 5 loops, best of 3: 3.86 s per loop
 }}}
 Without the patch applied:
 {{{
 Loading Sage library. Current Mercurial branch is: combinat
 sage: K = KirillovReshetikhinCrystal(['C',3,1],1,1)
 sage: sage: L = KirillovReshetikhinCrystal(['C',3,1],2,2)
 sage: sage: %timeit f = K.R_matrix(L)
 5 loops, best of 3: 96.2 s per loop
 }}}

 It also fixes a doctest failure in /category/crystals.py
 {{{
 sage -t --optional crystals.py
 sage -t --optional "devel/sage-combinat/sage/categories/crystals.py"
 **********************************************************************
 File "/Applications/sage-5.6/devel/sage-
 combinat/sage/categories/crystals.py", line 603:
     sage: T._latex_()   #optional - dot2tex
 Expected nothing
 Got:
     '\n\\begin{tikzpicture}[>=latex,line join=bevel,]\n%%\n\\node (1) at
 (8bp,162bp) [draw,draw=none]
 
{${\\def\\lr#1{\\multicolumn{1}{|@{\\hspace{.6ex}}c@{\\hspace{.6ex}}|}{\\raisebox{-.3ex}{$#1$}}}\\raisebox{-.6ex}{$\\begin{array}[b]{c}\\cline{1-1}\\lr{1}\\\\\\cline{1-1}\\end{array}$}}$};\n
 \\node (3) at (8bp,10bp) [draw,draw=none]
 
{${\\def\\lr#1{\\multicolumn{1}{|@{\\hspace{.6ex}}c@{\\hspace{.6ex}}|}{\\raisebox{-.3ex}{$#1$}}}\\raisebox{-.6ex}{$\\begin{array}[b]{c}\\cline{1-1}\\lr{3}\\\\\\cline{1-1}\\end{array}$}}$};\n
 \\node (2) at (8bp,86bp) [draw,draw=none]
 
{${\\def\\lr#1{\\multicolumn{1}{|@{\\hspace{.6ex}}c@{\\hspace{.6ex}}|}{\\raisebox{-.3ex}{$#1$}}}\\raisebox{-.6ex}{$\\begin{array}[b]{c}\\cline{1-1}\\lr{2}\\\\\\cline{1-1}\\end{array}$}}$};\n
 \\draw [blue,->] (1) ..controls (8bp,140.79bp) and (8bp,121.03bp)  ..
 (2);\n  \\definecolor{strokecol}{rgb}{0.0,0.0,0.0};\n
 \\pgfsetstrokecolor{strokecol}\n  \\draw (17bp,124bp) node {$1$};\n
 \\draw [red,->] (2) ..controls (8bp,64.789bp) and (8bp,45.027bp)  ..
 (3);\n  \\draw (17bp,48bp) node {$2$};\n%\n\\end{tikzpicture}\n'
 **********************************************************************
 File "/Applications/sage-5.6/devel/sage-
 combinat/sage/categories/crystals.py", line 610:
     sage: T._latex_(color_by_label = {0:"black", 1:"red", 2:"blue"})
 #optional - dot2tex graphviz
 Expected nothing
 Got:
     '\n\\begin{tikzpicture}[>=latex,line join=bevel,]\n%%\n\\node (1) at
 (8bp,162bp) [draw,draw=none]
 
{${\\def\\lr#1{\\multicolumn{1}{|@{\\hspace{.6ex}}c@{\\hspace{.6ex}}|}{\\raisebox{-.3ex}{$#1$}}}\\raisebox{-.6ex}{$\\begin{array}[b]{c}\\cline{1-1}\\lr{1}\\\\\\cline{1-1}\\end{array}$}}$};\n
 \\node (3) at (8bp,10bp) [draw,draw=none]
 
{${\\def\\lr#1{\\multicolumn{1}{|@{\\hspace{.6ex}}c@{\\hspace{.6ex}}|}{\\raisebox{-.3ex}{$#1$}}}\\raisebox{-.6ex}{$\\begin{array}[b]{c}\\cline{1-1}\\lr{3}\\\\\\cline{1-1}\\end{array}$}}$};\n
 \\node (2) at (8bp,86bp) [draw,draw=none]
 
{${\\def\\lr#1{\\multicolumn{1}{|@{\\hspace{.6ex}}c@{\\hspace{.6ex}}|}{\\raisebox{-.3ex}{$#1$}}}\\raisebox{-.6ex}{$\\begin{array}[b]{c}\\cline{1-1}\\lr{2}\\\\\\cline{1-1}\\end{array}$}}$};\n
 \\draw [red,->] (1) ..controls (8bp,140.79bp) and (8bp,121.03bp)  ..
 (2);\n  \\definecolor{strokecol}{rgb}{0.0,0.0,0.0};\n
 \\pgfsetstrokecolor{strokecol}\n  \\draw (17bp,124bp) node {$1$};\n
 \\draw [blue,->] (2) ..controls (8bp,64.789bp) and (8bp,45.027bp)  ..
 (3);\n  \\draw (17bp,48bp) node {$2$};\n%\n\\end{tikzpicture}\n'
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/14089>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to