This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module SimplePolynomials | |
typealias ExponentInt Int | |
import StaticArrays: SVector | |
import Base: (+), (*), (^), zero, one | |
immutable Polynomial{T,NV} | |
exps::Vector{SVector{NV,ExponentInt}} | |
coeffs::Vector{T} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module WebInterface | |
using Morsel | |
app = Morsel.app() | |
using Debug | |
import JSON | |
route(app, GET | POST | PUT, "/") do req, res |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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),... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function doSomethingOften(n::Int64) | |
intv = 1000 | |
try | |
gc_disable() | |
for i = 1:n | |
doSomething() | |
if i == intv | |
gc() | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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()); |