Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

  • b09e2a7
  • /
  • Math
  • /
  • Statistics.h
Raw File Download

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
content badge
swh:1:cnt:74374eccd6c5f940513b2184f58705e980934e82
directory badge
swh:1:dir:52be542130f4fc05977cdc8899b1abc605c18509

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Statistics.h
#ifndef STATISTICS_H
#define STATISTICS_H

#include <vector>
#include <iostream>
#include <Ziran/CS/Util/Forward.h>

namespace ZIRAN {

/**
  Computes estimates for equal probability quantiles of a stream of data
  Used the P squared algorithm of Raj Jain and Iimrich Chlamtac

*/
class Quantiler {
public:
    size_t num_bins;
    size_t num_samples;
    StdVector<double> marker_height; // q
    StdVector<size_t> marker_position; // n

    Quantiler(size_t num_bins);

    void insert(double sample);

    size_t closetsBinToQuantile(double q);

    double quantile(double q);

    void print(std::ostream& out);

    void constructCumulativeHistogram(StdVector<double>& histogram, double start_quantile = 0.0, double end_quantile = 1.0);

    /**
      Constructs an approximate histogram by using central differences on the cumulative one
      */
    double constructHistogram(StdVector<double>& histogram, double start_quantile = 0.0, double end_quantile = 1.0);

    void printGraph(std::ostream& out, const StdVector<double>& y, double data_height, size_t plot_width, size_t plot_height);

    void printScale(std::ostream& out, size_t width, double start_quantile = 0.0, double end_quantile = 1.0);

    void printCumulativeHistogram(std::ostream& out, size_t plot_width, size_t plot_height, double start_quantile = 0.0, double end_quantile = 1.0);

    void printHistogram(std::ostream& out, size_t plot_width, size_t plot_height, double start_quantile = 0.0, double end_quantile = 1.0);
};
} // namespace ZIRAN
#endif

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API