Craig44 / SpatialSablefishAssessment

A R package that contains TMB stock assessment models and auxiliary functions. Initially it was built for Sablefish, but could be fit to any stock that exhibits sexual dimorphism, has two fishing fleets and generalized number of spatial regions.
https://craig44.github.io/SpatialSablefishAssessment/
4 stars 1 forks source link

plus group #9

Closed BenWilliams-NOAA closed 1 year ago

BenWilliams-NOAA commented 1 year ago

https://github.com/Craig44/SpatialSablefishAssessment/blob/821112099391c2dc26c8f79972bb51c3e86c9e5c/src/TMB/CurrentAssessment.hpp#L562

I may be confused (likely) but wouldn't the plus group be n_ages, not n_ages -1?

Craig44 commented 1 year ago

Thats a C++ index, so if there are 30 ages, the vector is indexed from 0:29 if you use a look up of 30 for a vector of size 30 you will get undefined behaviour. Most likely a crash

BenWilliams-NOAA commented 1 year ago

Guess I had assumed the index was based on ages.size() but sounds like the init_n is based on max age?On Oct 2, 2023, at 12:10 PM, Craig Marsh (aka Cyril) @.***> wrote: Thats a C++ index, so if there are 30 ages, the vector is indexed from 0:29 if you use a look up of 30 for a vector of size 30 you will get undefined behaviour. Most likely a crash

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

BenWilliams-NOAA commented 1 year ago

durrr - been looking at to much admb code