I notice that in your finite-element notebook you use:
T = zeros(Integer, 3, 2*N^2)
You really want to use Int in cases like this (Int = Int64 on 64-bit
machines and Int32 on 32-bit machines). Using Integer means that you have
an array of pointers to generic integer containers, whose type must be
checked at runtime (e.g. T[i] could be an Int32, Int64, BigInt, etc.).
(You also have very Matlab-like code that allocates zillions of little
temporary arrays in your inner loops. I assume this is intentional, but it
is definitely suboptimal performance, possibly by an order of magnitude.)