#15463: Implement crystal morphisms, subcrystals, and virtual crystals
-------------------------------------+-------------------------------------
       Reporter:  tscrim             |        Owner:  sage-combinat
           Type:  enhancement        |       Status:  needs_review
       Priority:  major              |    Milestone:  sage-6.2
      Component:  combinatorics      |   Resolution:
       Keywords:  crystals,          |    Merged in:
  morphisms, subcrystals             |    Reviewers:
        Authors:  Travis Scrimshaw   |  Work issues:
Report Upstream:  N/A                |       Commit:
         Branch:                     |  5ee50cd5c9b2d8f6aa2d0fbced80c154f1884f25
  public/combinat/crystals/crystal_morphisms|     Stopgaps:
   Dependencies:  #15462             |
-------------------------------------+-------------------------------------

Comment (by tscrim):

 Okay, so I've changed KR crystals to return honest crystal morphisms and
 made `DirectSumOfCrystals` into a proper facade parent (when requested).
 I've also changed `morphism()` to `crystal_morphism()` and moved the old
 function to `kirillov_reshetikhin.py` in case we want to revive it. I also
 added references to `virtual_crystal.py` and had `Subcrystal` redirect to
 `VirtualCrystal` depending on parameters so we could have in the future a
 more uniform interface with the `subcrystal()` method.

 Here's some timing tests for KR crystals.

 The test I ran:
 {{{#!python
 def test_KR(ct, r, s):
     print "construction:"
     %time B = KirillovReshetikhinCrystal(ct, r, s)
     print "TestSuite:"
     %time TestSuite(B).run()
     print "Digraph:"
     %time G = B.digraph()
 }}}

 With the branch:
 {{{
 sage: test_KR(['A',4,1], 3, 2)
 construction:
 CPU times: user 0.01 s, sys: 0.00 s, total: 0.01 s
 Wall time: 0.04 s
 TestSuite:
 CPU times: user 2.61 s, sys: 0.09 s, total: 2.70 s
 Wall time: 3.21 s
 Digraph:
 CPU times: user 0.23 s, sys: 0.01 s, total: 0.24 s
 Wall time: 0.26 s

 sage: test_KR(['D',4,1], 2, 1)
 construction:
 CPU times: user 0.01 s, sys: 0.00 s, total: 0.01 s
 Wall time: 0.01 s
 TestSuite:
 CPU times: user 2.07 s, sys: 0.00 s, total: 2.08 s
 Wall time: 2.33 s
 Digraph:
 CPU times: user 0.23 s, sys: 0.01 s, total: 0.24 s
 Wall time: 0.27 s

 sage: test_KR(['E',6,1], 1, 1)
 construction:
 CPU times: user 0.19 s, sys: 0.00 s, total: 0.19 s
 Wall time: 0.31 s
 TestSuite:
 CPU times: user 0.57 s, sys: 0.00 s, total: 0.57 s
 Wall time: 0.70 s
 Digraph:
 CPU times: user 0.12 s, sys: 0.02 s, total: 0.14 s
 Wall time: 0.16 s

 sage: test_KR(['A',6,2], 2, 1)
 construction:
 CPU times: user 0.01 s, sys: 0.00 s, total: 0.01 s
 Wall time: 0.02 s
 TestSuite:
 CPU times: user 2.23 s, sys: 0.01 s, total: 2.24 s
 Wall time: 2.71 s
 Digraph:
 CPU times: user 0.24 s, sys: 0.00 s, total: 0.24 s
 Wall time: 0.27 s

 sage: test_KR(['D',4,2], 2, 1)
 construction:
 CPU times: user 0.01 s, sys: 0.00 s, total: 0.01 s
 Wall time: 0.01 s
 TestSuite:
 CPU times: user 2.91 s, sys: 0.02 s, total: 2.92 s
 Wall time: 3.36 s
 Digraph:
 CPU times: user 0.27 s, sys: 0.01 s, total: 0.28 s
 Wall time: 0.38 s

 sage: K = KirillovReshetikhinCrystal(['D',4,1], 2,2)
 sage: %time TestSuite(K).run()
 CPU times: user 58.50 s, sys: 0.10 s, total: 58.60 s
 Wall time: 70.46 s
 }}}
 Develop:
 {{{
 sage: test_KR(['A',4,1], 3, 2)
 construction:
 CPU times: user 0.04 s, sys: 0.00 s, total: 0.04 s
 Wall time: 0.18 s
 TestSuite:
 CPU times: user 2.59 s, sys: 0.06 s, total: 2.65 s
 Wall time: 3.97 s
 Digraph:
 CPU times: user 0.23 s, sys: 0.01 s, total: 0.24 s
 Wall time: 0.33 s

 sage: test_KR(['D',4,1], 2, 1)
 construction:
 CPU times: user 0.01 s, sys: 0.00 s, total: 0.02 s
 Wall time: 0.07 s
 TestSuite:
 CPU times: user 0.52 s, sys: 0.02 s, total: 0.54 s
 Wall time: 0.75 s
 Digraph:
 CPU times: user 0.10 s, sys: 0.00 s, total: 0.10 s
 Wall time: 0.12 s

 sage: test_KR(['E',6,1], 1, 1)
 construction:
 CPU times: user 0.01 s, sys: 0.00 s, total: 0.02 s
 Wall time: 0.07 s
 TestSuite:
 CPU times: user 0.45 s, sys: 0.00 s, total: 0.45 s
 Wall time: 0.58 s
 Digraph:
 CPU times: user 0.10 s, sys: 0.01 s, total: 0.11 s
 Wall time: 0.12 s

 sage: test_KR(['A',6,2], 2, 1)
 construction:
 CPU times: user 0.01 s, sys: 0.00 s, total: 0.01 s
 Wall time: 0.09 s
 TestSuite:
 CPU times: user 0.64 s, sys: 0.02 s, total: 0.65 s
 Wall time: 0.86 s
 Digraph:
 CPU times: user 0.21 s, sys: 0.00 s, total: 0.21 s
 Wall time: 0.28 s

 sage: test_KR(['D',4,2], 2, 1)
 construction:
 CPU times: user 0.00 s, sys: 0.00 s, total: 0.01 s
 Wall time: 0.01 s
 TestSuite:
 CPU times: user 0.38 s, sys: 0.01 s, total: 0.39 s
 Wall time: 0.50 s
 Digraph:
 CPU times: user 0.12 s, sys: 0.01 s, total: 0.13 s
 Wall time: 0.28 s

 sage: K = KirillovReshetikhinCrystal(['D',4,1], 2,2)
 sage: %time TestSuite(K).run()
 CPU times: user 5.30 s, sys: 0.02 s, total: 5.32 s
 Wall time: 6.30 s
 }}}

 So there's a major speed penality with using promotion as a crystal
 morphism directly. My guess is caused from the fact we are no longer
 caching things. On develop we have:
 {{{
 sage: K = KirillovReshetikhinCrystal(['D',4,1], 2,2)
 sage: K.promotion()
 Cached version of <function morphism at 0xc77133c>
 }}}
 So I have a the following questions:

 1 - The code and the documentation for the old `crystal_morphism()` did
 not match as the default was to not cache (i.e. `cache = False` but the
 code did return a cached function when the `cache` argument was `False`.
 Do we want to cache the output of the promotion (or something else that's
 related)?

 2 - Do we want to use honest crystal morphisms or use the old function
 returned from the old `crystal_morphism()`?

 3 - Do we want to have an option to cache the output of a crystal
 morphism, or morphisms in general?

--
Ticket URL: <http://trac.sagemath.org/ticket/15463#comment:10>
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to