Skip to content

Instantly share code, notes, and snippets.

Robert Lee Gates rleegates

Block or report user

Report or block rleegates

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View mult.jl
function *{T1<:AbstractDataBlock,T2<:AbstractDataBlock}(A::SparseMatrixCSC{T1,Int}, B::SparseMatrixCSC{T2,Int})
# modified from julia base (put into license!!!!)
mA, nA = size(A)
mB, nB = size(B)
nA==mB || throw(DimensionMismatch())
colptrA = A.colptr; rowvalA = A.rowval; nzvalA = A.nzval
colptrB = B.colptr; rowvalB = B.rowval; nzvalB = B.nzval
# TODO: Need better estimation of result space
nnzC = min(mA*nB, length(nzvalA) + length(nzvalB))
View simple_mpoly.jl
module SimplePolynomials
typealias ExponentInt Int
import StaticArrays: SVector
import Base: (+), (*), (^), zero, one
immutable Polynomial{T,NV}
exps::Vector{SVector{NV,ExponentInt}}
coeffs::Vector{T}
View WebInterface.jl
module WebInterface
using Morsel
app = Morsel.app()
using Debug
import JSON
route(app, GET | POST | PUT, "/") do req, res
@rleegates
rleegates / Quad8.m
Created Dec 15, 2014
Quad8 Shape Functions
View Quad8.m
N = [ 0.25* (1+s) * (1+r) * (r+s-1),...
0.25* (1+s) * (r-1) * (r+1-s),...
-0.25* (s-1) * (r-1) * (r+s+1),...
-0.25* (s-1) * (1+r) * (r-1-s),...
-0.5 * (1+r) * (r-1) * (1+s) ,...
0.5 * (r-1) * (1+s) * (s-1) ,...
0.5 * (1+r) * (r-1) * (s-1) ,...
-0.5 * (1+r) * (1+s) * (s-1) ]';
dN = [ 0.25* (1+s) * (s+2*r) ,...
0.25* (1+s) * (-s+2*r),...
@rleegates
rleegates / keTest.jl
Last active Aug 29, 2015
Element stiffness benchmark
View keTest.jl
function keTestVec(N::Int64, gradN::Array{Float64,2}, kappa::Array{Float64,2}, keDim::Int64, sdim::Int64)
ke = zeros(Float64,keDim,keDim)
detJ = 1.0
w = 1.0/2.0
for n = 1:N
fill!(ke,0.0)
ke += (w*detJ).*(gradN*kappa*gradN')
end
return ke
end
@rleegates
rleegates / intervalsGC.jl
Last active Aug 29, 2015
Run GC at intervals
View intervalsGC.jl
function doSomethingOften(n::Int64)
intv = 1000
try
gc_disable()
for i = 1:n
doSomething()
if i == intv
gc()
end
end
@rleegates
rleegates / globalToLocal.m
Created Dec 5, 2014
Computes element coordinate from global coordinate
View globalToLocal.m
% local coordinates from global coordinates
function eta = globalToLocal(obj, xPt, nodalX)
% tolerance
tol = 1e-13;
% get an initial guess at [0,0]
eta = zeros(size(xPt));
% NR iteration
deta = 1;
iter = 0;
maxIter = 20;
View parallelTest.jl
# parallelTest.jl
# automatic differentiation of a function at n = 100e6 points using dual numbers
# compare parallel to serial implementation
# benchmark timings were observed on a 2.66GHz Quad-Core Xeon after an initial warm up run
# initialize processors
availProcs = 8;
addprocs(availProcs-nprocs());
You can’t perform that action at this time.