-
-
Couldn't load subscription status.
- Fork 680
Closed
Milestone
Description
We implement several missing features of sets, enumerated sets and their cartesian products.
We add methods is_empty and is_finite to all sets.
We implement most of the methods for cartesian products of sets and enumerated sets (cardinality, rank/unrank, iteration).
For example, all commands below were hanging
sage: C = cartesian_product([Permutations(7), Permutations(9)])
sage: C.cardinality()
1828915200
sage: C.unrank(143872745)
([1, 5, 3, 6, 2, 4, 7], [5, 3, 2, 4, 7, 8, 9, 6, 1])
sage: C.rank(_)
143872745
sage: C.random_element() # random
([4, 2, 6, 7, 1, 3, 5], [4, 7, 2, 8, 6, 3, 9, 5, 1])
Component: categories
Keywords: cartesian_product
Author: Vincent Delecroix
Branch: 707bf1e
Reviewer: Nicolas M. Thiéry
Issue created by migration from https://trac.sagemath.org/ticket/18290