#18290: enhanced sets and cartesian products
-------------------------------------+-------------------------------------
Reporter: vdelecroix | Owner:
Type: enhancement | Status: needs_work
Priority: major | Milestone: sage-6.7
Component: categories | Resolution:
Keywords: cartesian_product | Merged in:
Authors: Vincent Delecroix | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/vdelecroix/18290 | 0de55d3765648006a85599140bfba83d175be8f2
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Description changed by vdelecroix:
Old description:
> We implement two missing methods in
> `sage.sets.cartesian_product.CartesianProduct`: `is_finite`
> and `cardinality`.
>
> For example, the following was hanging
> {{{
> sage: F = Permutations(10)
> sage: cartesian_product([ZZ, Set(), ZZ]).is_finite()
> True
> sage: cartesian_product([F, F]).is_finite()
> True
> sage: cartesian_product([F, F]).cardinality()
> 13168189440000
> }}}
New 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])
}}}
--
--
Ticket URL: <http://trac.sagemath.org/ticket/18290#comment:10>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.