Skip to content
Prev 262947 / 398502 Next

optimization with Sparse matrices

Dube, Jean-Pierre <Jean-Pierre.Dube <at> chicagobooth.edu> writes:
I wouldn't guess that optim() itself would do any conversion
of the data values (are these passed as additional parameters
or used as global variables?)  The only thing optim() does with
parameters in '...' is pass them along to the objective
function as follows:

    fn1 <- function(par) fn(par, ...)

and I can't see a reason that would convert them in any way.
It seems more likely to me (?) that there is some step in 
your objective function where you do an operation that accidentally
converts the sparse back to non-sparse matrices ...

  Can you construct a minimal example that shows this happening?