Copyright | (c) 2016 Andrew Lelechenko |
---|---|
License | MIT |
Maintainer | Andrew Lelechenko <andrew.lelechenko@gmail.com> |
Safe Haskell | Safe |
Language | Haskell2010 |
Deprecated: Use Bilinear
instead.
Bilinear recurrent sequences and Bernoulli numbers, roughly covering Ch. 5-6 of Concrete Mathematics by R. L. Graham, D. E. Knuth and O. Patashnik.
Note on memory leaks and memoization. Top-level definitions in this module are polymorphic, so the results of computations are not retained in memory. Make them monomorphic to take advantages of memoization. Compare
>>>
:set +s
>>>
binomial !! 1000 !! 1000 :: Integer
1 (0.01 secs, 1,385,512 bytes)>>>
binomial !! 1000 !! 1000 :: Integer
1 (0.01 secs, 1,381,616 bytes)
against
>>>
let binomial' = binomial :: [[Integer]]
>>>
binomial' !! 1000 !! 1000 :: Integer
1 (0.01 secs, 1,381,696 bytes)>>>
binomial' !! 1000 !! 1000 :: Integer
1 (0.01 secs, 391,152 bytes)