quick start:g++ [flags ...] file ... -l /isip/tools/lib/$ISIP_BINARY/lib_stat.a #include <Histogram.h> ~Histogram(); Histogram(); Histogram(const Histogram& copy_sym); boolean read(Sof& sof, long tag, const String& name = CLASS_NAME); boolean setMode(BIN_MODE mode); boolean setDim(long dim); boolean setBins(const TVector& bins); boolean setBins(long num_bins = DEF_NUM_BINS, TIntegral min = DEF_MIN, TIntegral max = DEF_MAX); boolean setCounts(const TVector& counts); boolean compute(const Vector<TVector>& values); boolean pdf(VectorDouble& pdf) const; boolean cdf(MatrixDouble& pdf);
description:#include <Histogram.h> // test a 2-D histogram with a specified number of bins in EDGES mode // MatrixDouble expected_cdf.assign(3, 3, L"0.4, 0.4, 0.4, 0.4, 0.8, 0.8, 0.4, 0.8, 1"), actual_cdf; Vectortest_data(2); test_data(0).assign(L"1.1, 2.1, 3.1, 4.1, 5.1, 6.1, 4.1, 3.1, 2.1, 1.1"); test_data(1).assign(L"1.1, 2.1, 3.1, 4.1, 5.1, 7.1, 4.1, 3.1, 2.1, 1.1"); hist6.clear(); hist6.setScale(Histogram::LINEAR); hist6.setMode(Histogram::EDGES); hist6.setDim(2); hist6.setBins(3, 1.0, 7.0); hist6.compute(test_data); hist6.cdf(actual_cdf); if (!actual_cdf.almostEqual(expected_cdf)) { actual_cdf.debug(L"actual cdf"); expected_cdf.debug(L"expected cdf"); return Error::handle(name(), L"compute", Error::TEST, __FILE__, __LINE__); }
static const String CLASS_NAME = L"Histogram";
static const String Histogram::DEF_PARAM = L"";
static const String Histogram::PARAM_SCALE = L"scale";
static const String Histogram::PARAM_MODE = L"mode";
static const String Histogram::PARAM_DIM = L"dim";
static const String Histogram::PARAM_MIN = L"min";
static const String Histogram::PARAM_MAX = L"max";
static const String Histogram::PARAM_NUM_BINS = L"num_bins";
static const String Histogram::PARAM_BINS = L"bins";
static const String Histogram::PARAM_COUNTS = L"counts";
static const NameMap MODE_MAP(L"LINEAR, LOG, USER_DEFINED");
static const NameMap MODE_MAP(L"CENTERS, EDGES");
static const long DEF_DIM = 1;
static const long DEF_MIN = 0;
static const long DEF_MAX = 1;
static const long DEF_NUM_BINS = 10;
enum BIN_MODE { EDGES = 0, CENTERS, DEF_MODE = EDGES};
enum SCALE { LINEAR = 0, LOG, USER_DEFINED, DEF_MODE = LINEAR};
static const long ERR = 60500;
static const long ERR_BINS = 60501;
SCALE scale_d;
BIN_MODE mode_d;
Long dim_d;
Vector<VectorDouble> bins_d;
VectorLong counts_d;
VectorDouble min_d, max_d;
VectorLong num_bins_d;
VectorLong block_boundary_index_d;
VectorDouble delta_d;
static Integral::DEBUG debug_level_d;
static MemoryManager mgr_d;
static const String& name();
static boolean diagnose(Integral::DEBUG debug_level);
static boolean setDebug(Integral::DEBUG debug_level);
boolean debug(const unichar* message) const;
~Histogram();
Histogram(SCALE scale = DEF_SCALE, BIN_MODE mode = DEF_MODE, long dim = DEF_DIM);
Histogram(const Histogram& arg);
boolean assign(const Histogram& arg);
Histogram& operator= (const Histogram& arg);
long sofSize() const;
boolean read(Sof& sof, long tag, const String& name = CLASS_NAME);
boolean write(Sof& sof, long tag, const String& name = CLASS_NAME) const;
boolean readData(Sof& sof, const String& pname = DEF_PARAM, long size = SofParser::FULL_OBJECT, boolean param = true, boolean nested = false);
boolean writeData(Sof& sof, const String& pname = DEF_PARAM) const;
boolean eq(const Histogram& compare_hist) const;
static void* operator new(size_t size);
static void* operator new[](size_t size);
static void operator delete(void* ptr);
static void operator delete[](void* ptr);
static boolean setGrowSize(long grow_size);
boolean clear(Integral::CMODE ctype = Integral::DEF_CMODE);
boolean setScale(SCALE scale);
boolean setMode(BIN_MODE mode);
boolean setDim(long dim);
template<class TVector> boolean setBins(const Vector<TVector>& bins);
template<class TVector> boolean setBins(const TVector& bins);
template<class TIntegral> boolean setBins(long num_bins = DEF_NUM_BINS, TIntegral min = DEF_MIN, TIntegral max = DEF_MAX);
template<class TVector> boolean setBins(const VectorLong& num_bins, const TVector& min, const TVector& max);
boolean setCounts(const VectorLong& counts);
SCALE getScale();
BIN_MODE getMode();
long getDim();
boolean getBins(Vector<VectorDouble>& bins);
boolean getBins(VectorLong& num_bins, VectorDouble& min, VectorDouble& max);
boolean getCounts(VectorLong& counts);
boolean getBinIndexCoordinates(Vector<VectorLong>& multidim_bin_index);
boolean getBlockBoundaryIndex(VectorLong& block_boundary_index);
template<class TVector> boolean compute(const Vector<TVector>& values);
template<class TVector> boolean compute(const TVector& values);
template<class TVector> boolean update(const Vector<TVector>& values);
template<class TVector> boolean update(const TVector& values);
boolean pdf(VectorDouble& pdf) const;
boolean pdf(MatrixDouble& pdf);
boolean cdf(VectorDouble& cdf);
boolean cdf(MatrixDouble& cdf);
boolean computeBlockBoundaryIndex();
long findBinIndex(double value, long dim_num);
boolean convertGlobalToLocalIndex(VectorLong& loc_ind, long glob_ind);
long convertLocalToGlobalIndex(VectorLong& loc_ind);