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

Implement non commutative symmetric functions #8899

Closed
nthiery opened this issue May 5, 2010 · 74 comments
Closed

Implement non commutative symmetric functions #8899

nthiery opened this issue May 5, 2010 · 74 comments

Comments

@nthiery
Copy link
Contributor

nthiery commented May 5, 2010

This patch includes quasi symmetric functions as well (see #11929).

Each algebra is implemented as a Hopf algebra with realizations (the realizations being the various bases of the algebras).

  • Bases implemented for NCSF, and change of bases between them:

    • Complete
    • Ribbon
    • Elementary
    • Psi (power sums)
    • Phi (power sums)
  • Bases implemented for QSym, and change of bases between them:

    • Monomial
    • Fundamental

There is also a method a_realization that returns a particular realization of the algebra. Computations that are not yet implemented in basis are performed by converting to a_realization(). Current implementation:

  • NCSF.a_realization() returns the Complete basis
  • QSym.a_realization() returns the Monomial basis

Dependencies:

Apply:

Depends on #12953
Depends on #12956
Depends on #12959
Depends on #13238
Depends on #13243
Depends on #5457

CC: @sagetrac-sage-combinat @sagetrac-chrisjamesberg @zabrocki @anneschilling

Component: combinatorics

Keywords: sd40, days38

Author: Jason Bandlow, Chris Berg, Franco Saliola, Nicolas M. Thiéry

Reviewer: Mike Zabrocki, Franco Saliola, Mike Hansen

Merged: sage-5.4.beta1

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

@nthiery
Copy link
Contributor Author

nthiery commented May 17, 2012

Dependencies: #12953, #12956

@nthiery

This comment has been minimized.

@saliola
Copy link

saliola commented Jul 15, 2012

Changed author from Nicolas M. Thiéry, ... to Jason Bandlow, Chris Berg, Franco Saliola, Nicolas M. Thiéry

@saliola
Copy link

saliola commented Jul 15, 2012

comment:4

Apply: trac_11929_8899-ncsf-qsym-folded-fs.patch, trac_11929_8899-additional_documentation-fs.patch

(for the patchbot)

@saliola
Copy link

saliola commented Jul 15, 2012

Changed keywords from none to sd40

@saliola
Copy link

saliola commented Jul 15, 2012

Changed dependencies from #12953, #12956 to #12953, #12956, #12959, #13238, #13243

@saliola

This comment has been minimized.

@saliola
Copy link

saliola commented Jul 15, 2012

comment:6

A note on the patch coproduct_with_realizations-fs.patch: an earlier version of this patch was folded into the patch at #5457. So this patch is not needed if that ticket gets merged before this ticket. (I've included it here so that the patchbot can run all doctests.)

If this ticket gets merged before #5457, then an easy rebase of #5457 will be required.

@saliola
Copy link

saliola commented Jul 15, 2012

comment:7

I put the author names in alphabetical order. I don't know the policy on this. I hope this is okay.

@saliola
Copy link

saliola commented Jul 15, 2012

comment:8

(I think I learned something new about the patchbot: it ignores the order of the patches specified in the Apply directive and applies the patches in the order in which they get attached/updated.)

@anneschilling
Copy link

comment:10

I think you guys need to add an entry in

doc/en/reference/combinat

so that NSym and QSym are included in the documentation!

Also, I spotted an OUTPUT without the : behind it. Aren't we supposed to use

INPUT:

  • x -- explanation

i.e. a double dash after the variable to be explained?

Anne

@saliola
Copy link

saliola commented Jul 20, 2012

Work Issues: include new files in documentation ; clean up ReST markup

@saliola
Copy link

saliola commented Jul 20, 2012

comment:11

Thanks for catching these, Anne. We'll have to correct them.

@saliola
Copy link

saliola commented Jul 28, 2012

Attachment: trac_11929_8899-ncsf-qsym-fs.patch.gz

@saliola
Copy link

saliola commented Jul 28, 2012

comment:12

I rebased attachment: trac_11929_8899-ncsf-qsym-fs.patch on #12959.

Chris, can you fix the documentation as explained by Anne:

  1. Add an entry in

     `doc/en/reference/combinat`
    

so that NSym and QSym are included in the documentation!

  1. Also, I spotted an OUTPUT without the : behind it.

  2. Proper syntax for INPUT blocks:

      ```
      INPUT:
    
      - ``x`` -- explanation
     ```
    

i.e. a double dash after the variable to be explained [and a space after the initial dash]

@saliola
Copy link

saliola commented Aug 13, 2012

comment:13

Attachment: trac_11929_8899-fix_skewby-fs.patch.gz

Two new small patches.

  1. trac_11929_8899-fix_skewby-fs.patch: Fixes things so that the following raises an error:
F([2,1]).skew_by([1])
  1. trac_11929_8899-add_degree_to_elementmethods-fs.patch: addes ElementMethods.degree and ElementMethods.is_homogeneous to GradedAlgebrasWithBasis (I extracted these from a separate patch on the sage-combinat queue).

Outstanding question about the degree of an element: what do we want as the default behaviour? Should it:
a. raise an error if the element is not homogeneous; or
b. return the maximum of the degrees of the homogeneous summands?

@saliola
Copy link

saliola commented Aug 14, 2012

@saliola
Copy link

saliola commented Aug 14, 2012

comment:14

Replying to @saliola:

Two new small patches.

  1. trac_11929_8899-fix_skewby-fs.patch: Fixes things so that the following raises an error:
F([2,1]).skew_by([1])
  1. trac_11929_8899-add_degree_to_elementmethods-fs.patch: addes ElementMethods.degree and ElementMethods.is_homogeneous to GradedAlgebrasWithBasis (I extracted these from a separate patch on the sage-combinat queue).

Outstanding question about the degree of an element: what do we want as the default behaviour? Should it:
a. raise an error if the element is not homogeneous; or
b. return the maximum of the degrees of the homogeneous summands?

Based on the discussion on sage-combinat-devel, I updated attachment: trac_11929_8899-add_degree_to_elementmethods-fs.patch:

  • add methods maximal_degree and homogeneous_degree in GradedAlgebrasWithBasis
  • as a default in GradedAlgebrasWithBasis, set degree = homogeneous_degree
  • for NCSF/QSym, degree is redefined to be maximal_degree

@nthiery
Copy link
Contributor Author

nthiery commented Sep 2, 2012

comment:43

I checked the patch, and am ok with it. Thanks Franco!

Assuming that all tests pass (the failures currently reported by the patchbot seem unrelated), you can set it back to positive review on my behalf!

Cheers,
Nicolas

@zabrocki
Copy link
Mannequin

zabrocki mannequin commented Sep 2, 2012

comment:44

All tests pass on sage-5.3.rc0 so I will give it a positive review.
Since #5457 got de-merged from 5.3 and so you might need the patch coproduct_with_realizations-fs.patch if they are applied in the wrong order. Should there be a dependency on #5457?

@anneschilling
Copy link

Changed dependencies from #12953, #12956, #12959, #13238, #13243 to #12953, #12956, #12959, #13238, #13243, #5457

@jdemeyer
Copy link

jdemeyer commented Sep 5, 2012

Merged: sage-5.4.beta1

@jdemeyer
Copy link

jdemeyer commented Sep 7, 2012

comment:47

With the new version, but I'm seeing failures which didn't happen with earlier versions:

sage -t  -force_lib devel/sage/sage/combinat/ncsf_qsym/ncsf.py
**********************************************************************
File "/release/merger/sage-5.4.beta1/devel/sage-main/sage/combinat/ncsf_qsym/ncsf.py", line 493:
    sage: R.to_symmetric_function
Expected:
    Generic morphism:
      From: Non-Commutative Symmetric Functions over the Rational Field in the Ribbon basis
      To:   Symmetric Function Algebra over Rational Field, Schur symmetric functions as basis
Got:
    Generic morphism:
      From: Non-Commutative Symmetric Functions over the Rational Field in the Ribbon basis
      To:   Symmetric Functions over Rational Field in the Schur basis
**********************************************************************

@jdemeyer
Copy link

jdemeyer commented Sep 7, 2012

Changed merged from sage-5.4.beta1 to none

@jdemeyer jdemeyer reopened this Sep 7, 2012
@saliola
Copy link

saliola commented Sep 7, 2012

comment:48

I double-checked, and the phrase "in the Schur basis" does not appear in the patches on this ticket.

I know that #13404 claims not to have been merged yet, but did you happen to merge it in sage-5.4.beta1? I think that ticket would have caused this change in the _repr_.

@anneschilling
Copy link

comment:49

Replying to @saliola:

I double-checked, and the phrase "in the Schur basis" does not appear in the patches on this ticket.

I know that #13404 claims not to have been merged yet, but did you happen to merge it in sage-5.4.beta1? I think that ticket would have caused this change in the _repr_.

Franco is right. I will fix this in 13404 and put a dependency on 8899 there.

Best,

Anne

@jdemeyer
Copy link

jdemeyer commented Sep 8, 2012

comment:50

Replying to @saliola:

I double-checked, and the phrase "in the Schur basis" does not appear in the patches on this ticket.

I know that #13404 claims not to have been merged yet, but did you happen to merge it in sage-5.4.beta1? I think that ticket would have caused this change in the _repr_.

I always test a bunch of tickets together, and in this case I included indeed #13404. So I will remove #13404 for now.

@jdemeyer
Copy link

jdemeyer commented Sep 8, 2012

Merged: sage-5.4.beta1

@jdemeyer jdemeyer closed this as completed Sep 8, 2012
@jdemeyer
Copy link

comment:51

This patch abuses assert and AssertionError. assert should not be used for control flow. An assert checks something which should always be true, a failed assertion is always a bug in the program.

For example:

                sage: R = NonCommutativeSymmetricFunctions(QQ).R()
                sage: R.skew([2,1], [1])
                Traceback (most recent call last):
                ...
                AssertionError: x must be an element of Non-Commutative Symmetric Functions over the Rational Field

This is a simple user mistake, for which assert is not right.

I think this must be fixed.

@nthiery
Copy link
Contributor Author

nthiery commented Sep 24, 2012

comment:52

Replying to @jdemeyer:

This patch abuses assert and AssertionError. assert should not be used for control flow. An assert checks something which should always be true, a failed assertion is always a bug in the program.

For example:

                sage: R = NonCommutativeSymmetricFunctions(QQ).R()
                sage: R.skew([2,1], [1])
                Traceback (most recent call last):
                ...
                AssertionError: x must be an element of Non-Commutative Symmetric Functions over the Rational Field

This is a simple user mistake, for which assert is not right.

I think this must be fixed.

I guess that's ok after all. See the same comment on #5457.

@jdemeyer
Copy link

comment:53

This is a better example from this patch on how not to use assert:

            try:
                assert self.is_homogeneous()
                return self.parent().degree_on_basis(self.leading_support())
            except AssertionError:
                raise ValueError("Element is not homogeneous.")

And this is an easily made mistake, it should give a TypeError:

def from_polynomial(self, f, check=True):
    ...
    assert self.base_ring() == f.base_ring()

You could even do:

if check and self.base_ring() != f.base_ring():
    raise TypeError(...)

@nthiery
Copy link
Contributor Author

nthiery commented Oct 2, 2012

Changed keywords from sd40 to sd40, days38

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