Skip to content

get rid of CartesianProduct #18411

@videlec

Description

@videlec

The features of sage.combinat.cartesian_product.CartesianProduct are now completely integrated into the category framework (see #18290). We remove all occurrences of CartesianProduct to either cartesian_product or itertools.product. We deprecate the CartesianProduct from sage.combinat.cartesian_product.

In order to support all features of the old class we also:

  • move the __iter__ from EnumeratedSets.CartesianProducts.ParentMethods to Sets.CartesianProducts.ParentMethods
  • allows cartesian_product to be called with list, tuple, set, frozenset
  • make cartesian_product([]) works
  • introduce a function some_tuples in sage.misc.misc that is intensively used in the testing framework (and incidentally speed up some doc test)
  • refine the category of Set([1,2,3]) to be finite
  • implement a (very naive) random_element for Set([1,2,3])
  • implement a (naive) hash for EnumeratedSetFromIterator

see also : #15425, #19195
one that can be closed as duplicate: #14224, #19192

Depends on #17411

CC: @nthiery @nathanncohen

Component: combinatorics

Author: Vincent Delecroix

Branch/Commit: 6e27dde

Reviewer: Nicolas M. Thiéry

Issue created by migration from https://trac.sagemath.org/ticket/18411

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions