Closed Craig44 closed 1 year ago
I can confirm this problem. It used to be that one could go from any of the Matrix classes to 'dgTMatrix' (the only one supported by TMB) using as(.,"dgTMatrix")
.
Now, that doesn't work anymore and I've been struggling to find an equivalent to be used by datasanitize()
- see https://github.com/kaskr/adcomp/commit/10cb50eced22e756a04e5a90d78b8a85ac8a7da1 - and came up with x <- as(.,"TsparseMatrix")
. But as your example demonstrates this coercion doesn't seem to be enough.
If in addition you do
data$S <- as(data$S, "generalMatrix")
class(data$S)
## "dgTMatrix"
it seems to work.
If there are no side-effects I should probably change datasanitize()
to use as(as(.,"TsparseMatrix"), "generalMatrix")
.
Thanks for that response. Your code did allow the TMB model to build and run.
When using the the function
Matrix::.bdiag
I now get a class typedsTMatrix
which used to create a typedgTMatrix
. This now means theMakeADFun
errors out.Reproducible Steps:
With the package versions and OS outlined below. If I re-run Hans's pSplines example https://github.com/skaug/tmb-case-studies/tree/master/pSplines I get an error about the sparse matrix data type
Current Output:
When I query the class of
S
I getIt seems like the
Matrix
library might be depreciatingdgTMatrix
in favor ofdsTMatrix
Expected Output:
This used to work with no issues
TMB Version:
R Version:
Operating System:
Windows 10