Skip to content

Instantly share code, notes, and snippets.

View floswald's full-sized avatar
👋

Florian Oswald floswald

👋
View GitHub Profile
static double adraw (struct aspacestruct *aspace)
{ /*returns the next value in the stream of guesses of A
terminates the sequence by sending -INFINITY
*/
double aa,bb,mstep,astep,upper;
int i;
aspace[0].ncalls+=1.0;
if (aspace[0].ncalls>=ngridmax)
{
@floswald
floswald / Plot_Examples.md
Created March 8, 2016 14:54 — forked from gizmaa/Plot_Examples.md
Various Julia plotting examples using PyPlot
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@floswald
floswald / pfunit
Created April 2, 2015 16:56
pfunit test return code
➜ Semi-Automatic git:(master) ✗ pwd
/Users/florianoswald/git/pfunit/Examples/Simple/Semi-Automatic
➜ Semi-Automatic git:(master) ✗ ./tests.x
..F.F...F..
Time: 0.063 seconds
Failure in: testAdd2
Location: [myTests.pf:17]
FLOs intentionally broken test expected: +5.000000 but found: +4.000000; difference: |+1.000000| > tolerance:+0.000000.
@floswald
floswald / de.jl
Created September 25, 2014 17:04
demean
julia> using DataFrames, DataFramesMeta, Lazy
julia> df = DataFrame(id=[1,1,1,2,2,2,3,3,3],x=rand(9))
9x2 DataFrame
| Row | id | x |
|-----|----|-----------|
| 1 | 1 | 0.0470736 |
| 2 | 1 | 0.440199 |
| 3 | 1 | 0.156013 |
| 4 | 2 | 0.864873 |
@floswald
floswald / core_dump
Last active August 29, 2015 14:06
profiling data
Process: julia [878]
Path: /usr/local/bin/julia
Identifier: julia
Version: ???
Code Type: X86-64 (Native)
Parent Process: zsh [715]
Responsible: Terminal [710]
User ID: 501
Date/Time: 2014-09-16 14:52:20.673 +0100
@floswald
floswald / integrate.jl
Last active August 29, 2015 14:05
integration loops
# original version: slow
#
function integrateVbar!(ia::Int,ih::Int,ij::Int,age::Int,Gz::Array{Float64,3},Gyp::Array{Float64,3},Gs::Array{Float64,2},Gtau::Array{Float64,1},m::Model,p::Param)
# loop over conditioning states
for itau = 1:p.ntau # current tau
for ip = 1:p.np # current p
for iy = 1:p.ny # current y
for iz = 1:p.nz # current z
for is = 1:p.ns # current HHsize
@floswald
floswald / build.sh
Last active August 29, 2015 14:04
julia build
➜ julia git:(master) ✗ make cleanall
rm -f *# *~
rm -f pcre_h.jl
rm -f errno_h.jl
rm -f build_h.jl
rm -f build_h.jl.phony
rm -f fenv_constants.jl
rm -f uv_constants.jl
rm -f file_constants.jl
rm -f version_git.jl
@floswald
floswald / addprocs.jl
Created August 1, 2014 14:21
addprocs
# this is output from the submit script:
# ======================================
Running PBS prologue script on red0004
End of prologue. Now executing user's job
------------------------------------------------------------------------------
@floswald
floswald / tensor.jl
Last active August 29, 2015 14:04
tensorgrid
# approximating tensor grids
# computing the approximating coefficients on
# a tensor product of basis functions
# NOTE: the fastest varying index in v is the one with highest
# index in ibm
function getTensorCoef{T<:Real}(ibm::Dict{Integer,Array{T,2}},v::Vector{T})
# ibm are usually inverse basis matrices
nall = length(v) # length value vector