TRIM_PERM/TrimPerm is used when a permutation's internal representation contains values bigger than it's LargestMovedPoint -- alll such values must map to themselves. In this case we can save memory by shrinking the permutation by removing all such values.
TRIM_PERM requires as an input a size to trim the permutation to. This has two problems:
- If this is smaller than the LargestMovedPoint, horrible things happen.
- If this is larger than the LargestMovedPoint, memory is wasted.
A simple method would be to just calculate the LargestMovedPoint, and trim to that. This would make a method which was easier to use, and couldn't be used to corrupt memory (except in HPC-GAP, which is a different problem).
I suggest we introduce such a method (I can't think of a good name.. SquashPerm? ShrinkPerm?), and port all uses of TrimPerm over to it.
We could in principle make a general method (ShrinkAllocation?) and implement it for all types (Perm, Trans, Plists, records,...) which would try to free any unused memory. This method already exists for plists and strings, and is called ShrinkAllocationPlist and ShrinkAllocationString.
TRIM_PERM/TrimPerm is used when a permutation's internal representation contains values bigger than it's LargestMovedPoint -- alll such values must map to themselves. In this case we can save memory by shrinking the permutation by removing all such values.
TRIM_PERM requires as an input a size to trim the permutation to. This has two problems:
A simple method would be to just calculate the LargestMovedPoint, and trim to that. This would make a method which was easier to use, and couldn't be used to corrupt memory (except in HPC-GAP, which is a different problem).
I suggest we introduce such a method (I can't think of a good name.. SquashPerm? ShrinkPerm?), and port all uses of TrimPerm over to it.
We could in principle make a general method (ShrinkAllocation?) and implement it for all types (Perm, Trans, Plists, records,...) which would try to free any unused memory. This method already exists for plists and strings, and is called ShrinkAllocationPlist and ShrinkAllocationString.