This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
target :: [Double] -> Double | |
target xs = go 0 0 xs | |
where go t0 t1 [] = -0.5 * t0 / h - 0.5 * h * t1 | |
go t0 t1 (u:us:uss) = go (t0 + (us - u)^2) (t1 + v (us + u)) uss | |
h = 1 / fromIntegral (length xs) | |
v x = (1 - x^2)^2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
./SPDE 1000000 1000 +RTS -N4 -qg > trace.dat | |
MUT time 4723.78s (1620.24s elapsed) | |
GC time 623.24s (596.64s elapsed) | |
Total time 5347.02s (2216.89s elapsed) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
./SPDE 1000000 1000 > trace.dat | |
MUT time 2769.65s (2770.68s elapsed) | |
GC time 600.57s (599.46s elapsed) | |
Total time 3370.22s (3370.13s elapsed) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Numeric.AD | |
gTarget :: [Double] -> [Double] | |
gTarget = grad target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# OPTIONS_GHC -Wall #-} | |
{-# LANGUAGE TemplateHaskell #-} | |
import Data.List | |
import Data.Hashable (Hashable) | |
import Data.HashMap.Strict hiding (filter) | |
import Control.Monad | |
import Test.QuickCheck | |
import Test.QuickCheck.All | |
import Criterion.Main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=== prop_i0ResultElementsAreInBoth from ui.hs:64 === | |
+++ OK, passed 1000 tests. | |
=== prop_i1ResultElementsAreInBoth from ui.hs:68 === | |
+++ OK, passed 1000 tests. | |
=== prop_i2ResultElementsAreInBoth from ui.hs:72 === | |
+++ OK, passed 1000 tests. | |
=== prop_u0ResultElementsInAtLeastOne from ui.hs:77 === |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE DeriveFunctor #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE StandaloneDeriving #-} | |
{-# LANGUAGE UndecidableInstances #-} | |
data Program f = Running (f (Program f)) | |
deriving instance (Show (f (Program f))) => Show (Program f) | |
data Instruction r = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE DeriveFunctor #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE StandaloneDeriving #-} | |
{-# LANGUAGE UndecidableInstances #-} | |
data Program f a = | |
Running (f (Program f a)) | |
| Terminated a | |
deriving instance (Show a, Show (f (Program f a))) => Show (Program f a) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE DeriveFunctor #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE StandaloneDeriving #-} | |
{-# LANGUAGE UndecidableInstances #-} | |
data Program f a = Program { | |
annotation :: a | |
, running :: f (Program f a) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# OPTIONS_GHC -Wall #-} | |
import Data.Function | |
import Data.List | |
main :: IO () | |
main = print $ minimumBy (compare `on` sumDiffs) portfolios | |
-- Data ------------------------------------------------------------------------ |