gadget-framework / gadget3

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

Consider not dropping to Type in subset #75

Open lentinj opened 1 year ago

lentinj commented 1 year ago

Currently when subsetting, x[1,2,3] will convert from array<Type> to Type. I suspect this causes more headaches than it solves, in particular, whether sum() will work on the end result.

Try turning it off, and see if we can get by with using [[ to resolve any cases that it breaks.

If this works, we can get rid of the condition surrounding sum in g3l_distribution_sumofsquares()

lentinj commented 1 year ago

https://github.com/gadget-framework/gadget3/blob/b14a7493c956cbbf9765d3705221be0a0211f1a2/R/action_migrate.R#L58

Doesn't look like [[ as an lvalue works either.

EDIT: Fixed in df8dc70728b9a93546048a7fdf9798f9410d4f1a

lentinj commented 1 year ago

stock_ss(nllstock__weight) <- weight and stock_ss(fleet_stock__catch) both expect a scalar result, not vector.