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

some details in lrcalc #37600

Merged
merged 1 commit into from
Mar 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions src/sage/libs/lrcalc/lrcalc.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@
import lrcalc


def _lrcalc_dict_to_sage(result):
def _lrcalc_dict_to_sage(result) -> dict:
r"""
Translate from lrcalc output format to Sage expected format.

Expand All @@ -203,7 +203,9 @@ def _lrcalc_dict_to_sage(result):
sage: mult([2,1],[3,2,1],3) # indirect doctest
{[3, 3, 3]: 1, [4, 3, 2]: 2, [4, 4, 1]: 1, [5, 2, 2]: 1, [5, 3, 1]: 1}
"""
return {_Partitions(la): Integer(k) for la, k in result.items()}
return {_Partitions.element_class(_Partitions, [Integer(p) for p in la]):
Integer(k) for la, k in result.items()}


def lrcoef_unsafe(outer, inner1, inner2):
r"""
Expand Down Expand Up @@ -268,7 +270,7 @@ def lrcoef(outer, inner1, inner2):
return lrcoef_unsafe(_Partitions(outer), _Partitions(inner1), _Partitions(inner2))


def mult(part1, part2, maxrows=None, level=None, quantum=None):
def mult(part1, part2, maxrows=None, level=None, quantum=None) -> dict:
r"""
Compute a product of two Schur functions.

Expand Down Expand Up @@ -345,13 +347,13 @@ def mult(part1, part2, maxrows=None, level=None, quantum=None):
result = lrcalc.mult_quantum(part1, part2, maxrows, level, degrees=True)
P = quantum.parent()
output = {}
for i,k in result.items():
for i, k in result.items():
la = _Partitions(i[0])
output[la] = output.get(la, P.zero()) + k * quantum**(i[1])
return output


def skew(outer, inner, maxrows=-1):
def skew(outer, inner, maxrows=-1) -> dict:
"""
Compute the Schur expansion of a skew Schur function.

Expand All @@ -377,7 +379,7 @@ def skew(outer, inner, maxrows=-1):
return _lrcalc_dict_to_sage(lrcalc.skew(outer, inner, maxrows))


def coprod(part, all=0):
def coprod(part, all=0) -> dict:
"""
Compute the coproduct of a Schur function.

Expand All @@ -404,11 +406,13 @@ def coprod(part, all=0):
[(([1, 1], [1]), 1), (([2], [1]), 1), (([2, 1], []), 1)]
"""
result = lrcalc.coprod(part, all)
return {tuple([_Partitions(mu) for mu in la]): Integer(k)
return {tuple([_Partitions.element_class(_Partitions,
[Integer(p) for p in mu])
for mu in la]): Integer(k)
for la, k in result.items()}


def mult_schubert(w1, w2, rank=0):
def mult_schubert(w1, w2, rank=0) -> dict:
r"""
Compute a product of two Schubert polynomials.

Expand Down Expand Up @@ -436,7 +440,7 @@ def mult_schubert(w1, w2, rank=0):
([7, 3, 4, 1, 2, 5, 6], 1), ([7, 4, 2, 1, 3, 5, 6], 1)]
"""
result = lrcalc.schubmult(w1, w2, rank)
return {Permutation(list(la)):Integer(k) for la,k in result.items()}
return {Permutation(list(la)): Integer(k) for la, k in result.items()}


def lrskew(outer, inner, weight=None, maxrows=-1):
Expand Down Expand Up @@ -503,7 +507,7 @@ def lrskew(outer, inner, weight=None, maxrows=-1):
if weight is None:
ST = SemistandardSkewTableaux(shape)
for data in iterator:
yield ST.from_shape_and_word(shape, [i+1 for i in data])
yield ST.from_shape_and_word(shape, [i + 1 for i in data])
else:
wt = _Partitions(weight)
ST = SemistandardSkewTableaux(shape, wt)
Expand All @@ -517,4 +521,4 @@ def lrskew(outer, inner, weight=None, maxrows=-1):
break
w[j] += 1
if w == wt:
yield ST.from_shape_and_word(shape, [i+1 for i in data])
yield ST.from_shape_and_word(shape, [i + 1 for i in data])
Loading