10 #ifndef GSL_RANDIST_H_INCLUDED_LIBKJB_UOFARIZONAVISION
11 #define GSL_RANDIST_H_INCLUDED_LIBKJB_UOFARIZONAVISION
19 #include "gsl/gsl_randist.h"
21 #warning "Compiling GNU GSL wrapper without GNU GSL; it will not run properly"
40 gsl_ran_discrete_t* m_opaque;
52 : m_opaque( gsl_ran_discrete_preproc( event_count, event_probs ) )
54 ETX_2( 00 == m_opaque,
"Gsl_ran_discrete ctor: bad alloc" );
118 return gsl_ran_discrete( rng, m_opaque );
131 return gsl_ran_discrete_pdf( k, m_opaque );
142 swap( m_opaque, that.m_opaque );
151 gsl_ran_discrete_free( m_opaque );
void gsl_rng
Definition: gsl_rng.h:22
size_type size() const
Alias to get_length(). Required to comply with stl Container concept.
Definition: m_vector.h:510
for k
Definition: APPgetLargeConnectedEdges.m:61
This class implements vectors, in the linear-algebra sense, with real-valued elements.
Definition: m_vector.h:87
double pdf(size_t k)
Recompute the probability mass (or density) for event k.
Definition: gsl_randist.h:128
Class defs for C++ wrapper on GNU GSL random number generators.
Gsl_ran_discrete(const std::vector< double > &event_probs)
build the sampler from a std::vector< double > of event weights
Definition: gsl_randist.h:89
Gsl_ran_discrete(size_t event_count, const double *event_probs)
build the sampler from an array of event weights or probabilities
Definition: gsl_randist.h:50
void swap(Gsl_ran_discrete &that)
swap the internal state of two of these objects
Definition: gsl_randist.h:137
double sample(const gsl_rng *rng)
sample from the discrete distribution
Definition: gsl_randist.h:115
#define KJB_THROW_2(ex, msg)
Definition: l_exception.h:48
void swap(kjb::Gsl_Multimin_fdf &m1, kjb::Gsl_Multimin_fdf &m2)
Swap two wrapped multimin objects.
Definition: gsl_multimin.h:693
#define ETX_2(a, msg)
Definition: l_exception.h:78
Support for error handling exception classes in libKJB.
Object thrown when a program lacks required resources or libraries.
Definition: l_exception.h:539
const Impl_type * get_c_vector() const
Get const pointer to the underlying kjb_c::Vector C struct.
Definition: m_vector.h:844
Gsl_ran_discrete(const Vector &event_probs)
build the sampler from a Vector event weights or probabilities
Definition: gsl_randist.h:67
Definition for the Vector class, a thin wrapper on the KJB Vector struct and its related functionalit...
Randomly sample discrete events with an empirical distribution.
Definition: gsl_randist.h:37