<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body style="word-wrap:break-word">
Hi Mark,
<div><br>
</div>
<div>It's a bit complicated I suppose, but you can recycle the traits for other functions as well, so you don't have to write a bunch of classes for each of the functions. However, functions that require specific specializations will have to have their own
traits attributed to them.</div>
<div><br>
</div>
<div>For example, you should be able to add the Richards growth function template, and use the same vonBtraits to return the appropriate dvar_vector or dvector.</div>
<div><br>
</div>
<div>Steve<br>
<div>
<div>On Jun 30, 2014, at 2:10 PM, Mark Maunder <<a href="mailto:mmaunder@iattc.org">mmaunder@iattc.org</a>> wrote:</div>
<br class="Apple-interchange-newline">
<blockquote type="cite">
<div lang="EN-US" style="font-family:Helvetica; font-size:18px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px">
<div class="WordSection1" style="">
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif; color:rgb(31,73,125)">Thanks Steve,</span></div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif; color:rgb(31,73,125)"> </span></div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif; color:rgb(31,73,125)">I was able to work out what the code is doing, but this is complicated. I would hate to do this for every function, but I guess that is what you should do for ADMB libraries.</span></div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif; color:rgb(31,73,125)"> </span></div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif; color:rgb(31,73,125)">Mark</span></div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif; color:rgb(31,73,125)"> </span></div>
<div>
<div style="border-style:solid none none; border-top-color:rgb(181,196,223); border-top-width:1pt; padding:3pt 0in 0in">
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<b><span style="font-size:10pt; font-family:Tahoma,sans-serif">From:</span></b><span style="font-size:10pt; font-family:Tahoma,sans-serif"><span class="Apple-converted-space"> </span><a href="mailto:developers-bounces@admb-project.org" style="color:purple; text-decoration:underline">developers-bounces@admb-project.org</a><span class="Apple-converted-space"> </span>[<a href="mailto:developers-bounces@admb-project.org" style="color:purple; text-decoration:underline">mailto:developers-bounces@admb-project.org</a>]<span class="Apple-converted-space"> </span><b>On
Behalf Of<span class="Apple-converted-space"> </span></b>Steve Martell<br>
<b>Sent:</b><span class="Apple-converted-space"> </span>Friday, June 27, 2014 11:55 PM<br>
<b>To:</b><span class="Apple-converted-space"> </span>dave fournier<br>
<b>Cc:</b><span class="Apple-converted-space"> </span>Sean Patrick Cox;<span class="Apple-converted-space"> </span><a href="mailto:developers@admb-project.org" style="color:purple; text-decoration:underline">developers@admb-project.org</a>; Alexandre Aires-Da-Silva;
Carolina Minte-Vera<br>
<b>Subject:</b><span class="Apple-converted-space"> </span>Re: [Developers] Template functions and documentation</span></div>
</div>
</div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
Here is an example using the vonb model.</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
You should just be able to compile the tpl file and be sure the hpp file is saved in the same directory. Note that I've commented out the standard template and the implemented two traits where if the user passes doubles for the growth parameters, the function
returns a dvector, and if the user passes dvariables, then the function returns a dvar_vector.</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
Steve</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
</div>
</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
Steve</div>
<div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
On Jun 27, 2014, at 2:19 PM, Steve Martell <<a href="mailto:SteveM@iphc.int" style="color:purple; text-decoration:underline">SteveM@iphc.int</a>> wrote:</div>
</div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<br>
<br>
</div>
<div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:13.5pt; font-family:Helvetica,sans-serif">The Soln Dave points to is the most robust. You would have to overload the template function to accommodate all of the possible combinations otherwise. I have an example of traits I can send
you when I get back to my mac. <br>
<br>
Sent from my iPad</span></div>
</div>
<div>
<p class="MsoNormal" style="margin:0in 0in 13.5pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:13.5pt; font-family:Helvetica,sans-serif"><br>
On Jun 27, 2014, at 1:43 PM, "dave fournier" <<a href="mailto:davef@otter-rsch.com" style="color:purple; text-decoration:underline"><span style="color:purple">davef@otter-rsch.com</span></a>> wrote:</span></p>
</div>
<blockquote style="margin-top:5pt; margin-bottom:5pt">
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:13.5pt; font-family:Helvetica,sans-serif">On 06/27/2014 01:38 PM, Mark Maunder wrote:<br>
<br>
see the concept traits in the template book. It is the way to deal with this.</span></div>
</div>
<blockquote style="margin-top:5pt; margin-bottom:5pt">
<div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif; color:rgb(31,73,125)">But that would mean the user has to know how to call the function in this special way, which is probably asking too much.</span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif; color:rgb(31,73,125)">Wouldn’t simply specifying the return type as being different from the argument work? And the compiler would work out t1 from the definition of len?</span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
len = vonB(age,linf,k,ro);</div>
</div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif; color:rgb(31,73,125)"> </span></div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
template<typename t1, typename t2, typename t3></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
t1 vonB(const t2 age, const t3 linf, const t3 k,const t3 to)</div>
</div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif; color:rgb(31,73,125)"> </span></div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif; color:rgb(31,73,125)"> </span></div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif; color:rgb(31,73,125)"> </span></div>
<div>
<div style="border-style:solid none none; border-top-color:rgb(181,196,223); border-top-width:1pt; padding:3pt 0in 0in">
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<b><span style="font-size:10pt; font-family:Tahoma,sans-serif">From:</span></b><span class="xapple-converted-space"><span style="font-size:10pt; font-family:Tahoma,sans-serif"> </span></span><span style="font-size:10pt; font-family:Tahoma,sans-serif">Steve
Martell [<a href="mailto:SteveM@iphc.int" style="color:purple; text-decoration:underline"><span style="color:purple">mailto:SteveM@iphc.int</span></a>]<span class="xapple-converted-space"> </span><br>
<b>Sent:</b><span class="xapple-converted-space"> </span>Friday, June 27, 2014 1:31 PM<br>
<b>To:</b><span class="xapple-converted-space"> </span>Mark Maunder<br>
<b>Cc:</b><span class="xapple-converted-space"> </span><a href="mailto:developers@admb-project.org" style="color:purple; text-decoration:underline"><span style="color:purple">developers@admb-project.org</span></a>; Alexandre Aires-Da-Silva; Carolina Minte-Vera;
Sean Patrick Cox<br>
<b>Subject:</b><span class="xapple-converted-space"> </span>Re: [Developers] Template functions and documentation</span></div>
</div>
</div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
Sorry I pulled the send trigger to quickly, the baby woke up!</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
What I was getting at is when you have function that returns a type that is not passed as one of the arguments. You can still use a template function but when you call it, you have to specify what the return type is. eg</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
len = vonB<dvar_vector>(age,linf,k,ro);</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
In this case you would write the template as:</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
template<typename t1, typename t2, typename t3></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
t1 vonB(const t2 age, const t3 linf, const t3 k,const t3 to)</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
Steve</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
</div>
<div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
On Jun 27, 2014, at 12:19 PM, Mark Maunder <<a href="mailto:mmaunder@iattc.org" style="color:purple; text-decoration:underline"><span style="color:purple">mmaunder@iattc.org</span></a>> wrote:</div>
</div>
<div>
<p class="MsoNormal" style="margin:0in 0in 12pt; font-size:12pt; font-family:'Times New Roman',serif">
</p>
</div>
<div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif; color:rgb(31,73,125)">Steve,</span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif; color:rgb(31,73,125)"> </span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
Re: In this case, the function returns a dvector, but assigns it to a dvar_vector. </div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
Yes, I recognize this. I think this can be solved by overloading the template with an explicit type for the return variable or making the return variable a third type.</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
Mark</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif; color:rgb(31,73,125)"> </span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif; color:rgb(31,73,125)"> </span></div>
</div>
<div>
<div style="border-style:solid none none; border-top-color:rgb(181,196,223); border-top-width:1pt; padding:3pt 0in 0in">
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<b><span style="font-size:10pt; font-family:Tahoma,sans-serif">From:</span></b><span class="xapple-converted-space"><span style="font-size:10pt; font-family:Tahoma,sans-serif"> </span></span><span style="font-size:10pt; font-family:Tahoma,sans-serif">Steve
Martell [<a href="mailto:SteveM@iphc.int" style="color:purple; text-decoration:underline"><span style="color:purple">mailto:SteveM@iphc.int</span></a>]<span class="xapple-converted-space"> </span><br>
<b>Sent:</b><span class="xapple-converted-space"> </span>Friday, June 27, 2014 11:31 AM<br>
<b>To:</b><span class="xapple-converted-space"> </span>Mark Maunder<br>
<b>Cc:</b><span class="xapple-converted-space"> </span><a href="mailto:developers@admb-project.org" style="color:purple; text-decoration:underline"><span style="color:purple">developers@admb-project.org</span></a>; Alexandre Aires-Da-Silva; Carolina Minte-Vera;
Sean Patrick Cox<br>
<b>Subject:</b><span class="xapple-converted-space"> </span>Re: [Developers] Template functions and documentation</span></div>
</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
</div>
</div>
<div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
Hi Mark, Alex, Carolina</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
Attached is a pretty comprehensive book on using template classes and template functions in C++. Its a great way to fall asleep at night.</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
There is a lot of things you can do with templates, but from my naive perspective its a great way to reduce the need for function overloading and only have a single copy of the function to maintain. The primary thing to remember is that the compiler will write
the actual code that gets implemented; therefore, the function templates are usually found in the header file (.h or .htp, or .hpp).</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
One thing to be aware of is return types that differ from the types passed to the function arguments. For example:</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
in the vonb.hpp file:</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
template<typename t1, typename t2></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
t1 vonB(const t1 age, const t2 linf, const t2, vonbk)</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
{</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
return(linf*(1.-exp(-vonbk*age)));</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
}</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
in your tpl file:</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
dvector age(1,5);</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
age.fill_seqadd(1,1);</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
dvar_vector len(1,5);</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
len = vonB(age,linf,vbk);</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
In this case, the function returns a dvector, but assigns it to a dvar_vector. And this will be problematic.</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
Steve</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
On Jun 27, 2014, at 11:05 A</div>
</div>
</div>
<div>
<div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
M, Mark Maunder <<a href="mailto:mmaunder@iattc.org" style="color:purple; text-decoration:underline"><span style="color:purple">mmaunder@iattc.org</span></a>> wrote:</div>
</div>
<div>
<div style="margin-bottom:12pt">
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
</div>
</div>
</div>
<div>
<div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif">Hi developers,</span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif"> </span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif">I am in the process or putting together a model that will be used to evaluate several growth equations so I thought I better try to use the ADMB project “approved” approach for writing the functions.
Below is a template function and documentation for the von Bertalanffy growth equation. I would appreciate any advice on doing this “correctly”.</span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif"> </span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif">Thanks,</span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif"> </span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif">Mark</span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif"> </span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif">/**</span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif">\defgroup CONTRIB Contributed libraries</span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif">*/</span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif"> </span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif">/**</span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif">\ingroup CONTRIB</span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif">\defgroup CAPAM CAPAM created functions</span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif">*/</span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif"> </span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif">#include <admodel.h></span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif"> </span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif">/** von Bertalanffy growth equation; constant objects.</span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif"> \ingroup CAPAM</span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif"> \brief Calculate the length from a given age based on the von Bertalanffy equation. Written by Mark Maunder.</span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif"> \param age age of individual, \f$a\f$.</span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif"> \param Linf asymptotic length, \f$L_inf\f$.</span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif"> \param K growth rate, \f$K\f$.</span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif"> \param t0 age at zero length, \f$t_0\f$.</span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif"> \return length predicted length of individual. \f$L_inf*(1-exp(-K*(a-t0)))\f$.</span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif"> */</span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif"> </span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif">template <typename type1, typename type1></span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif">//can have multiple types so that they are used below in variable definitions, they can differ between function calls, but remain the same within a function call</span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif">//type1 is probably a long</span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif">//type2 is probably a dvariable (either a model parameter (Linf K t0) or a derived variable (length))</span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif">//may need a type3, which is a dvar_vector if age and length are vectors, where type 1 will be a vector</span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif">type1 vonB(const type1 &age, const type2 &Linf, const type2 &K, const type2 &t0)</span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif">{</span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif"> type2 length = Linf*(1.-mfexp(-K*(age-t0)));</span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif"> return (length);</span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif">} </span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif"> </span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif"> </span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif">//is length a bad word to use</span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif">//do we use ingroup for both groups and subgroups in doxygen documentation</span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif">//should we use mfexp?</span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif">//what if age and length are vectors, but age is a vector and length is a dvar_vector, do we need to overload the type with one with three variable types</span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif">//I couldn't work out how to put in the detailed description</span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif">//The equations did not work on my computer</span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif"> </span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif"> </span></div>
</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:13.5pt; font-family:Helvetica,sans-serif">_______________________________________________<br>
Developers mailing list<br>
<a href="mailto:Developers@admb-project.org" style="color:purple; text-decoration:underline"><span style="color:purple">Developers@admb-project.org</span></a><br>
<a href="http://lists.admb-project.org/mailman/listinfo/developers" style="color:purple; text-decoration:underline"><span style="color:purple">http://lists.admb-project.org/mailman/listinfo/developers</span></a></span></div>
</div>
</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
</div>
</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
</div>
</div>
<div class="MsoNormal" align="center" style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif; text-align:center">
<hr size="3" width="100%" align="center">
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:7.5pt; font-family:Arial,sans-serif; color:gray"><br>
This internet e-mail message, and any files transmitted with it, contains confidential, privileged information that is intended only for the addressee. If you have received this e-mail message in error, please call us at (206) 634-1838 collect if necessary)
and ask to speak to the message sender. Nothing in this e-mail or the act of transmitting it, is to be construed as a waiver of any rights or privileges enjoyed by the sender or the International Pacific Halibut Commission pursuant to the International Organizations
Immunities Act, 22 U.S.C. Sec. 288 et seq.</span></div>
</div>
</div>
</div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
</div>
</div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
</div>
<div class="MsoNormal" align="center" style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif; text-align:center">
<hr size="3" width="100%" align="center">
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:7.5pt; font-family:Arial,sans-serif; color:gray"><br>
This internet e-mail message, and any files transmitted with it, contains confidential, privileged information that is intended only for the addressee. If you have received this e-mail message in error, please call us at (206) 634-1838 collect if necessary)
and ask to speak to the message sender. Nothing in this e-mail or the act of transmitting it, is to be construed as a waiver of any rights or privileges enjoyed by the sender or the International Pacific Halibut Commission pursuant to the International Organizations
Immunities Act, 22 U.S.C. Sec. 288 et seq.</span></div>
</div>
</div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:13.5pt; font-family:Helvetica,sans-serif"><br>
<br>
</span></div>
<pre style="margin:0in 0in 0.0001pt; font-size:10pt; font-family:'Courier New'">_______________________________________________</pre>
<pre style="margin:0in 0in 0.0001pt; font-size:10pt; font-family:'Courier New'">Developers mailing list</pre>
<pre style="margin:0in 0in 0.0001pt; font-size:10pt; font-family:'Courier New'"><a href="mailto:Developers@admb-project.org" style="color:purple; text-decoration:underline"><span style="color:purple">Developers@admb-project.org</span></a></pre>
<pre style="margin:0in 0in 0.0001pt; font-size:10pt; font-family:'Courier New'"><a href="http://lists.admb-project.org/mailman/listinfo/developers" style="color:purple; text-decoration:underline"><span style="color:purple">http://lists.admb-project.org/mailman/listinfo/developers</span></a></pre>
</blockquote>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:13.5pt; font-family:Helvetica,sans-serif"> </span></div>
</blockquote>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:13.5pt; font-family:Helvetica,sans-serif"> </span></div>
<div class="MsoNormal" align="center" style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif; text-align:center">
<span style="font-size:13.5pt; font-family:Helvetica,sans-serif">
<hr size="3" width="100%" align="center">
</span></div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:7.5pt; font-family:Arial,sans-serif; color:gray"><br>
This internet e-mail message, and any files transmitted with it, contains confidential, privileged information that is intended only for the addressee. If you have received this e-mail message in error, please call us at (206) 634-1838 collect if necessary)
and ask to speak to the message sender. Nothing in this e-mail or the act of transmitting it, is to be construed as a waiver of any rights or privileges enjoyed by the sender or the International Pacific Halibut Commission pursuant to the International Organizations
Immunities Act, 22 U.S.C. Sec. 288 et seq.<br>
</span><span style="font-size:13.5pt; font-family:Helvetica,sans-serif">_______________________________________________<br>
Developers mailing list<br>
<a href="mailto:Developers@admb-project.org" style="color:purple; text-decoration:underline"><span style="color:purple">Developers@admb-project.org</span></a><br>
<a href="http://lists.admb-project.org/mailman/listinfo/developers" style="color:purple; text-decoration:underline"><span style="color:purple">http://lists.admb-project.org/mailman/listinfo/developers</span></a></span></div>
</div>
</div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
</div>
</div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
</div>
<div class="MsoNormal" align="center" style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif; text-align:center">
<hr size="3" width="100%" align="center">
</div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:7.5pt; font-family:Arial,sans-serif; color:gray"><br>
This internet e-mail message, and any files transmitted with it, contains confidential, privileged information that is intended only for the addressee. If you have received this e-mail message in error, please call us at (206) 634-1838 collect if necessary)
and ask to speak to the message sender. Nothing in this e-mail or the act of transmitting it, is to be construed as a waiver of any rights or privileges enjoyed by the sender or the International Pacific Halibut Commission pursuant to the International Organizations
Immunities Act, 22 U.S.C. Sec. 288 et seq.</span></div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
<br>
<hr>
<font face="Arial" color="Gray" size="1"><br>
This internet e-mail message, and any files transmitted with it, contains confidential, privileged information that is intended only for the addressee. If you have received this e-mail message in error, please call us at (206) 634-1838 collect if necessary)
and ask to speak to the message sender. Nothing in this e-mail or the act of transmitting it, is to be construed as a waiver of any rights or privileges enjoyed by the sender or the International Pacific Halibut Commission pursuant to the International Organizations
Immunities Act, 22 U.S.C. Sec. 288 et seq.<br>
</font>
</body>
</html>