Skip to content

Instantly share code, notes, and snippets.

View rinx's full-sized avatar
🍵
Drinking sencha all the time

Rintaro Okamura rinx

🍵
Drinking sencha all the time
View GitHub Profile
import Data.Vector.Unboxed as VU
-- linear algebra
-- add
(<+>) :: Vector Double -> Vector Double -> Vector Double
(<+>) x y = VU.zipWith (+) x y
-- sub
(<->) :: Vector Double -> Vector Double -> Vector Double
(<->) x y = VU.zipWith (-) x y
@rinx
rinx / mc1drad_mersenne_parallel.hs
Last active June 25, 2017 13:45
monte carlo 1d radiative transfer code written in haskell using random-mersenne package and parallel computation technique
import System.Random.Mersenne
import Control.Parallel.Strategies hiding (parMap)
nt = 4 -- number of thread
np = 1000000 -- number of photon
tau = 1.0 -- cloud optical thickness
sal = 0.5 -- surface albedo
omg = 1.0 -- single scattering albedo
@rinx
rinx / mc1drad_mersenne_list.hs
Created June 25, 2017 08:29
monte carlo 1d radiative transfer code written in haskell using random-mersenne package and infinite list of random numbers.
import System.Random.Mersenne
np = 1000000
tau = 1.0 -- cloud optical thickness
sal = 0.5 -- surface albedo
omg = 1.0 -- single scattering albedo
zu = tau -- atmosphere upper boundary
zb = 0.0 -- atmosphere lower boundary
@rinx
rinx / mc1drad_mersenne.hs
Created June 25, 2017 08:28
monte carlo 1d radiative transfer code written in haskell using random-mersenne package.
import System.Random.Mersenne
np = 1000000
tau = 1.0 -- cloud optical thickness
sal = 0.5 -- surface albedo
omg = 1.0 -- single scattering albedo
zu = tau -- atmosphere upper boundary
zb = 0.0 -- atmosphere lower boundary
@rinx
rinx / count.elm
Created May 30, 2017 14:37
my first elm sample
module Main exposing (..)
import Html exposing (..)
import Html.Events exposing (..)
import Html.Attributes exposing (..)
type alias Model = Int
type Msg = Click
@rinx
rinx / akima.hs
Created April 15, 2017 06:12
Akima 補間 途中まで書いて放置
type ZipList = [(Double, Double)]
-- akima interpolation
akimaint :: ZipList -> Double -> Maybe Double
akimaint zls x = akimacore zls' x
where
zls' = zlistsort zls
zls'' = selzls zls' n n2
xls = map fst zls'
@rinx
rinx / cnn-tikz.tex
Created January 15, 2017 10:04
TikZでCNNの図を描くやつ
\begin{figure}[htbp]
\centering
\tikzset{%
every channel/.style={
rectangle,
draw,
draw=black,
fill=white,
minimum size=1cm,
},
@rinx
rinx / wp_change.sh
Created January 9, 2017 06:21
wpchange.sh for iterm2 version3
#!/bin/sh
CMDNAME=`basename $0`
BASE_DIR=$(cd $(dirname $0);pwd)
image_list=(${BASE_DIR}/*.jpg)
numimglist=${#image_list[@]}
rannum=$(( $RANDOM % ${numimglist}))
image_path=${image_list[$rannum]}
@rinx
rinx / hist_gp.rb
Last active January 7, 2017 06:42
Histogram libraries for ruby using gnuplot gem
# -*- coding: utf-8 -*-
# hist_gp.rb
#
# Author: Rintaro Okamura
#
# Description:
# Histogram libraries for ruby using gnuplot gem
#
@rinx
rinx / cover.tex
Last active December 2, 2016 04:08
東北大地物の修論とかアレとかの表紙テンプレ
\documentclass[a4j, 12pt, titlepage]{ltjreport}
%\documentclass[a4j, 12pt, titlepage]{jreport}
\usepackage[top=20truemm,bottom=20truemm,left=20truemm,right=20truemm]{geometry}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{automata,positioning}
\makeatletter