Instantly share code, notes, and snippets.

# Robert Lee Gatesrleegates

• Sort options
Created May 18, 2017
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))
Created May 5, 2017
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}
Created Mar 23, 2015
A simple Servlet
View WebInterface.jl
 module WebInterface using Morsel app = Morsel.app() using Debug import JSON route(app, GET | POST | PUT, "/") do req, res
Created Dec 15, 2014
 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),...
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
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
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;
Last active Aug 29, 2015
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.