Changes between Version 2 and Version 3 of Ticket #15425
 Timestamp:
 05/05/14 00:04:46 (6 years ago)
Legend:
 Unmodified
 Added
 Removed
 Modified

Ticket #15425
 Property Cc ncohen vdelecroix added

Property
Type
changed from
defect
totask

Ticket #15425 – Description
v2 v3 47 47 really just a duplicated of itertools.product. 48 48 49 #. Fix bug in cartesian_product (reported by Vincent Delecroix [1]):49 #. #16289: Fix bug in cartesian_product (reported by Vincent Delecroix [1]): 50 50 {{{ 51 51 sage: C = cartesian_product([ZZ,ZZ]) … … 80 80 {{{sage.sets.cartesian_product.CartesianProduct._element_constructor}}}. 81 81 82 #. Fix mixed cartesian products with modules and non modules: 83 {{{ 84 sage: A = AlgebrasWithBasis(QQ).example(); A.rename("A") 85 sage: cartesian_product([A, ZZ]) 86 ... 87 AttributeError: 'sage.rings.integer_ring.IntegerRing_class' object has no attribute 'basis' 88 }}} 89 This should instead detect that not all factors are modules, and 90 just use a plain cartesian product. 91 92 #. Fix cartesian products involving NN: 93 {{{ 94 sage: cartesian_product([NN,NN]) 95 170 from sage.structure.parent import Parent 96 > 171 assert(all(isinstance(parent, Parent) for parent in parents)) 97 172 # Should we pass a set of categories to reduce the cache size? 98 173 # But then this would impose that, for any constructor, the 99 AssertionError: 100 }}} 101 This is in fact a bug in the way NN is lazy imported in the global 102 name space: 103 {{{ 104 sage: type(NN) 105 <type 'sage.misc.lazy_import.LazyImport'> 106 sage: isinstance(NN, Parent) 107 False 108 }}} 109 Things works if one forces the import of NN: 110 {{{ 111 sage: NN = NonNegativeIntegers() 112 sage: cartesian_product([NN,NN]) 113 The cartesian product of (Non negative integers, Non negative integers) 114 }}} 115 116 82 117 #. Many features could be further added, like for example making the 83 cartesian product of an additive magma into an additive magma and118 cartesian product of an additive magma into an additive magma, and 84 119 so on. A good step was done with #16269. Another step needs to be 85 120 done after #10963 to ventilate the features in the appropriate 86 axiom categories .121 axiom categories, and add Distributive.CartesianProducts. 87 122 88 123 [1] https://groups.google.com/forum/#!topic/sagecombinatdevel/8Aw63kro_0M