Re: [sage-combinat-devel] alcove path crystal code
On Sat, May 15, 2010 at 08:58:35AM -0700, Brant Jones wrote: There is already a method CartanType.symmetrizer() which returns the entries of the D matrix, and there is also a test in AmbientSpace._test_norm_of_simple_roots() that ensures the root norms in AmbientSpace are scalar multiples of the D entries. Oops, I actually probably implemented that one :-) Since D is defined only up to scalar. The one returned by symmetrizer is guaranteed to be unique (see the doc). It seems somewhat clearer to me to use the AmbientSpace to compute the root norm. This assumes that you have an ambient space available. Which is not the case currently for affine types. Whereas symmetrizer will work for any symmetrizable Kac-Moody. I'm not sure how to create a diagonal module morphism, but I'd be willing to try. Which class contains the documentation you suggested, and are there any existing examples I could look at? sage: F = CombinatorialFreeModule(QQ, ZZ) sage: F.module_morphism? Otherwise, I'd like to add the root_norm and associated_coroot methods to RootLatticeRealization. Ok. Cheers, Nicolas -- Nicolas M. Thiéry Isil nthi...@users.sf.net http://Nicolas.Thiery.name/ -- You received this message because you are subscribed to the Google Groups sage-combinat-devel group. To post to this group, send email to sage-combinat-de...@googlegroups.com. To unsubscribe from this group, send email to sage-combinat-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sage-combinat-devel?hl=en.
Re: [sage-combinat-devel] alcove path crystal code
Hi Brant! Good to hear from you :-) On Thu, May 13, 2010 at 05:56:38PM -0700, Brant Jones wrote: Anne and I are working on merging some code that implements the Lenart--Postnikov alcove path model into sage. The algorithm needed a few features that aren't available in the root_system package, so I implemented (very basic) versions of what I needed in a temporary file called crystals/alcove_path_util.py. I'd like to get some advice on whether my implementations can be merged into the root_system code. They definitely should :-) We need them elsewhere. Essentially, I need the associated_coroot() method (that returns the element of the coroot_space corresponding to a given element of the root_space) in the root_lattice_realization.py to be implemented. My implementation (currently residing in alcove_path_util.py) is: def root_norm(R, root): V = R.ambient_space() alpha = V.simple_roots() v = alpha[Integer(1)] - alpha[Integer(1)] for i in (ellipsis_range(Integer(0),Ellipsis,len(root.monomials())- Integer(1))): simple_root = root.monomials()[i] coeff = root.coefficients()[i] for j in R.index_set(): if simple_root == R.root_space().simple_root(j): v = v + coeff*alpha[j] return v.scalar(v) # Return an element of coroot_space that is the coroot of the given root. def coroot(R, root): rcoroot = R.coroot_space().simple_root(Integer(1)) - R.coroot_space().simple_root(Integer(1)) for i in (ellipsis_range(Integer(0),Ellipsis,len(root.monomials())- Integer(1))): simple_root = root.monomials()[i] coeff = root.coefficients()[i] for j in R.index_set(): if simple_root == R.root_space().simple_root(j): rcoroot = rcoroot + coeff*(Integer(1)/Integer(2))*(root_norm(R, R.root_space().simple_root(j)))*R.coroot_space().simple_root(j) return (Integer(2)/root_norm(R, root))*rcoroot (I wrote this code over 6 months ago when the root_system code was still being developed, so you may have more efficient ways to accomplish this, and I welcome your feedback.) Would anyone mind if I make a patch to move this code into root_lattice_realization.py (using the appropriate method names, of course)? +1 What the code is doing in the ambient space is to find the appropriate scaling factors between a simple root and the corresponding simple coroot, right? A type free implementation could be to look at the Cartan matrix M (which is symmetrizable), and compute the appropriate diagonal matrix making D^-1 M D symmetric. Then, a nice implementation (which is partly how it was done in MuPAD, and how I would like to eventually see it in Sage) would be to: - Add a method in DynkinDiagram (possibly with a link from CartanType) returning D (as a family i - D[i]). Question: What would be a good name for this method? Todo: check how this relates to the a/acheck c/check coefficients. - Implement a diagonal module morphism from the root lattice to the coroot lattice, using D (this morphism is usually denoted by mu/nu if I remember well). It could be made available under: L.to_coroot_lattice_morphism() or some better name. See also the documentation of module_morphism. - Implement the method associated_coroot in the root lattice by applying the morphism, and dividing by the scalar product with the root as you did above. Do you feel like implementing some or all of the above? Except possibly for finding D, this should be just a few lines of code. There might be a bit of fiddling with integer w.r.t. rational coefficients though, unless you work in the root space. Once I do this, I think that the existing reflection() method in root_lattice_realization.py should be able to replace my method root_space_reflection() in alcove_path_util.py, and I will be able to get rid of the alcove_path_util.py file entirely. Perfect. Have a nice week-end, Nicolas -- Nicolas M. Thiéry Isil nthi...@users.sf.net http://Nicolas.Thiery.name/ -- You received this message because you are subscribed to the Google Groups sage-combinat-devel group. To post to this group, send email to sage-combinat-de...@googlegroups.com. To unsubscribe from this group, send email to sage-combinat-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sage-combinat-devel?hl=en.
[sage-combinat-devel] alcove path crystal code
Hello all- Anne and I are working on merging some code that implements the Lenart--Postnikov alcove path model into sage. The algorithm needed a few features that aren't available in the root_system package, so I implemented (very basic) versions of what I needed in a temporary file called crystals/alcove_path_util.py. I'd like to get some advice on whether my implementations can be merged into the root_system code. Essentially, I need the associated_coroot() method (that returns the element of the coroot_space corresponding to a given element of the root_space) in the root_lattice_realization.py to be implemented. My implementation (currently residing in alcove_path_util.py) is: def root_norm(R, root): V = R.ambient_space() alpha = V.simple_roots() v = alpha[Integer(1)] - alpha[Integer(1)] for i in (ellipsis_range(Integer(0),Ellipsis,len(root.monomials())- Integer(1))): simple_root = root.monomials()[i] coeff = root.coefficients()[i] for j in R.index_set(): if simple_root == R.root_space().simple_root(j): v = v + coeff*alpha[j] return v.scalar(v) # Return an element of coroot_space that is the coroot of the given root. def coroot(R, root): rcoroot = R.coroot_space().simple_root(Integer(1)) - R.coroot_space().simple_root(Integer(1)) for i in (ellipsis_range(Integer(0),Ellipsis,len(root.monomials())- Integer(1))): simple_root = root.monomials()[i] coeff = root.coefficients()[i] for j in R.index_set(): if simple_root == R.root_space().simple_root(j): rcoroot = rcoroot + coeff*(Integer(1)/Integer(2))*(root_norm(R, R.root_space().simple_root(j)))*R.coroot_space().simple_root(j) return (Integer(2)/root_norm(R, root))*rcoroot (I wrote this code over 6 months ago when the root_system code was still being developed, so you may have more efficient ways to accomplish this, and I welcome your feedback.) Would anyone mind if I make a patch to move this code into root_lattice_realization.py (using the appropriate method names, of course)? Once I do this, I think that the existing reflection() method in root_lattice_realization.py should be able to replace my method root_space_reflection() in alcove_path_util.py, and I will be able to get rid of the alcove_path_util.py file entirely. Thanks very much for your help. Regards, Brant -- You received this message because you are subscribed to the Google Groups sage-combinat-devel group. To post to this group, send email to sage-combinat-de...@googlegroups.com. To unsubscribe from this group, send email to sage-combinat-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sage-combinat-devel?hl=en.