Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cartesian_product AssertionError #14224

Closed
eviatarbach opened this issue Mar 4, 2013 · 3 comments
Closed

cartesian_product AssertionError #14224

eviatarbach opened this issue Mar 4, 2013 · 3 comments

Comments

@eviatarbach
Copy link

As of now, passing a list, tuple, or set to cartesian_product returns an AssertionError.

sage: cartesian_product([[0,1]])
AssertionError: 
sage: cartesian_product([FiniteEnumeratedSet([0,1])])  
The cartesian product of ({0, 1},)

I understand that this function can construct Cartesian products on different categories, so I see why it requires specific types. However, the error message should be more descriptive, especially considering that cartesian_product_iterator([[0,1]]), CartesianProduct([0,1]), and permutations([[0,1]]) all work.

Component: combinatorics

Reviewer: Frédéric Chapoton, Vincent Delecroix

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

@eviatarbach eviatarbach added this to the sage-5.11 milestone Mar 4, 2013
@jdemeyer jdemeyer modified the milestones: sage-5.11, sage-5.12 Aug 13, 2013
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.1, sage-6.2 Jan 30, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.2, sage-6.3 May 6, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.3, sage-6.4 Aug 10, 2014
@videlec
Copy link
Contributor

videlec commented Sep 13, 2015

comment:5

Hello,

I propose to close this one as duplicate since with #18411 tuple/list input are automatically converted into FiniteEnumeratedSet and set/frozenset converted to Set

sage: C = cartesian_product([[1,2], (3,4), set([1,2,3]), frozenset([1,2])])
The cartesian product of ({1, 2}, {3, 4}, {1, 2, 3}, {1, 2})
sage: for c in C.cartesian_factors():
....:     print c.__class__.__name__
FiniteEnumeratedSet_with_category
FiniteEnumeratedSet_with_category
Set_object_enumerated_with_category
Set_object_enumerated_with_category

Vincent

@videlec videlec removed this from the sage-6.4 milestone Sep 13, 2015
@fchapoton
Copy link
Contributor

comment:6

ok, I agree

@fchapoton
Copy link
Contributor

Reviewer: Frédéric Chapoton, Vincent Delecroix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants