| Home | Libraries | People | FAQ | More

## Class param_type

boost::random::hyperexponential_distribution::param_type

## Synopsis

    // In header: <boost/random/hyperexponential_distribution.hpp>

    class param_type {
    public:
      // types
      typedef hyperexponential_distribution distribution_type;

      // construct/copy/destruct
      param_type();
      template<typename ProbIterT, typename RateIterT>
        param_type(ProbIterT, ProbIterT, RateIterT, RateIterT);
      template<typename ProbRangeT, typename RateRangeT>
        param_type(ProbRangeT const &, RateRangeT const &,
                   typename boost::disable_if_c< boost::has_pre_increment< ProbRangeT >::value||boost::has_pre_increment< RateRangeT >::value >::type * = 0);
      template<typename RateIterT>
        param_type(RateIterT, RateIterT,
                   typename boost::enable_if_c< boost::has_pre_increment< RateIterT >::value >::type * = 0);
      template<typename RateRangeT> param_type(RateRangeT const &);
      param_type(std::initializer_list< RealT >, std::initializer_list< RealT >);
      param_type(std::initializer_list< RealT >);

      // public member functions
      std::vector< RealT > probabilities() const;
      std::vector< RealT > rates() const;

      // friend functions
      template<typename CharT, typename Traits>
        friend std::basic_ostream< CharT, Traits > &
        operator<<(std::basic_ostream< CharT, Traits > &, const param_type &);
      template<typename CharT, typename Traits>
        friend std::basic_istream< CharT, Traits > &
        operator>>(std::basic_istream< CharT, Traits > &, const param_type &);
      friend bool operator==(const param_type &, const param_type &);
      friend bool operator!=(const param_type &, const param_type &);
    };

## Description

The parameters of a hyperexponential distribution.

Stores the phase probability vector and the rate vector of the hyperexponential distribution.

Marco Guazzone (marco.guazzone@gmail.com)

### `param_type` public construct/copy/destruct

1.     param_type();

   Constructs a ``param_type`` with the default parameters of the distribution.

2.     template<typename ProbIterT, typename RateIterT>
         param_type(ProbIterT prob_first, ProbIterT prob_last, RateIterT rate_first,
                    RateIterT rate_last);

   Constructs a ``param_type`` from the phase probability vector and rate vector parameters of the distribution.

   The phase probability vector parameter is given by the range defined by [prob_first, prob_last) iterator pair, and the rate vector parameter is given by the range defined by [rate_first, rate_last) iterator pair.

   References:

   1. ISO, ISO/IEC 14882-2014: Information technology - Programming languages - C++, 2014

   Parameters: |

   `prob_first` | The iterator to the beginning of the range of non-negative real elements representing the phase probabilities; if elements don't sum to 1, they are normalized.
   `prob_last` | The iterator to the ending of the range of non-negative real elements representing the phase probabilities; if elements don't sum to 1, they are normalized.
   `rate_first` | The iterator to the beginning of the range of non-negative real elements representing the rates.
   `rate_last` | The iterator to the ending of the range of non-negative real elements representing the rates.

   Template Parameters: |

   `ProbIterT` | Must meet the requirements of `InputIterator` concept (ISO,2014,sec. 24.2.3 [input.iterators]).
   `RateIterT` | Must meet the requirements of `InputIterator` concept (ISO,2014,sec. 24.2.3 [input.iterators]).

3.     template<typename ProbRangeT, typename RateRangeT>
         param_type(ProbRangeT const & prob_range, RateRangeT const & rate_range,
                    typename boost::disable_if_c< boost::has_pre_increment< ProbRangeT >::value||boost::has_pre_increment< RateRangeT >::value >::type * = 0);

   Constructs a ``param_type`` from the phase probability vector and rate vector parameters of the distribution.

   The phase probability vector parameter is given by the range defined by prob_range, and the rate vector parameter is given by the range defined by rate_range.

   | Note
   The final `disable_if` parameter is an implementation detail that differentiates between this two argument constructor and the iterator-based two argument constructor described below.

   Parameters: |

   `prob_range` | The range of non-negative real elements representing the phase probabilities; if elements don't sum to 1, they are normalized.
   `rate_range` | The range of positive real elements representing the rates.

   Template Parameters: |

   `ProbRangeT` | Must meet the requirements of Range concept.
   `RateRangeT` | Must meet the requirements of Range concept.

4.     template<typename RateIterT>
         param_type(RateIterT rate_first, RateIterT rate_last,
                    typename boost::enable_if_c< boost::has_pre_increment< RateIterT >::value >::type * = 0);

   Constructs a ``param_type`` from the rate vector parameter of the distribution and with equal phase probabilities.

   The rate vector parameter is given by the range defined by [rate_first, rate_last) iterator pair, and the phase probability vector parameter is set to the equal phase probabilities (i.e., to a vector of the same length of the rate vector and with each element set to ).

   | Note
   The final `disable_if` parameter is an implementation detail that differentiates between this two argument constructor and the range-based two argument constructor described above.

   References:

   1. ISO, ISO/IEC 14882-2014: Information technology - Programming languages - C++, 2014

   Parameters: |

   `rate_first` | The iterator to the beginning of the range of non-negative real elements representing the rates.
   `rate_last` | The iterator to the ending of the range of non-negative real elements representing the rates.

   Template Parameters: |

   `RateIterT` | Must meet the requirements of `InputIterator` concept (ISO,2014,sec. 24.2.3 [input.iterators]).

5.     template<typename RateRangeT> param_type(RateRangeT const & rate_range);

   Constructs a ``param_type`` from the "rates" parameters of the distribution and with equal phase probabilities.

   The rate vector parameter is given by the range defined by rate_range, and the phase probability vector parameter is set to the equal phase probabilities (i.e., to a vector of the same length of the rate vector and with each element set to ).

   Parameters: |

   `rate_range` | The range of positive real elements representing the rates.

   Template Parameters: |

   `RateRangeT` | Must meet the requirements of Range concept.

6.     param_type(std::initializer_list< RealT > l1,
                  std::initializer_list< RealT > l2);

   Constructs a ``param_type`` from the phase probability vector and rate vector parameters of the distribution.

   The phase probability vector parameter is given by the brace-init-list (ISO,2014,sec. 8.5.4 [dcl.init.list]) defined by l1, and the rate vector parameter is given by the brace-init-list (ISO,2014,sec. 8.5.4 [dcl.init.list]) defined by l2.

   References:

   1. ISO, ISO/IEC 14882-2014: Information technology - Programming languages - C++, 2014

   Parameters: |

   `l1` | The initializer list for inizializing the phase probability vector.
   `l2` | The initializer list for inizializing the rate vector.

7.     param_type(std::initializer_list< RealT > l1);

   Constructs a ``param_type`` from the rate vector parameter of the distribution and with equal phase probabilities.

   The rate vector parameter is given by the brace-init-list (ISO,2014,sec. 8.5.4 [dcl.init.list]) defined by l1, and the phase probability vector parameter is set to the equal phase probabilities (i.e., to a vector of the same length of the rate vector and with each element set to ).

   References:

   1. ISO, ISO/IEC 14882-2014: Information technology - Programming languages - C++, 2014

   Parameters: |

   `l1` | The initializer list for inizializing the rate vector.

### `param_type` public member functions

1.     std::vector< RealT > probabilities() const;

   Gets the phase probability vector parameter of the distribtuion.

   | Note
   The returned probabilities are the normalized version of the ones passed at construction time.

   Returns: | The phase probability vector parameter of the distribution.

2.     std::vector< RealT > rates() const;

   Gets the rate vector parameter of the distribtuion.

   Returns: | The rate vector parameter of the distribution.

### `param_type` friend functions

1.     template<typename CharT, typename Traits>
         friend std::basic_ostream< CharT, Traits > &
         operator<<(std::basic_ostream< CharT, Traits > & os,
                    const param_type & param);

   Writes a ``param_type`` to a `std::ostream`.

2.     template<typename CharT, typename Traits>
         friend std::basic_istream< CharT, Traits > &
         operator>>(std::basic_istream< CharT, Traits > & is,
                    const param_type & param);

   Reads a ``param_type`` from a `std::istream`.

3.     friend bool operator==(const param_type & lhs, const param_type & rhs);

   Returns true if the two sets of parameters are the same.

4.     friend bool operator!=(const param_type & lhs, const param_type & rhs);

   Returns true if the two sets of parameters are the different.