[ADMB Users] bug?
davef at otter-rsch.com
Wed Jul 13 15:00:48 PDT 2011
Its not really a bug. when you declare
it creates an unallocated vector.
When you assign a vector to an unallocated vector it
does a shallow copy. But when you assign a number
(which is NOT a vector of size 1) it will depend on how the
assignment operator was written.
y=K/(1.0+(K/n0-1.0)*exp(-r*t)); // y is still unallocated.
If you had written your function as
dvar_vector logisticK( const dvector& t, const prevariable& K, const
prevariable& r, const dvar_vector& n0)
dvar_vector y=K/(1.0+(K/n0-1.0)*exp(-r*t)); // tries to invoke
a copy constructor but there isn't one
you would have got an error message.
In this case it does nothing because there is no size information
so an unallocated vector is returned.
More information about the Users