QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
Public Types | List of all members
Histogram Class Reference

Histogram class. More...

#include <histogram.hpp>

+ Collaboration diagram for Histogram:

Public Types

enum  Algorithm { None , Sturges , FD , Scott }
 

Public Member Functions

constructors
 Histogram ()
 
template<class T >
 Histogram (T data_begin, T data_end, Size breaks)
 
template<class T >
 Histogram (T data_begin, T data_end, Algorithm algorithm)
 
template<class T , class U >
 Histogram (T data_begin, T data_end, U breaks_begin, U breaks_end)
 
inspectors
Size bins () const
 
const std::vector< Real > & breaks () const
 
Algorithm algorithm () const
 
bool empty () const
 

results

std::vector< Realdata_
 
Size bins_ = 0
 
Algorithm algorithm_ = None
 
std::vector< Realbreaks_
 
std::vector< Sizecounts_
 
std::vector< Realfrequency_
 
Size counts (Size i) const
 
Real frequency (Size i) const
 
void calculate ()
 

Detailed Description

Histogram class.

This class computes the histogram of a given data set. The caller can specify the number of bins, the breaks, or the algorithm for determining these quantities in computing the histogram.

Definition at line 38 of file histogram.hpp.

Member Enumeration Documentation

◆ Algorithm

enum Algorithm
Enumerator
None 
Sturges 
FD 
Scott 

Definition at line 40 of file histogram.hpp.

Constructor & Destructor Documentation

◆ Histogram() [1/4]

Histogram ( )

Definition at line 44 of file histogram.hpp.

◆ Histogram() [2/4]

Histogram ( T  data_begin,
T  data_end,
Size  breaks 
)

Definition at line 47 of file histogram.hpp.

+ Here is the call graph for this function:

◆ Histogram() [3/4]

Histogram ( T  data_begin,
T  data_end,
Algorithm  algorithm 
)

Definition at line 53 of file histogram.hpp.

+ Here is the call graph for this function:

◆ Histogram() [4/4]

Histogram ( T  data_begin,
T  data_end,
breaks_begin,
breaks_end 
)

Definition at line 60 of file histogram.hpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ bins()

Size bins ( ) const

Definition at line 67 of file histogram.cpp.

+ Here is the caller graph for this function:

◆ breaks()

const std::vector< Real > & breaks ( ) const

Definition at line 71 of file histogram.cpp.

+ Here is the caller graph for this function:

◆ algorithm()

Histogram::Algorithm algorithm ( ) const

Definition at line 75 of file histogram.cpp.

◆ empty()

bool empty ( ) const

Definition at line 79 of file histogram.cpp.

◆ counts()

Size counts ( Size  i) const

Definition at line 83 of file histogram.cpp.

◆ frequency()

Real frequency ( Size  i) const

Definition at line 91 of file histogram.cpp.

+ Here is the caller graph for this function:

◆ calculate()

void calculate ( )
private

Definition at line 99 of file histogram.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ data_

std::vector<Real> data_
private

Definition at line 81 of file histogram.hpp.

◆ bins_

Size bins_ = 0
private

Definition at line 82 of file histogram.hpp.

◆ algorithm_

Algorithm algorithm_ = None
private

Definition at line 83 of file histogram.hpp.

◆ breaks_

std::vector<Real> breaks_
private

Definition at line 84 of file histogram.hpp.

◆ counts_

std::vector<Size> counts_
private

Definition at line 85 of file histogram.hpp.

◆ frequency_

std::vector<Real> frequency_
private

Definition at line 86 of file histogram.hpp.