ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
admodel.h
Go to the documentation of this file.
1 /*
2  * $Id$
3  *
4  * Author: David Fournier
5  * Copyright (c) 2008-2012 Regents of the University of California
6  *
7  * ADModelbuilder and associated libraries and documentations are
8  * provided under the general terms of the "BSD" license.
9  *
10  * License:
11  *
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions are
14  * met:
15  *
16  * 1. Redistributions of source code must retain the above copyright
17  * notice, this list of conditions and the following disclaimer.
18  *
19  * 2. Redistributions in binary form must reproduce the above copyright
20  * notice, this list of conditions and the following disclaimer in the
21  * documentation and/or other materials provided with the distribution.
22  *
23  * 3. Neither the name of the University of California, Otter Research,
24  * nor the ADMB Foundation nor the names of its contributors may be used
25  * to endorse or promote products derived from this software without
26  * specific prior written permission.
27  *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39  *
40  */
45 #ifndef _ADMODEL_H_
46 #define _ADMODEL_H_
47 
48 #define USE_SHARE_FLAGS
49 //#define DO_PROFILE
50 #define __MINI_MAX__
51 #if defined(__GNUC__) && (__GNUC__ < 3)
52  #pragma interface
53 #endif
54 
55 #include <limits>
56 
57 #include <vector>
58 
61 
62 #include <fvar.hpp>
63 
64 //#include <d4arr.hpp>
65 #include <cifstrem.h>
66 
67 #include <adstring.hpp>
68 class init_xml_doc;
69 
70 //#define _ADSTD_ std::
71 #define param_matrix named_dvar_matrix
72 #define param_vector named_dvar_vector
73 #define param_number named_dvariable
74 #define param_3array named_dvar3_array
75 #define param_4array named_dvar4_array
76 #define param_5array named_dvar5_array
77 #define param_6array named_dvar6_array
78 #define param_7array named_dvar7_array
79 
80 #define SPparam_matrix SPnamed_dvar_matrix
81 #define SPparam_vector SPnamed_dvar_vector
82 #define SPparam_number SPnamed_dvariable
83 #define SPparam_3array SPnamed_dvar3_array
84 #define SPparam_4array SPnamed_dvar4_array
85  double mfexp(const double);
86  dvariable mfexp(const prevariable& v1);
88  dvector mfexp(const dvector&);
89 
91  extern int AD_gaussflag;
92 
93  extern function_minimizer * pfm;
94  extern int traceflag;
95  extern int ADqd_flag;
96 /*
97  void set_value_inv(const dvariable& x, const dvector& v, const int& ii);
98  void set_value_inv(const dvar_matrix& x, const dvector& v, const int& ii);
99  void set_value_inv(const dvar_vector&, const dvector&, const int &ii);
100  void set_value_inv(const dvariable& u, const dvector& x, const int& ii,
101  const double fmin, const double fmax);
102  void set_value_inv(const dvar_matrix& u, const dvector& x, const int& ii,
103  const double fmin,const double fmax);
104  void set_value_inv(const dvar3_array& u, const dvector& x, const int& ii,
105  const double fmin,const double fmax);
106  void set_value_inv(const dvar3_array& u, const dvector& x, const int& ii);
107 */
108 
109  void copy_value_to_vector(const prevariable& x, const dvector& v,
110  const int& ii);
111  void copy_value_to_vector(const dvar_vector& x, const dvector& v,
112  const int& ii);
113  void copy_value_to_vector(const dvar_matrix& x, const dvector& v,
114  const int& ii);
115  void copy_value_to_vector(const dvar3_array& x, const dvector& v,
116  const int& ii);
117 
118  void restore_value_from_vector(const prevariable& x, const dvector& v,
119  const int& ii);
120  void restore_value_from_vector(const dvar_vector& x, const dvector& v,
121  const int& ii);
122  void restore_value_from_vector(const dvar_matrix& x, const dvector& v,
123  const int& ii);
125  const int& ii);
126 
132 {
133 public:
134 #if defined (_BORLANDC_)
135  exception * err;
136  AD_matherror(exception * _err) : err(_err) {;}
137 #endif
138 #if defined (_MSC_VER)
139  _exception * err;
140  AD_matherror(_exception * _err) : err(_err) {;}
141 #endif
142 };
143 
144 class model_data;
145 
151 {
152  const char * name;
153  friend ostream& operator<<(const ostream& s, const label_class& lc);
154  friend class model_name_tag;
155 public:
156  const char * mychar(void) { return name;}
157  label_class(const char * s){name=s;}
158 };
159 
165 {
166 protected:
168  //friend ostream& operator<<(const ostream& os, const model_name_tag& mnt);
169 public:
170  model_name_tag(void){;}
171  void allocate(const char * s);
172  label_class label(void){return (char*)(name);}
173  const char * get_name(void) { return name;}
174 };
175 
181 {
182 public:
186  named_dvar_vector& operator=(const double m);
188  void allocate(int mmin,int mmax,const char * s);
189  void allocate(const char * s);
190 };
191 
197 {
198 public:
202  equality_constraint_vector& operator=(const double m);
204  void allocate(int mmin,int mmax,const char * s);
205 };
206 
212 {
213 public:
217  inequality_constraint_vector& operator=(const double m);
219  void allocate(int mmin,int mmax,const char * s);
220 };
221 
227 {
228  double * pd;
229 public:
231  void allocate(double *_pd,int mmin,int mmax,const char * s);
234  dll_param_vector& operator=(const double m);
236 };
237 
243 {
244  //named_dvariable& operator=(const dvariable& m);
245 public:
247  void allocate(const char * s);
249  named_dvariable& operator=(const double m);
250 };
251 
257 {
258  double * pd;
259 public:
260  //named_dvariable(void) : dvariable(), model_name_tag() {;}
261  void allocate(double *_d,const char * s);
263  dll_param_number& operator=(const double m);
264  virtual ~dll_param_number();
265 };
266 
272 {
273 public:
275  void allocate(int rmin,int rmax,int cmin,int cmax,const char * s);
276  void allocate(int rmin,int rmax,const char * s);
277  void allocate(const char * s);
278  //void allocate(int rmin,int rmax,int,const ivector&, const char * s);
279  void allocate(
280  int rmin, int rmax,
281  const index_type& cmin, const index_type& cmax,
282  const char* s);
283  named_dvar_matrix& operator=(const double m);
287 };
288 
294 {
295  double * pd;
296 public:
297  //named_dvar_matrix(void) : dvar_matrix(), model_name_tag() {;}
298  void allocate(double * ,int rmin,int rmax,int cmin,int cmax,const char * s);
299  void allocate(double * ,int rmin,int rmax,const index_type&
300  ,const index_type& ,const char * s);
302  dll_param_matrix & operator = (const double m);
305  virtual ~dll_param_matrix();
306 };
307 
313 {
314 public:
316  void allocate(const ad_integer& sl,const ad_integer& sh,
317  const index_type& nrl,const index_type& nrh,const index_type& ncl,
318  const index_type& nch,const char * s="UNNAMED");
319  void allocate(int hsl,int hsu,int rmin,int rmax,int cmin,int cmax,
320  const char * s="UNNAMED");
321 
322  void allocate(int hsl,int hsu,int rmin,int rmax,const char * s="UNNAMED");
323  void allocate(int hsl,int hsu,const index_type& rmin,const index_type& rmax,
324  const char * s="UNNAMED");
325  void allocate(int hsl,int hsu,const char * s="UNNAMED");
326  void allocate(const char * s="UNNAMED");
327  void allocate(int hsl, int hsu, const ivector& rmin, int rmax,
328  int cmin, int cmax, const char *s = "UNNAMED");
329  void allocate(int hsl, int hsu, int rmin, const ivector& rmax,
330  int cmin,int cmax,const char * s="UNNAMED");
331  void allocate(int hsl, int hsu, const ivector& rmin, const ivector& rmax,
332  int cmin,int cmax,const char * s="UNNAMED");
333  void allocate(int hsl, int hsu, int rmin, int rmax, const ivector& cmin,
334  int cmax,const char * s="UNNAMED");
335  void allocate(int hsl, int hsu, int rmin, int rmax, const ivector& cmin,
336  const ivector& cmax, const char *s = "UNNAMED");
337  void allocate(int hsl,int hsu,int rmin,int rmax,int cmin,
338  const ivector& cmax, const char *s = "UNNAMED");
341 };
342 
348 {
349 public:
351  void allocate(int hhsl,int hhsu,int hsl,int hsu,int rmin,int rmax,
352  int cmin,int cmax,const char * s);
354  const index_type&,const index_type&,const index_type&,const index_type&,
355  const char *s);
356 
358  const index_type&,const index_type&,const char *s);
359 
361  const char *s);
362  void allocate(ad_integer,ad_integer,const char *s);
363  void allocate(const char *s);
364 
365  void allocate(int hhsl,int hhsu,int hsl,int hsu,int rmin,int rmax,
366  const char * s);
367  void allocate(int hhsl,int hhsu,int hsl,int hsu,const char * s);
368  void allocate(int hhsl,int hhsu,const char * s);
369 
372 };
373 
379 {
380 public:
382  void allocate(int hhsl,int hhsu,int hsl,int hsu,int rmin,int rmax,
383  int cmin,int cmax,
384  int l5,int u5,
385  const char * s);
386 
387  void allocate(const ad_integer& hhsl,const ad_integer& hhsu,
388  const index_type& hsl,const index_type& hsu,
389  const index_type& sl,const index_type& sh,
390  const index_type& nrl,const index_type& nrh,
391  const index_type& ncl,const index_type& nch,
392  const char * s);
393 
396 };
397 
403 {
404 public:
406  void allocate(int hhsl,int hhsu,
407  int hsl,int hsu,
408  int rmin,int rmax,
409  int cmin,int cmax,
410  int l5,int u5,
411  int l6,int u6,
412  const char * s);
413 
414  void allocate(const ad_integer& hhsl,const ad_integer& hhsu,
415  const index_type& hsl,const index_type& hsu,
416  const index_type& sl,const index_type& sh,
417  const index_type& nrl,const index_type& nrh,
418  const index_type& ncl,const index_type& nch,
419  const index_type& l5,const index_type& u5,
420  const char * s);
421 
424 };
425 
431 {
432 public:
434  void allocate(
435  int hhsl,int hhsu,
436  int hsl,int hsu,
437  int rmin,int rmax,
438  int cmin,int cmax,
439  int l5,int u5,
440  int l6,int u6,
441  int l7,int u7,
442  const char * s);
443 
444  void allocate(const ad_integer& hhsl,const ad_integer& hhsu,
445  const index_type& hsl,const index_type& hsu,
446  const index_type& sl,const index_type& sh,
447  const index_type& nrl,const index_type& nrh,
448  const index_type& ncl,const index_type& nch,
449  const index_type& l5,const index_type& u5,
450  const index_type& l6,const index_type& u6,
451  const char * s);
452 
455 };
456 
461 class named_dvector : public dvector, public model_name_tag
462 {
463 public:
465  void allocate(int mmin,int mmax,const char * s);
466  void allocate(const char * s);
467  void allocate(int mmin, const ivector& mmax, const char *s);
468  named_dvector& operator=(const dvector& m);
469  named_dvector& operator=(const double m);
470 };
471 
476 class named_ivector : public ivector, public model_name_tag
477 {
478 protected:
480  void allocate(int mmin,int mmax,const char * s);
481 };
482 
487 class named_dmatrix : public dmatrix, public model_name_tag
488 {
489 protected:
491  void allocate(int rmin,int rmax,const char * s);
492  void allocate(const char * s);
493  void allocate(int rmin,int rmax,int cmin,int cmax,const char * s);
494  void allocate(int rmin,int rmax,const ivector& cmin,int cmax,const char * s);
495  void allocate(int rmin,int rmax,const ivector& cmin,const ivector& cmax,
496  const char * s);
497  void allocate(int rmin,int rmax,int cmin,const ivector& cmax,const char * s);
498  named_dmatrix& operator=(const dmatrix& m);
499  named_dmatrix& operator=(const double m);
500 };
501 
506 class named_imatrix : public imatrix, public model_name_tag
507 {
508 protected:
510  void allocate(int rmin,int rmax,int cmin,int cmax,const char * s);
511  void allocate(int rmin, int rmax, const index_type& cmin,
512  const index_type& cmax, const char *s);
513  named_imatrix& operator=(const imatrix& m);
514  named_imatrix& operator=(const int& m);
515 };
516 
521 class named_d3_array : public d3_array, public model_name_tag
522 {
523 protected:
525  void allocate(int hsl,int hsu,int rmin,int rmax,int cmin,int cmax,
526  const char * s);
527  void allocate(int hsl, int hsu, const index_type& rmin,
528  const index_type& rmax, const index_type& cmin,
529  const index_type& cmax, const char *s);
530  void allocate(int hsl, int hsu, const ivector& rmin, int rmax,
531  int cmin,int cmax,const char * s);
532  void allocate(int hsl, int hsu, int rmin, const ivector& rmax,
533  int cmin,int cmax,const char * s);
534  void allocate(int hsl, int hsu, const ivector& rmin, const ivector& rmax,
535  int cmin,int cmax,const char * s);
536  void allocate(int hsl, int hsu, int rmin, int rmax, const ivector& cmin,
537  int cmax, const char * s);
538  void allocate(int hsl,int hsu,int rmin,int rmax,int cmin,
539  const ivector& cmax, const char *s);
540  void allocate(int hsl, int hsu, int rmin, int rmax, const ivector& cmin,
541  const ivector& cmax, const char *s);
542  named_d3_array& operator=(const d3_array& m);
543 
544  void allocate(int hsl,int hsu,const index_type& rmin,const index_type& rmax,
545  const char * s);
546  void allocate(int hsl,int hsu,int rmin,int rmax,const char * s);
547  void allocate(int hsl,int hsu,const char * s);
548  void allocate(const char * s);
549 };
550 
555 class named_i3_array : public i3_array, public model_name_tag
556 {
557 protected:
559  void allocate(int hsl,int hsu,int rmin,int rmax,int cmin,int cmax,
560  const char * s);
561  void allocate(int hsl, int hsu, const index_type& rmin,
562  const index_type& rmax, const index_type& cmin,
563  const index_type& cmax, const char *s);
564  named_i3_array& operator=(const i3_array& m);
565 };
566 
571 class named_d4_array : public d4_array, public model_name_tag
572 {
573 protected:
576  const index_type&,const index_type&,const index_type&,const index_type&,
577  const char * s);
578  void allocate(int hhsl,int hhsu,int hsl,int hsu,int rmin,
579  int rmax,int cmin,int cmax,const char * s);
580 
581  void allocate(int hhsl,int hhsu,int hsl,int hsu,int rmin,
582  int rmax,const char * s);
583  void allocate(int hhsl,int hhsu,int hsl,int hsu,const char * s);
584  void allocate(int hhsl,int hhsu,const char * s);
585  void allocate(const char * s);
586 
588  const index_type&,const index_type&,const char * s);
590  const char * s);
591  void allocate(ad_integer,ad_integer,const char * s);
592 
593 
594  named_d4_array& operator=(const d4_array& m);
595 };
596 class named_i4_array : public i4_array, public model_name_tag
597 {
598 protected:
601  const index_type&,const index_type&,const index_type&,const index_type&,
602  const char * s);
603  void allocate(int hhsl,int hhsu,int hsl,int hsu,int rmin,
604  int rmax,int cmin,int cmax,const char * s);
605 
606  void allocate(int hhsl,int hhsu,int hsl,int hsu,int rmin,
607  int rmax,const char * s);
608  void allocate(int hhsl,int hhsu,int hsl,int hsu,const char * s);
609  void allocate(int hhsl,int hhsu,const char * s);
610  void allocate(const char * s);
611 
613  const index_type&,const index_type&,const char * s);
615  const char * s);
616  void allocate(ad_integer,ad_integer,const char * s);
617 
618 
619  named_i4_array& operator=(const i4_array& m);
620 };
621 
626 class named_d5_array : public d5_array, public model_name_tag
627 {
628 protected:
630  void allocate(int l5,int u5,int hhsl,int hhsu,int hsl,int hsu,int rmin,
631  int rmax,int cmin,int cmax,const char * s);
632  void allocate(const ad_integer& hhsl,const ad_integer& hhsu,
633  const index_type& hsl,const index_type& hsu, const index_type& sl,
634  const index_type& sh,const index_type& nrl,const index_type& nrh,
635  const index_type& ncl,const index_type& nch,const char * s);
636 
637  named_d5_array& operator=(const d5_array& m);
638 };
639 
644 class named_d6_array : public d6_array, public model_name_tag
645 {
646 protected:
648  void allocate(int l6,int u6,int l5,int u5,int hhsl,int hhsu,int hsl,
649  int hsu,int rmin,int rmax,int cmin,int cmax,const char * s);
650  void allocate(const ad_integer& l6,const ad_integer& u6,
651  const index_type& l5,const index_type& u5,
652  const index_type& hhsl,const index_type& hhsu,
653  const index_type& hsl,const index_type& hsu,
654  const index_type& sl,const index_type& sh,
655  const index_type& nrl,const index_type& nrh,
656  const char * s);
657 
658  named_d6_array& operator=(const d6_array& m);
659 };
660 
665 class named_d7_array : public d7_array, public model_name_tag
666 {
667 protected:
669  void allocate(int l7,int u7,int l6,int u6,int l5,int u5,int hhsl,
670  int hhsu,int hsl,int hsu,int rmin,int rmax,int cmin,int cmax,
671  const char * s);
672  void allocate(const ad_integer& l7,const ad_integer& u7,
673  const index_type& l6,const index_type& u6,
674  const index_type& l5,const index_type& u5,
675  const index_type& hhsl,const index_type& hhsu,
676  const index_type& hsl,const index_type& hsu,
677  const index_type& sl,const index_type& sh,
678  const index_type& nrl,const index_type& nrh,
679  const char * s);
680 
681  named_d7_array& operator=(const d7_array& m);
682 };
683 
684 
685 class function_minimizer;
686 
687 #if defined(USE_ADPVM)
688 
693 {
694  static pvm_params * varsptr[]; // this should be a resizeable array
695  static int num_pvm_params;
696  static const int maxnum_pvm_params;
697  void add_to_list(void);
698  virtual void send_to_slaves(void)=0;
699  virtual void get_from_master(void)=0;
700 public:
701  static void pvm_params::send_all_to_slaves(void);
702  static void pvm_params::get_all_from_master(void);
703  void allocate(const char *);
704  void allocate(void);
705 };
706 
711 class pvm_number : public pvm_params
712 {
713 public:
714  virtual void send_to_slaves(void);
715  virtual void get_from_master(void);
717  double d;
718  operator double();
719  void assign(const dvector&);
720  void assign(double);
721 };
722 
727 class pvm_int : public pvm_params
728 {
729 public:
730  virtual void send_to_slaves(void);
731  virtual void get_from_master(void);
733  int d;
734  operator int();
735  void assign(const ivector&);
736  void assign(int);
737 };
738 #endif // #if defined(USE_ADPVM)
739 
742 
747 {
748  unsigned int current;
749  unsigned int current_size;
750  typedef void* ptovoid;
752  void resize(void);
753  std::vector<void*> list;
754  void add_to_list(void*);
755 
756 public:
757  adlist_ptr();
758  adlist_ptr(const adlist_ptr&) = delete;
759  adlist_ptr(adlist_ptr&&) = delete;
760  ~adlist_ptr();
761 
762  void initialize();
763 
764  void allocate(unsigned int init_size);
765 
766  pinitial_params& operator[](int i);
767 
768  friend class initial_params;
769 };
770 
771 #if defined(USE_SHARE_FLAGS)
772 
777  class shareinfo
778  {
785  int maxshare;
787  public:
788  void get_inv_matrix_shared( int _cf);
789  void get_inv_vector_shared( int _cf);
790  int & get_maxshare(void) { return maxshare; }
791  i3_array & get_bmap(void);
792  int & get_dimension(void){ return dimension;}
794  index_type * get_shareflags(void);
795  int& get_current_phase(void);
796  index_type * get_activeflags(void);
797  index_type * get_invflags(void);
798  void set_shareflags(const index_type& sf);
799  void set_original_shareflags(const index_type& sf);
800  void reset_shareflags(const index_type& sf);
801  void set_activeflags(const index_type& af);
802  void set_bmap(const i3_array& af);
803  void reset_bmap(const i3_array& af);
804  void set_invflags(const index_type& af);
805  shareinfo(const index_type& sf,const index_type& af);
806  ~shareinfo();
807  };
808 #endif
809 
815 {
816 protected:
817 #if defined(USE_SHARE_FLAGS)
819 #endif
820  virtual ~initial_params();
824  double scalefactor;
825 public:
826 #if defined(USE_SHARE_FLAGS)
827  virtual void setshare(const index_type& sf,const index_type& af);
828  virtual void shared_set_value_inv(const dvector&,const int&);
829  virtual void shared_set_value(const dvar_vector&,const int&,
830  const dvariable& pen);
831  virtual int shared_size_count(void); // get the number of active parameters
832 #endif
833  double get_scalefactor();
834  void set_scalefactor(const double);
835  //Resizeable arrays
836  static int num_initial_params;
841  static int max_number_phases;
842  static int current_phase;
843  static int restart_phase;
844  static int sd_phase;
845  static bool in_hessian_phase;
846  static int mc_phase;
847  static int mceval_phase;
851  virtual void set_random_effects_active();
852  void restore_phase_start(void);
853  virtual void set_random_effects_inactive();
854  virtual void set_only_random_effects_active();
855  virtual void set_only_random_effects_inactive();
856  virtual void set_value(const dvar_vector&, const int&,
857  const dvariable& pen) = 0;
858  virtual void dev_correction(const dmatrix&, const int&) = 0;
859  void set_initial_value(double x);
860  double get_initial_value(void);
861  void set_phase_start(int x);
862  int get_phase_start(void);
863  static void set_all_simulation_bounds(const dmatrix& symbds);
864  static void set_all_simulation_bounds(const dmatrix& symbds, const dvector&);
865  static void get_jacobian_value(const dvector& y, const dvector& jac);
866  static int correct_for_dev_objects(const dmatrix &H);
867  virtual void set_simulation_bounds(const dmatrix& symbds, const int& ii) = 0;
868  //virtual void set_simulation_bounds(const dmatrix&, const dvector& symbds,
869  // const int& ii) = 0;
870  virtual void set_value_inv(const dvector&, const int&) = 0;
871  virtual void add_value(const dvector&, const int&) = 0;
872  virtual void add_value(const dvector&, const dvector&, const int&,
873  const double&, const dvector&) = 0;
874  virtual void get_jacobian(const dvector&, const dvector&, const int&) = 0;
875  //virtual void check_tightness(const dvector&, const int&) = 0;
876  virtual void copy_value_to_vector(const dvector&, const int&) = 0;
877  virtual void restore_value_from_vector(const dvector&, const int&) = 0;
878  virtual void sd_scale(const dvector& d, const dvector& x, const int& ii) = 0;
879  virtual void sd_vscale(const dvar_vector& d,const dvar_vector& x,
880  const int& ii)=0;
881  virtual void mc_scale(const dvector& d, const dvector& x, const int& ii) = 0;
882  virtual void curv_scale(const dvector& d, const dvector& x,
883  const int& ii) = 0;
884  virtual void hess_scale(const dvector& d, const dvector& x,
885  const int& ii) = 0;
886  virtual unsigned int size_count() const = 0; // get the number of active parameters
887 
888  // save the objects value in to a text file
889  virtual void save_value(ofstream& ofs) = 0;
890 
891  // save the objects value in a binary file
892  virtual void bsave_value(uostream& uos) = 0;
893 
894  virtual void save_value(const ofstream& ofs, int prec) = 0;
895  virtual void save_value(const ofstream& ofs, int prec,const dvector&,
896  int& offset)=0;
897  virtual const char* label() = 0;
898  void allocate(int _phase_start);
899  void set_active_flag(void);
900  void set_inactive_flag(void);
901  friend int active(const initial_params& ip);
902  static adstring get_reportfile_name(void);
903  initial_params(void);
904  static void xinit(const dvector& x); // get the number of active parameters
905  // get the number of active parameters
906  static void xinit_all(const dvector& x);
907  static void save_all(const ofstream& _ofs,int prec,const dvector&g);
908  // get the number of active parameters
909  static void set_active_random_effects(void);
910  // get the number of active parameters
911  static void set_active_only_random_effects(void);
912  // get the number of active parameters
913  static void set_inactive_only_random_effects(void);
914  // get the number of active parameters
915  static void set_inactive_random_effects(void);
916  // get the number of active parameters
917  static void restore_start_phase(void);
918  static void xinit1(const dvector& x, const dvector& g);
919  //save all initial parameter values in a vector
920  static void copy_all_values(const dvector& x, const int& ii);
921  //get ivalues for all active parameters from a vector
922  static void restore_all_values(const dvector& x, const int& ii);
923  // get the number of active parameters
924  static dvariable reset(const dvar_vector& x);
925  // get the number of active parameters
926  static dvariable reset(const dvector& x);
927  static dvariable reset1(const dvar_vector& x, const dvector& g);
928  // get the number of active parameters
929  static dvariable reset(const dvar_vector& x, const dvector& pen);
930  // get the number of active parameters
931  static dvariable reset_all(const dvar_vector& x,const dvector& pen);
932  static int nvarcalc();
933  static int nvarcalc_all(void);
934  static int num_active_calc(void);
935  static int stddev_scale(const dvector& d, const dvector& x);
936  static int stddev_vscale(const dvar_vector& d,const dvar_vector& x);
937  static int montecarlo_scale(const dvector& d, const dvector& x);
938  static int stddev_curvscale(const dvector& d, const dvector& x);
939  static void read(void);
940  static void save(void);
941  static void save(const ofstream& ofs, int prec);
942  static void restore(const ifstream& ifs);
943  static void add_random_vector(const dvector& x);
944  static void add_random_vector(const dvector& y, const dvector& x,
945  const double& ll, const dvector& diag);
946  virtual void restore_value(const ifstream& ifs) = 0;
947  virtual void add_to_list(void);
948 
949 #if defined(USE_ADPVM)
950  virtual void pvm_pack(void)=0;
951  virtual void pvm_unpack(void)=0;
952 #endif
953 
954  friend class function_minimizer;
955 };
956 
957 void pvm_pack(const dvar_vector&);
958 void pvm_unpack(const dvar_vector&);
959 void pvm_pack(const prevariable&);
960 void pvm_unpack(const prevariable&);
961 void pvm_pack(const dvar_matrix&);
962 void pvm_unpack(const dvar_matrix&);
963 
969 {
970 public:
971 #if defined(USE_SHARE_FLAGS)
972  virtual void setshare(const index_type& sf,const index_type& af);
973  virtual void shared_set_value_inv(const dvector&,const int&);
974  virtual void shared_set_value(const dvar_vector&,const int&,
975  const dvariable& pen);
976  virtual int shared_size_count(void); // get the number of active parameters
977 #endif
978  virtual void dev_correction(const dmatrix& H, const int& ii);
979  virtual const char * label(void);
981 #if defined(USE_ADPVM)
982  void pvm_pack(void){::pvm_pack(*this);}
983  void pvm_unpack(void){::pvm_unpack(*this);}
984 #endif
985  virtual void set_simulation_bounds(const dmatrix& symbds, const int& ii);
986  //virtual void set_simulation_bounds(const dmatrix&, const dvector& symbds,
987  // const int& ii);
988  virtual void add_value(const dvector&, const dvector&, const int&,
989  const double&, const dvector&);
990  virtual void add_value(const dvector&, const int&);
991  virtual void get_jacobian(const dvector&, const dvector&, const int&);
992  virtual void sd_vscale(const dvar_vector& d,const dvar_vector& x,
993  const int& ii);
994 
995  virtual void set_value(const dvar_vector& x, const int& ii,
996  const dvariable& pen);
997  virtual void set_value_inv(const dvector& x, const int& ii);
998  virtual void copy_value_to_vector(const dvector& x, const int& ii);
999  virtual void restore_value_from_vector(const dvector&, const int&);
1000  virtual unsigned int size_count() const;
1001  virtual void sd_scale(const dvector& d, const dvector& x, const int&);
1002  virtual void mc_scale(const dvector& d, const dvector& x, const int&);
1003  virtual void curv_scale(const dvector& d, const dvector& x,const int&);
1004  virtual void hess_scale(const dvector&, const dvector&, const int&){}
1005  virtual void save_value(ofstream& ofs);
1006  virtual void bsave_value(uostream& uos);
1007  virtual void save_value(const ofstream& ofs, int prec);
1008  virtual void save_value(const ofstream& ofs, int prec,const dvector&,
1009  int& offset);
1010  virtual void restore_value(const ifstream& ifs);
1011  void report_value(void);
1012  //virtual void read_value(void);
1013  void allocate(int imin,int imax,int phasestart=1,const char * s="UNNAMED");
1014  void allocate(const ad_integer& imin,const ad_integer& imax,
1015  const ad_integer& phasestart=1,const char * s="UNNAMED");
1016  void allocate(int imin,int imax,const char * s="UNNAMED");
1017 #if defined(USE_SHARE_FLAGS)
1018  void allocate(int imin,int imax,const ivector& ishare,
1019  const char * s="UNNAMED");
1020 #endif
1025  param_init_vector& operator = (const double&);
1027 };
1028 
1034 {
1035  double* pd;
1036 
1037 public:
1038  virtual ~dll_param_init_vector();
1039 
1043  dll_param_init_vector& operator=(const double&);
1044 
1045  void allocate(double* _pd,
1046  int imin, int imax,
1047  int phasestart = 1,
1048  const char* s = "UNNAMED");
1049  void allocate(double* _pd,
1050  int imin, int imax,
1051  const char* s="UNNAMED");
1052 };
1053 
1059 {
1060  virtual void* parent_this(void){return this;}
1061 public:
1062  double get_minb(void);
1063  void set_minb(double b);
1064  double get_maxb() const;
1065  void set_maxb(double b);
1066  double minb;
1067  double maxb;
1069  virtual void dev_correction(const dmatrix&, const int&);
1070  virtual void set_simulation_bounds(const dmatrix& symbds, const int& ii);
1071  virtual void sd_vscale(const dvar_vector& d,const dvar_vector& x,
1072  const int& ii);
1073  //virtual void set_simulation_bounds(const dmatrix&, const dvector& symbds,
1074  // const int& ii);
1075  virtual void add_value(const dvector&, const dvector&, const int&,
1076  const double&, const dvector&);
1077  virtual void add_value(const dvector&, const int&);
1078  virtual void get_jacobian(const dvector&, const dvector&, const int&);
1079  virtual void set_value(const dvar_vector& x, const int& ii,
1080  const dvariable& pen);
1081  virtual void copy_value_to_vector(const dvector& x, const int& ii);
1082  virtual void restore_value_from_vector(const dvector&, const int&);
1083  virtual void set_value_inv(const dvector& x, const int& ii);
1084  virtual unsigned int size_count() const;
1085  virtual void sd_scale(const dvector& d, const dvector& x, const int& ii);
1086  virtual void mc_scale(const dvector& d, const dvector& x, const int&);
1087  virtual void curv_scale(const dvector& d, const dvector& x, const int&);
1088  virtual void hess_scale(const dvector&, const dvector&, const int&){}
1089  void allocate(int imin,int imax,double _minb,double _maxb,
1090  int phasestart=1, const char * name="UNNAMED");
1091  void allocate(int imin,int imax,double _minb,double _maxb,
1092  const char * name="UNNAMED");
1093  //void param_init_bounded_vector::allocate(const ad_integer& imin,
1094  //const ad_integer& imax,const ad_double& _minb,const ad_double& _maxb,
1095  //const ad_integer& phase_start,const char * s);
1097  virtual const char * label(void);
1098  virtual void save_value(const ofstream& ofs, int prec);
1099  virtual void save_value(const ofstream& ofs, int prec,const dvector&,
1100  int& offset);
1101  virtual void restore_value(const ifstream& ifs);
1102  virtual void save_value(ofstream& ofs);
1103  virtual void bsave_value(uostream& uos);
1104  void report_value(void);
1105  //virtual void read_value(void);
1109  param_init_bounded_vector& operator = (const double&);
1110 #if defined(USE_ADPVM)
1111  void pvm_pack(void){::pvm_pack(*this);}
1112  void pvm_unpack(void){::pvm_unpack(*this);}
1113 #endif
1114 };
1115 
1121 {
1122  double * pd;
1123 public:
1124  void allocate(double * _pd,int imin,int imax,double _minb,double _maxb,
1125  int phasestart=1, const char * name="UNNAMED");
1126  void allocate(double * _pd,int imin,int imax,double _minb,double _maxb,
1127  const char * name="UNNAMED");
1129 };
1130 
1136 {
1137  virtual void set_value(const dvar_vector& x, const int& ii,
1138  const dvariable& pen);
1139  virtual void dev_correction(const dmatrix& H, const int& ii);
1140 public:
1144  param_init_bounded_dev_vector& operator = (const double& m);
1145 };
1146 
1152 {
1153 public:
1154  virtual void dev_correction(const dmatrix&, const int&);
1155  virtual void set_simulation_bounds(const dmatrix& symbds, const int& ii);
1156 
1157 #if defined(USE_ADPVM)
1158  void pvm_pack(void){::pvm_pack(*this);}
1159  void pvm_unpack(void){::pvm_unpack(*this);}
1160 #endif
1161 
1162 // virtual void set_simulation_bounds(const dmatrix&, const dvector& symbds,
1163 // const int& ii);
1164  virtual void add_value(const dvector&, const dvector&, const int&,
1165  const double&, const dvector&);
1166  virtual void add_value(const dvector&, const int&);
1167  virtual void get_jacobian(const dvector&, const dvector&, const int&);
1168  virtual void set_value(const dvar_vector& x, const int& ii,
1169  const dvariable& pen);
1170  virtual void copy_value_to_vector(const dvector& x, const int& ii);
1171  virtual void restore_value_from_vector(const dvector&, const int&);
1172  virtual void set_value_inv(const dvector& x, const int& ii);
1173  virtual unsigned int size_count() const;
1174  virtual void save_value(const ofstream& ofs, int prec);
1175  virtual void save_value(const ofstream& ofs, int prec,const dvector&,
1176  int& offset);
1177  virtual void restore_value(const ifstream& ifs);
1178  virtual void save_value(ofstream& ofs);
1179  virtual void bsave_value(uostream& uos);
1180  void report_value(void);
1181  virtual const char * label(void);
1182  virtual void sd_scale(const dvector& d, const dvector& x, const int& ii);
1183  virtual void mc_scale(const dvector& d, const dvector& x, const int&);
1184  virtual void curv_scale(const dvector& d, const dvector& x, const int&);
1185  virtual void hess_scale(const dvector&, const dvector&, const int&){}
1186  virtual void sd_vscale(const dvar_vector& d,const dvar_vector& x,
1187  const int& ii);
1188  //virtual void read_value(void);
1189  void allocate(int phase_start=1,const char *s="UNNAMED");
1190  void allocate(const char *s="UNNAMED");
1191  void allocate(init_xml_doc&, const char *s="UNNAMED");
1195  {
1196  allocate(name);
1197  }
1198  param_init_number& operator=(const double m);
1200 };
1201 
1207 {
1208  double* pd;
1209 public:
1211  virtual ~dll_param_init_number();
1212 
1213  dll_param_init_number& operator=(const double m);
1215 
1216  void allocate(double* pd, int phase_start = 1, const char* s = "UNNAMED");
1217  void allocate(double* pd, const char *s = "UNNAMED");
1218 };
1219 
1220 //forward declaration
1221 class data_vector;
1229 {
1230 public:
1231  double get_minb(void);
1232  void set_minb(double b);
1233  double get_maxb() const;
1234  void set_maxb(double b);
1235  double minb;
1236  double maxb;
1237  void allocate(double _minb,double _maxb,int phase_start=1,
1238  const char * s="UNNAMED");
1239  void allocate(double _minb,double _maxb,const char * s="UNNAMED");
1240  // Added by Steve Martell for using input data for allocation.
1241  void allocate(const data_vector& v,const char * s="UNNAMED");
1242  void allocate(init_xml_doc&, const char * s="UNNAMED");
1243 
1244 #if defined(USE_ADPVM)
1245  void pvm_pack(void){::pvm_pack(*this);}
1246  void pvm_unpack(void){::pvm_unpack(*this);}
1247 #endif
1250  const double new_initial_value,
1251  const double bounds_min,
1252  const double bounds_max,
1253  const int phase_start,
1254  const char* name
1256  {
1257  set_initial_value(new_initial_value);
1258  allocate(bounds_min, bounds_max, phase_start, name);
1259  }
1261  (
1262  const double new_initial_value,
1263  const double bounds_min,
1264  const double bounds_max,
1265  const char* name
1267  {
1268  set_initial_value(new_initial_value);
1269  allocate(bounds_min, bounds_max, 1, name);
1270  }
1271 
1272  virtual void set_simulation_bounds(const dmatrix& symbds, const int& ii);
1273 //virtual void set_simulation_bounds(const dmatrix&, const dvector& symbds,
1274 // const int& ii);
1275  virtual void add_value(const dvector&, const dvector&, const int&,
1276  const double&, const dvector&);
1277  virtual void add_value(const dvector&, const int&);
1278  virtual void get_jacobian(const dvector&, const dvector&, const int&);
1279  virtual void set_value(const dvar_vector& x, const int& ii,
1280  const dvariable& pen);
1281  virtual void copy_value_to_vector(const dvector& x, const int& ii);
1282  virtual void restore_value_from_vector(const dvector&, const int&);
1283  virtual void set_value_inv(const dvector& x, const int& ii);
1284  virtual void sd_scale(const dvector& d, const dvector& x, const int& ii);
1285  virtual void mc_scale(const dvector& d, const dvector& x, const int&);
1286  virtual void curv_scale(const dvector& d, const dvector& x, const int&);
1287  virtual void hess_scale(const dvector&, const dvector&, const int&){}
1288  virtual const char * label(void);
1289  void report_value(void);
1290  param_init_bounded_number& operator=(const double m);
1292  virtual void sd_vscale(const dvar_vector& d,const dvar_vector& x,
1293  const int& ii);
1294 };
1295 
1301 {
1302  double * pd;
1303 public:
1304  void allocate(double * _pd,double _minb,double _maxb,int phase_start=1,
1305  const char * s="UNNAMED");
1306  void allocate(double* _pd,double _minb, double _maxb,const char* s="UNNAMED");
1307 public:
1309  void report_value(void);
1310 };
1311 
1317 {
1318 #if defined(USE_SHARE_FLAGS)
1319  virtual void shared_set_value_inv(const dvector& x,const int& ii);
1320  virtual int shared_size_count(void); // get the number of active parameters
1321  virtual void shared_set_value(const dvar_vector&,const int&,
1322  const dvariable& pen);
1323 #endif
1324  virtual void dev_correction(const dmatrix&, const int&);
1325  virtual void set_simulation_bounds(const dmatrix& symbds,const int& ii);
1326 #if defined(USE_ADPVM)
1327  void pvm_pack(void){::pvm_pack(*this);}
1328  void pvm_unpack(void){::pvm_unpack(*this);}
1329 #endif
1330 //virtual void set_simulation_bounds(const dmatrix&, const dvector& symbds,
1331 // const int& ii);
1332 public:
1333  virtual void add_value(const dvector&, const dvector&, const int&,
1334  const double&, const dvector&);
1335  virtual void add_value(const dvector&, const int&);
1336  virtual void get_jacobian(const dvector&, const dvector&, const int&);
1337  virtual void set_value(const dvar_vector& x, const int& ii,
1338  const dvariable& pen);
1339  virtual void copy_value_to_vector(const dvector& x, const int& ii);
1340  virtual void restore_value_from_vector(const dvector&, const int&);
1341  virtual void set_value_inv(const dvector& x, const int& ii);
1342  virtual unsigned int size_count() const;
1343  virtual void save_value(ofstream& ofs);
1344  virtual void bsave_value(uostream& uos);
1345  virtual void save_value(const ofstream& ofs, int prec,const dvector&,
1346  int& offset);
1347  virtual void save_value(const ofstream& ofs, int prec);
1348  virtual void restore_value(const ifstream& ifs);
1349  void report_value(void);
1350  //virtual void read_value(void);
1351  virtual const char * label(void);
1352  virtual void sd_scale(const dvector& d, const dvector& x, const int& ii);
1353  virtual void mc_scale(const dvector& d, const dvector& x, const int&);
1354  virtual void curv_scale(const dvector& d, const dvector& x, const int&);
1355  virtual void hess_scale(const dvector&, const dvector&, const int&){}
1356  virtual void sd_vscale(const dvar_vector& d,const dvar_vector& x,
1357  const int& ii);
1358 
1359 public:
1360  void allocate(int rmin,int rmax,int cmin,int cmax,
1361  int phase_start=1,const char * = "UNNAMED");
1362 #if defined(USE_SHARE_FLAGS)
1363  //void allocate(int rmin,int rmax,int cmin,int cmax, const imatrix& jshare,
1364  // const char * = "UNNAMED");
1365  virtual void setshare(const index_type& sf,const index_type& af);
1366 #endif
1367  void allocate(int rmin,int rmax,int cmin,int cmax,
1368  const char * = "UNNAMED");
1369  void allocate(const ad_integer& imin,const ad_integer&imax,
1370  const index_type& imin2,const index_type& imax2,
1371  const ad_integer& phase_start, const char * s);
1372  void allocate(const ad_integer& rmin, const ad_integer& rmax,
1373  const index_type& cmin, const index_type& cmax,
1374  const char * = "UNNAMED");
1375  void allocate(const ad_integer& rmin, const ad_integer& rmax,
1376  const index_type& cmin, const index_type& cmax,
1377  int phase_start = 1, const char * = "UNNAMED");
1378  param_init_matrix(void);
1382  param_init_matrix& operator = (const double& m);
1383 };
1384 
1390 {
1391  double * d;
1392 public:
1393  void allocate(double* _d,int rmin,int rmax,int cmin,int cmax,
1394  int phase_start=1,const char * = "UNNAMED");
1395  void allocate(double * _d,int rmin,int rmax,int cmin,int cmax,
1396  const char * = "UNNAMED");
1397  virtual ~dll_param_init_matrix();
1402  dll_param_init_matrix& operator = (const double& m);
1403 };
1404 
1410 {
1411 public:
1412  double get_minb(void);
1413  void set_minb(double b);
1414  double get_maxb() const;
1415  void set_maxb(double b);
1416 protected:
1417  double minb;
1418  double maxb;
1419  virtual void set_simulation_bounds(const dmatrix& symbds, const int& ii);
1420 //virtual void set_simulation_bounds(const dmatrix&, const dvector& symbds,
1421 // const int& ii);
1422  virtual void add_value(const dvector&, const dvector&, const int&,
1423  const double&, const dvector&);
1424  virtual void add_value(const dvector&, const int&);
1425  virtual void get_jacobian(const dvector&, const dvector&, const int&);
1426 public:
1427 #if defined(USE_ADPVM)
1428  void pvm_pack(void){::pvm_pack(*this);}
1429  void pvm_unpack(void){::pvm_unpack(*this);}
1430 #endif
1431  virtual void set_value(const dvar_vector& x, const int& ii,
1432  const dvariable& pen);
1433 #if defined(USE_SHARE_FLAGS)
1434  virtual void shared_set_value_inv(const dvector&,const int&);
1435  virtual void shared_set_value(const dvar_vector&,const int&,
1436  const dvariable& pen);
1437 #endif
1438  virtual void set_value_inv(const dvector& x, const int& ii);
1439  virtual void sd_scale(const dvector& d, const dvector& x, const int& ii);
1440  virtual void mc_scale(const dvector& d, const dvector& x, const int&);
1441  virtual void curv_scale(const dvector& d, const dvector& x, const int&);
1442  virtual void hess_scale(const dvector&, const dvector&, const int&){}
1443  virtual void sd_vscale(const dvar_vector& d,const dvar_vector& x,
1444  const int& ii);
1445 
1446 public:
1447  void allocate(const ad_integer& imin,
1448  const ad_integer& imax, const ad_integer& imin2,
1449  const ad_integer& imax2, const ad_double& _bmin,
1450  const ad_double& _bmax, const ad_integer& phase_start,
1451  const char * s);
1452 
1454  void allocate(int rmin,int rmax,int cmin,int cmax,
1455  double _minb,double _maxb,
1456  int phase_start=1,const char * = "UNNAMED");
1457  void allocate(int rmin,int rmax,int cmin,int cmax,
1458  double _minb,double _maxb,const char * = "UNNAMED");
1459 
1460  void allocate(const ad_integer& rmin, const ad_integer& rmax,
1461  const index_type& cmin,
1462  const index_type& cmax, double _minb, double _maxb,
1463  const char * = "UNNAMED");
1464  void allocate(const ad_integer& rmin, const ad_integer& rmax,
1465  const index_type& cmin,
1466  const index_type& cmax, double _minb, double _maxb,
1467  int phase_start = 1, const char * = "UNNAMED");
1468 };
1469 
1475 {
1476 protected:
1477  int val;
1478 
1479 public:
1480  void allocate(int n,const char * s="UNNAMED");
1481  void allocate(const char * s="UNNAMED");
1482  void allocate(init_xml_doc&, const char * s="UNNAMED");
1483 
1484  data_int(): val(0) { }
1485  data_int(const data_int& other): val((int)other)
1486  {
1487  }
1489 
1490  data_int& operator=(const data_int& other)
1491  { return data_int::operator=((int)other); }
1492  data_int& operator=(const int);
1493  operator int() const { return val; }
1494 
1495  friend int operator+(const int n, const data_int& v);
1496  friend int operator+(const data_int& v, const int n);
1497  friend int operator+(const data_int& v, const data_int& n);
1498 };
1499 
1505 {
1506 protected:
1507  void allocate(const char * s1,const char * s="UNNAMED");
1508  void operator = (const adstring&);
1509  void operator = (const char *);
1510 };
1511 
1513 {
1514 protected:
1515  void allocate(int min, int max, const char* s);
1516  void allocate(const char* s);
1517 };
1518 
1524 {
1525 protected:
1526  void allocate(const char* s1, const char* s = "UNNAMED");
1527  void operator=(const adstring&);
1528  void operator=(const char*);
1529 };
1530 
1536 {
1537 public:
1538  void allocate(const char * s="UNNAMED");
1539 };
1540 
1542 {
1543 public:
1544  void allocate(const char* s = "UNNAMED");
1545  void allocate(int imin, int imax, const char* s= "UNNAMED");
1546 };
1547 
1553 {
1554 public:
1555  void allocate(const char* s = "UNNAMED");
1556 };
1557 
1563 {
1564  char ** d;
1565 public:
1566  void allocate(char ** ps1,const char * s="UNNAMED");
1567  void operator = (const adstring&);
1568  void operator = (const char *);
1570  dll_named_adstring(void){d=NULL;}
1571 };
1572 
1577 class dll_data_int : public data_int
1578 {
1579 public:
1580  int *pi;
1581  void allocate(int *_pi,const char * s);
1582  virtual ~dll_data_int();
1583 };
1584 
1590 {
1591 public:
1593  data_matrix& operator=(const dmatrix& m);
1594  data_matrix& operator=(const double& m);
1595  void allocate(int rmin,int rmax,int cmin,int cmax,
1596  const char * = "UNNAMED");
1597  void allocate(int rmin, int rmax, const ivector& cmin, const ivector& cmax,
1598  const char * = "UNNAMED");
1599  void allocate(int rmin, int rmax, const ivector& cmin, int cmax,
1600  const char * = "UNNAMED");
1601  void allocate(int rmin, int rmax, int cmin, const ivector& cmax,
1602  const char * = "UNNAMED");
1603  void allocate(init_xml_doc&, const char * = "UNNAMED");
1604 };
1605 
1611 {
1612  double * d;
1613 public:
1614  void allocate(double * _d,int rmin,int rmax,int cmin,int cmax,
1615  const char * _s = "UNNAMED");
1616  virtual ~dll_data_matrix();
1618  dll_data_matrix& operator=(const double &m);
1619 };
1620 
1626 {
1627 public:
1629  void allocate(int hsl,int hsu,int rmin,int rmax,int cmin,int cmax,
1630  const char * ="UNNAMED");
1631  void allocate(int hsl, int hsu, const ivector& rmin, int rmax,
1632  int cmin,int cmax,const char * ="UNNAMED");
1633  void allocate(int hsl, int hsu, int rmin, const ivector& rmax,
1634  int cmin,int cmax,const char * ="UNNAMED");
1635  void allocate(int hsl, int hsu, const ivector& rmin, const ivector& rmax,
1636  int cmin,int cmax,const char * ="UNNAMED");
1637  void allocate(int hsl, int hsu, int rmin, int rmax, const ivector& cmin,
1638  int cmax, const char * ="UNNAMED");
1639  void allocate(int hsl, int hsu, int rmin, int rmax, const ivector& cmin,
1640  const ivector& cmax, const char * ="UNNAMED");
1641  void allocate(int hsl,int hsu,int rmin,int rmax,int cmin,
1642  const ivector& cmax, const char * ="UNNAMED");
1643  void allocate(int hsl,int hsu, const index_type& rmin, const index_type& rmax,
1644  const index_type& cmin, const index_type& cmax, const char * ="UNNAMED");
1645 };
1646 
1648 {
1649 public:
1651  void allocate(int hsl,int hsu,int rmin,int rmax,int cmin,int cmax,
1652  const char * ="UNNAMED");
1653  void allocate(int hsl, int hsu,const index_type& rmin, const index_type& rmax,
1654  const index_type& cmin, const index_type& cmax, const char * ="UNNAMED");
1655 };
1656 
1662 {
1663  double * d;
1664 public:
1665  void allocate(double * _d,int hmin,int hmax,int rmin,int rmax,
1666  int cmin,int cmax,const char * _s = "UNNAMED");
1668  virtual ~dll_data_3array();
1669 };
1670 
1671 
1673 {
1674 public:
1676  void allocate(int l7,int u7,int l6,int u6,int l5,int u5,int hhsl,
1677  int hhsu,int hsl,int hsu,int rmin,int rmax,int cmin,int cmax,
1678  const char* s="UNNAMED");
1679  void allocate(const ad_integer& l7,const ad_integer& u7,
1680  const index_type& l6,const index_type& u6,
1681  const index_type& l5,const index_type& u5,
1682  const index_type& hhsl,const index_type& hhsu,
1683  const index_type& hsl,const index_type& hsu,
1684  const index_type& sl,const index_type& sh,
1685  const index_type& nrl,const index_type& nrh,
1686  const char* s="UNNAMED");
1687 };
1688 
1690 {
1691 public:
1693  void allocate(int l6,int u6,int l5,int u5,int hhsl,int hhsu,int hsl,
1694  int hsu,int rmin,int rmax,int cmin,int cmax,const char * s="UNNAMED");
1695  void allocate(const ad_integer& l6,const ad_integer& u6,
1696  const index_type& l5,const index_type& u5,
1697  const index_type& hhsl,const index_type& hhsu,
1698  const index_type& hsl,const index_type& hsu,
1699  const index_type& sl,const index_type& sh,
1700  const index_type& nrl,const index_type& nrh,
1701  const char * s="UNNAMED");
1702 };
1703 
1705 {
1706 public:
1708  void allocate(int hhsl,int hhsu,
1709  int hhhsl,int hhhsu,
1710  int hsl,int hsu,int rmin,int rmax,
1711  int cmin,int cmax,const char * ="UNNAMED");
1712  void allocate(ad_integer hhhsl, ad_integer hhhsu, const index_type& hhsl,
1713  const index_type& hhsu, const index_type& hsl, const index_type& hsu,
1714  const index_type& rmin, const index_type& rmax, const index_type& cmin,
1715  const index_type& cmax, const char * ="UNNAMED");
1716 };
1717 
1723 {
1724 public:
1726  void allocate(int hhsl,int hhsu,int hsl,int hsu,int rmin,int rmax,
1727  int cmin,int cmax,const char * ="UNNAMED");
1728  void allocate(ad_integer hhsl, ad_integer hhsu, const index_type& hsl,
1729  const index_type& hsu, const index_type& rmin, const index_type& rmax,
1730  const index_type& cmin, const index_type& cmax, const char * ="UNNAMED");
1731 };
1732 
1734 {
1735 public:
1737  void allocate(int hhsl,int hhsu,int hsl,int hsu,int rmin,int rmax,
1738  int cmin,int cmax,const char * ="UNNAMED");
1739  void allocate(ad_integer hhsl, ad_integer hhsu, const index_type& hsl,
1740  const index_type& hsu, const index_type& rmin, const index_type& rmax,
1741  const index_type& cmin, const index_type& cmax, const char * ="UNNAMED");
1742 };
1743 
1749 {
1750 public:
1752  void allocate(int rmin,int rmax,int cmin,int cmax,const char * ="UNNAMED");
1753  void allocate(int rmin, int rmax, const index_type&, const index_type& cmax,
1754  const char * ="UNNAMED");
1755 };
1756 
1762 {
1763 public:
1764  data_vector& operator=(const dvector& m);
1765  data_vector& operator=(const double m);
1767  void allocate(int imin,int imax,const char * ="UNNAMED");
1768  void allocate(int imin, const ivector& imax, const char * ="UNNAMED");
1769  void allocate(init_xml_doc&, const char * ="UNNAMED");
1770 };
1771 
1777 {
1778 public:
1779  double * pd;
1780  void allocate(double * pd,int imin,int imax,const char * ="UNNAMED");
1781  void allocate(double *pd, int imin, const ivector& imax,
1782  const char * ="UNNAMED");
1783  virtual ~dll_data_vector();
1785  dll_data_vector& operator = (const double& x);
1786 };
1787 
1793 {
1794 public:
1796  void allocate(int imin,int imax,const char * ="UNNAMED");
1797 };
1798 
1804 {
1805 protected:
1806  double val;
1807 public:
1808  void allocate(const char * ="UNNAMED");
1809  void report_value(void);
1810  operator double() {return val;}
1811  double& value(void) {return val;}
1812  void initialize(void) {val=0.0;}
1813  data_number & operator=(const double& m);
1814 };
1815 
1821 {
1822 public:
1823  double * pd;
1824  void allocate(double *_pd,const char * s);
1825  virtual ~dll_data_number();
1826  dll_data_number & operator=(const double& m);
1827 };
1828 
1829 #include <functional>
1830 
1831 typedef std::function<dvariable(const dvariable&)> _func;
1832 
1833 #if defined(USE_ADPVM)
1834 class model_parameters;
1835 typedef dvariable (model_parameters::*PMF) (const dvariable&);
1836 typedef dvariable (model_parameters::*PMFI) (const dvariable&,int n);
1837 typedef dvariable (model_parameters::*PMFVI) (const dvar_vector&,int n);
1838 typedef void (model_parameters::*PMFVIV4) (const dvar_vector&,int n,
1839  dvariable& f1, const dvariable& f2, const dvariable& f3, const dvariable& f4);
1840 #endif
1841 
1842  class init_df1b2vector;
1843  class df1b2vector;
1844  class df1b2variable;
1845 
1851 {
1852 public:
1853  static int bad_step_flag;
1854  static int likeprof_flag;
1856  static int test_trust_flag;
1860  static int inner_opt_flag;
1861  static int inner_opt(void);
1865  //init_df1b2vector* py;
1866  virtual void AD_uf_inner();
1867  virtual void AD_uf_outer();
1868  virtual void user_function();
1869  void pre_user_function(void);
1870  //void df1b2_pre_user_function(void);
1871  //virtual void user_function(const init_df1b2vector& x,df1b2variable& f);
1872  //static int hesstype;
1873  //int set_hessian_type(int);
1875  void other_separable_stuff_begin(void);
1876  void other_separable_stuff_end(void);
1877  void begin_df1b2_funnel(void){;}
1879  void end_df1b2_funnel(void){;}
1880  void get_function_difference(void);
1888  long ifn;
1889  int maxfn;
1890  int iprint;
1891  double crit;
1892  int imax;
1893  double dfn;
1894  long iexit;
1895  long ihflag;
1896  long ihang;
1900  double min_improve;
1901  void pre_userfunction(void);
1902  virtual void userfunction(void)=0;
1903  virtual void allocate() {}
1904  virtual void deallocate() {}
1907 protected:
1908  double ffbest;
1909 private:
1913 protected:
1915  virtual void report(const dvector& gradients){;};
1918  static int sd_flag;
1921  static int have_constraints;
1922 public:
1923  virtual dvariable user_randeff(const dvar_vector& x);
1924  virtual dvar_vector user_dfrandeff(const dvar_vector& x);
1925  virtual dvar_matrix user_d2frandeff(const dvar_vector& x);
1928  void limited_memory_quasi_newton(double& f, const independent_variables&,
1929  int, int, int,double);
1930  function_minimizer(long int sz=0L);
1931  void likeprof_routine(double global_min);
1932  virtual ~function_minimizer();
1933  virtual void other_calculations(void){;}
1934  virtual void final_calcs(void){;}
1935  virtual void minimize(void);
1936  virtual void constraints_minimize(void);
1937  virtual void between_phases_calculations(void){;}
1938  void computations(int argc,char * argv[]);
1939  void computations1(int argc,char * argv[]);
1940  void computations_np(int argc,char * argv[]);
1941  void computations(void);
1942  void hess_routine(void);
1943  void hess_routine_noparallel(void);
1944  void hess_routine_master(void);
1945  void hess_routine_slave(void);
1946  void constraint_report(void);
1947  void pvm_slave_likeprof_routine(void);
1949  independent_variables& x,const dvector & g,int nvar,int iprof,double weight,
1950  double new_value);
1951  void pvm_slave_prof_minimize(int underflow_flag);
1952  void pvm_master_prof_minimize(int iprof, double sigma,
1953  double new_value, const double& _fprof, const int underflow_flag,
1954  double global_min, const double& _penalties,
1955  const double& _final_weight);
1956  //void pvm_master_function_evaluation_profile(double& f,
1957  // independent_variables& x,dvector & g,int nvar,int iprof);
1958  void pvm_slave_function_evaluation(void);
1962  independent_variables& x,int nvar);
1963  void pvm_master_function_evaluation(double& f,
1964  independent_variables& x,const dvector & g,int nvar);
1965  dmatrix dep_hess_routine(const dvariable& dep);
1966  void top_mcmc_routine(int,int,double,int);
1967  void mcmc_routine(int,int,double,int);
1968  void sgibbs_mcmc_routine(int,int,double,int);
1969  void hybrid_mcmc_routine(int,int,double,int);
1970 
1971  // Compact flag to toggle new console output
1972  static int output_flag;
1973 
1975  void hess_step();
1976  bool choleski_decomp_hmc(const dmatrix& metric, dmatrix& L);
1977  bool calculate_chd_and_inverse(int nvar, const dmatrix& metric,
1978  dmatrix& chd, dmatrix& chdinv);
1979  void add_sample_diag(const int nvar, int& n, dvector& m, dvector& m2,
1980  const independent_variables& q);
1981  void add_sample_dense(const int nvar, int& is2, dvector& m, dmatrix& m2,
1982  const independent_variables& q);
1983  dvector rotate_pars(const dvector& m, const dvector& x);
1984  dvector rotate_pars(const dmatrix& m, const dvector& x);
1985  dvector rotate_gradient(const dvector& x, const dmatrix& m);
1986  int compute_next_window(int i, int warmup, int w1, int aws, int w3);
1987  bool slow_phase(int is, int warmup, int w1, int w3);
1988  std::string get_filename(const char* f);
1989  double get_hybrid_monte_carlo_value(int nvar,const independent_variables& y,
1990  dvector& g);
1991  void read_mle_hmc(int nvar, dvector& mle);
1992  void rwm_mcmc_routine(int,int, double, int);
1993  void shmc_mcmc_routine(int,int,double,int);
1994  void nuts_mcmc_routine(int,int,double,int);
1995  void print_mcmc_timing(double time_warmup, double time_total, int chain);
1996  void print_mcmc_progress(int is, int nmcmc, int nwarmup, int chain, int refresh);
1997  double find_reasonable_stepsize(int nvar, dvector y, dvector p, dmatrix& chd, bool verbose_adapt_mass, bool verbose_find_epsilon, int chain);
1998  bool stop_criterion(int nvar, dvector& thetaminus, dvector& thetaplus,
1999  dvector& rminus, dvector& rplus);
2000  void build_tree(int nvar, dvector& gr, dmatrix& chd, double eps, dvector& p,
2001  dvector& y, dvector& gr2, double logu, int v, int j, double H0,
2002  dvector& _thetaprime, dvector& _thetaplus, dvector& _thetaminus,
2003  dvector& _rplus, dvector& _rminus,
2004  double& _alphaprime, int& _nalphaprime, bool& _sprime,
2005  int& _nprime, int& _nfevals, bool& _divergent,
2006  const random_number_generator& rng,
2007  dvector& gr2_end, dvector& _grprime, dvector& _gr2prime, double& _nllprime,
2008  double& _Hprime, independent_variables& _parsaveprime);
2009  double leapfrog(int nvar,dvector& gr, dmatrix& chd,
2010  double eps, dvector& p, dvector& x, dvector& gr2);
2011  double adapt_eps(int ii, int iseps, double eps, double alpha,
2012  double& adapt_delta, double& mu,
2013  dvector& epsvec, dvector& epsbar,
2014  dvector& Hbar);
2015  double exprnd(double p);
2016  // End new functions
2017 
2018  double pvm_master_get_monte_carlo_value(int nvar,
2019  const dvector& x);
2020  void pvm_slave_get_monte_carlo_value(int nvar);
2021  void mcmc_eval(void);
2022  //void hess_routine_and_constraint(int);
2023  void hess_routine_and_constraint(int iprof, const dvector& g,
2024  dvector& fg);
2025  dmatrix diag_hess_routine(void);
2026  bool hess_inv();
2027  void depvars_routine(void);
2028  void sd_routine(void);
2029  int ef_(double * f, double * x);
2030  int constrained_minimization2(int _n,int _nh, int _ng,dvector& __x);
2032  void get_bigS(int ndvar,int nvar1,int nvar,
2033  dmatrix& S,dmatrix& BS,dvector& scale);
2034 
2035 #ifdef CURVE_CORRECT
2036  void constraint_hess_routine(int ip);
2037  void get_curvature_correction_factors(int ip,
2038  dvector& g, const int underflow_flag, const dvector& eigenvals,
2039  dvector& curvcor);
2040 #endif
2041  double projected_jacobian(const dvector& g, const dvector& xscale);
2042 
2043  dvariable random_effects_maximization(const dvar_vector& v);
2044  void prof_minimize_re(int iprof, double sigma,
2045  double new_value, const double& fprof, const int underflow_flag,
2046  double global_min, const double& penalties, const double& final_weight);
2047  void prof_minimize(int iprof, double sigma,
2048  double new_value, const double& fprof, const int underflow_flag,
2049  double global_min, const double& penalties, const double& final_weight);
2050  void begin_gauss_hermite_stuff(void);
2051  void begin_funnel_stuff(void);
2052  void end_gauss_hermite_stuff(void);
2053 
2054  void prof_hess_routine(int ip,double new_value,double final_weight);
2055 
2056  void quasi_newton_minimizer1(int nvar,double _crit,
2057  double& f, const independent_variables& x,const dvector& g);
2058 
2059  double hess_determinant(int underflow_flag);
2060 
2061 #ifndef CURVE_CORRECT
2062  void normalize_posterior_distribution(double udet,
2063  const dvector& siglevel, const ofstream& ofs2, int num_pp,
2064  const dvector& all_values, const dmatrix& actual_value, double global_min,
2065  int offset, const dmatrix& lprof, const dmatrix& ldet, const dmatrix& xdist,
2066  const dmatrix& penalties);
2067  // dmatrix& penalties, const hdmatrix& lg_jacob);
2068 #else
2069  void normalize_posterior_distribution(double udet,
2070  const dvector& siglevel, const ofstream& ofs2, int num_pp,
2071  const dvector& all_values, const dmatrix& actual_value,
2072  double global_min,
2073  int offset, const dmatrix& lprof, const dmatrix& ldet,
2074  const dmatrix& xdist,
2075  const d3_array& eigenvals,d3_array& curvcor);
2076 #endif
2077  void get_particular_grad(int iprof, int nvar, const dvector& fg,
2078  const dvector& g);
2079  double projected_hess_determinant(const dvector& g, const int underflow_flag,
2080  const dvector& xscale, const double& ln_det_proj_jac);
2081 // double projected_hess_determinant(const dvector& fg, const dvector& g,
2082  //const int underflow_flag, const dvector& xscale,
2083  // const double& ln_det_proj_jac);
2084  double projected_hess_determinant(const dvector& g,const int underflow_flag);
2085  double projected_hess_determinant(const dmatrix& hh, const dvector& g,
2086  const int underflow_flag);
2087  //double projected_hess_determinant(const dvector& g, const int underflow_flag,
2088  //dvector& xscale, const double& ln_det_proj_jac);
2089 
2090  double projected_hess_determinant(const dvector& fg, const dvector& g,
2091  const int underflow_flag, const dvector& curvscale, const dvector& xscale,
2092  double& ln_det_proj_jac, const double& tmp, const dmatrix& hesses);
2093  double diag_projected_hess_determinant(const dvector& g,
2094  const int underflow_flag, dmatrix& dh);
2095  double unrestricted_hess_determinant(void);
2096  void monte_carlo_routine(void);
2097  double get_monte_carlo_value(int nvar, const independent_variables& x);
2098  double get_monte_carlo_value(int nvar, const independent_variables& x,
2099  dvector& g);
2100  void mcmc_computations(void);
2101 #if defined(USE_ADPVM)
2102  void pvm_slave_mcmc_computations(void);
2103  void pvm_master_mcmc_computations(void);
2104 #endif
2105  double get_monte_carlo_value(int nvar, const dvector& x);
2106  void sob_routine(int nmcmc,double dscale,int restart_flag);
2107  void sobol_importance_routine(int nmcmc,int iseed0,double dscale,
2108  int restart_flag);
2109  void pvm_master_mcmc_routine(int nmcmc,int iseed0,double dscale,
2110  int restart_flag);
2111 #if defined(USE_ADPVM)
2112  void pvm_slave_mcmc_routine(void);
2113 #else
2114  void pvm_slave_mcmc_routine(void) {}
2115 #endif
2116  void trust_region_update(int nvar,int _crit,
2117  independent_variables& x,const dvector& _g,const double& _f);
2118 
2119 #if defined(USE_ADPVM)
2120  void multint4(int n, const dvar_vector& a, const dvar_vector& b,
2121  const dvar_vector& h, double al, int m, const dvariable& e,
2122  const dvariable& aint1, const dvariable& aint2, dvariable& aint3,
2123  const dvariable& aint4, const int& key, PMFVIV4 f);
2124 
2125  void multint(int n, const dvar_vector& a, const dvar_vector& b,
2126  const dvar_vector& h, double al, int m, const dvariable& e,
2127  const dvariable& aint, const int& key, PMFVI f);
2128 #endif
2129 
2130  virtual void set_runtime(void);
2131  virtual void set_runtime_maxfn(const char *);
2132  virtual void set_runtime_crit(const char *);
2133  dvariable adromb(_func func, double a, double b, int ns = 9);
2134  dvariable adromb(_func func, const dvariable& a, double b, int ns = 9);
2135  dvariable adromb(_func func, const dvariable& a, const dvariable& b, int ns = 9);
2136  dvariable adromb(_func func, double a, const dvariable& b, int ns = 9);
2137 
2138  dvariable adrombo(_func func, double a, double b, int ns = 9);
2139  dvariable adrombo(_func func, const dvariable& a, double b, int ns = 9);
2140  dvariable adrombo(_func func, const dvariable& a, const dvariable& b, int ns = 9);
2141  dvariable adrombo(_func func, double a, const dvariable& b, int ns = 9);
2142 
2143  dvariable trapzd(void*, double a, double b, int n);
2144  dvariable trapzd(_func func, double a, double b, int n);
2145  dvariable trapzd(_func func, double a, const dvariable& b, int n);
2146  dvariable trapzd(_func func, const dvariable& a, double b, int n);
2147  dvariable trapzd(_func func, const dvariable& a, const dvariable& b, int n);
2148 
2149  /*
2150  //No code for midpnt functions
2151  //dvariable midpnt(PMF,double a,double b,int n);
2152  //dvariable midpnt(PMF, double a, const dvariable& b, int n);
2153  //dvariable midpnt(PMF, const dvariable& a, double b, int n);
2154  //dvariable midpnt(PMF, const dvariable& a, const dvariable& b, int n);
2155  //virtual void * mycast() { return (void*)this;}
2156  */
2157 
2158  void neldmead(int n, dvector& _start, dvector& _xmin, double *ynewlo,
2159  double reqmin, double delta,int *icount, int *numres, int *ifault);
2160  void adamoeba(const dmatrix& p, const dvector& y, int ndim, double ftol,
2161  int maxfn);
2162  void set_initial_simplex(const dmatrix& p, const dvector& y, int nvar,
2163  const dvector& x, double delta);
2164  double amxxx(const dmatrix& p, const dvector& y, const dvector& psum,
2165  int ndim, int ihi, double fac);
2168  void quasi_newton_block(int nvar,int crit,independent_variables& x,
2169  const dvector& g,const double& f);
2170  void limited_memory_quasi_newton_block(int nvar,int _crit,
2171  independent_variables& x,const dvector& _g,const double& _f,
2172  int nsteps);
2173 
2175  independent_variables& x,const dvector& g,const double& f);
2176  void quasi_newton_block_pvm_master_random_effects(int nvar,int _crit,
2177  independent_variables& x,const dvector& g,const double& f);
2179  void hess_routine_random_effects(void);
2180  void quasi_newton_block_pvm_master(int nvar,int _crit,
2181  independent_variables& x,const dvector& g,const double& f);
2183 #if defined(USE_ADPVM)
2186 #endif
2187  dvariable do_gauss_hermite_integration(void);
2188  void end_df1b2_funnel_stuff(void);
2189 
2190  double get_ln_det_value() const
2191  { return !_hessian ? 0 : _ln_det_value; }
2194 
2195 private:
2196  dvariable do_gauss_hermite_integration_multi(void);
2200 };
2201 
2202 cifstream& operator>>(const cifstream& s, const param_init_number& x);
2203 cifstream& operator>>(const cifstream& s, const param_init_vector& v);
2204 cifstream& operator>>(const cifstream& s, const param_init_matrix& m);
2205 ostream& operator<<(const ostream& s, const label_class& lc);
2206 
2212 {
2213 public:
2214  // this should be a resizeable array
2215  static stddev_params * stddevptr[150];
2216  // this should be a resizeable array
2218  static void get_all_sd_values(const dvector& x, const int& ii);
2219  static int num_stddev_params;
2221  static ivector copy_all_number_offsets(void);
2222  void allocate(void){;};
2223  static int num_stddev_calc(void);
2224  static int num_stddev_number_calc(void);
2225  static void get_stddev_number_offset(void);
2226 public:
2227  stddev_params(void){;}
2228  virtual void setindex(int);
2229  virtual int getindex(void);
2230 
2231  // get the number of active parameters
2232  virtual unsigned int size_count() const = 0;
2233 
2234  virtual void set_dependent_variables(void)=0;
2235  virtual void copy_value_to_vector(const dvector&,const int&) = 0;
2236  virtual void get_sd_values(const dvector& x, const int& ii) = 0;
2237  //get the number of active parameters
2238  static void copy_all_values(const dvector& x, const int& ii);
2239  //get the number of active parameters
2240  static void copy_all_number_values(const dvector& x, const int& ii);
2241  virtual void add_to_list(void);
2242  virtual void add_to_gui_list(void);
2243  virtual const char * label()=0;
2244  friend class function_minimizer;
2245 };
2246 
2252 {
2253  double stepsize;
2255 protected:
2256 public:
2257  static likeprof_params * likeprofptr[500]; // this should be a
2258  // resizeable array
2260  void allocate(void){;};
2261  static int num_stddev_calc(void);
2262 public:
2263  likeprof_params(void);
2264  virtual void add_to_list(void);
2265  virtual const char * label()=0;
2266  virtual dvariable variable(void)=0;
2267  virtual double& get_sigma(void)=0;
2268  virtual double get_value(void)=0;
2269  double get_stepsize(void);
2270  int get_stepnumber(void);
2271  void set_stepsize(double);
2272  void set_stepnumber(int);
2273  friend class function_minimizer;
2274 };
2275 
2281 {
2282 public:
2284 
2285  // get the number of active parameters
2286  virtual unsigned int size_count() const;
2287 
2288  virtual const char * label(void);
2290  void allocate(int imin,int imax,const char * s="UNNAMED");
2291  virtual void set_dependent_variables(void);
2292  virtual void copy_value_to_vector(const dvector& x, const int& ii);
2293  virtual void get_sd_values(const dvector& x, const int& ii);
2294  param_stddev_vector& operator=(const dvar_vector& m);
2296  param_stddev_vector& operator=(const double m);
2297 };
2298 
2304 {
2305 public:
2306  double sd;
2307  int index;
2308  void allocate(const char *s="UNNAMED");
2309  virtual void setindex(int);
2310  virtual int getindex(void);
2311 
2312  // get the number of active parameters
2313  virtual unsigned int size_count() const;
2314 
2315  virtual const char * label(void);
2316  virtual void copy_value_to_vector(const dvector& x, const int& ii);
2317  virtual void get_sd_values(const dvector& x, const int& ii);
2320  {
2321  allocate(name);
2322  }
2323  virtual void set_dependent_variables(void);
2325  param_stddev_number& operator=(const double);
2326 };
2327 
2333  public likeprof_params
2334 {
2335 public:
2336  double sigma;
2337  void allocate(const char *s="UNNAMED");
2338 
2339  // get the number of active parameters
2340  virtual unsigned int size_count() const;
2341 
2342  virtual const char * label(void);
2343  virtual double& get_sigma(void){return sigma;}
2344  virtual double get_value(void){return value(*this);}
2345  //void copy_value_to_vector(const dvector& x, const int& ii);
2346  virtual dvariable variable(void){ return dvariable(*this);}
2347 
2350  {
2351  allocate(name);
2352  }
2354  const int step_number,
2355  const char* name
2356  ): param_likeprof_number(name)
2357  {
2358  set_stepnumber(step_number);
2359  }
2360 
2362  param_likeprof_number& operator=(const double);
2363 };
2364 
2370 {
2371 public:
2373  virtual unsigned int size_count() const;
2374  //virtual void read_value(void);
2375  virtual const char * label(void);
2376  void allocate(int rmin,int rmax,int cmin,int cmax,
2377  const char * s="UNNAMED");
2378  param_stddev_matrix(void);
2379  virtual void set_dependent_variables(void);
2380  virtual void get_sd_values(const dvector& x, const int& ii);
2381  virtual void copy_value_to_vector(const dvector& x, const int& ii);
2382  param_stddev_matrix& operator=(const double m);
2385 };
2386 
2392  {
2393  public:
2395  static double fun_without_pen;
2396  static double gmax;
2399  {
2400  allocate(name);
2401  }
2402 
2404  objective_function_value& operator=(const double v);
2405  };
2406 
2407  int withinbound(int lb,int n,int ub);
2408 
2409 double cumd_cauchy(const double& x);
2410 double density_cauchy(const double& x);
2411 double log_density_cauchy(const double& x);
2412 double inv_cumd_cauchy(const double& x);
2413 
2414 double cumd_mixture(const double& x);
2415 double inv_cumd_mixture(const double& y);
2416 double cumd_mixture_02(const double& x);
2417 double inv_cumd_mixture_02(const double& y);
2418 
2419 #if defined _ADM_HIGHER_ARRAYS__
2420 
2426 {
2427  virtual void set_simulation_bounds(const dmatrix& symbds, const int& ii);
2428 //virtual void set_simulation_bounds(const dmatrix&, const dvector& symbds,
2429 // const int& ii);
2430  virtual void add_value(const dvector&, const dvector&, const int&,
2431  const double&, const dvector&);
2432  virtual void add_value(const dvector&, const int&);
2433  virtual void get_jacobian(const dvector&, const dvector&, const int&);
2434 public:
2435  virtual void set_value(const dvar_vector& x, const int& ii,
2436  const dvariable& pen);
2437  virtual void copy_value_to_vector(const dvector& x, const int& ii);
2438  virtual void restore_value_from_vector(const dvector&, const int&);
2439  virtual void set_value_inv(const dvector& x, const int& ii);
2440  virtual unsigned int size_count() const;
2441  virtual void save_value(ofstream& ofs);
2442  virtual void bsave_value(uostream& uos);
2443  virtual void save_value(const ofstream& ofs, int prec);
2444  virtual void restore_value(const ifstream& ifs);
2445  void report_value(void);
2446  //virtual void read_value(void);
2447  virtual const char * label(void);
2448  virtual void sd_scale(const dvector& d, const dvector& x, const int& ii);
2449  virtual void mc_scale(const dvector& d, const dvector& x, const int&);
2450  virtual void curv_scale(const dvector& d, const dvector& x, const int&);
2451  virtual void hess_scale(const dvector& d, const dvector& x, const int& ii){;};
2452 
2453 public:
2454  void allocate(int rmin,int rmax,int cmin,int cmax,
2455  int phase_start=1,const char * = "UNNAMED");
2456  void allocate(int rmin,int rmax,int cmin,int cmax,
2457  const char * = "UNNAMED");
2458  param_init_matrix(void);
2461  param_init_matrix& operator = (const dvariable& m);
2462  param_init_matrix& operator = (const double& m);
2463 };
2464 #endif // #if defined _ADM_HIGER_ARRAYS__
2465 
2471 {
2472 public:
2473 #if defined(USE_SHARE_FLAGS)
2474  virtual void setshare(const index_type& sf,const index_type& af);
2475  virtual void shared_set_value_inv(const dvector&,const int&);
2476  virtual void shared_set_value(const dvar_vector&,const int&,
2477  const dvariable& pen);
2478  virtual int shared_size_count(void); // get the number of active parameters
2479 #endif
2480 
2481  virtual void sd_vscale(const dvar_vector& d,const dvar_vector& x,
2482  const int& ii);
2483  virtual void dev_correction(const dmatrix&, const int&);
2484  virtual void curv_scale(const dvector& d, const dvector& x, const int& ii);
2485  virtual void set_simulation_bounds(const dmatrix& symbds, const int& ii);
2486 //virtual void set_simulation_bounds(const dmatrix&, const dvector& symbds,
2487 // const int& ii);
2488  virtual void add_value(const dvector&, const dvector&, const int&,
2489  const double&, const dvector&);
2490  virtual void add_value(const dvector&, const int&);
2491  virtual void get_jacobian(const dvector&, const dvector&, const int&);
2492  virtual void set_value(const dvar_vector& x, const int& ii,
2493  const dvariable& pen);
2494  virtual void copy_value_to_vector(const dvector& x, const int& ii);
2495  virtual void restore_value_from_vector(const dvector&,const int&);
2496  virtual void set_value_inv(const dvector& x, const int& ii);
2497  virtual unsigned int size_count() const;
2498  virtual void save_value(ofstream& ofs);
2499  virtual void bsave_value(uostream& uos);
2500  virtual void save_value(const ofstream& ofs, int prec);
2501  virtual void save_value(const ofstream& ofs, int prec,const dvector&,
2502  int& offset){}
2503  virtual void restore_value(const ifstream& ifs);
2504  void report_value(void);
2505  //virtual void read_value(void);
2506  virtual const char * label(void);
2507  virtual void sd_scale(const dvector& d, const dvector& x, const int& ii);
2508  virtual void mc_scale(const dvector& d, const dvector& x, const int&);
2509  virtual void hess_scale(const dvector& d, const dvector& x, const int& ii);
2510 
2511 public:
2512 #if defined(USE_ADPVM)
2513  virtual void pvm_pack(void) { cerr << "Error" << endl; ad_exit(1);}
2514  virtual void pvm_unpack(void) { cerr << "Error" << endl; ad_exit(1);}
2515 #endif
2516 
2517  void allocate(const ad_integer& sl,const ad_integer& sh,
2518  const index_type& nrl,const index_type& nrh,
2519  const index_type& ncl,const index_type& nch,const char * s="UNNAMED");
2520 
2521  void allocate(const ad_integer& sl,const ad_integer& sh,
2522  const index_type& nrl,const index_type& nrh,
2523  const index_type& ncl,const index_type& nch,int phase_start=1,
2524  const char * s="UNNAMED");
2525 
2526  void allocate(int smin,int smax,int rmin,int rmax,int cmin,int cmax,
2527  int phase_start=1,const char * = "UNNAMED");
2528  void allocate(int smin,int smax,int rmin,int rmax,int cmin,int cmax,
2529  const char * = "UNNAMED");
2530  param_init_d3array(void);
2531 };
2532 
2538 {
2539  double * d;
2540 public:
2541  void allocate(double* _d,int hmin,int hmax,
2542  int rmin,int rmax,int cmin,int cmax,
2543  int phase_start=1,const char * = "UNNAMED");
2544  void allocate(double * _d,int hmin,int hmax,int rmin,int rmax,
2545  int cmin,int cmax,const char * = "UNNAMED");
2546  virtual ~dll_param_init_d3array();
2550 };
2551 
2557 {
2558  double * d;
2559 public:
2560  void allocate(double* _d,int hmin,int hmax,
2561  int rmin,int rmax,int cmin,int cmax,
2562  int phase_start=1,const char * = "UNNAMED");
2563  void allocate(double * _d,int hmin,int hmax,int rmin,int rmax,
2564  int cmin,int cmax,const char * = "UNNAMED");
2565  virtual ~dll_param_d3array();
2569 };
2570 
2571 
2572 //double set_value_mc(const double& x, const double fmin, const double fmax);
2573 
2574 void set_value_mc(const dvar_vector& x, const dvar_vector& v, const int& ii,
2575  const double fmin, const double fmax);
2576 
2577 double set_value_inv_mc(double v,double fmin,double fmax);
2578 
2579 double set_value_inv_mc(const prevariable& v, double fmin, double fmax);
2580 
2581 void set_value_inv_mc(const dvar_vector& x, const dvector& v, const int& ii,
2582  const double fmin, const double fmax);
2583 
2584 //double set_value_inv_mc(const dvector&, const dvector& x, int ii, double minb,
2585 // double maxb);
2586 
2587 double set_value_mc(double z,double min,double max);
2588 double ndfboundp( double x, double fmin, double fmax,const double& fpen);
2589 double ndfboundp_mc( double x, double fmin, double fmax,const double& fpen);
2590 
2591 void copy_value_from_vector(const double& _sd,const dvector& x,const int & _ii);
2592 void copy_value_from_vector(const dvector& _sd,const dvector& x,
2593  const int & _ii);
2594 void copy_value_from_vector(const dmatrix& _sd,const dvector& x,
2595  const int & _ii);
2596 
2597 dvector bounded_multivariate_normal(int nvar, const dvector& a1,
2598  const dvector& b1, dmatrix& ch, const double& _wght,
2599  const random_number_generator & rng);
2600 
2601 void bounded_multivariate_normal_mcmc(int nvar, const dvector& a1,
2602  const dvector& b1, dmatrix& ch, const double& wght, const dvector& y,
2603  const random_number_generator & rng);
2604 
2605 void bounded_multivariate_uniform_mcmc(int nvar, const dvector& a1,
2606  const dvector& b1, dmatrix& ch, const double& wght, const dvector& y,
2607  const random_number_generator & rng);
2608 
2609 dvector bounded_multivariate_normal(int nvar, const dvector& a1,
2610  const dvector& b1, dmatrix& ch, const double& lprob,
2612 
2614  const dvector& b1, dmatrix& ch, const double& lprob,
2615  const random_number_generator &rng);
2616 
2618  const dvector& b1, dmatrix& ch, const double& lprob, double pprobe,
2619  const random_number_generator &rng);
2620 
2621 dvector bounded_multivariate_uniform(int nvar, const dvector& a1,
2622  const dvector& b1, dmatrix& ch, const double& lprob,
2624 
2626  const dvector& b1, dmatrix& ch, const dmatrix& ch3, double contaminant,
2627  const double& _wght, random_number_generator &rng);
2628 
2629 void probing_bounded_multivariate_normal_mcmc(int nvar, const dvector& a1,
2630  const dvector& b1, dmatrix& ch, const double& wght, const dvector& v,
2631  double pprobe, const random_number_generator &rng);
2632 
2633 /*
2634 int option_match(int argc,char * argv[], const char * string);
2635 int option_match(int argc,char * argv[], const char * string, const int& nopt);
2636 int option_match(char * s, const char * string, const int& _nopt);
2637 int option_match(char * s, const char * string);
2638 */
2639 
2640 double inv_cumd_exp(double x);
2641 double cumd_exp(double x);
2642 
2643 double ffmax(double a,double b);
2644 double ffmin(double a,double b);
2645 
2646 void check_datafile_pointer(void * p);
2647 
2649 
2650 void ad_make_code_reentrant(void);
2651 
2652 char** parse_dll_options(char *pname, const int& argc,
2653  char * dll_options);
2654 
2655 void parse_dll_options(char *pname, const int& argc, char *dll_options,
2656  char *** pargv);
2657 
2658 char** no_dll_options(char *pname, const int& argc);
2659 
2660 void cleanup_argv(int nopt,char *** pa);
2661 
2662 void get_sp_printf(void);
2663 
2664 void do_dll_housekeeping(int argc,char ** argv);
2665 
2666 void adwait(double);
2667 
2668 int ad_get_commandline_option(const char *option_label, const int &option_value,
2669  const char * error_message);
2670 
2676 {
2681 
2682 public:
2685 
2686  void set_scalefactor(double s);
2687  void set_scalefactor(const dvector& s);
2688  dvector get_scalefactor(void);
2689 
2690 #if defined(OPT_LIB)
2691  param_init_vector& operator [] (int i) { return v[i];}
2692  param_init_vector& operator () (int i) { return v[i];}
2693  prevariable operator () (int i,int j) { return v[i][j];}
2694 #else
2697  prevariable operator () (int i,int j);
2698 #endif
2699 
2700  void allocate(int min1,int max1,const index_type& min,
2701  const index_type& max,const index_type& phase_start,
2702  const char * s);
2703 
2704  void allocate(int min1,int max1,const index_type& min,
2705  const index_type& max,const char * s);
2706 
2707  bool allocated() const { return v != NULL; }
2708  int indexmin(void) {return (index_min);}
2709  int indexmax(void) {return (index_max);}
2710  void set_initial_value(const double_index_type& it);
2711  void deallocate(void);
2712 };
2713 
2719 {
2724 public:
2727 
2728  void set_scalefactor(double s);
2729  void set_scalefactor(const dvector& s);
2730  dvector get_scalefactor(void);
2731 #if defined(OPT_LIB)
2734  prevariable operator () (int i,int j) { return v[i][j];}
2735 #else
2738  prevariable operator () (int i,int j);
2739 #endif
2740 
2741  void allocate(int min1,int max1,
2742  const index_type& min,
2743  const index_type& max,
2744  const double_index_type& dmin,
2745  const double_index_type& dmax,
2746  const index_type& phase_start,
2747  const char* s);
2748 
2749  void allocate(int min1,int max1,
2750  const index_type& min,
2751  const index_type& max,
2752  const double_index_type& dmin,
2753  const double_index_type& dmax,
2754  const char* s);
2755 
2756  bool allocated() const { return v != NULL; }
2757  int indexmin() const {return index_min;}
2758  int indexmax() const {return index_max;}
2759  void deallocate(void);
2760  void set_initial_value(const double_index_type& it);
2761 };
2762 
2768 {
2773 
2774 public:
2777 
2778  void set_scalefactor(double s);
2779  void set_scalefactor(const dvector& s);
2780  dvector get_scalefactor(void);
2781 
2782 #if defined(OPT_LIB)
2783  param_init_matrix& operator [] (int i) { return v[i];}
2784  param_init_matrix& operator () (int i) { return v[i];}
2785  dvar_vector& operator () (int i,int j) { return v[i][j];}
2786  prevariable operator () (int i,int j,int k) { return v[i](j,k);}
2787 #else
2790  dvar_vector& operator () (int i,int j);
2791  prevariable operator () (int i,int j,int k);
2792 #endif
2793  void allocate(int min0,int max0,const index_type& min,
2794  const index_type& max,const index_type& min1,
2795  const index_type& max1,const index_type& phase_start,
2796  const char * s);
2797 
2798  void allocate(int min0,int max0,const index_type& min,
2799  const index_type& max,const index_type& min1,
2800  const index_type& max1,const char * s);
2801 
2802  bool allocated() const { return v != NULL; }
2803  int indexmin() const { return index_min;}
2804  int indexmax() const { return index_max;}
2805  void set_initial_value(const double_index_type& it);
2806  void deallocate(void);
2807 };
2808 
2814 {
2819 public:
2822 
2823  void set_scalefactor(double s);
2824  void set_scalefactor(const dvector& s);
2826 
2827  void allocate(
2828  int min1, int max1,
2829  const index_type& min, const index_type& max,
2830  const index_type& min2, const index_type& max2,
2831  const double_index_type& dmin2, const double_index_type& dmax2,
2832  const index_type& phase_start,
2833  const char * s);
2834 
2835  void allocate(
2836  int min1, int max1,
2837  const index_type& min, const index_type& max,
2838  const index_type& min2, const index_type& max2,
2839  const double_index_type& dmin2, const double_index_type& dmax2,
2840  const char * s);
2841 
2844  dvar_vector& operator()(int i, int j);
2845  prevariable operator()(int i, int j, int k);
2846 
2847  bool allocated() const { return v != NULL; }
2848  int indexmin() const { return index_min; }
2849  int indexmax() const { return index_max; }
2850 
2851  void set_initial_value(const double_index_type& initial_value);
2852  void deallocate();
2853 };
2854 #if defined(OPT_LIB)
2857  { return v[i]; }
2860  { return v[i]; }
2861 inline dvar_vector&
2863  { return v[i][j]; }
2864 inline prevariable
2866  { return v[i](j,k); }
2867 #endif
2868 
2874 {
2879 public:
2882 
2883  void set_scalefactor(double s);
2884  void set_scalefactor(const dvector& s);
2885  dvector get_scalefactor(void);
2886 
2887 #if defined(OPT_LIB)
2888  param_init_number& operator[](int i) { return v[i];}
2889  param_init_number& operator()(int i) { return v[i];}
2890 #else
2891  param_init_number& operator[](int i);
2892  param_init_number& operator()(int i);
2893 #endif
2894 
2895  void allocate(int min1,int max1,const index_type& phase_start,
2896  const char * s);
2897 
2898  void allocate(int min1,int max1,const char * s);
2899 
2900  bool allocated() const { return v != NULL; }
2901  int indexmin() const { return index_min; }
2902  int indexmax() const { return index_max; }
2903  void set_initial_value(const double_index_type& it);
2904  void deallocate(void);
2905 };
2906 
2907 class data_matrix;
2916 {
2921 public:
2924 
2925  void set_scalefactor(double s);
2926  void set_scalefactor(const dvector& s);
2928 
2931 
2932  void allocate(int min1,int max1,const double_index_type & bmin,
2933  const double_index_type & bmax,const index_type& phase_start,
2934  const char * s);
2935 
2936  void allocate(int min1,int max1,const double_index_type & bmin,
2937  const double_index_type & bmax,const char * s);
2938 
2939  // Added by Steve Martell, Jan 18, 2014.
2940  void allocate(const data_matrix &m, const char *s);
2941 
2942  bool allocated() const { return v != NULL; }
2943  int indexmin() const { return index_min; }
2944  int indexmax() const { return index_max; }
2945  void set_initial_value(const double_index_type& it);
2946  void deallocate();
2947 };
2948 #if defined(OPT_LIB)
2951 {
2952  return v[i];
2953 }
2956 {
2957  return v[i];
2958 }
2959 #endif
2960  extern int traceflag;
2961  void tracing_message(int traceflag,const char *s,int *pn);
2962  void tracing_message(int traceflag,const char *s,double *pn);
2964  void set_gauss_covariance_matrix(const dmatrix& m);
2965  void set_covariance_matrix(const dll_data_matrix& m);
2966  void set_covariance_matrix(const dmatrix& m);
2967 
2968  //ostream& operator<<(const ostream&, const param_init_number_vector);
2969  //ostream& operator<<(const ostream&, const param_init_bounded_number_vector);
2970  //ostream& operator<<(const ostream&, const param_init_vector_vector);
2971  //ostream& operator<<(const ostream&, const param_init_bounded_vector_vector);
2972  //ostream& operator<<(const ostream&, const param_init_matrix_vector);
2973  //ostream& operator<<(const ostream&, const param_init_bounded_matrix_vector);
2974 
2979  class vector_kludge : public dvar_vector
2980  {
2981  public:
2984  };
2990  {
2991  public:
2994  };
2995 
2996 void read_covariance_matrix(const dmatrix& S, int nvar, int& hbf,
2997  dvector& sscale);
2998 
3001 //dvector value(const param_init_bounded_number_matrix& t);
3002 //dvector value(const param_init_vector_vector& t);
3003 //dvector value(const param_init_bounded_vector_vector& t);
3004 
3005 dvector read_old_scale(int & old_nvar);
3006 
3007 int withinbound(int lb,int n,int ub);
3008 
3009 #if defined(_MSC_VER)
3010 # if defined(min)
3011 # undef min
3012 # endif
3013 # if defined(max)
3014 # undef max
3015 # endif
3016 #endif
3017 
3019 
3020 #include <Vectorize.hpp>
3021 
3022 #endif
static likeprof_params * likeprofptr[500]
Definition: admodel.h:2257
virtual void hess_scale(const dvector &, const dvector &, const int &)
Definition: admodel.h:1355
stddev_params(void)
Definition: admodel.h:2227
ivector v
Definition: admodel.h:732
void allocate(void)
Description not yet available.
Definition: d7arr2.cpp:27
double projected_hess_determinant(const dvector &g, const int underflow_flag, const dvector &xscale, const double &ln_det_proj_jac)
Definition: nnewmod2.cpp:9
double val
Definition: admodel.h:1806
static int straight_through_flag
Definition: admodel.h:839
virtual void set_value(const dvar_vector &x, const int &ii, const dvariable &pen)
Definition: model.cpp:442
dll_data_matrix & operator=(const dmatrix &m)
Assign values from mat to elements of dll_data_matrix.
Definition: model31.cpp:242
char ** no_dll_options(char *pname, const int &argc)
Definition: model33.cpp:103
void deallocate(void)
Free member allocated memory.
Definition: model44.cpp:113
void set_minb(double b)
Definition: model10.cpp:167
void cleanup_laplace_stuff(laplace_approximation_calculator *)
Description not yet available.
Definition: df1b2lap.cpp:2226
virtual void set_value(const dvar_vector &x, const int &ii, const dvariable &pen)
Definition: model21.cpp:61
void hess_routine_noparallel_randomeffects(void)
Base class for dvariable.
Definition: fvar.hpp:1315
Description not yet available.
Definition: admodel.h:1577
virtual void add_value(const dvector &, const int &)=0
ivector * m
Definition: imatrix.h:74
virtual void set_value(const dvar_vector &x, const int &ii, const dvariable &pen)
Definition: model.cpp:864
param_init_bounded_matrix_vector()
Default constructor.
Definition: model46.cpp:20
param_stddev_matrix(void)
Definition: model2.cpp:156
bool hess_inv()
Symmetrize and invert the hessian.
Definition: mod_hess.cpp:574
void allocate(void)
Does NOT allocate, but initializes empty d3_array.
Definition: d3arr10.cpp:11
void setup_quadprior_calcs(void)
Definition: admodel.h:1878
void computations1(int argc, char *argv[])
Definition: modspmin.cpp:138
static void restore_all_values(const dvector &x, const int &ii)
Definition: model3.cpp:105
virtual void set_simulation_bounds(const dmatrix &symbds, const int &ii)
Definition: montebds.cpp:93
void operator=(const adstring &)
laplace_approximation_calculator * lapprox
Definition: admodel.h:1862
ptovoid * ptr
Definition: admodel.h:751
void restore_value_from_vector(const prevariable &x, const dvector &v, const int &ii)
Definition: model3.cpp:147
virtual void add_value(const dvector &, const dvector &, const int &, const double &, const dvector &)
Definition: montebds.cpp:133
dll_named_adstring(void)
Definition: admodel.h:1570
virtual void pvm_pack(void)
Definition: admodel.h:2513
Description not yet available.
Definition: admodel.h:506
virtual void set_value(const dvar_vector &, const int &, const dvariable &pen)=0
param_init_bounded_number & operator()(int i)
Definition: admodel.h:2955
dvector bounded_multivariate_uniform(int nvar, const dvector &a1, const dvector &b1, dmatrix &ch, const double &lprob, random_number_generator &rng)
Definition: monte.cpp:216
virtual void AD_uf_inner()
Definition: xmodelm4.cpp:40
void set_initial_value(const double_index_type &it)
Definition: model47.cpp:9
void set_multinomial_weights(dvector &d)
Definition: xmodelm3.cpp:548
void allocate(int min1, int max1, const index_type &phase_start, const char *s)
Definition: model47.cpp:56
void trust_region_update(int nvar, int _crit, independent_variables &x, const dvector &_g, const double &_f)
Description not yet available.
Definition: f1b2trst.cpp:20
objective_function_value & operator=(const prevariable &v)
Assigment operator for prevariable.
Definition: model8.cpp:23
void hess_routine_slave_random_effects(void)
Description not yet available.
Definition: mod_rhes.cpp:556
dvector * multinomial_weights
Definition: admodel.h:1863
virtual unsigned int size_count() const
Returns the number of active parameters.
Definition: model.cpp:904
virtual void dev_correction(const dmatrix &, const int &)
Definition: model23.cpp:30
virtual void send_to_slaves(void)
static adstring user_par_file
Definition: admodel.h:1920
index_type * get_shareflags(void)
Definition: shared.cpp:204
virtual void sd_scale(const dvector &d, const dvector &x, const int &)
Definition: model10.cpp:51
adstring name
Definition: admodel.h:167
virtual void hess_scale(const dvector &, const dvector &, const int &)
Definition: admodel.h:1004
dvariable(model_parameters::* PMF)(const dvariable &)
Definition: admodel.h:1835
virtual void get_from_master(void)
~shareinfo()
Definition: shared.cpp:180
void probing_bounded_multivariate_normal_mcmc(int nvar, const dvector &a1, const dvector &b1, dmatrix &ch, const double &wght, const dvector &v, double pprobe, const random_number_generator &rng)
Definition: xmonte2.cpp:87
void allocate(int min1, int max1, const index_type &min, const index_type &max, const double_index_type &dmin, const double_index_type &dmax, const index_type &phase_start, const char *s)
Definition: model45.cpp:38
dmatrix _hessian_inverse
Definition: admodel.h:2199
Uses polymorphism to get index information from various data types to be used in constructing and all...
Definition: fvar.hpp:7731
dvariable adrombo(_func func, double a, double b, int ns=9)
virtual void restore_value_from_vector(const dvector &, const int &)
Definition: model3.cpp:117
void pvm_pack(const dvar_vector &)
virtual unsigned int size_count() const =0
double get_scalefactor()
Definition: model.cpp:30
void set_scalefactor(double s)
Definition: model48.cpp:215
Description not yet available.
Definition: adrndeff.h:182
Description not yet available.
Definition: fvar.hpp:7054
void set_scalefactor(double s)
Sets scalefactor for param_init_number_vector.
Definition: model48.cpp:177
virtual void set_simulation_bounds(const dmatrix &symbds, const int &ii)
Definition: montebds.cpp:36
dvector rotate_pars(const dvector &m, const dvector &x)
void allocate(double *_pd, double _minb, double _maxb, int phase_start=1, const char *s="UNNAMED")
Definition: model31.cpp:333
named_dvar_matrix & operator=(const double m)
Assign named_dvar_matrix with value.
Definition: model11.cpp:101
Description not yet available.
Definition: fvar.hpp:6861
virtual void shared_set_value_inv(const dvector &, const int &)
Definition: shared.cpp:31
matrix_kludge(const param_init_vector_vector &)
Definition: vec_io.cpp:35
void begin_funnel_stuff(void)
Definition: xmodelm3.cpp:803
void pvm_master_prof_minimize(int iprof, double sigma, double new_value, const double &_fprof, const int underflow_flag, double global_min, const double &_penalties, const double &_final_weight)
static const int maxnum_pvm_params
Definition: admodel.h:696
~param_init_bounded_number_vector()
Destructor.
Definition: model48.cpp:41
static dvariable reset_all(const dvar_vector &x, const dvector &pen)
Description not yet available.
Definition: nvarcall.cpp:45
virtual void sd_vscale(const dvar_vector &d, const dvar_vector &x, const int &ii)
Definition: model53x.cpp:9
void allocate(void)
Does not allocate, but initializes imatrix members.
Definition: imat.cpp:138
index_type * original_sflags
Definition: admodel.h:780
Description not yet available.
Definition: admodel.h:1474
static void get_jacobian_value(const dvector &y, const dvector &jac)
Definition: mod_mc3.cpp:21
void quasi_newton_block_pvm_master(int nvar, int _crit, independent_variables &x, const dvector &g, const double &f)
Description not yet available.
Definition: admodel.h:2391
virtual void deallocate()
Definition: admodel.h:1904
dmatrix & get_hessian_inverse()
Definition: admodel.h:2193
param_init_bounded_vector()
Default constructor.
Definition: model.cpp:912
data_5array(void)
Definition: admodel.h:1707
named_dvector(void)
Definition: admodel.h:464
void deallocate()
Frees member allocated memory.
Definition: model46.cpp:126
Description not yet available.
Definition: imatrix.h:69
data_imatrix(void)
Definition: admodel.h:1751
param_init_vector()
Default constructor.
Definition: model.cpp:730
double hess_determinant(int underflow_flag)
Definition: modhdet.cpp:10
virtual ~initial_params()
Destructor.
Definition: model.cpp:56
Description not yet available.
Definition: admodel.h:2211
void allocate(const char *="UNNAMED")
Definition: model.cpp:576
virtual void restore_value(const ifstream &ifs)=0
virtual void copy_value_to_vector(const dvector &x, const int &ii)
Definition: model4.cpp:25
int maxshare
Definition: admodel.h:785
static adstring user_data_file
Definition: admodel.h:1919
virtual void copy_value_to_vector(const dvector &x, const int &ii)
Definition: model4.cpp:30
label_class label(void)
Definition: admodel.h:172
virtual void set_value_inv(const dvector &x, const int &ii)
Definition: model.cpp:544
static void set_active_random_effects(void)
Definition: model.cpp:267
Description not yet available.
Definition: admodel.h:211
data_4iarray(void)
Definition: admodel.h:1736
void shmc_mcmc_routine(int, int, double, int)
Definition: hmc.cpp:19
virtual ~dll_param_init_vector()
Destructor.
Definition: model32.cpp:58
static void xinit1(const dvector &x, const dvector &g)
Definition: model.cpp:296
void pvm_pack(void)
Definition: admodel.h:1327
static int num_active_initial_params
Definition: admodel.h:840
named_imatrix & operator=(const imatrix &m)
static int stddev_curvscale(const dvector &d, const dvector &x)
Definition: model.cpp:214
virtual void restore_value_from_vector(const dvector &, const int &)
Definition: model3.cpp:123
int withinbound(int lb, int n, int ub)
Definition: model.cpp:45
void allocate(void)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: dmat0.cpp:8
ivector param_size
Definition: admodel.h:1912
static named_dvar_vector * pg
Definition: admodel.h:1906
data_matrix & operator=(const dmatrix &m)
Assign data_matrix with values.
Definition: model11.cpp:534
named_i4_array & operator=(const i4_array &m)
Definition: model15i.cpp:77
dll_param_init_d3array & operator=(const d3_array &)
Definition: model35.cpp:180
Description not yet available.
Definition: admodel.h:727
adlist_ptr()
Default constructor.
Definition: model.cpp:1309
static int sd_phase
Definition: admodel.h:844
void read_mle_hmc(int nvar, dvector &mle)
shareinfo * get_share_flags() const
Definition: admodel.h:1026
void copy_value_to_vector(const prevariable &x, const dvector &v, const int &ii)
Definition: model3.cpp:47
Description not yet available.
Definition: admodel.h:2303
void sobol_importance_routine(int nmcmc, int iseed0, double dscale, int restart_flag)
void set_scalefactor(const double)
Definition: model.cpp:34
void prof_hess_routine(int ip, double new_value, double final_weight)
virtual void sd_vscale(const dvar_vector &d, const dvar_vector &x, const int &ii)=0
named_dmatrix(void)
Definition: admodel.h:490
virtual void sd_scale(const dvector &d, const dvector &x, const int &ii)
Definition: model21.cpp:230
dvector read_old_scale(int &old_nvar)
Definition: xxmcmc.cpp:1667
~dll_param_vector()
Destructor.
Definition: model32.cpp:36
void nuts_mcmc_routine(int, int, double, int)
The function implements the MCMC algorithm NUTS, which is a self-tuning variant of Hamiltonian Monte ...
Definition: nuts.cpp:51
static int num_active_calc(void)
Definition: model.cpp:177
Description not yet available.
Definition: admodel.h:1748
void limited_memory_quasi_newton_block(int nvar, int _crit, independent_variables &x, const dvector &_g, const double &_f, int nsteps)
Description not yet available.
Definition: df1b2lmn2.cpp:23
static int likeprof_flag
Definition: admodel.h:1854
void allocate(int *_pi, const char *s)
Definition: model31.cpp:9
initial_params * pinitial_params
Definition: admodel.h:740
index_type * aflags
Definition: admodel.h:781
virtual void set_value(const dvar_vector &x, const int &ii, const dvariable &pen)
Definition: model.cpp:688
For storing void pointers in a array.
Definition: admodel.h:746
int imax2(int a, double v)
Definition: dtweedie.cpp:5
virtual unsigned int size_count() const
Returns the number of active parameters.
Definition: model2.cpp:109
virtual unsigned int size_count() const
Return number of active paramters.
Definition: model2.cpp:133
double stepsize
Definition: admodel.h:2253
virtual void send_to_slaves(void)=0
named_d5_array & operator=(const d5_array &m)
Definition: model26.cpp:48
param_stddev_matrix & operator=(const double m)
Assign param_stddev_matrix with value.
Definition: model11.cpp:141
void report_value(void)
param_likeprof_number & operator=(const prevariable &)
Assign param_likeprof_number with prevariable var.
Definition: mod_prof.cpp:65
virtual void get_from_master(void)
Description not yet available.
Definition: admodel.h:242
Description not yet available.
Definition: fvar.hpp:5433
function_minimizer(long int sz=0L)
Definition: xmodelm3.cpp:553
virtual void curv_scale(const dvector &d, const dvector &x, const int &)
Definition: model19.cpp:78
named_dvar3_array(void)
Definition: admodel.h:315
void set_maxb(double b)
Set maximum bounds value for param_init_bounded_vector.
Definition: model50.cpp:29
param_stddev_vector & operator=(const dvar_vector &m)
Definition: model11.cpp:147
void allocate(double _minb, double _maxb, int phase_start=1, const char *s="UNNAMED")
Definition: model.cpp:489
#define x
dvector bounded_multivariate_normal_sobol(int nvar, const dvector &a1, const dvector &b1, dmatrix &ch, const double &lprob, const random_number_generator &rng)
Description not yet available.
Definition: admodel.h:1552
double cumd_exp(double x)
Definition: monte.cpp:37
Vector of double precision numbers.
Definition: dvector.h:50
virtual void bsave_value(uostream &uos)
Definition: model.cpp:742
bool stop_criterion(int nvar, dvector &thetaminus, dvector &thetaplus, dvector &rminus, dvector &rplus)
param_init_bounded_matrix & operator()(int i)
Definition: admodel.h:2859
static int inner_opt_flag
Definition: admodel.h:1860
void quasi_newton_block_pvm_master_random_effects(int nvar, int _crit, independent_variables &x, const dvector &g, const double &f)
Description not yet available.
Definition: admodel.h:521
param_likeprof_number(const int step_number, const char *name)
Definition: admodel.h:2353
param_init_matrix * v
Definition: admodel.h:2769
pinitial_params & operator[](int i)
Definition: model.cpp:1294
Description not yet available.
Definition: admodel.h:196
static void xinit_all(const dvector &x)
Description not yet available.
Definition: nvarcall.cpp:31
virtual void get_jacobian(const dvector &, const dvector &, const int &)
Definition: montebds.cpp:357
void get_function_difference(void)
Definition: xmodelm3.cpp:823
void prof_minimize(int iprof, double sigma, double new_value, const double &fprof, const int underflow_flag, double global_min, const double &penalties, const double &final_weight)
Definition: newmodm2.cpp:221
int ADqd_flag
Definition: model.cpp:28
dll_param_vector & operator=(const dvar_vector &m)
Definition: model31.cpp:138
void neldmead(int n, dvector &_start, dvector &_xmin, double *ynewlo, double reqmin, double delta, int *icount, int *numres, int *ifault)
Nelder-Mead simplex alogrithm.
Definition: amoeba.cpp:150
Description not yet available.
Definition: admodel.h:555
void allocate(void)
Does not allocate, but initializes pointers to NULL.
Definition: d4arr3.cpp:14
std::vector< void * > list
Definition: admodel.h:753
void set_initial_value(const double_index_type &it)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: model48.cpp:12
virtual void restore_value_from_vector(const dvector &, const int &)
Definition: model21.cpp:77
virtual void get_jacobian(const dvector &, const dvector &, const int &)
Definition: montebds.cpp:388
double_index_type * it
Definition: admodel.h:2723
void set_initial_simplex(const dmatrix &p, const dvector &y, int nvar, const dvector &x, double delta)
Definition: xmodelm3.cpp:656
void pvm_unpack(void)
Definition: admodel.h:983
void begin_df1b2_funnel(void)
Definition: admodel.h:1877
void pvm_master_function_evaluation_profile(double &f, independent_variables &x, const dvector &g, int nvar, int iprof, double weight, double new_value)
param_init_bounded_number & operator=(const double m)
Definition: model11.cpp:221
named_dvar_matrix(void)
Definition: admodel.h:274
const char * mychar(void)
Definition: admodel.h:156
double get_maxb() const
Returns maximum bounds value for param_init_bounded_vector.
Definition: model50.cpp:36
param_init_bounded_matrix * v
Definition: admodel.h:2815
int indexmin() const
Definition: admodel.h:2901
Description not yet available.
Definition: admodel.h:1151
void other_separable_stuff_begin(void)
Definition: xmodelm3.cpp:732
virtual void other_calculations(void)
Definition: admodel.h:1933
void fmin(double f, const independent_variables &x, const dvector &g, const int &n, const dvector &w, const dvector &h, const fmm_control &fmc)
virtual void setindex(int)
Definition: model2.cpp:68
friend int operator+(const int n, const data_int &v)
Definition: model9.cpp:10
static int correct_for_dev_objects(const dmatrix &H)
Definition: model.cpp:137
dll_data_number & operator=(const double &m)
Definition: model31.cpp:23
param_init_number & operator=(const double m)
Definition: model11.cpp:209
static void add_random_vector(const dvector &x)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: mod_mc1.cpp:7
void hess_routine_and_constraint(int iprof, const dvector &g, dvector &fg)
Definition: mod_hess.cpp:215
std::function< dvariable(const dvariable &)> _func
Definition: admodel.h:1831
void get_sp_printf(void)
Definition: model33.cpp:149
static int max_num_initial_params
Definition: admodel.h:837
void set_shareflags(const index_type &sf)
Definition: shared.cpp:250
int AD_gaussflag
Definition: model.cpp:27
named_d4_array & operator=(const d4_array &m)
Definition: model15.cpp:139
Description not yet available.
Definition: admodel.h:2767
void allocate(void)
Does not allocate, but initializes dvar_vector to empty.
Definition: fvar_arr.cpp:216
void allocate(int min0, int max0, const index_type &min, const index_type &max, const index_type &min1, const index_type &max1, const index_type &phase_start, const char *s)
Definition: model44.cpp:37
virtual void set_runtime_maxfn(const char *)
Definition: modspmin.cpp:453
param_init_bounded_number & operator[](int i)
Definition: admodel.h:2950
virtual void curv_scale(const dvector &d, const dvector &x, const int &)
Definition: model19.cpp:9
int compute_next_window(int i, int warmup, int w1, int aws, int w3)
virtual void hess_scale(const dvector &, const dvector &, const int &)
Definition: admodel.h:1185
static pvm_params * varsptr[]
Definition: admodel.h:694
double get_initial_value(void)
Definition: model.cpp:96
virtual int shared_size_count(void)
Definition: shared.cpp:15
data_7array(void)
Definition: admodel.h:1675
void initialize(void)
Definition: admodel.h:1812
void allocate(double *pd, int phase_start=1, const char *s="UNNAMED")
Allocate param_init_number and sets pd = _pd.
Definition: model31.cpp:48
Description not yet available.
Definition: df1b2fun.h:953
virtual ~dll_param_init_matrix()
Destructor.
Definition: model32.cpp:109
named_dvar_vector & operator=(const dvar_vector &m)
Definition: model11.cpp:153
virtual void mc_scale(const dvector &d, const dvector &x, const int &)
Description not yet available.
Definition: mc_scale.cpp:181
Stores double value.
Definition: fvar.hpp:8499
dvariable do_gauss_hermite_integration_multi(void)
Definition: xmodelm5.cpp:31
int phase_save
Definition: admodel.h:849
virtual void curv_scale(const dvector &d, const dvector &x, const int &)
Definition: model19.cpp:63
char ** parse_dll_options(char *pname, const int &argc, char *dll_options)
Definition: model33.cpp:443
function_minimizer * pfm
virtual ~dll_param_init_number()
Definition: model32.cpp:18
param_init_number(const char *name)
Definition: admodel.h:1194
double scalefactor
Definition: admodel.h:824
Description not yet available.
Definition: admodel.h:1409
static int inner_opt(void)
Definition: xmodelm3.cpp:39
virtual void save_value(ofstream &ofs)
Definition: model.cpp:736
void rwm_mcmc_routine(int, int, double, int)
Definition: rwm.cpp:92
virtual void setindex(int)
Definition: model2.cpp:61
void multint(int n, const dvar_vector &a, const dvar_vector &b, const dvar_vector &h, double al, int m, const dvariable &e, const dvariable &aint, const int &key, PMFVI f)
virtual void pvm_unpack(void)=0
virtual void get_jacobian(const dvector &, const dvector &, const int &)
Definition: montebds.cpp:349
void hybrid_mcmc_routine(int, int, double, int)
Description not yet available.
Definition: hybmcmc.cpp:83
dvariable(model_parameters::* PMFI)(const dvariable &, int n)
Definition: admodel.h:1836
named_dvar4_array & operator=(const dvar4_array &m)
Definition: model15.cpp:145
Description not yet available.
Definition: admodel.h:626
void print_mcmc_progress(int is, int nmcmc, int nwarmup, int chain, int refresh)
void allocate(const char *s1, const char *s="UNNAMED")
virtual unsigned int size_count() const
Returns the number of active parameters.
Definition: mod_prof.cpp:34
void allocate(void)
Initializes to NULL.
Definition: f4arr3.cpp:20
exitptr ad_exit
Definition: gradstrc.cpp:53
dvariable random_effects_maximization(const dvar_vector &v)
Definition: randeff.cpp:33
virtual void get_sd_values(const dvector &x, const int &ii)
Definition: model41.cpp:27
Description not yet available.
Definition: admodel.h:430
virtual void set_value_inv(const dvector &x, const int &ii)
Definition: model.cpp:451
named_i3_array & operator=(const i3_array &m)
Definition: model29.cpp:25
~param_init_vector_vector()
Destructor.
Definition: model43.cpp:127
param_init_bounded_vector & operator=(const dvector &)
Definition: model20.cpp:52
virtual void get_sd_values(const dvector &x, const int &ii)
Definition: model41.cpp:17
void set_maxb(double b)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: model50.cpp:13
double density_cauchy(const double &x)
Description not yet available.
Definition: cumd_cau.cpp:29
void set_initial_value(double x)
Definition: model.cpp:90
named_ivector(void)
Definition: admodel.h:479
Description not yet available.
Definition: admodel.h:461
void set_gauss_covariance_matrix(const dll_data_matrix &m)
Definition: mod_sd.cpp:20
named_d6_array(void)
Definition: admodel.h:647
void allocate(void)
Allocate dvector without allocating memory.
Definition: dvector.cpp:495
virtual void set_runtime(void)
Definition: modspmin.cpp:451
virtual void add_value(const dvector &, const dvector &, const int &, const double &, const dvector &)
Definition: montebds.cpp:210
virtual double & get_sigma(void)=0
#define dmin(a, b)
Definition: cbivnorm.cpp:190
virtual void pvm_pack(void)=0
bool choleski_decomp_hmc(const dmatrix &metric, dmatrix &L)
dvector probing_bounded_multivariate_normal(int nvar, const dvector &a1, const dvector &b1, dmatrix &ch, const double &lprob, double pprobe, const random_number_generator &rng)
const char * name
Definition: admodel.h:152
dvector bounded_multivariate_normal(int nvar, const dvector &a1, const dvector &b1, dmatrix &ch, const double &_wght, const random_number_generator &rng)
dvariable(model_parameters::* PMFVI)(const dvar_vector &, int n)
Definition: admodel.h:1837
void allocate(void)
Definition: admodel.h:2222
virtual ~dll_data_3array()
Definition: model35.cpp:9
static dvariable reset(const dvar_vector &x)
Definition: model.cpp:345
double get_maxb() const
Returns maximum bounds value for param_init_bounded_matrix.
Definition: model50.cpp:52
void allocate(void)
Does NOT allocate, but initializes d6_array members.
Definition: d6arr2.cpp:14
virtual void shared_set_value(const dvar_vector &, const int &, const dvariable &pen)
Definition: shared.cpp:146
named_dvar7_array(void)
Definition: admodel.h:433
dvariable do_gauss_hermite_integration(void)
Definition: xmodelm5.cpp:12
virtual unsigned int size_count() const
Returns the number of active parameters.
Definition: model.cpp:1025
virtual void set_value(const dvar_vector &x, const int &ii, const dvariable &pen)
Definition: model.cpp:535
equality_constraint_vector & operator=(const dvar_vector &m)
void top_mcmc_routine(int, int, double, int)
virtual void save_value(const ofstream &ofs, int prec)
Write values of param_init_matrix into output stream _ofs.
Definition: model12.cpp:60
int & get_dimension(void)
Definition: admodel.h:792
void reset_bmap(const i3_array &af)
Definition: shared.cpp:228
virtual void mc_scale(const dvector &d, const dvector &x, const int &)
Description not yet available.
Definition: mc_scale.cpp:44
ADMB variable vector.
Definition: fvar.hpp:2172
Description not yet available.
Definition: admodel.h:1661
virtual dvar_vector user_dfrandeff(const dvar_vector &x)
Definition: model37.cpp:18
virtual const char * label()=0
static void set_all_simulation_bounds(const dmatrix &symbds)
Definition: montebds.cpp:25
bool allocated() const
Definition: admodel.h:2802
void set_covariance_matrix(const dll_data_matrix &m)
Definition: mod_sd.cpp:30
Description not yet available.
Definition: admodel.h:814
void set_activeflags(const index_type &af)
Definition: shared.cpp:254
virtual void * parent_this(void)
Definition: admodel.h:1060
Description not yet available.
Definition: fvar.hpp:6673
double leapfrog(int nvar, dvector &gr, dmatrix &chd, double eps, dvector &p, dvector &x, dvector &gr2)
Function to take a single HMC leapfrog step, given current position and momentum variables.
param_init_d3array(void)
Definition: model21.cpp:32
virtual void sd_vscale(const dvar_vector &d, const dvar_vector &x, const int &ii)
Definition: model53.cpp:11
virtual void sd_scale(const dvector &d, const dvector &x, const int &ii)
Definition: model10.cpp:69
param_init_vector & operator=(const dvector &)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: model20.cpp:13
int ef_(double *f, double *x)
static void restore_start_phase(void)
Definition: model.cpp:275
virtual double & get_sigma(void)
Definition: admodel.h:2343
double cumd_mixture_02(const double &x)
Definition: nmonte.cpp:517
param_init_bounded_vector_vector()
Default constructor.
Definition: model45.cpp:18
void do_dll_housekeeping(int argc, char **argv)
Definition: model33.cpp:159
void end_df1b2_funnel(void)
Definition: admodel.h:1879
label_class(const char *s)
Definition: admodel.h:157
param_init_bounded_number()
Default constructor.
Definition: model.cpp:924
static int num_stddev_calc(void)
Definition: model2.cpp:51
virtual void between_phases_calculations(void)
Definition: admodel.h:1937
static void send_all_to_slaves(void)
index_type * get_activeflags(void)
Definition: shared.cpp:216
named_dvar7_array & operator=(const dvar7_array &m)
Definition: model28.cpp:82
friend ostream & operator<<(const ostream &s, const label_class &lc)
Definition: model11.cpp:43
virtual void setshare(const index_type &sf, const index_type &af)
Definition: shared.cpp:173
void computations(void)
Definition: modspmin.cpp:397
Description not yet available.
Definition: admodel.h:2556
virtual void shared_set_value(const dvar_vector &, const int &, const dvariable &pen)
Definition: shared1.cpp:59
Description not yet available.
Definition: admodel.h:1776
virtual void mc_scale(const dvector &d, const dvector &x, const int &)
Description not yet available.
Definition: mc_scale.cpp:158
param_init_number_vector()
Default constructor.
Definition: model47.cpp:16
double get_maxb() const
Returns maximum bounds value for param_init_bounded_number.
Definition: model50.cpp:20
void get_inv_matrix_shared(int _cf)
Definition: shared.cpp:269
virtual void set_dependent_variables(void)
Definition: model2.cpp:178
virtual dvariable variable(void)=0
virtual void bsave_value(uostream &uos)
Definition: model21.cpp:52
void allocate(const char *s="UNNAMED")
Allocate init_line_adstring with id name_tag, then assign input string from opened ad_comm::global_da...
Definition: model51.cpp:25
dvector rotate_gradient(const dvector &x, const dmatrix &m)
double_index_type * it
Definition: admodel.h:2680
double ffmax(double a, double b)
Definition: monte.cpp:14
void likeprof_routine(double global_min)
Definition: mod_pmin.cpp:67
virtual unsigned int size_count() const
Returns number of active paramters.
Definition: model.cpp:468
static dvariable reset1(const dvar_vector &x, const dvector &g)
Definition: model.cpp:330
virtual void add_value(const dvector &, const dvector &, const int &, const double &, const dvector &)
Definition: montebds.cpp:277
Description not yet available.
Definition: admodel.h:665
double cumd_mixture(const double &x)
Definition: nmonte.cpp:529
dvariable()
Default constructor.
Definition: fvar.hpp:1526
double inv_cumd_exp(double x)
Definition: monte.cpp:25
Description not yet available.
Definition: df1b2fun.h:266
Description not yet available.
Definition: admodel.h:968
void copy_value_from_vector(const double &_sd, const dvector &x, const int &_ii)
Definition: model42.cpp:9
param_init_matrix(void)
Definition: model.cpp:1016
Description not yet available.
Definition: admodel.h:378
Description not yet available.
Definition: admodel.h:271
void deallocate()
Deallocate param_init_bounded_number_vector memory.
Definition: model48.cpp:46
named_imatrix(void)
Definition: admodel.h:509
int constrained_minimization2(int _n, int _nh, int _ng, dvector &__x)
virtual void set_simulation_bounds(const dmatrix &symbds, const int &ii)
Definition: montebds.cpp:113
Description not yet available.
Definition: admodel.h:2979
Description not yet available.
Definition: admodel.h:1120
void allocate(double *_pd, const char *s)
Definition: model31.cpp:16
virtual void bsave_value(uostream &uos)
Definition: model.cpp:1036
void monte_carlo_routine(void)
Definition: mod_mc.cpp:35
virtual unsigned int size_count() const
Return number of active parameters.
Definition: model21.cpp:41
double diag_projected_hess_determinant(const dvector &g, const int underflow_flag, dmatrix &dh)
double find_reasonable_stepsize(int nvar, dvector y, dvector p, dmatrix &chd, bool verbose_adapt_mass, bool verbose_find_epsilon, int chain)
static int nvarcalc()
Definition: model.cpp:152
double * pd
Definition: admodel.h:1823
virtual void add_to_list(void)
Definition: model.cpp:129
void restore_phase_start(void)
Definition: model.cpp:283
void allocate()
Definition: adstring.hpp:210
Description not yet available.
Definition: admodel.h:692
virtual ~dll_param_number()
Destructor.
Definition: model32.cpp:31
virtual void set_only_random_effects_active()
Definition: model.cpp:1280
static int constraint_exit_number
Definition: admodel.h:2031
virtual void shared_set_value_inv(const dvector &, const int &)
Definition: shared.cpp:70
Description not yet available.
Definition: fvar.hpp:5769
Description not yet available.
Definition: admodel.h:2470
int phase_stop
Definition: admodel.h:850
double ffmin(double a, double b)
Definition: monte.cpp:19
int & get_maxshare(void)
Definition: admodel.h:790
void pvm_master_mcmc_computations(void)
Definition: modspmin.cpp:598
void sob_routine(int nmcmc, double dscale, int restart_flag)
virtual void set_value_inv(const dvector &x, const int &ii)
Definition: model21.cpp:67
param_init_bounded_vector * v
Definition: admodel.h:2720
#define dmax(a, b)
Definition: cbivnorm.cpp:191
static int stddev_vscale(const dvar_vector &d, const dvar_vector &x)
Definition: model.cpp:191
param_init_bounded_vector & operator[](int i)
Definition: admodel.h:2732
dmatrix _hessian
Definition: admodel.h:2198
bool calculate_chd_and_inverse(int nvar, const dmatrix &metric, dmatrix &chd, dmatrix &chdinv)
Calculate the Cholesky decomposition and its inverse given a mass matrix.
param_init_vector_vector()
Default constructor.
Definition: model43.cpp:19
void pvm_master_mcmc_routine(int nmcmc, int iseed0, double dscale, int restart_flag)
d3_array mfexp(const d3_array &m)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: d3arr7.cpp:10
void adamoeba(const dmatrix &p, const dvector &y, int ndim, double ftol, int maxfn)
Nelder-Mead simplex alogrithm.
Definition: amoeba.cpp:38
Description not yet available.
Definition: admodel.h:1820
void quasi_newton_minimizer1(int nvar, double _crit, double &f, const independent_variables &x, const dvector &g)
data_ivector(void)
Definition: admodel.h:1795
virtual unsigned int size_count() const =0
void computations_np(int argc, char *argv[])
dvector v
Definition: admodel.h:716
Description not yet available.
Definition: fvar.hpp:5161
Description not yet available.
Definition: admodel.h:1761
param_likeprof_number(const char *name)
Definition: admodel.h:2349
virtual void pvm_unpack(void)
Definition: admodel.h:2514
index_type * invflags
Definition: admodel.h:782
virtual void hess_scale(const dvector &d, const dvector &x, const int &ii)=0
void pvm_slave_mcmc_routine(void)
virtual const char * label(void)
Definition: model11.cpp:258
void allocate(const char *s)
Definition: model.cpp:112
Description not yet available.
Definition: admodel.h:2280
void pvm_unpack(const dvar_vector &)
void pvm_slave_function_evaluation(void)
dll_param_init_vector & operator=(const dvector &)
Definition: model31.cpp:97
double_index_type * it
Definition: admodel.h:2772
Description not yet available.
Definition: admodel.h:1228
param_init_bounded_vector & operator()(int i)
Definition: admodel.h:2733
virtual void mc_scale(const dvector &d, const dvector &x, const int &)
Description not yet available.
Definition: mc_scale.cpp:109
Description not yet available.
Definition: admodel.h:1058
shareinfo * share_flags
Definition: admodel.h:818
double log_density_cauchy(const double &x)
Description not yet available.
Definition: cumd_cau.cpp:39
void pvm_master_function_evaluation(double &f, independent_variables &x, const dvector &g, int nvar)
virtual const char * label(void)
Definition: model11.cpp:240
virtual void set_dependent_variables(void)
Definition: model2.cpp:151
virtual void dev_correction(const dmatrix &, const int &)=0
Description not yet available.
Definition: admodel.h:2718
virtual double get_value(void)
Definition: admodel.h:2344
void limited_memory_quasi_newton(const independent_variables &, int)
Definition: lmnewton.cpp:32
virtual void set_simulation_bounds(const dmatrix &symbds, const int &ii)=0
Description not yet available.
Definition: fvar.hpp:7951
static adstring get_reportfile_name(void)
Definition: model.cpp:1267
virtual void save_value(ofstream &ofs)
Definition: model.cpp:1030
static int num_stddev_number_calc(void)
Definition: model2.cpp:88
virtual const char * label()=0
virtual ~dll_param_init_d3array()
Definition: model35.cpp:101
void set_scalefactor(double s)
Definition: model48.cpp:253
void pvm_pack(void)
Definition: admodel.h:982
Description not yet available.
Definition: admodel.h:2813
void set_initial_value(const double_index_type &it)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: model43.cpp:11
void assign(const ivector &)
void set_minb(double b)
Definition: model10.cpp:177
void set_bmap(const i3_array &af)
Definition: shared.cpp:224
void end_get_importance_sampling_comnponent(void)
Definition: xmodelm3.cpp:785
prnstream & endl(prnstream &)
Description not yet available.
Definition: fvar.hpp:1937
int & get_current_phase(void)
Definition: shared.cpp:196
virtual void add_to_gui_list(void)
Definition: model2.cpp:28
virtual void set_value(const dvar_vector &x, const int &ii, const dvariable &pen)
Definition: model5.cpp:9
void allocate(void)
Does NOT allocate, but set empty i3_array.
Definition: i3arr.cpp:237
Array of integers(int) with indexes from index_min to indexmax.
Definition: ivector.h:50
void check_datafile_pointer(void *p)
Exits if p is null.
Definition: model.cpp:560
void pvm_unpack(void)
Definition: admodel.h:1159
virtual void dev_correction(const dmatrix &, const int &)
Definition: model23.cpp:24
static int current_phase
Definition: admodel.h:842
virtual void shared_set_value_inv(const dvector &x, const int &ii)
Definition: shared.cpp:55
virtual void set_dependent_variables(void)
Definition: model2.cpp:114
named_dvar6_array(void)
Definition: admodel.h:405
virtual void dev_correction(const dmatrix &H, const int &ii)
Definition: model23.cpp:48
virtual void curv_scale(const dvector &d, const dvector &x, const int &ii)
Definition: model21.cpp:184
void(model_parameters::* PMFVIV4)(const dvar_vector &, int n, dvariable &f1, const dvariable &f2, const dvariable &f3, const dvariable &f4)
Definition: admodel.h:1838
Description not yet available.
Definition: admodel.h:2369
static void set_active_only_random_effects(void)
Definition: model.cpp:251
double * pd
Definition: admodel.h:228
virtual void bsave_value(uostream &uos)
Definition: model.cpp:989
virtual void restore_value(const ifstream &ifs)
Definition: model21.cpp:269
Description not yet available.
Definition: admodel.h:1562
objective_function_value()
Default constructor.
Definition: model8.cpp:15
static dvector maximum_function_evaluations
Definition: admodel.h:1917
virtual void set_value_inv(const dvector &x, const int &ii)
Definition: model.cpp:697
static int max_number_phases
Definition: admodel.h:841
virtual unsigned int size_count() const
Returns the number of active parameters.
Definition: model.cpp:724
void pvm_slave_function_evaluation_no_derivatives(void)
virtual ~dll_param_matrix()
Destructor.
Definition: model32.cpp:138
double get_hybrid_monte_carlo_value(int nvar, const independent_variables &y, dvector &g)
Written by Dave, commented by Cole starting 8/31/2016 Description not yet available.
void adwait(double)
Definition: model34.cpp:42
virtual void set_value(const dvar_vector &x, const int &ii, const dvariable &pen)
Definition: model6.cpp:22
dvector bounded_robust_multivariate_normal(int nvar, const dvector &a1, const dvector &b1, dmatrix &ch, const dmatrix &ch3, double contaminant, const double &_wght, random_number_generator &rng)
Definition: monte.cpp:256
Description not yet available.
Definition: admodel.h:777
void allocate(int min1, int max1, const index_type &min, const index_type &max, const index_type &min2, const index_type &max2, const double_index_type &dmin2, const double_index_type &dmax2, const index_type &phase_start, const char *s)
Definition: model46.cpp:42
double inv_cumd_mixture_02(const double &y)
Definition: nmonte.cpp:609
void operator=(const adstring &)
Definition: model36.cpp:20
param_init_bounded_dev_vector & operator=(const dvar_vector &m)
Definition: model24.cpp:15
#define min(a, b)
Definition: cbivnorm.cpp:188
void begin_gauss_hermite_stuff(void)
Definition: xmodelm3.cpp:761
virtual void hess_scale(const dvector &, const dvector &, const int &)
Definition: admodel.h:1287
virtual void set_value_inv(const dvector &x, const int &ii)
Definition: model.cpp:883
Description not yet available.
Definition: fvar.hpp:3398
data_vector & operator=(const dvector &m)
Definition: model11.cpp:186
Description not yet available.
Definition: fvar.hpp:6498
virtual void add_value(const dvector &, const dvector &, const int &, const double &, const dvector &)
Definition: montebds.cpp:259
Description not yet available.
Definition: admodel.h:2675
static double gmax
Definition: admodel.h:2396
int get_phase_start(void)
Definition: model.cpp:107
void normalize_posterior_distribution(double udet, const dvector &siglevel, const ofstream &ofs2, int num_pp, const dvector &all_values, const dmatrix &actual_value, double global_min, int offset, const dmatrix &lprof, const dmatrix &ldet, const dmatrix &xdist, const dmatrix &penalties)
Definition: newmodmn.cpp:63
void allocate(void)
Description not yet available.
Definition: f6arr2.cpp:26
int dimension
Definition: admodel.h:784
static void get_stddev_number_offset(void)
Definition: model2.cpp:73
virtual void final_calcs(void)
Definition: admodel.h:1934
void allocate(const char *s1, const char *s="UNNAMED")
Definition: model36.cpp:9
void other_separable_stuff_end(void)
Definition: xmodelm3.cpp:748
~param_init_number_vector()
Destructor.
Definition: model47.cpp:26
virtual void send_to_slaves(void)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
int indexmin() const
Definition: admodel.h:2803
Description not yet available.
Definition: admodel.h:487
int val
Definition: admodel.h:1477
void allocate(void)
Does not allocate, but initializes members.
Definition: fvar_mat.cpp:479
virtual void set_random_effects_inactive()
Definition: model.cpp:1292
virtual void copy_value_to_vector(const dvector &x, const int &ii)
Definition: model21.cpp:72
Description not yet available.
Definition: admodel.h:1722
virtual void sd_scale(const dvector &d, const dvector &x, const int &ii)
Definition: model10.cpp:26
void add_to_list(void *)
Store pointer p to array.
Definition: model.cpp:1366
virtual void save_value(const ofstream &ofs, int prec, const dvector &, int &offset)
Definition: admodel.h:2501
data_int()
Definition: admodel.h:1484
static int have_constraints
Definition: admodel.h:1921
virtual void save_value(const ofstream &ofs, int prec)
Write values of param_init_number into output stream _ofs.
Definition: model12.cpp:30
virtual void set_dependent_variables(void)=0
static objective_function_value * pobjfun
Definition: admodel.h:2394
Description not yet available.
Definition: admodel.h:1523
named_i4_array(void)
Definition: admodel.h:599
virtual void restore_value(const ifstream &ifs)
Definition: model13.cpp:26
static named_dvar_vector * ph
Definition: admodel.h:1905
void allocate(const char *s)
Definition: model.cpp:583
static void xinit(const dvector &x)
Definition: model.cpp:226
virtual void curv_scale(const dvector &d, const dvector &x, const int &ii)=0
void pvm_slave_function_evaluation_noder(void)
param_init_number & operator()(int i)
Definition: admodel.h:2889
Description not yet available.
Definition: admodel.h:180
dmatrix diag_hess_routine(void)
double set_value_inv_mc(double v, double fmin, double fmax)
Definition: mod_mc3.cpp:116
static int num_pvm_params
Definition: admodel.h:695
virtual void add_to_list(void)
Definition: mod_prof.cpp:17
Description not yet available.
Definition: admodel.h:1300
dvector get_scalefactor(void)
Returns vector of scalefactor values.
Definition: model48.cpp:141
Description not yet available.
Definition: admodel.h:1504
dvector * m
Definition: fvar.hpp:2824
static int bad_step_flag
Definition: admodel.h:1853
void deallocate(void)
Free member allocated memory.
Definition: model47.cpp:33
virtual void report(const dvector &gradients)
Definition: admodel.h:1915
void cleanup_argv(int nopt, char ***pa)
Definition: model33.cpp:124
virtual const char * label(void)
Definition: model2.cpp:218
initial_params(void)
Default constructor.
Definition: model.cpp:76
static int nvarcalc_all(void)
Description not yet available.
Definition: nvarcall.cpp:17
adstring_array param_labels
Definition: admodel.h:1911
void allocate(unsigned int init_size)
Construct array with init_size.
Definition: model.cpp:1318
void function_evaluation_block_pvm_slave(void)
data_matrix(void)
Definition: admodel.h:1592
virtual void restore_value(const ifstream &ifs)
Definition: model13.cpp:36
virtual void set_simulation_bounds(const dmatrix &symbds, const int &ii)
Definition: montebds.cpp:426
void constraint_report(void)
virtual void get_jacobian(const dvector &, const dvector &, const int &)=0
static void set_inactive_random_effects(void)
Definition: model.cpp:288
i3_array & get_bmap(void)
Definition: shared.cpp:208
void get_bigS(int ndvar, int nvar1, int nvar, dmatrix &S, dmatrix &BS, dvector &scale)
Description not yet available.
Definition: getbigs.cpp:15
void mcmc_computations(void)
Definition: modspmin.cpp:472
double ndfboundp(double x, double fmin, double fmax, const double &fpen)
Derivatative code for double nd2fboundp( double x, double fmin, double fmax,const double&amp; fpen) ...
Definition: boundfun.cpp:210
~param_init_bounded_vector_vector()
Destructor.
Definition: model45.cpp:75
index_type * get_original_shareflags(void)
Definition: shared.cpp:200
double * pd
Definition: admodel.h:295
named_d3_array(void)
Definition: admodel.h:524
void pre_user_function(void)
Description not yet available.
Definition: df1b2lp8.cpp:370
virtual void save_value(ofstream &ofs)
Definition: model21.cpp:46
virtual void copy_value_to_vector(const dvector &x, const int &ii)
Definition: model3.cpp:42
Description not yet available.
Definition: fvar.hpp:2819
virtual unsigned int size_count() const
Returns the number of active parameters.
Definition: model2.cpp:165
int indexmax() const
Definition: admodel.h:2804
dll_param_init_matrix & operator=(const dmatrix &m)
Definition: model31.cpp:415
void read_covariance_matrix(const dmatrix &S, int nvar, int &hbf, dvector &sscale)
Definition: xxmcmc.cpp:1320
int active_flag
Definition: admodel.h:821
param_stddev_number(const char *name)
Definition: admodel.h:2319
void allocate(char **ps1, const char *s="UNNAMED")
Definition: model36.cpp:35
int get_stepnumber(void)
Definition: model14.cpp:41
friend double & value(const prevariable &v1)
Definition: fvar.hpp:1495
void allocate(void)
Description not yet available.
Definition: f5arr3.cpp:26
named_d6_array & operator=(const d6_array &m)
Definition: model27.cpp:57
static void read(void)
param_init_bounded_number * v
Definition: admodel.h:2917
virtual void sd_vscale(const dvar_vector &d, const dvar_vector &x, const int &ii)
Definition: model53.cpp:72
shareinfo(const index_type &sf, const index_type &af)
Definition: shared.cpp:258
Description not yet available.
Definition: fvar.hpp:4197
void allocate(void)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: i4arr.cpp:9
double_and_int * v
pointer to the data
Definition: fvar.hpp:1333
virtual double get_value(void)=0
param_stddev_number()
Default constructor.
Definition: model2.cpp:96
param_init_bounded_number_vector()
Default constructor.
Definition: model48.cpp:33
double amxxx(const dmatrix &p, const dvector &y, const dvector &psum, int ndim, int ihi, double fac)
Description not yet available.
Definition: amoeba.cpp:107
void * ptovoid
Definition: admodel.h:750
Description not yet available.
Definition: admodel.h:1610
void prof_minimize_re(int iprof, double sigma, double new_value, const double &fprof, const int underflow_flag, double global_min, const double &penalties, const double &final_weight)
Definition: newmodm5.cpp:17
named_dvar3_array & operator=(const dvar3_array &m)
Definition: model11.cpp:340
void pvm_slave_mcmc_computations(void)
Definition: modspmin.cpp:661
dll_param_init_number & operator=(const double m)
Assigns val to parameter value.
Definition: model31.cpp:81
double pvm_master_get_monte_carlo_value(int nvar, const dvector &x)
Definition: mod_mc2.cpp:36
virtual void copy_value_to_vector(const dvector &x, const int &ii)
Definition: model3.cpp:21
double unrestricted_hess_determinant(void)
Definition: newmodm4.cpp:10
Description not yet available.
Definition: admodel.h:571
virtual void hess_scale(const dvector &, const dvector &, const int &)
Definition: admodel.h:1442
static void copy_all_values(const dvector &x, const int &ii)
Definition: model3.cpp:9
static int num_initial_params
Definition: admodel.h:836
void set_value_mc(const dvar_vector &x, const dvar_vector &v, const int &ii, const double fmin, const double fmax)
Definition: mod_mc3.cpp:152
static int num_stddev_calc(void)
Description not yet available.
Definition: admodel.h:2251
Description not yet available.
Definition: admodel.h:1316
void reset_shareflags(const index_type &sf)
Definition: shared.cpp:237
void set_stepsize(double)
Definition: model14.cpp:10
void allocate(const char *s="UNNAMED")
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: model51.cpp:13
param_init_matrix_vector()
Default constructor.
Definition: model44.cpp:17
static void copy_all_number_values(const dvector &x, const int &ii)
Definition: model4.cpp:17
virtual const char * label(void)
Definition: model11.cpp:252
virtual void mc_scale(const dvector &d, const dvector &x, const int &)
Description not yet available.
Definition: mc_scale.cpp:92
virtual void set_simulation_bounds(const dmatrix &symbds, const int &ii)
Definition: montebds.cpp:71
virtual void curv_scale(const dvector &d, const dvector &x, const int &)
Definition: model19.cpp:18
void set_inactive_flag(void)
Definition: model.cpp:432
dmatrix * negdirections
Definition: admodel.h:1858
named_dvariable(void)
Definition: admodel.h:246
virtual void shared_set_value(const dvar_vector &, const int &, const dvariable &pen)
Definition: shared.cpp:125
virtual void set_random_effects_active()
Definition: model.cpp:1290
virtual void mc_scale(const dvector &d, const dvector &x, const int &)
Description not yet available.
Definition: mc_scale.cpp:31
void allocate()
Does not allocate, but initializes class members.
Definition: ivector.cpp:316
virtual void set_only_random_effects_inactive()
Definition: model.cpp:1286
void pvm_pack(void)
Definition: admodel.h:1158
virtual void restore_value(const ifstream &ifs)
Definition: model13.cpp:31
void set_initial_value(const double_index_type &it)
Definition: model44.cpp:9
void pvm_slave_get_monte_carlo_value(int nvar)
Definition: mod_mc2.cpp:59
static bool in_hessian_phase
Definition: admodel.h:845
dmatrix & get_hessian()
Definition: admodel.h:2192
Description not yet available.
Definition: admodel.h:256
Description not yet available.
Definition: admodel.h:293
named_d3_array & operator=(const d3_array &m)
Definition: model11.cpp:524
named_dvariable & operator=(const prevariable &m)
Definition: model11.cpp:435
double * d
Definition: admodel.h:1663
void set_minb(double b)
Definition: model10.cpp:157
void get_inv_vector_shared(int _cf)
Definition: shared.cpp:483
virtual void setshare(const index_type &sf, const index_type &af)
Definition: shared1.cpp:91
void deallocate(void)
Free member allocated memory.
Definition: model43.cpp:134
void get_particular_grad(int iprof, int nvar, const dvector &fg, const dvector &g)
Definition: newmodm2.cpp:175
virtual void hess_scale(const dvector &d, const dvector &x, const int &ii)
Definition: model21.cpp:207
virtual void shared_set_value_inv(const dvector &, const int &)
Definition: shared1.cpp:35
void allocate(int _phase_start)
Definition: model.cpp:117
virtual void restore_value_from_vector(const dvector &, const int &)=0
dll_param_matrix & operator=(const dvariable &m)
Definition: model31.cpp:405
static void restore(const ifstream &ifs)
Definition: model13.cpp:9
double get_ln_det_value() const
Definition: admodel.h:2190
void quasi_newton_block(int nvar, int crit, independent_variables &x, const dvector &g, const double &f)
Description not yet available.
Definition: df1b2qnm.cpp:23
void sd_routine(void)
Definition: mod_sd.cpp:101
void pvm_slave_likeprof_routine(void)
Definition: mod_pmin.cpp:50
friend int active(const initial_params &ip)
Definition: model.cpp:437
virtual const char * label(void)
Definition: model21.cpp:27
virtual int shared_size_count(void)
Definition: shared1.cpp:17
void hess_routine_noparallel_random_effects(void)
Description not yet available.
Definition: mod_rhes.cpp:129
double * d
Definition: admodel.h:1612
void sgibbs_mcmc_routine(int, int, double, int)
void hess_routine_slave(void)
int traceflag
Definition: fvar1.cpp:18
virtual void copy_value_to_vector(const dvector &x, const int &ii)
Definition: model4.cpp:35
static stddev_params * stddev_number_ptr[150]
Definition: admodel.h:2217
named_dvar5_array & operator=(const dvar5_array &m)
Definition: model26.cpp:54
virtual void sd_scale(const dvector &d, const dvector &x, const int &ii)
Definition: model10.cpp:95
double inv_cumd_mixture(const double &y)
Definition: nmonte.cpp:556
double exprnd(double p)
Description not yet available.
Definition: admodel.h:1206
istream & operator>>(const istream &input, const d3_array &arr3)
Read values from input stream into arr3.
Definition: d3_io.cpp:60
virtual void restore_value_from_vector(const dvector &, const int &)
Definition: model3.cpp:135
void multint4(int n, const dvar_vector &a, const dvar_vector &b, const dvar_vector &h, double al, int m, const dvariable &e, const dvariable &aint1, const dvariable &aint2, dvariable &aint3, const dvariable &aint4, const int &key, PMFVIV4 f)
i3_array * bmap
Definition: admodel.h:783
double adapt_eps(int ii, int iseps, double eps, double alpha, double &adapt_delta, double &mu, dvector &epsvec, dvector &epsbar, dvector &Hbar)
param_init_bounded_matrix & operator[](int i)
Definition: admodel.h:2856
static stddev_params * stddevptr[150]
Definition: admodel.h:2215
void pvm_master_function_evaluation_no_derivatives(double &f, independent_variables &x, int nvar)
void report_function_minimizer_stats(void)
Definition: admodel.h:1914
~data_int()
Definition: admodel.h:1488
Description not yet available.
Definition: df1b2fun.h:373
Description not yet available.
Definition: admodel.h:1135
double_index_type * it
Definition: admodel.h:2818
param_init_number * v
Definition: admodel.h:2875
Description not yet available.
Definition: admodel.h:312
ostream & operator<<(const ostream &_s, preshowpoint p)
Description not yet available.
Definition: admanip.cpp:48
virtual ~dll_data_vector()
Destructor.
Definition: model32.cpp:69
void set_initial_value(const double_index_type &it)
Definition: model45.cpp:9
virtual void sd_vscale(const dvar_vector &d, const dvar_vector &x, const int &ii)
Definition: model53.cpp:47
void set_active_flag(void)
Definition: model.cpp:427
void set_maxb(double b)
Set maximum bounds value for param_init_bounded_matrix.
Definition: model50.cpp:45
virtual int shared_size_count(void)
Definition: shared.cpp:37
void initialize()
Double array size if needed.
Definition: model.cpp:1353
void set_stepnumber(int)
Definition: model14.cpp:23
void allocate(void)
Description not yet available.
Definition: d5arr3.cpp:26
void allocate(int min1, int max1, const double_index_type &bmin, const double_index_type &bmax, const index_type &phase_start, const char *s)
Allocate vector of param_init_bounded_number with dimension [min1 to max1] and bounded by [bmin...
Definition: model48.cpp:108
double * pd
Definition: admodel.h:1779
virtual ~dll_data_matrix()
Destructor.
Definition: model32.cpp:80
void print_mcmc_timing(double time_warmup, double time_total, int chain)
named_dvar_vector(void)
Definition: admodel.h:183
void allocate(void)
Does not allocte, but initialize class members.
Definition: f3arr17.cpp:18
bool slow_phase(int is, int warmup, int w1, int w3)
dll_param_number & operator=(const prevariable &m)
Definition: model31.cpp:28
virtual void copy_value_to_vector(const dvector &x, const int &ii)
Definition: model3.cpp:25
void allocate(int phase_start=1, const char *s="UNNAMED")
Definition: model.cpp:629
int * pi
Definition: admodel.h:1580
void end_gauss_hermite_stuff(void)
Definition: xmodelm3.cpp:863
void allocate(void)
Description not yet available.
Definition: f7arr2.cpp:26
virtual int getindex(void)
Definition: model2.cpp:62
virtual void add_value(const dvector &, const dvector &, const int &, const double &, const dvector &)
Definition: montebds.cpp:202
Description not yet available.
Definition: admodel.h:644
virtual void mc_scale(const dvector &d, const dvector &x, const int &)
Description not yet available.
Definition: mc_scale.cpp:131
double initial_value
Definition: admodel.h:823
static ivector copy_all_number_offsets(void)
Definition: model2.cpp:39
virtual void add_to_list(void)
Definition: model2.cpp:17
named_dvar5_array(void)
Definition: admodel.h:381
virtual dvar_matrix user_d2frandeff(const dvar_vector &x)
Definition: model37.cpp:26
param_init_matrix & operator=(const dmatrix &m)
Assigns values from mat to param_init_matrix.
Definition: model20.cpp:81
void operator=(const adstring &)
Definition: model36.cpp:30
dll_param_d3array & operator=(const d3_array &)
Definition: model35.cpp:167
vector_kludge(const param_init_number_vector &)
Definition: vec_io.cpp:9
Class definition of matrix with derivitive information .
Definition: fvar.hpp:2480
virtual void AD_uf_outer()
Definition: xmodelm4.cpp:39
double projected_jacobian(const dvector &g, const dvector &xscale)
adstring get_reportfile_name(void)
double inv_cumd_cauchy(const double &x)
Description not yet available.
Definition: cumd_cau.cpp:49
virtual void save_value(ofstream &ofs)=0
void hess_step()
hess_step is used for HMC. See details in function_minimizer::hess_step.
double eps
Definition: ftweak.cpp:13
param_init_number & operator[](int i)
Definition: admodel.h:2888
virtual ~dll_data_number()
Definition: model32.cpp:13
Description not yet available.
Definition: admodel.h:2537
virtual void dev_correction(const dmatrix &, const int &)
Definition: model23.cpp:18
dvariable trapzd(void *, double a, double b, int n)
virtual void get_jacobian(const dvector &, const dvector &, const int &)
Definition: model21.cpp:18
virtual void dev_correction(const dmatrix &H, const int &ii)
Definition: model23.cpp:36
data_6array(void)
Definition: admodel.h:1692
virtual const char * label()=0
Description not yet available.
Definition: admodel.h:2873
virtual void setshare(const index_type &sf, const index_type &af)
Definition: shared.cpp:567
int phase_start
Definition: admodel.h:848
unsigned char * s
Definition: adstring.hpp:76
bool allocated() const
Definition: admodel.h:2900
named_d7_array(void)
Definition: admodel.h:668
void bounded_multivariate_uniform_mcmc(int nvar, const dvector &a1, const dvector &b1, dmatrix &ch, const double &wght, const dvector &y, const random_number_generator &rng)
Definition: xmonte2.cpp:138
virtual void sd_vscale(const dvar_vector &d, const dvar_vector &x, const int &ii)
Definition: model53.cpp:20
double ndfboundp_mc(double x, double fmin, double fmax, const double &fpen)
Description not yet available.
Definition: mc_scale.cpp:63
virtual dvariable user_randeff(const dvar_vector &x)
Definition: model37.cpp:9
named_d5_array(void)
Definition: admodel.h:629
Definition of the cifstream class.
likeprof_params(void)
Definition: mod_prof.cpp:11
Description not yet available.
Definition: admodel.h:226
Description not yet available.
Definition: fvar.hpp:6331
void resize(void)
data_number & operator=(const double &m)
Definition: model.cpp:570
~param_init_bounded_matrix_vector()
Destructor.
Definition: model46.cpp:121
static int restart_phase
Definition: admodel.h:843
double * pd
Definition: admodel.h:258
Description not yet available.
Definition: admodel.h:2989
int initial_value_flag
Definition: admodel.h:822
Description not yet available.
Definition: admodel.h:2332
double & value(void)
Definition: admodel.h:1811
static int sd_flag
Definition: admodel.h:1918
static int mceval_phase
Definition: admodel.h:847
virtual const char * label(void)
Definition: model2.cpp:213
virtual void copy_value_to_vector(const dvector &, const int &)=0
virtual void shared_set_value(const dvar_vector &, const int &, const dvariable &pen)
Definition: shared.cpp:99
void report_value(void)
void report_value(void)
static int test_trust_flag
Definition: admodel.h:1856
void set_original_shareflags(const index_type &sf)
Definition: shared.cpp:246
Description not yet available.
Definition: admodel.h:1850
Description not yet available.
Definition: admodel.h:1792
virtual ~function_minimizer()
Destructor.
Definition: xmodelm3.cpp:633
virtual dvariable variable(void)
Definition: admodel.h:2346
virtual void set_value_inv(const dvector &, const int &)=0
virtual void bsave_value(uostream &uos)
Definition: model.cpp:682
Description not yet available.
Definition: admodel.h:164
void allocate(void)
void mcmc_routine(int, int, double, int)
Monte Carlo Markov Chain minimization routine Approximate the target distribution by performing a ran...
Definition: xxmcmc.cpp:126
virtual void setshare(const index_type &sf, const index_type &af)
Definition: shared.cpp:596
Description not yet available.
Definition: admodel.h:1589
double cumd_cauchy(const double &x)
Description not yet available.
Definition: cumd_cau.cpp:17
Description not yet available.
Definition: fvar.hpp:7262
gradient_structure * pgs
Definition: admodel.h:1910
virtual const char * label(void)
Definition: model11.cpp:234
virtual void shared_set_value_inv(const dvector &, const int &)
Definition: shared.cpp:84
virtual void copy_value_to_vector(const dvector &, const int &)=0
static int output_flag
Definition: admodel.h:1972
~adlist_ptr()
Destructor.
Definition: model.cpp:1381
int diagonal_metric_flag
Definition: admodel.h:1887
void report_value(void)
virtual ~dll_data_int()
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: model32.cpp:8
named_dvar6_array & operator=(const dvar6_array &m)
Definition: model27.cpp:63
int indexmax() const
Definition: admodel.h:2902
void set_initial_value(const double_index_type &initial_value)
Sets initial value of param_init_bounded_matrix_vector.
Definition: model46.cpp:14
int current_phase
Definition: admodel.h:786
static void save(void)
Definition: model.cpp:382
virtual void user_function()
Definition: xmodelm4.cpp:43
static void get_all_sd_values(const dvector &x, const int &ii)
Definition: model41.cpp:9
Description not yet available.
Definition: admodel.h:402
dll_data_3array & operator=(const d3_array &)
Definition: model35.cpp:155
named_dmatrix & operator=(const dmatrix &m)
Assign named_dmatrix with values.
Definition: model11.cpp:401
virtual void get_jacobian(const dvector &, const dvector &, const int &)
Definition: montebds.cpp:370
param_init_vector & operator[](int i)
Definition: admodel.h:2691
void end_df1b2_funnel_stuff(void)
Definition: xmodelm3.cpp:830
virtual void curv_scale(const dvector &d, const dvector &x, const int &)
Definition: model19.cpp:45
dvector get_scalefactor(void)
Definition: model48.cpp:187
virtual void set_simulation_bounds(const dmatrix &symbds, const int &ii)
Definition: montebds.cpp:46
static int negative_eigenvalue_flag
Definition: admodel.h:1859
index_type * get_invflags(void)
Definition: shared.cpp:212
int d
Definition: admodel.h:733
static void copy_all_values(const dvector &x, const int &ii)
Definition: model4.cpp:9
virtual void restore_value_from_vector(const dvector &, const int &)
Definition: model3.cpp:141
static void get_all_from_master(void)
void set_phase_start(int x)
Definition: model.cpp:101
objective_function_value(const char *name)
Definition: admodel.h:2398
void assign(const dvector &)
void allocate(int n, const char *s="UNNAMED")
Definition: model.cpp:1200
dvector value(const df1_one_vector &v)
Definition: df11fun.cpp:69
virtual void constraints_minimize(void)
unsigned int current
Definition: admodel.h:748
named_d4_array(void)
Definition: admodel.h:574
Stores integer.
Definition: fvar.hpp:7654
param_init_bounded_matrix(void)
Default constructor.
Definition: model6.cpp:17
void allocate(int min1, int max1, const index_type &min, const index_type &max, const index_type &phase_start, const char *s)
Allocate vector min1 to max2 of param_init_vector with dimensions min to max using specified phase_st...
Definition: model43.cpp:56
double min_improve
Definition: admodel.h:1900
virtual void userfunction(void)=0
virtual void copy_value_to_vector(const dvector &x, const int &ii)
Definition: model3.cpp:36
Description not yet available.
Definition: fvar.hpp:3944
std::string get_filename(const char *f)
virtual int shared_size_count(void)
Definition: shared.cpp:46
virtual void get_sd_values(const dvector &x, const int &ii)
Definition: model41.cpp:22
void mcmc_eval(void)
Description not yet available.
Definition: mceval.cpp:14
Description not yet available.
Definition: admodel.h:1033
double get_monte_carlo_value(int nvar, const independent_variables &x)
Definition: mod_mc2.cpp:11
double _ln_det_value
Definition: admodel.h:2197
param_init_vector & operator()(int i)
Definition: admodel.h:2692
#define max(a, b)
Definition: cbivnorm.cpp:189
virtual void sd_vscale(const dvar_vector &d, const dvar_vector &x, const int &ii)
Definition: model53.cpp:90
static int stddev_scale(const dvector &d, const dvector &x)
Definition: model.cpp:202
Description not yet available.
Definition: admodel.h:1389
static int mc_phase
Definition: admodel.h:846
void add_sample_dense(const int nvar, int &is2, dvector &m, dmatrix &m2, const independent_variables &q)
Calculate running covariance using Welford&#39;s &quot;online&quot; algorithm.
dll_data_vector & operator=(const dvector &x)
Definition: model31.cpp:195
virtual void mc_scale(const dvector &d, const dvector &x, const int &ii)=0
class for things related to the gradient structures, including dimension of arrays, size of buffers, etc.
Description not yet available.
Definition: fvar.hpp:3727
virtual const char * label(void)
Definition: model11.cpp:246
data_int(const data_int &other)
Definition: admodel.h:1485
void pre_userfunction(void)
Definition: model7.cpp:586
virtual void bsave_value(uostream &uos)=0
void function_evaluation_block_pvm_slave_random_effects(void)
Class object for init_bounded_number vector.
Definition: admodel.h:2915
void depvars_routine(void)
Calculate the derivatives of dependent variables with respect to the independent variables.
Definition: mod_hess.cpp:488
virtual void set_simulation_bounds(const dmatrix &symbds, const int &ii)
Definition: montebds.cpp:56
dmatrix dep_hess_routine(const dvariable &dep)
Description not yet available.
Definition: dep_hess.cpp:16
void pvm_unpack(void)
Definition: admodel.h:1328
Description not yet available.
Definition: admodel.h:711
static int num_stddev_number_params
Definition: admodel.h:2220
Description not yet available.
Definition: admodel.h:1625
virtual ~dll_param_d3array()
Definition: model35.cpp:33
void tracing_message(int traceflag, const char *s)
Description not yet available.
Definition: newfmin.cpp:94
virtual void allocate()
Definition: admodel.h:1903
data_4array(void)
Definition: admodel.h:1725
virtual void sd_scale(const dvector &d, const dvector &x, const int &ii)=0
Description not yet available.
Definition: admodel.h:476
void set_invflags(const index_type &af)
Definition: shared.cpp:220
dvector get_scalefactor(void)
Definition: model48.cpp:225
virtual const char * label(void)
Definition: mod_prof.cpp:56
void hess_routine_random_effects(void)
Description not yet available.
Definition: mod_rhes.cpp:99
virtual void set_value_inv(const dvector &x, const int &ii)
Definition: model6.cpp:35
const char * get_name(void)
Definition: admodel.h:173
void allocate(double *_d, const char *s)
Definition: model31.cpp:57
virtual int getindex(void)
Definition: model2.cpp:64
param_stddev_number & operator=(const prevariable &)
Definition: model11.cpp:417
param_init_matrix & operator[](int i)
Definition: admodel.h:2783
bool allocated() const
Definition: admodel.h:2707
void add_to_list(void)
int imin2(int a, int b)
Definition: dtweedie.cpp:10
void hess_routine_noparallel(void)
Definition: mod_hess.cpp:61
static dvector convergence_criteria
Definition: admodel.h:1915
Description not yet available.
Definition: admodel.h:131
void bounded_multivariate_normal_mcmc(int nvar, const dvector &a1, const dvector &b1, dmatrix &ch, const double &wght, const dvector &y, const random_number_generator &rng)
Definition: xmonte2.cpp:14
param_init_vector * v
Definition: admodel.h:2677
static double fun_without_pen
Definition: admodel.h:2395
Description not yet available.
Definition: admodel.h:347
void deallocate(void)
Free member allocated memory.
Definition: model45.cpp:82
void report_value(void)
virtual void curv_scale(const dvector &d, const dvector &x, const int &)
Definition: model19.cpp:32
int ad_get_commandline_option(const char *option_label, const int &option_value, const char *error_message)
virtual void get_from_master(void)=0
virtual void dev_correction(const dmatrix &, const int &)
Definition: model23.cpp:42
virtual void add_value(const dvector &, const dvector &, const int &, const double &, const dvector &)
Definition: montebds.cpp:296
virtual void shared_set_value(const dvar_vector &, const int &, const dvariable &pen)
Definition: shared.cpp:23
inequality_constraint_vector & operator=(const dvar_vector &m)
named_dvector & operator=(const dvector &m)
Definition: model11.cpp:175
void build_tree(int nvar, dvector &gr, dmatrix &chd, double eps, dvector &p, dvector &y, dvector &gr2, double logu, int v, int j, double H0, dvector &_thetaprime, dvector &_thetaplus, dvector &_thetaminus, dvector &_rplus, dvector &_rminus, double &_alphaprime, int &_nalphaprime, bool &_sprime, int &_nprime, int &_nfevals, bool &_divergent, const random_number_generator &rng, dvector &gr2_end, dvector &_grprime, dvector &_gr2prime, double &_nllprime, double &_Hprime, independent_variables &_parsaveprime)
static int first_hessian_flag
Definition: admodel.h:1855
data_3array(void)
Definition: admodel.h:1628
named_dvar4_array(void)
Definition: admodel.h:350
Description not yet available.
Definition: fvar.hpp:8564
virtual void sd_scale(const dvector &d, const dvector &x, const int &ii)
Definition: model10.cpp:16
Fundamental data type for reverse mode automatic differentiation.
Definition: fvar.hpp:1518
Description not yet available.
Definition: admodel.h:150
Description not yet available.
Definition: admodel.h:1535
virtual void set_value(const dvar_vector &x, const int &ii, const dvariable &pen)
Definition: model.cpp:998
virtual void sd_scale(const dvector &d, const dvector &x, const int &ii)
Definition: model10.cpp:127
static void save_all(const ofstream &_ofs, int prec, const dvector &g)
Write all values of g into output stream _ofs.
Definition: model12.cpp:161
virtual void copy_value_to_vector(const dvector &x, const int &ii)
Definition: model3.cpp:31
void hess_routine_master(void)
virtual void add_value(const dvector &, const dvector &, const int &, const double &, const dvector &)
Definition: montebds.cpp:223
virtual void set_runtime_crit(const char *)
Definition: modspmin.cpp:463
void pvm_slave_prof_minimize(int underflow_flag)
Description not yet available.
Definition: admodel.h:1803
virtual void hess_scale(const dvector &, const dvector &, const int &)
Definition: admodel.h:1088
double d
Definition: admodel.h:717
~dll_param_init_bounded_vector()
Destructor.
Definition: model32.cpp:47
named_i3_array(void)
Definition: admodel.h:558
static void set_inactive_only_random_effects(void)
Definition: model.cpp:259
index_type * sflags
Definition: admodel.h:779
named_d7_array & operator=(const d7_array &m)
Definition: model28.cpp:76
static int random_effects_flag
Definition: admodel.h:1857
static adlist_ptr varsptr
Definition: admodel.h:838
data_int & operator=(const data_int &other)
Definition: admodel.h:1490
model_name_tag(void)
Definition: admodel.h:170
param_init_matrix & operator()(int i)
Definition: admodel.h:2784
void hess_routine(void)
Definition: mod_hess.cpp:21
void allocate(void)
Definition: admodel.h:2260
virtual void set_value_inv(const dvector &x, const int &ii)
Definition: model.cpp:1008
Macros to do vectorization.
~param_init_matrix_vector()
Destructor.
Definition: model44.cpp:106
void add_sample_diag(const int nvar, int &n, dvector &m, dvector &m2, const independent_variables &q)
Calculate running covariance using Welford&#39;s &quot;online&quot; algorithm.
static int montecarlo_scale(const dvector &d, const dvector &x)
Description not yet available.
Definition: mc_scale.cpp:15
virtual void get_jacobian(const dvector &, const dvector &, const int &)
Definition: montebds.cpp:406
void start_get_importance_sampling_comnponent(void)
Definition: xmodelm3.cpp:777
param_init_bounded_number(const double new_initial_value, const double bounds_min, const double bounds_max, const int phase_start, const char *name)
Definition: admodel.h:1249
data_3iarray(void)
Definition: admodel.h:1650
virtual void get_jacobian(const dvector &, const dvector &, const int &)
Definition: montebds.cpp:341
data_vector(void)
Definition: admodel.h:1766
dvar_vector * m
Definition: fvar.hpp:2484
static int num_stddev_params
Definition: admodel.h:2219
void ad_make_code_reentrant(void)
Definition: model33.cpp:9
double get_stepsize(void)
Definition: model14.cpp:36
double_index_type * it
Definition: admodel.h:2920
virtual ~dll_param_init_bounded_number()
Destructor.
Definition: model32.cpp:26
virtual void get_sd_values(const dvector &x, const int &ii)=0
virtual const char * label(void)
Definition: model2.cpp:208
virtual void minimize(void)
Definition: xmodelm3.cpp:49
virtual void sd_vscale(const dvar_vector &d, const dvar_vector &x, const int &ii)
Definition: model53.cpp:29
dvariable adromb(_func func, double a, double b, int ns=9)
Romberg integration.
Definition: dfqromb.cpp:40
virtual void restore_value_from_vector(const dvector &, const int &)
Definition: model3.cpp:129
double_index_type * it
Definition: admodel.h:2878
static int num_likeprof_params
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: admodel.h:2259
virtual void restore_value(const ifstream &ifs)
Definition: model13.cpp:17
unsigned int current_size
Definition: admodel.h:749