Commit 34e23dcc by dterei

### Merge branch 'master' of http://darcs.haskell.org/nofib

parents d2e04003 c5660c58
 ... ... @@ -54,12 +54,12 @@ instance (Num a,Ord a,Eq a,Show{-was:Text-} a) => Num (Interval a) where fromInteger = ivFromInteger instance (Num a,Ord a,Fractional a) => Fractional (Interval a) where instance (Show a,Num a,Ord a,Fractional a) => Fractional (Interval a) where (/) = ivDiv fromRational = ivFromRational -- instance (Fractional a,Ord a,Floating a) => - not this ? instance (RealFloat a) => instance (Show a,RealFloat a) => Floating (Interval a) where pi = Pt pi exp = ivExp ... ...
 ... ... @@ -41,8 +41,8 @@ extract n (x :+: ps) = x : extract (n-1) ps deriv:: Num a => Ps a -> Ps a integral:: Fractional a => Ps a -> Ps a compose:: Num a => Ps a -> Ps a -> Ps a revert:: Fractional a => Ps a -> Ps a compose:: (Eq a, Num a) => Ps a -> Ps a -> Ps a revert:: (Eq a, Fractional a) => Ps a -> Ps a toList:: Num a => Ps a -> [a] takePs:: Num a => Int -> Ps a -> [a] (.*):: Num a => a -> Ps a -> Ps a ... ... @@ -59,13 +59,13 @@ toList (f :+: fs) = f : (toList fs) takePs n fs = take n (toList fs) instance Num a => Eq (Ps a) where --(1) instance (Eq a, Num a) => Eq (Ps a) where --(1) Pz == Pz = True Pz == (f :+: fs) = f==0 && Pz==fs fs == Pz = Pz==fs (f :+: fs) == (g :+: gs) = f==g && fs==gs instance Num a => Show (Ps a) where --(2) instance (Show a, Num a) => Show (Ps a) where --(2) showsPrec p Pz = showsPrec p [0] showsPrec p fs = showsPrec p (toList fs) ... ... @@ -85,7 +85,7 @@ instance Num a => Num (Ps a) where fromInteger 0 = Pz fromInteger c = fromInteger c :+: Pz instance Fractional a => Fractional (Ps a) where instance (Eq a, Fractional a) => Fractional (Ps a) where recip fs = 1/fs Pz/Pz = error "power series 0/0" ... ... @@ -113,7 +113,7 @@ integral fs = 0 :+: (int1 fs 1) where --(6) int1 Pz _ = Pz int1 (f :+: fs) n = f/n :+: (int1 fs (n+1)) instance Fractional a => Floating (Ps a) where instance (Eq a, Fractional a) => Floating (Ps a) where sqrt Pz = Pz sqrt (0 :+: 0 :+: fs) = 0 :+: (sqrt fs) sqrt (1 :+: fs) = qs where ... ...
 ... ... @@ -78,7 +78,7 @@ payA_par depth val ((c,q):coins) acc | otherwise = res where res = unEval \$ pure append <*> rpar left <*> rwhnf right res = runEval \$ pure append <*> rpar left <*> rseq right left = payA_par (if q == 1 then (depth-1) else depth) (val - c) coins' (c:acc) right = payA_par (depth-1) val coins acc ... ...
 ... ... @@ -14,7 +14,7 @@ module Illumination ) where import Control.Parallel import Control.Parallel.Strategies (withStrategy, parBuffer, rwhnf) import Control.Parallel.Strategies (withStrategy, parBuffer, rseq) import Data.Array import Data.Char(chr) ... ... @@ -38,9 +38,9 @@ render (m,m') amb ls obj dep fov wid ht file } where #ifdef STRATEGIES_2 parallel = parBuffer 100 rwhnf . map (\x -> seqList x `pseq` x) parallel = parBuffer 100 rseq . map (\x -> seqList x `pseq` x) #else parallel = withStrategy (parBuffer 100 rwhnf) . map (\x -> seqList x `pseq` x) parallel = withStrategy (parBuffer 100 rseq) . map (\x -> seqList x `pseq` x) #endif debugging = return () ... ...
 ... ... @@ -135,7 +135,7 @@ parallelMandel mat limit radius #ifdef STRATEGIES_2 parallel = parBuffer 70 rwhnf #else parallel = withStrategy (parBuffer 70 rwhnf) parallel = withStrategy (parBuffer 70 rseq) #endif seqList :: [a] -> () ... ...
 -- Time-stamp: <2010-02-12 14:57:09 simonmar> -- Time-stamp: <2011-10-07 11:36:17 simonmar> ----------------------------------------------------------------------------- module Game where ... ... @@ -20,7 +20,7 @@ alternate _ _ _ _ b | static b == OWin = [] alternate depth player f g board = move : alternate depth opponent g f board' where move@(board',eval) = best f possibles scores scores = map (bestMove depth opponent g f) possibles `using` parList rwhnf scores = map (bestMove depth opponent g f) possibles `using` parList rseq possibles = newPositions player board opponent = opposite player ... ... @@ -62,4 +62,4 @@ mise f g (Branch _ l) = foldr f (g OWin XWin) (map (mise g f) l) parMise :: Int -> Player -> Player -> (Tree Evaluation) -> Evaluation parMise 0 f g t = mise f g t parMise n f g (Branch a []) = a parMise n f g (Branch _ l) = foldr f (g OWin XWin) (map (parMise (n-1) g f) l `using` parList rwhnf) parMise n f g (Branch _ l) = foldr f (g OWin XWin) (map (parMise (n-1) g f) l `using` parList rseq)
 ... ... @@ -3,7 +3,7 @@ Michaelson for SML, converted to (parallel) Haskell by Kevin Hammond! > {-# LANGUAGE BangPatterns,CPP #-} > import Control.Parallel > import Control.Parallel.Strategies (Strategy, withStrategy, rwhnf, parBuffer) > import Control.Parallel.Strategies (Strategy, withStrategy, rseq, parBuffer) > import System.Environment > main = do ... ... @@ -144,7 +144,7 @@ in_poly_test (p,q,r) (A,B,C) Vs #ifdef STRATEGIES_2 > parallel = parBuffer 200 rwhnf #else > parallel = withStrategy (parBuffer 200 rwhnf) > parallel = withStrategy (parBuffer 200 rseq) #endif ... ...
 {-# OPTIONS_GHC -fffi #-} -- This benchmark is also ffi014 in the test suite. -- This program behaves unpredictably with the non-threaded RTS, -- because depending on when the context switches happen it might end -- up building a deep stack of callbacks. When this happens, the run -- queue gets full of threads that have finished but cannot exit -- because they do not belong to the topmost call to schedule(), and -- the scheduler repeatedly traverses the run queue full of these -- zombie threads. module Main where import Control.Concurrent ... ...
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!