# ANN: combinatorics

19 messages
Open this post in threaded view
|

## ANN: combinatorics

Open this post in threaded view
|

## Re: ANN: combinatorics

 * wren ng thornton <[hidden email]> [2012-01-28 23:06:08-0500] > * Math.Combinatorics.Primes: provides the prime numbers via > Runciman's lazy wheel sieve algorithm. Provided here since efficient > algorithms for combinatorial functions often require prime numbers. > The current version memoizes the primes as an infinite list CAF, > which could lead to memory leaks in long-running programs with > irregular access to large primes. I'm looking into a GHC patch to > allow resetting individual CAFs from within compiled programs so that > you can explicitly decide when to un-memoize the primes. (In GHCi > when you reload a module all the CAFs are reset. However, there's no > way to access this feature from within compiled programs as yet.) Why not to make it more pure? That is, return a lazy list of Ints (but not a CAF), which user can throw away by the usual GC means? The functions from the other modules that use primes would have to be put in a Reader monad. That would make it a little bit more awkward to use, but personally I'd prefer that over memory leaks. -- Roman I. Cheplyaka :: http://ro-che.info/_______________________________________________ Haskell-Cafe mailing list [hidden email] http://www.haskell.org/mailman/listinfo/haskell-cafe
Open this post in threaded view
|

## Re: ANN: combinatorics

Open this post in threaded view
|

## Re: ANN: combinatorics

 In reply to this post by wren ng thornton ---------------------------------------------- combinatorics 0.1.0-------------------------------------------- The combinatorics package offers efficient *exact* computation of common combinatorial functions like the binomial coefficients and factorial. (For fast *approximations*, see the math-functions package instead.) Shameless self-promotion: The combinat package (which deliberately does not try to own the valuable namespace Math.Combinatorics) is a more extensive combinatorics library:http://hackage.haskell.org/package/combinat While the main focus is the generation of combinatorial objects themselves, counting functions and common number sequences like the above are also offered.Even though the binomial and factorial definition in this package are the naive ones, a quick experiment imply that the differences start show themselves around 100,000 factorial, or choosing 50,000 elements out of 100,000, which is probably a rather specialized use case.The primes function in the combinat package is based on an old Cafe thread, and actually seems to be faster than the one in the combinatoricspackage.In any case, I may switch to the faster algorithms in the future :)Balazs _______________________________________________ Haskell-Cafe mailing list [hidden email] http://www.haskell.org/mailman/listinfo/haskell-cafe
Open this post in threaded view
|

## Re: ANN: combinatorics

Open this post in threaded view
|

## Re: ANN: combinatorics

Open this post in threaded view
|

## Re: ANN: combinatorics

Open this post in threaded view
|

## Re: ANN: combinatorics

Open this post in threaded view
|

## Re: ANN: combinatorics

 In reply to this post by Jean-Marie Gaillourdet-3 On 1/31/12 8:58 AM, Jean-Marie Gaillourdet wrote: > A slight variation on that approach is to use implicit parameters to parameterize your functions by the primes. Something allong the following lines: That is another option. However, implicit parameters are GHC-only and seldom used even in GHC. The RTS-hacking I mentioned in the announcement would also be GHC-only, which is part of the reason I'd prefer to find a non-cumbersome way of dealing with the issue purely. As it stands the library is Haskell98 (with some trivial CPP to make the Haddocks pretty) and it'd be nice to stay that way. -- Live well, ~wren _______________________________________________ Haskell-Cafe mailing list [hidden email] http://www.haskell.org/mailman/listinfo/haskell-cafe
Open this post in threaded view
|

## Re: ANN: combinatorics

 In reply to this post by wren ng thornton On Wed, Feb 01, 2012 at 01:53:03AM -0500, wren ng thornton wrote: > > [2] HaskellForMaths, gamma, statistics, erf, math-functions, > combinat,... To this list I'd like to add 'species' and also the specialized 'multiset-comb' packages.  The former doesn't build under recent GHCs but I plan to fix that (and continue extending the library) soon. Would people be interested in creating a mailing list for those interested in combinatorics+Haskell? -Brent _______________________________________________ Haskell-Cafe mailing list [hidden email] http://www.haskell.org/mailman/listinfo/haskell-cafe
Open this post in threaded view
|

## Re: ANN: combinatorics

 On 3 February 2012 07:11, Brent Yorgey <[hidden email]> wrote: > On Wed, Feb 01, 2012 at 01:53:03AM -0500, wren ng thornton wrote: >> >> [2] HaskellForMaths, gamma, statistics, erf, math-functions, >> combinat,... > > To this list I'd like to add 'species' and also the specialized > 'multiset-comb' packages. Â The former doesn't build under recent GHCs > but I plan to fix that (and continue extending the library) soon. > > Would people be interested in creating a mailing list for those > interested in combinatorics+Haskell? I would. > > -Brent > > _______________________________________________ > Haskell-Cafe mailing list > [hidden email] > http://www.haskell.org/mailman/listinfo/haskell-cafe-- Ivan Lazar Miljenovic [hidden email] IvanMiljenovic.wordpress.com _______________________________________________ Haskell-Cafe mailing list [hidden email] http://www.haskell.org/mailman/listinfo/haskell-cafe
Open this post in threaded view
|

## Re: ANN: combinatorics

Open this post in threaded view
|

## ANN: exact-combinatorics (re-release of combinatorics)

Open this post in threaded view
|

## Re: ANN: combinatorics

 In reply to this post by Carter Schonwald On 2/2/12 6:46 PM, Carter Schonwald wrote: > On Thu, Feb 2, 2012 at 4:06 PM, Ivan Lazar Miljenovic wrote: >> On 3 February 2012 07:11, Brent Yorgey wrote: >>> On Wed, Feb 01, 2012 at 01:53:03AM -0500, wren ng thornton wrote: >>>> >>>> [2] HaskellForMaths, gamma, statistics, erf, math-functions, >>>> combinat,... >>> >>> To this list I'd like to add 'species' and also the specialized >>> 'multiset-comb' packages.  The former doesn't build under recent GHCs >>> but I plan to fix that (and continue extending the library) soon. >>> >>> Would people be interested in creating a mailing list for those >>> interested in combinatorics+Haskell? >> >> I would. > > ditto I don't know how involved I'd be, but I'd join. It's just a side interest for me (more a curiosity than a hobby at this point), though I would definitely like to see things better organized and integrated since it seems like there are a bunch of folks with passing interest in the area, and it's someplace that Haskell could really shine. -- Live well, ~wren _______________________________________________ Haskell-Cafe mailing list [hidden email] http://www.haskell.org/mailman/listinfo/haskell-cafe
Open this post in threaded view
|

## Re: ANN: combinatorics

 On Fri, Feb 03, 2012 at 01:06:16AM -0500, wren ng thornton wrote: > On 2/2/12 6:46 PM, Carter Schonwald wrote: > >On Thu, Feb 2, 2012 at 4:06 PM, Ivan Lazar Miljenovic wrote: > >>On 3 February 2012 07:11, Brent Yorgey wrote: > >>>On Wed, Feb 01, 2012 at 01:53:03AM -0500, wren ng thornton wrote: > >>>> > >>>>[2] HaskellForMaths, gamma, statistics, erf, math-functions, > >>>>combinat,... > >>> > >>>To this list I'd like to add 'species' and also the specialized > >>>'multiset-comb' packages.  The former doesn't build under recent GHCs > >>>but I plan to fix that (and continue extending the library) soon. > >>> > >>>Would people be interested in creating a mailing list for those > >>>interested in combinatorics+Haskell? > >> > >>I would. > > > >ditto > > I don't know how involved I'd be, but I'd join. It's just a side > interest for me (more a curiosity than a hobby at this point), though > I would definitely like to see things better organized and integrated > since it seems like there are a bunch of folks with passing interest > in the area, and it's someplace that Haskell could really shine. OK, I've emailed [hidden email] requesting the creation of a [hidden email] mailing list (if anyone knows of a better way to go about this let me know). -Brent _______________________________________________ Haskell-Cafe mailing list [hidden email] http://www.haskell.org/mailman/listinfo/haskell-cafe
Open this post in threaded view
|

## Re: ANN: combinatorics

Open this post in threaded view
|

## Re: ANN: combinatorics

 On 2/5/12 10:21 AM, Daniel Fischer wrote: > Why not use one of the packages on hackage which offer faster prime > generators? Mostly because I hadn't looked, having had the code already laying around. I'm not opposed to it, however another goal is to remain portable to other compilers, which means being H98/H2010 compliant. NumberSieves uses BangPatterns, but that would be easily remedied if the author is willing; arithmoi looks quite nice, however it is GHC-only. -- Live well, ~wren _______________________________________________ Haskell-Cafe mailing list [hidden email] http://www.haskell.org/mailman/listinfo/haskell-cafe