Skip to content

Instantly share code, notes, and snippets.

@jsams
jsams / scale_sparse.jl
Created Oct 9, 2017
metaprogramming error
View scale_sparse.jl
function scale_sd!(A::SparseMatrixCSC; corrected=true)
n = size(A, 1)
if corrected
sdcall = :(sqrt(sum(vi^2 for vi in v) / (n - 1) - (n / (n - 1)) * mn^2))
else
sdcall = :(sqrt(sum(vi^2 for vi in v) / n - mn^2))
end
for j in 1:size(A, 2)
k = A.colptr[j]:(A.colptr[j+1] - 1)
if length(k) == 0