## Haskell (n=29 in 53s on Core i5-4590S with 4 cores and 3 Ghz) import Control.Parallel.Strategies x :: [Integer] -> [[Integer]] -> Integer -> Int -> Integer x :: [Integer] -> [[Integer]] -> Integer -> Int -> Integer x p (v:vs) m c = let c' = c - 1 r = if c>0 then parTuple2 rpar rpar else r0 -- (*) (a,b) = ( x p vs m c' , x (zipWith(-) p v) vs (-m) c' ) `using` r -- (*) in a+b x p _ m _ = m * product p -- Ignoring the lines marked (*) and the last argument of x gives -- the same algorithm without parallelism p :: [[Integer]] -> Integer p (v:vs) = x (foldl (zipWith (+)) v vs) (map (map (2*)) vs) 1 11 `div` 2^(length vs) p [] = 1 -- handle 0x0 matrices too :-) main = getContents >>= print . p . read My first attempt at parallelism in Haskell. It seems to perform quite reasonable, especially given its simpleness. It is based on the formula in the section "Balasubramanian-Bax/Franklin-Glynn formula" in the Wikipedia article on [computing the permanent](https://en.wikipedia.org/wiki/Computing_the_permanent). I'm really curious to see how fast is is on @Lembik's machine. Compile with `ghc -O2 -threaded -o <name> <name>.hs`. To run with parallelisation, give it runtime parameters like this: `./<name> +RTS -N`. Input is from stdin with nested comma separated lists in brackets like `[[1,2],[3,4]]` as in the last example (newlines allowed everywhere).