Joerg Arndt on Wed, 05 Jun 2013 10:43:09 +0200

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: new GP loop: forpart()

* Bill Allombert <> [May 30. 2013 14:06]:
> Dear PARI developers,
> I have commited a patch by Pascal and myself that adds GP function
> to loop over partitions:
> forpart(v=5,print(v))
> Vecsmall([1,1,1,1,1])
> Vecsmall([1,1,1,2])
> Vecsmall([1,2,2])
> Vecsmall([1,1,3])
> Vecsmall([2,3])
> Vecsmall([1,4])
> Vecsmall([5])

Documentation issue:
This (as least as displayed) is not lex order, but colex.
Should also add representation:
"The partitions are vectors (of type Vecsmall) containing a
 weakly increasing list of parts."
(or some prettier wording).

Are the partitions _internally_ represented as
weakly decreasing lists?

> [...]

Looking at the forpart_next() code in the
snapshot pari-2.6.0-68-g63d35a5 I expected
a not so great performance.
However, I get
  time = 3,140 ms.
that is numbpart(90)/3.140 ==
 18 Million per second.
That's quite OK (166 cycles per update),
cf. my partitions into exactly m parts
takes 18 cycles per update (and 10 cycles
would already be excellent in practice).

Best,  jj