]> www.ginac.de Git - ginac.git/commit
In power::expand_add(), don't reserve excess monomial sizes.
authorRichard Kreckel <kreckel@ginac.de>
Wed, 25 Nov 2015 10:28:10 +0000 (11:28 +0100)
committerRichard Kreckel <kreckel@ginac.de>
Wed, 25 Nov 2015 11:12:14 +0000 (12:12 +0100)
commit2639812c0ba4e1f9620660bbba1f12bf5b865e29
treef2e04a4bfac06f7bdbf475b62e0bad705977dae8
parent27213d158e5ec4b606b4f4d0766bf75eeb18673f
In power::expand_add(), don't reserve excess monomial sizes.

There is no need to reserve n terms in each of the monomials of the
result of power(+(x,y,z...;0),n): We can compute it exactly as the
number of nonzero exponents in the multinomial expansion. The good
thing is that this counting is the same for each composition of a
partition, so it can be hoisted out of the loop over compositions.
ginac/power.cpp