Closed jaganmn closed 1 year ago
BTW, going forward the subscript method for CsparseMatrix
will not construct an intermediate dgCMatrix
for <dsCMatrix>[i, i]
when i
is strictly increasing or strictly decreasing. So lookup
can in principle be made faster if you know that r
is monotone.
Somehow, I didn't notice that the bug appears twice, i.e., also here:
Forthcoming improvements to subscript methods in Matrix have uncovered that you are misusing
M_chm_sparse_to_SEXP
intmb_invQ_tril_halfdiag
:https://github.com/kaskr/adcomp/blob/bb2e1432638a8af60aee9b6f1868cc38cb5731dc/TMB/src/solve_subset.c#L318
Here, the fifth argument is used to set the
diag
slot of the resultingdtCMatrix
and so must be"N"
(non-unit triangular) or"U"
(unit triangular) but never""
. Please correct, then test your patch against Matrix-devel:Trouble with the invalid
ihessian
(havingdiag = ""
) seems to start inside of thislookup
call and result in a gradient withNA
in the "simple" example (and for several packages depending on TMB):https://github.com/kaskr/adcomp/blob/bb2e1432638a8af60aee9b6f1868cc38cb5731dc/TMB/R/TMB.R#L767