Sage 4.3.1 Release Tour

<

>

Major features

Algebra

Basic arithmetics

Combinatorics

Elliptic curves

Graph theory

Linear algebra

Miscellaneous

# File p.sage
def h(s):
    sleep(1)
    return s*s

def f(n1, n2, cores=24):
    @parallel(cores)
    def g(n):
        return h(n)*h(n)
    return [a for _, a in g([n1..n2])]

#------

sage: load p.sage
sage: time f(1,24)
CPU times: user 0.03 s, sys: 0.22 s, total: 0.25 s
Wall time: 2.28 s
[1, 16, 81, 256, 625, 1296, 2401, 4096, 6561, 10000, 14641, 28561, 20736, 
 38416, 50625, 65536, 83521, 104976, 130321, 160000, 194481, 234256, 279841, 331776]

This rewrite involves replacing the old implementation, which used multiprocessing (or Dsage), by a new one which uses the fork system call (it's about 2 pages of code written using only basic Python).

Packages