There is the cardinality method of IntegerVectors. Note that the default for min_part is 0.

It is implemented in src/sage/combinat/integer_vector.py without brute force enumeration under some constraints. Looking at it now, I think there is a bug at line 1331: It will never enter the if clause there and always continue with brute force, because if the length (=self.k) is not None and there is a max_part constraint, then there are at least two constraints...

Indeed, it would be great for Compositions and IntegerVectors to do the right thing.

Regards,
TB

On 19/02/2019 23:03, 'Martin R' via sage-devel wrote:
I do think that P = Partitions(15, min_length=10, max_length=10); P.cardinality() also uses brute force. (at least P.cardinality?? says so).

Would be great, though!

Martin

Am Dienstag, 19. Februar 2019 21:43:36 UTC+1 schrieb Jori Mäntysalo (TAU):

    Is there a fast way to compute for example

    Compositions(15, min_length=10, max_length=10).cardinality()

    in some package already integrated to SageMath? For Partitions(...)
    that
    seems to be the case, but Compositions(...) uses just brute
    enumeration.

-- Jori Mäntysalo

    Tampereen yliopisto - Ihminen ratkaisee

--
You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com <mailto:sage-devel+unsubscr...@googlegroups.com>. To post to this group, send email to sage-devel@googlegroups.com <mailto:sage-devel@googlegroups.com>.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to