I agree with you that __len__ should be removed, especially if len(
finiteclass ) returns a value. But even if it doesn't then the correct
method to use is finiteclass.cardinality() anyway. Right?
About this ._apply_module_morphism() fix though. The segment of code that
is is in combinat/free_module.py currently reads:
if x == self.zero():
if not codomain:
B = self.basis()
keys = list( B.keys() )
if len( keys ) > 0:
key = keys[0]
codomain = on_basis( key ).parent()
else:
raise ValueError, 'Codomain could not be determined'
return codomain.zero()
That is, it is trying to determine the codomain by picking an element of
the domain. But in the case when the domain doesn't exist (when would this
happen? I don't know how to trigger this) it raises a value error. Can I
replace this with the code?:
if x == self.zero():
if not codomain:
B = self.basis()
codomain = on_basis( B.first() ).parent()
return codomain.zero()
-Mike
On Friday, 15 June 2012 09:14:22 UTC-4, Franco Saliola wrote:
>
> On Fri, Jun 15, 2012 at 6:40 AM, Mike Zabrocki <[email protected]>
> wrote:
> > FYI, I have fixed .nabla(), plethysm() and .inner_plethysm() (and maybe
> one
> > or two other cases) where the base case of s(0) needs to be handled
> > differently in some recent updates to my patch and I added doc tests
> which
> > check this case and s(1) (although this one never gave me a problem).
> I'll
> > never know for sure if I caught them all. Instead it would be better
> > if ._apply_module_morphism() worked as expected if the self.is_zero() is
> > True and the indexing set is infinite.
> >
> > Franco, if I understand right, then s(0).nabla() would then raise an
> error
> > (before my patch is applied). I still think then that there is another
> fix
> > to be done on ._apply_module_morphism().
>
> Definitely. There are two issues here:
>
> 1. __len__ should eventually be removed from CombinatorialClass
>
> 2. _apply_module_morphism needs to be fixed
>
> Then you wouldn't have to worry about handling zero elements correctly
> and it might catch other bugs in Sage.
>
> Franco
>
> --
>
--
You received this message because you are subscribed to the Google Groups
"sage-combinat-devel" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/sage-combinat-devel/-/uzFiZUbFHeMJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-combinat-devel?hl=en.