My approach to delayed execution is about 10x slower than the normal
execution, this might be a problem for you. Also, usually all
operations done to matrix entries are the same. If that is the case for
you, then you don't need to have each entry a delayed datatype. Instead
have the one delayed datatype represent the whole matrix:
de = DeAny()
de2 = (de^2)*7*9
a=sparse(1:2, 1:2, [1,2])
evalDe(de2, a)
> Cool, thanks for the links. So a few folks have looked at doing this kind
> of thing, but maybe not specifically with sparse matrices yet :)
>
> The application I'm most interested in is sparse nonlinear constrained
> optimization, but the same pattern shows up lots of places: you're
> computing a sparse matrix with constant nonzero structure, but many
> iterations in a row with changing nonzero values.
>
> What would be perfect here is symbolic assembly of the initial nonzero
> structure, into a fast function straight from your vector input to the
> vector of nonzero values in the sparse matrix, without any interpreted
> temporaries in between. Miles and the other JuliaOpt guys are working on
> doing this with reverse-mode AD, but I've got an alternate formulation
> where I can express the input/output relationship in terms of spmm, with
> one matrix constant and the second matrix with nonzeros that are simple
> functions of the input.
>
> So in my case I'm going for something a little like PETSc's separation of
> MatMatMultSymbolic
> (http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatMatMultSymbolic.html)
>
> from MatMatMultNumeric. I feel like in Julia, symbolic can really mean
> symbolic, actually populating the array of nonzeros with the real
> expressions.
>
> -Tony