I think I figured it out. Your code gives a much nicer stacktrace than Unknown() from Sims.jl was for some reason:
ERROR: access to undefined reference in unsafe_copy! at array.jl:41 in copy! at array.jl:51 in getindex at array.jl:296 in splice! at array.jl:643 in * at linalg/sparse.jl:171 She's actually completely right. Sparse matmul allocates space as it goes, in reasonable-sized chunks at a time. At the end, it trims off the extra unneeded elements with splice!. The problem is with these Any type arrays we're trying to use, the extra allocated space is actually #undef until it gets written to. Since splice! returns the removed elements, that first line of splice is indeed trying to access an undefined reference. Minimal test case, no funky symbolic expression stuff required: julia> sparse(1:2, 1:2, Any[1;2])^2 I think the solution is to replace uses of splice! with deleteat! in linalg/sparse.jl. Testing this now and will put together a PR if it works. -Tony
