Skip to content

Commit 00c302e

Browse files
author
Release Manager
committed
gh-39469: small improvement in classically_highest_weight_vectors
The change is to avoid insertions and removals at the beginning of a list as these operations require linear time in the length of the list. We instead build the reverse path (append and pop at the end of the list in constant time) and use method `reversed` when needed. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - #12345: short description why this is a dependency --> <!-- - #34567: ... --> URL: #39469 Reported by: David Coudert Reviewer(s): Frédéric Chapoton
2 parents 28a6b51 + 5c35075 commit 00c302e

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

build/pkgs/configure/checksums.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
tarball=configure-VERSION.tar.gz
2-
sha1=86711d4cbef2cd4e7bb4afcde36965e5dea908e0
3-
sha256=9793cf92ebdceb09050a585294de93c242c033745a0012cae1bd301d307a45df
2+
sha1=2a6cd0b57346c92a73fc14246672abd6f150b423
3+
sha256=a732b3abcdf5f63995c63b765af00bfeed8efb67f1f451caac3ae2f48a105ad4
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
efc0914cd8d72a9bdfdcca4511b55e290b9b6674
1+
3735a1f77361171f19919b1651e14a56332c41ba

src/sage/categories/loop_crystals.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -773,16 +773,17 @@ def classically_highest_weight_vectors(self):
773773
except StopIteration:
774774
it.pop()
775775
if path:
776-
path.pop(0)
776+
path.pop()
777777
continue
778778

779-
b = self.element_class(self, [x] + path)
779+
path.append(x)
780+
b = self.element_class(self, reversed(path))
780781
if not b.is_highest_weight(index_set=I0):
782+
path.pop()
781783
continue
782-
path.insert(0, x)
783784
if len(path) == n:
784785
ret.append(b)
785-
path.pop(0)
786+
path.pop()
786787
else:
787788
it.append(iter(self.crystals[-len(path) - 1]))
788789
return tuple(ret)

0 commit comments

Comments
 (0)