1 /*****************************************************************************
2  *                                                                           *
3  *          UNURAN -- Universal Non-Uniform Random number generator          *
4  *                                                                           *
5  *****************************************************************************
6  *                                                                           *
7  *   FILE: hri.h                                                             *
8  *                                                                           *
9  *   PURPOSE:                                                                *
10  *         function prototypes for method HRI                                *
11  *         (Hazard Rate Increasing)                                          *
12  *                                                                           *
13  *   USAGE:                                                                  *
14  *         only included in unuran.h                                         *
15  *                                                                           *
16  *****************************************************************************
17  *                                                                           *
18  *   Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold             *
19  *   Department of Statistics and Mathematics, WU Wien, Austria              *
20  *                                                                           *
21  *   This program is free software; you can redistribute it and/or modify    *
22  *   it under the terms of the GNU General Public License as published by    *
23  *   the Free Software Foundation; either version 2 of the License, or       *
24  *   (at your option) any later version.                                     *
25  *                                                                           *
26  *   This program is distributed in the hope that it will be useful,         *
27  *   but WITHOUT ANY WARRANTY; without even the implied warranty of          *
28  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           *
29  *   GNU General Public License for more details.                            *
30  *                                                                           *
31  *   You should have received a copy of the GNU General Public License       *
32  *   along with this program; if not, write to the                           *
33  *   Free Software Foundation, Inc.,                                         *
34  *   59 Temple Place, Suite 330, Boston, MA 02111-1307, USA                  *
35  *                                                                           *
36  *****************************************************************************/
37 
38 /*
39    =METHOD  HRI   Hazard Rate Increasing
40 
41    =UP  Methods_for_CONT
42 
43    =REQUIRED increasing (non-decreasing) hazard rate
44 
45    =SPEED Set-up: fast, Sampling: slow
46 
47    =REINIT supported
48 
49    =REF  [HLD04: Sect.9.1.6, Alg.9.6]
50 
51    =DESCRIPTION
52       Generates random variate with given non-increasing hazard rate.
53       It is necessary that the distribution object contains this hazard rate.
54       Increasing hazard rate implies that the corresponding PDF of the
55       distribution has heavier tails than the exponential distribution
56       (which has constant hazard rate).
57 
58       The method uses a decomposition of the hazard rate into a main
59       part which is constant for all @i{x} beyond some point @i{p0}
60       and a remaining part. From both of these parts points are
61       sampled using the thinning method and the minimum of both is
62       returned. Sampling from the first part is easier as we have a
63       constant dominating hazard rate. Thus @i{p0} should be large. On
64       the other hand, if @i{p0} is large than the thinning algorithm
65       needs many iteration. Thus the performance of the the algorithm
66       deponds on the choice of @i{p0}. We found that values close to
67       the expectation of the generated distribution result in good
68       performance.
69 
70    =HOWTOUSE
71       HRI requires a hazard function for a continuous distribution
72       with non-decreasing hazard rate.
73       The parameter @i{p0} should be set to a value close to the
74       expectation of the required distribution using
75       unur_hri_set_p0(). If performance is crucial one may try other
76       values as well.
77 
78       It is important to note that the domain of the distribution can
79       be set via a unur_distr_cont_set_domain() call. However, only
80       the left hand boundary is used. For computational reasons the
81       right hand boundary is always reset to @code{UNUR_INFINITY}.
82       If no domain is given by the user then the left hand boundary is
83       set to @code{0}.
84 
85       For distributions with decreasing hazard rate method HRD
86       (@pxref{HRI,,Hazard Rate Decreasing}) is required.
87       For distributions which do not have increasing or decreasing
88       hazard rates but are bounded from above use method HRB
89       (@pxref{HRB,,Hazard Rate Bounded}).
90 
91       It is possible to change the parameters and the domain of the chosen
92       distribution and run unur_reinit() to reinitialize the generator object.
93 
94 
95       Notice, that the upper bound given by the unur_hrb_set_upperbound() call
96       cannot be changed and must be valid for the changed distribution.
97       Notice that the parameter @i{p0} which has been set by a unur_hri_set_p0()
98       call cannot be changed and must be valid for the changed distribution.
99 
100    =END
101 */
102 
103 /*---------------------------------------------------------------------------*/
104 /* Routines for user interface                                               */
105 
106 /* =ROUTINES */
107 
108 UNUR_PAR *unur_hri_new( const UNUR_DISTR *distribution );
109 /*
110    Get default parameters for generator.
111 */
112 
113 /*...........................................................................*/
114 
115 int unur_hri_set_p0( UNUR_PAR *parameters, double p0 );
116 /*
117    Set design point for algorithm. It is used to split the domain of the
118    distribution. Values for @var{p0} close to the expectation of the
119    distribution results in a relatively good performance of the algorithm.
120    It is important that the hazard rate at this point must be greater
121    than @code{0} and less than @code{UNUR_INFINITY}.
122 
123    Default: left boundary of domain + @code{1.}
124 */
125 
126 int unur_hri_set_verify( UNUR_PAR *parameters, int verify );
127 /* */
128 
129 int unur_hri_chg_verify( UNUR_GEN *generator, int verify );
130 /*
131    Turn verifying of algorithm while sampling on/off.
132    If the hazard rate is not bounded by the given bound, then
133    @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}.
134 
135    Default is FALSE.
136 */
137 
138 /* =END */
139 /*---------------------------------------------------------------------------*/
140