ADMB Documentation  11.1.2261
 All Classes Files Functions Variables Typedefs Friends Defines
drancau.cpp
Go to the documentation of this file.
00001 /*
00002  * $Id: drancau.cpp 1919 2014-04-22 22:02:01Z johnoel $
00003  *
00004  * Author: David Fournier
00005  * Copyright (c) 2008-2012 Regents of the University of California
00006  */
00011 #include "fvar.hpp"
00012 
00017 double randcau(const random_number_generator& rng)
00018 {
00019   double u=inv_cumd_cauchy(((random_number_generator&) rng).better_rand());
00020   return(u);
00021 }
00022 
00027 void dvector::fill_randcau(const random_number_generator& rng)
00028 {
00029   for (int i=indexmin(); i<=indexmax(); i++)
00030   {
00031     (*this)(i)=randcau(rng);
00032   }
00033 }
00034 
00039 void dmatrix::fill_randcau(const random_number_generator& rng)
00040 {
00041   for (int i=rowmin(); i<=rowmax(); i++)
00042   {
00043     elem(i).fill_randcau(rng);
00044   }
00045 }
00046 
00051 void d3_array::fill_randcau(const random_number_generator& rng)
00052 {
00053   for (int i=slicemin(); i<=slicemax(); i++)
00054   {
00055     elem(i).fill_randcau(rng);
00056   }
00057 }