gadget-framework / gadget3

TMB-based gadget implemtation
GNU General Public License v2.0
8 stars 6 forks source link

One of the likelihood components turns nll into an array #73

Closed lentinj closed 1 year ago

lentinj commented 1 year ago

In @willbutler42 's model in support/gadget3_spawning_error, 0 * nll was giving problems since nll was turning into an array:

> load('support/gadget3_spawning_error/model.Rdata')
> model(tmb_param$value)
Error in r * ling_mat__offspringnum : non-conformable arrays
Environment:
  1: model(tmb_param$value)

This isn't a problem any more since 0 * nll has gone away, but we should still not do this.

lentinj commented 1 year ago

It might not be a likelihood component. It might be sneaking in via. parameter. From a test model containing g3_formula( nll <- nll + g3_param("dummy", value = 0):

> str(attr(model_cpp, 'parameter_template')$value)
List of 4
 $ retro_years                    : num [1(1d)] 0
 $ adist_sumofsquares_adist_weight: num [1(1d)] 1
 $ dummy                          : num [1(1d)] 0
 $ project_years                  : num [1(1d)] 0
 - attr(*, "class")= chr "AsIs"