Skip to content

Instantly share code, notes, and snippets.

View stephenjbarr's full-sized avatar

Stephen Jeffrey Barr stephenjbarr

View GitHub Profile
library(ggplot2)
pts = cartesian_product(c('x','y'))
d1 = cbind(pts, runif(nrow(pts),min=0,max=1), 1)
d2 = cbind(pts, runif(nrow(pts),min=0,max=4), 2)
colnames(d1) = colnames(d2) = c("x","y","val","k")
d = rbind(d1,d2)
p1 <- ggplot(d1, aes(x = x, y = y, fill = val))
sudo yum -y update
cabal update
cabal install either-unwrap
cabal install uuid
cabal install roots
cabal install integration
cabal install syb
git clone https://github.com/simonmar/monad-par.git
cd monad-par
{-| print_inst_uuid_list
Given a list of [IndividualParameterization], and an output filename
print a csv file describing each IndividualParameterization, one line
each.
-}
print_inst_uuid_list :: [IndividualParameterization] -> String -> IO ()
print_inst_uuid_list xlist fname =
do
let headerstring = inputst_csv_string ++ ",nstep_s,nstep_w,uuid"
let inst_strings = map (inputst_to_csv_string . _ipp_inst) xlist
library(ggplot2)
library(cumplyr)
library(scales)
library(reshape2)
library(RColorBrewer)
library(tools)
library(gridExtra)
{-# LANGUAGE DeriveDataTypeable #-}
module HW4_23 where
import Data.Typeable
import Data.Generics
import Math.Factorial
import Data.List
import System.IO
import Data.UUID as U
inner_decentral_sino_st :: ProblemParams -> (Double,Double,Double) -> (Double,Double,Double)
inner_decentral_sino_st pp (simin, simed, simax) = (simin', simed', simax')
where
p = fromIntegral $ _pp_p pp :: Double
t = fromIntegral $ _pp_t pp :: Double
h = fromIntegral $ _pp_h pp :: Double
myf_val = myfunN1 simed pp
thresh = (p*t)/(p+h)
if myf_val < thresh then
@stephenjbarr
stephenjbarr / TheRandomMonad.hs
Created November 7, 2014 16:44
using TheRandomMonad.hs
import Control.Monad.Random
import Data.List.Split as LS
bounds = [(10.0, 20.0), (5.0, 6.0), (3.0, 4.0), (100.0, 200.0)]
-- INPUT:
-- RandomGen random number generator for uniforms
-- [(Double, Double)] list of upper and lower bounds
-- Int number of lists of random numbers
--
@stephenjbarr
stephenjbarr / MTHelp.hs
Created January 4, 2015 23:11
Monad Transformer advice outline
import Control.Monad
import Control.Monad.Reader
import Control.Monad.Random
import Data.Map as Map
import Data.Maybe
import Control.Seq as Seq
import Control.Monad.Par
import Control.DeepSeq
@stephenjbarr
stephenjbarr / sample-post
Created February 1, 2015 20:40
sample post
#+TITLE: Simple Example
#+AUTHOR: Stephen
#+DATE: 2015-01-30
#+HTML_DOCTYPE: html5
#+OPTIONS: toc:nil
* Headline 1
Here is a nice equation: \( x^{2} - 3 x^{3} - \alpha \beta \).

Keybase proof

I hereby claim:

  • I am stephenjbarr on github.
  • I am stevejb (https://keybase.io/stevejb) on keybase.
  • I have a public key whose fingerprint is 07C1 118A A251 AFDE 258C 2E7B FFD0 0625 D5E2 5321

To claim this, I am signing this object: