Skip to content

Instantly share code, notes, and snippets.

@RalphAS
RalphAS / svj.jl
Created February 10, 2019 20:44
Julia wrapper for LAPACK Jacobi SVD routines
module SVJ
#=
Wrapper for Jacobi SVD subroutines from LAPACK
*WARNING* This is a draft. Only `joba = 'G'` has been tested.
Boilerplate copied from Julia LinearAlgebra standard library
copyright (c) 2009-2019: the Julia developers https://julialang.org
License: MIT Expat
@RalphAS
RalphAS / ksgpu.jl
Created August 23, 2018 03:46
GPU version of KS example
using CuArrays
const ArrayType = CuArray
const TY = Float32
const half = convert(TY,0.5)
function ksintegrateInplaceGPU(u_in, Lx_in, dt_in, Nt)
dt = convert(TY,dt_in)
Lx = convert(TY,Lx_in)
u = ArrayType((1+0im)*convert.(TY,u_in)) # force u to be complex
@RalphAS
RalphAS / RData.jl
Created July 25, 2018 02:10
proposal for RData
__precompile__()
module RData
using DataFrames, CategoricalArrays, Missings, CodecZlib, FileIO, TimeZones
import DataFrames: identifier
import FileIO
export
sexp2julia,
@RalphAS
RalphAS / VCHT.jl
Created July 27, 2017 03:19
Julia: Chebyshev transforms for PDE projects
#=
Vector Chebyshev transforms
Like the 1-D versions from ApproxFun, but many at once.
Should also work with Complex eltypes!
# WARNING: in-place versions not yet checked.
# WARNING: A_mul_B!(y,plan,x) typically mutates x AND y
extensions
Copyright (c) 2017: Ralph Smith
@RalphAS
RalphAS / parwrite.jl
Created October 15, 2016 03:51
Multi-process resource control in Julia
# Julia doesn't have cross-process semaphores/mutexes.
# Here is a work-around using Tasks and Channels.
# The example controls access to a file written by workers.
#
# Design:
# each worker shares Req and Reply channels w/ master
# worker puts a token in Req channel when wanting access, waits on Reply channel
# when woken, writes to file, then posts Req and goes back to work.
# task on master (one per worker) waits on Req channel