Skip to content

Instantly share code, notes, and snippets.

View 1oly's full-sized avatar

Oliver Lylloff 1oly

  • Copenhagen, Denmark
View GitHub Profile
@1oly
1oly / wind.json
Last active November 24, 2023 12:36
wind-data
View wind.json
[{"header": {"parameterCategory": 2, "parameterNumber": 2, "lo1": 9.249359602308473, "la1": 55.85070694141145, "dx": 0.029743471585207716, "dy": 0.0365760887486843, "nx": 6, "ny": 16, "refTime": "2023-11-24T06:00:00.000Z"}, "data": [5.574723044700687, 7.619567386306366, 2.825262548805914, 3.837937622968217, 5.835497170133532, 7.1744880405002585, 2.648804228427202, 6.111549605740025, 6.877097815611028, 2.2725514656239363, 5.867787200985269, 6.511432784375532, 2.7006211918613725, 4.840395250089012, 6.424692076616517, 7.339452773109874, 3.4274040489087407, 3.5026708937407505, 6.3317374895312595, 7.2260342549888925, 2.6640240046945483, 6.089819491976226, 7.39159779236442, 2.7363550078913312, 5.458933321854281, 7.4013635452578415, 3.4022771762934085, 4.370372024198471, 7.042073573522599, 6.616500914811612, 4.057345102872524, 3.377614307069232, 6.271802399149777, 6.786152073448418, 3.052092197057784, 5.464956842397208, 7.334254729720126, 3.5039990386101936, 4.551762753664564, 7.592919020706147, 4.1898064575950995,
@1oly
1oly / gp.jl
Created July 14, 2014 07:40
subgradient projection for nnls
View gp.jl
function gp(nnls::Function,A::AbstractMatrix,b::AbstractVector,x0::AbstractVector,maxit::Integer)
obj = zeros(maxit)
x = x0
for i = 1:maxit
f,g,r = nnls(A,b,x)
g[(x.==0.0) & (g.>0.0)] = 0.0
alpha = dot(A*g,r)/dot(A*g,A*g)
x = x-alpha*g
x[x.<0.0] = 0.0
obj[i] = f
@1oly
1oly / func.jl
Last active August 29, 2015 14:02
Matlab vs. Julia
View func.jl
function func(b,x,Fps)
r = fftshift(ifft(fft(x).*Fps)) - b;
return r
end