Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ FEATURE:
- `symmetria.Permutation`: add `lexicographic_rank` method
- `symmetria.CycleDecomposition`: add `lexicographic_rank` method

FIX:
- `symmetria.Permutation`: fix small typos in class methods

## \[0.3.0\] - 2024-07-15

FEATURE:
Expand Down
6 changes: 3 additions & 3 deletions symmetria/elements/permutation.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ def from_cycle(cls, cycle: "Cycle") -> "Permutation":
image.append(cycle[(idx + 1) % cycle_length])
else:
image.append(element)
return Permutation(*image)
return cls(*image)

@classmethod
def from_cycle_decomposition(cls, cycle_decomposition: "CycleDecomposition") -> "Permutation":
Expand All @@ -660,7 +660,7 @@ def from_cycle_decomposition(cls, cycle_decomposition: "CycleDecomposition") ->
>>> Permutation.from_cycle_decomposition(CycleDecomposition(Cycle(4, 3), Cycle(1, 2)))
Permutation(2, 1, 4, 3)
"""
return Permutation.from_dict(p=cycle_decomposition.map)
return cls.from_dict(p=cycle_decomposition.map)

@classmethod
def from_dict(cls, p: Dict[int, int]) -> "Permutation":
Expand All @@ -681,7 +681,7 @@ def from_dict(cls, p: Dict[int, int]) -> "Permutation":
>>> Permutation.from_dict({1: 5, 2: 3, 3: 1, 4: 2, 5:4})
Permutation(5, 3, 1, 2, 4)
"""
return Permutation(*[p[idx] for idx in range(1, len(p) + 1)])
return cls(*[p[idx] for idx in range(1, len(p) + 1)])

@property
def image(self) -> Tuple[int]:
Expand Down
Loading