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
#include <Halide.h> | |
#include <cstdio> | |
using namespace Halide; | |
#include "image_io.h" | |
#include <sys/time.h> | |
double currentTime() { | |
timeval t; | |
gettimeofday(&t, NULL); |
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
// Modified from tutorials/lesson_02.cpp and test/vectorize.cpp | |
// On linux, you can compile and run it like so: | |
// g++ -I ../include -L ../bin -lHalide -lpthread -ldl -lpng blur.cpp | |
// LD_LIBRARY_PATH=../bin ./lesson_02 | |
// On os x: | |
// g++ -I ../include -L ../bin -lHalide `libpng-config --cflags --ldflags` blur.cpp | |
// DYLD_LIBRARY_PATH=../bin ./lesson_02 |
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 OverloadedStrings,GADTs,FlexibleInstances #-} | |
import Data.List (intercalate,foldl1) | |
import Data.Text (Text) | |
import qualified Data.Text as T | |
import qualified Data.Text.IO as T | |
import Data.Map (Map) | |
import qualified Data.Map as M | |
import Control.Monad.RWS | |
import Control.Monad.State.Class |
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 OverloadedStrings,GADTs,FlexibleInstances #-} | |
import Data.List (intercalate) | |
import Data.Text (Text) | |
import qualified Data.Text as T | |
import qualified Data.Text.IO as T | |
type Ident = Text | |
-- 2D matrix |
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 GADTs #-} -- You need GADTs pragma. | |
data Exp r where | |
Const :: (Show r) => r -> Exp r | |
Add :: (Num r) => Exp r -> Exp r -> Exp r | |
Subtract :: (Num r) => Exp r -> Exp r -> Exp r | |
Eq :: (Eq r) => Exp r -> Exp r -> Exp Bool | |
And :: Exp Bool -> Exp Bool -> Exp Bool | |
Or :: Exp Bool -> Exp Bool -> Exp Bool |
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
data Exp r = Const r | Add (Exp r) (Exp r) | Subtract (Exp r) (Exp r) | |
eval :: (Num r) => Exp r -> r | |
eval (Const v) = v | |
eval (Add e1 e2) = (eval e1) + (eval e2) | |
eval (Subtract e1 e2) = (eval e1) - (eval e2) | |
reify :: (Show r) => Exp r -> String | |
reify (Const v) = show v | |
reify (Add e1 e2) = concat ["(",reify e1,"+",reify e2,")"] |
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 NoImplicitPrelude,OverloadedStrings,GADTs,MultiParamTypeClasses,FlexibleInstances #-} | |
-- GADTを使った型付きDSLのごく簡単なプロトタイプ。 | |
-- 出力のロジックに、この記事のアイデア・実装を一部利用: http://d.hatena.ne.jp/keigoi/20111206/haskell_tagless_dsl | |
import BasicPrelude as B | |
import Prelude (Show(..)) | |
import Control.Monad.Writer | |
import Control.Monad.State |
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 System.Directory | |
import Control.Monad | |
import Data.Maybe | |
import Data.List | |
filesep :: String | |
filesep = "/" | |
findUnder :: FilePath -> (FilePath -> IO (a,Bool)) -> IO [a] | |
findUnder dir func = do |
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
nebutas-MacBook-Air:~ nebuta$ time sudo cabal install yesod-platform yesod-bin | |
Resolving dependencies... | |
Configuring SHA-1.6.1... | |
Building SHA-1.6.1... | |
Preprocessing library SHA-1.6.1... | |
[1 of 1] Compiling Data.Digest.Pure.SHA ( Data/Digest/Pure/SHA.hs, dist/build/Data/Digest/Pure/SHA.o ) | |
[1 of 1] Compiling Data.Digest.Pure.SHA ( Data/Digest/Pure/SHA.hs, dist/build/Data/Digest/Pure/SHA.p_o ) | |
In-place registering SHA-1.6.1... | |
Running Haddock for SHA-1.6.1... | |
Preprocessing library SHA-1.6.1... |
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
{ | |
"method": "AROW", | |
"converter": { | |
"num_filter_types": {}, | |
"num_filter_rules": [], | |
"string_filter_types": {}, | |
"string_filter_rules": [], | |
"num_types": {}, | |
"num_rules": [], |