Alien-libhisto

 view release on metacpan or  search on metacpan

bundled/include/histo/fit.h  view on Meta::CPAN

 * @brief Fitting convergence and status return codes.
 */
typedef enum histo_fit_status {
    HISTO_FIT_CONVERGED_FTOL     =  0, /**< Converged: relative reduction in sum of squares <= ftol */
    HISTO_FIT_CONVERGED_XTOL     =  1, /**< Converged: relative step size in parameters <= xtol */
    HISTO_FIT_CONVERGED_GTOL     =  2, /**< Converged: orthogonal gradient norm <= gtol */
    HISTO_FIT_CONVERGED_EXACT    =  3, /**< Converged: direct exact linear solution obtained */
    HISTO_FIT_MAX_ITERATIONS     = -1, /**< Exceeded maximum allowed iterations without convergence */
    HISTO_FIT_ERR_INVALID_ARG    = -2, /**< Invalid parameter, NULL pointer, or illegal range */
    HISTO_FIT_ERR_SINGULAR       = -3, /**< Singular or rank-deficient Hessian/Jacobian matrix */
    HISTO_FIT_ERR_DIVERGENCE     = -4, /**< Objective function diverged or encountered NaN/Inf */
    HISTO_FIT_ERR_NO_DATA        = -5, /**< Insufficient non-empty bins in fitting range */
    HISTO_FIT_ERR_NOMEM          = -6  /**< Memory allocation failed */
} histo_fit_status_t;

/**
 * @brief Function pointer signature for custom parametric models.
 *
 * @param x Coordinate value (bin center).
 * @param params Array of model parameters.
 * @param userdata User context pointer.

bundled/include/histo/histo.h  view on Meta::CPAN


/* ========================================================================= */
/* Ingestion / Filling                                                       */
/* ========================================================================= */

/**
 * @brief Fills a single value into the histogram with unit weight (1.0).
 *
 * @param[in,out] h Histogram handle.
 * @param[in]     x Sample coordinate.
 * @return HISTO_OK on success, or HISTO_ERR_NON_FINITE if x is NaN/Inf.
 */
histo_status_t histo_fill(histo_t *h, double x);

/**
 * @brief Fills a single value into the histogram with a specified weight.
 *
 * @param[in,out] h      Histogram handle.
 * @param[in]     x      Sample coordinate.
 * @param[in]     weight Real-valued event weight.
 * @return HISTO_OK on success, or HISTO_ERR_NON_FINITE if x/weight is NaN/Inf.
 */
histo_status_t histo_fill_w(histo_t *h, double x, double weight);

/**
 * @brief Batch fills N contiguous values with optional weights.
 *
 * @param[in,out] h       Histogram handle.
 * @param[in]     n       Number of samples to ingest.
 * @param[in]     x       Contiguous array of sample coordinates.
 * @param[in]     weights Optional contiguous array of weights (NULL for unit weights).

bundled/include/histo/histo.h  view on Meta::CPAN

 * @return HISTO_OK on success, or HISTO_ERR_INVALID_ARG if any pointer is NULL.
 */
histo_status_t histo_range(const histo_t *h, double *out_min, double *out_max);

/**
 * @brief Locates the bin index for coordinate x using boundary-guarded lookup.
 *
 * @param[in]  h       Histogram handle.
 * @param[in]  x       Coordinate to locate.
 * @param[out] out_bin Output pointer: [0, nbins-1] on hit, -1 for underflow, nbins for overflow.
 * @return HISTO_OK on success, or HISTO_ERR_NON_FINITE if x is NaN.
 */
histo_status_t histo_find_bin(const histo_t *h, double x, int64_t *out_bin);

/**
 * @brief Retrieves the boundary interval [lower, upper] for a specific bin.
 *
 * @param[in]  h         Histogram handle.
 * @param[in]  bin_index Target bin index [0, nbins - 1].
 * @param[out] out_lower Output pointer for lower bin boundary.
 * @param[out] out_upper Output pointer for upper bin boundary.

bundled/include/histo/histo.h  view on Meta::CPAN


/**
 * @brief Retrieves the feature configuration flags bitmask for this histogram.
 *
 * @param[in] h Histogram handle.
 * @return Bitmask of HISTO_FLAG_* flags, or 0 if h is NULL.
 */
uint32_t histo_flags(const histo_t *h);

/**
 * @brief Retrieves total number of non-finite (NaN / Inf) rejected samples.
 *
 * @param[in] h Histogram handle.
 * @return Non-finite sample count, or 0 if h is NULL.
 */
uint64_t histo_nan_count(const histo_t *h);


/* ========================================================================= */
/* Statistical Moments & Quantiles                                           */
/* ========================================================================= */

bundled/include/histo/histo.h  view on Meta::CPAN

 * @param[in]     other  Source histogram to divide by.
 * @return HISTO_OK on success, or HISTO_ERR_INCOMPATIBLE if geometries mismatch.
 */
histo_status_t histo_divide(histo_t *target, const histo_t *other);

/**
 * @brief Scales all bin contents and weights by a scalar factor.
 *
 * @param[in,out] h      Histogram handle to scale.
 * @param[in]     factor Scalar multiplier (finite).
 * @return HISTO_OK on success, or HISTO_ERR_NON_FINITE if factor is NaN/Inf.
 */
histo_status_t histo_scale(histo_t *h, double factor);

/**
 * @brief Normalizes the histogram such that total in-range weight equals target_area.
 *
 * @param[in,out] h           Histogram handle to normalize.
 * @param[in]     target_area Desired integrated area (finite, target_area > 0.0).
 * @return HISTO_OK on success, HISTO_ERR_EMPTY if zero weight, or HISTO_ERR_INVALID_ARG.
 */

bundled/include/histo/histo2d.h  view on Meta::CPAN

/* ========================================================================= */
/* Ingestion / Filling                                                       */
/* ========================================================================= */

/**
 * @brief Fills a single coordinate pair (x, y) with unit weight (1.0).
 *
 * @param[in,out] h 2D histogram handle.
 * @param[in]     x Sample X coordinate.
 * @param[in]     y Sample Y coordinate.
 * @return HISTO_OK on success, or HISTO_ERR_NON_FINITE if x or y is NaN/Inf.
 */
histo_status_t histo2d_fill(histo2d_t *h, double x, double y);

/**
 * @brief Fills a single coordinate pair (x, y) with specified weight.
 *
 * @param[in,out] h      2D histogram handle.
 * @param[in]     x      Sample X coordinate.
 * @param[in]     y      Sample Y coordinate.
 * @param[in]     weight Event weight.
 * @return HISTO_OK on success, or HISTO_ERR_NON_FINITE if x, y, or weight is NaN/Inf.
 */
histo_status_t histo2d_fill_w(histo2d_t *h, double x, double y, double weight);

/**
 * @brief Batch fills N coordinate pairs with optional weights (SoA format).
 *
 * @param[in,out] h       2D histogram handle.
 * @param[in]     n       Number of samples to ingest.
 * @param[in]     x       Contiguous array of X coordinates.
 * @param[in]     y       Contiguous array of Y coordinates.

bundled/include/histo/histo2d.h  view on Meta::CPAN

histo_status_t histo2d_axis_y(const histo2d_t *h, histo2d_axis_t *out_axis);

/**
 * @brief Locates the (ix, iy) bin indices for coordinate pair (x, y).
 *
 * @param[in]  h      2D histogram handle.
 * @param[in]  x      X coordinate.
 * @param[in]  y      Y coordinate.
 * @param[out] out_ix Output X bin index ([0, nx-1] on hit, -1 underflow, nx overflow).
 * @param[out] out_iy Output Y bin index ([0, ny-1] on hit, -1 underflow, ny overflow).
 * @return HISTO_OK on success, or HISTO_ERR_NON_FINITE if x or y is NaN.
 */
histo_status_t histo2d_find_bin(const histo2d_t *h, double x, double y,
                                int64_t *out_ix, int64_t *out_iy);

/**
 * @brief Identifies which of the 9 geometric regions (x, y) belongs to.
 *
 * @param[in]  h          2D histogram handle.
 * @param[in]  x          X coordinate.
 * @param[in]  y          Y coordinate.
 * @param[out] out_region Output region classification enum.
 * @return HISTO_OK on success, or HISTO_ERR_NON_FINITE if x or y is NaN.
 */
histo_status_t histo2d_find_region(const histo2d_t *h, double x, double y,
                                   histo2d_region_t *out_region);

/**
 * @brief Retrieves the accumulated weight in cell (ix, iy).
 *
 * @param[in]  h          2D histogram handle.
 * @param[in]  ix         X bin index [0, nx - 1].
 * @param[in]  iy         Y bin index [0, ny - 1].

bundled/include/histo/histo2d.h  view on Meta::CPAN


/**
 * @brief Retrieves the feature configuration flags bitmask for this 2D histogram.
 *
 * @param[in] h 2D histogram handle.
 * @return Bitmask of HISTO_FLAG_* flags, or 0 if h is NULL.
 */
uint32_t histo2d_flags(const histo2d_t *h);

/**
 * @brief Retrieves total number of rejected non-finite (NaN/Inf) fill samples.
 *
 * @param[in] h 2D histogram handle.
 * @return Count of non-finite events.
 */
uint64_t histo2d_nan_count(const histo2d_t *h);

/**
 * @brief Retrieves total in-range accumulated weight.
 *
 * @param[in] h 2D histogram handle.

bundled/include/histo/sketch.h  view on Meta::CPAN

 * @par Complexity:
 * O(1) time and space.
 */
void histo_sketch_destroy(histo_sketch_t *s);

/**
 * @brief Insert a single value into the sketch with unit weight (1.0).
 *
 * @param[in,out] s     The sketch handle.
 * @param[in]     value The coordinate value to insert.
 * @return HISTO_OK on success, or HISTO_ERR_NON_FINITE if value is NaN/Inf.
 *
 * @par Complexity:
 * O(1) amortized time.
 */
histo_status_t histo_sketch_insert(histo_sketch_t *s, double value);

/**
 * @brief Insert a weighted value into the sketch.
 *
 * @param[in,out] s      The sketch handle.

bundled/include/histo/types.h  view on Meta::CPAN

/**
 * @brief Status and warning/error codes returned by most API functions.
 */
typedef enum histo_status {
    HISTO_WARN_NON_FINITE     =  1,  /**< Operation succeeded, but non-finite sample(s) were skipped */
    HISTO_OK                  =  0,  /**< Operation succeeded */
    HISTO_ERR_INVALID_ARG     = -1,  /**< NULL pointer or invalid parameter */
    HISTO_ERR_NOMEM           = -2,  /**< Out of memory */
    HISTO_ERR_INCOMPATIBLE    = -3,  /**< Histograms have incompatible geometry */
    HISTO_ERR_OUT_OF_RANGE    = -4,  /**< Bin index or range out of bounds */
    HISTO_ERR_NON_FINITE      = -5,  /**< Non-finite (NaN or Inf) input rejected */
    HISTO_ERR_EMPTY           = -6,  /**< Histogram has zero entries / weight */
    HISTO_ERR_DIV_BY_ZERO     = -7,  /**< Division by zero */
    HISTO_ERR_SERIALIZATION   = -8,  /**< Serialization encoding failed / buffer too small */
    HISTO_ERR_DESERIALIZATION = -9   /**< Deserialization format corrupted or unsupported */
} histo_status_t;

/**
 * @brief Binning models supported by the library.
 */
typedef enum histo_bin_type {

bundled/src/internal.h  view on Meta::CPAN

    double           binsize;        /* Width per bin: (width / nbins) for UNIFORM; 0.0 for VARIABLE */
    double          *bin_edges;      /* Pointer to (nbins + 1) strictly monotonic doubles for VARIABLE; NULL for UNIFORM */

    /* --- Out-of-Range & Exception Accumulators --- */
    double           underflow_weight;   /* Accumulated weight for x < min */
    double           overflow_weight;    /* Accumulated weight for x >= max */
    double           underflow_sum_w2;   /* Accumulated sum(w^2) for underflow */
    double           overflow_sum_w2;    /* Accumulated sum(w^2) for overflow */
    uint64_t         n_underflow;        /* Fill count for underflow */
    uint64_t         n_overflow;         /* Fill count for overflow */
    uint64_t         n_nan;              /* Count of rejected NaN / non-finite samples */

    /* --- In-Range Global Aggregates --- */
    double           total_sum_w2;       /* Total in-range accumulated sum of squared weights */

    /* --- Exact Online Sample Statistics (Updated if HISTO_FLAG_EXACT_MOMENTS is set) --- */
    double           stats_min;          /* Exact minimum sample value observed */
    double           stats_max;          /* Exact maximum sample value observed */
    double           stats_mean;         /* Online running mean (Welford) */
    double           stats_M2;           /* Online running sum of squared differences (Welford) */
};

bundled/src/internal_2d.h  view on Meta::CPAN

    uint32_t                 reserved_pad;   /**< Explicit 8-byte alignment padding */

    histo2d_axis_internal_t  x_axis;         /**< X axis geometry */
    histo2d_axis_internal_t  y_axis;         /**< Y axis geometry */

    double                   total_weight;   /**< Total in-range accumulated weight */
    double                   total_sum_w2;   /**< Total in-range sum(w^2) */
    uint64_t                 n_fills;        /**< Total in-range fill events */

    histo2d_guard_t          guards[HISTO2D_REGION_COUNT]; /**< 9-Region boundary accumulators */
    uint64_t                 n_nan;          /**< Count of rejected non-finite (NaN/Inf) samples */

    /* Exact Online 2D Welford Bivariate Accumulators */
    double                   stats_min_x;    /**< Exact minimum X observed */
    double                   stats_max_x;    /**< Exact maximum X observed */
    double                   stats_min_y;    /**< Exact minimum Y observed */
    double                   stats_max_y;    /**< Exact maximum Y observed */
    double                   stats_mean_x;   /**< Running sample mean of X */
    double                   stats_mean_y;   /**< Running sample mean of Y */
    double                   stats_M2_x;     /**< Running sum of squared deviations for X */
    double                   stats_M2_y;     /**< Running sum of squared deviations for Y */

bundled/src/simd_avx2.c  view on Meta::CPAN

    __m256d v_max = _mm256_set1_pd(max_val);
    __m256d v_inv_binsize = _mm256_set1_pd(inv_binsize);
    __m256d v_nbins_minus_1 = _mm256_set1_pd((double)(nbins - 1));
    __m256d v_zero = _mm256_setzero_pd();

    for (; i + 3 < n; i += 4) {
        __m256d v_x = _mm256_loadu_pd(&x[i]);
        
        __m256d mask_under = _mm256_cmp_pd(v_x, v_min, _CMP_LT_OQ);
        __m256d mask_over = _mm256_cmp_pd(v_x, v_max, _CMP_GE_OQ);
        __m256d mask_nan = _mm256_cmp_pd(v_x, v_x, _CMP_NEQ_UQ); // true if NaN
        
        __m256d mask_any_bad = _mm256_or_pd(_mm256_or_pd(mask_under, mask_over), mask_nan);
        int bad_mask = _mm256_movemask_pd(mask_any_bad);
        
        if (bad_mask != 0) {
            for (size_t j = 0; j < 4; ++j) {
                double val = x[i + j];
                if (isnan(val)) {
                    h->n_nan++; had_non_finite = true;
                } else if (val < h->min) {

bundled/src/simd_avx512.c  view on Meta::CPAN

    __m512d v_max = _mm512_set1_pd(max_val);
    __m512d v_inv_binsize = _mm512_set1_pd(inv_binsize);
    __m512d v_nbins_minus_1 = _mm512_set1_pd((double)(nbins - 1));
    __m512d v_zero = _mm512_setzero_pd();

    for (; i + 7 < n; i += 8) {
        __m512d v_x = _mm512_loadu_pd(&x[i]);
        
        __mmask8 mask_under = _mm512_cmp_pd_mask(v_x, v_min, _CMP_LT_OQ);
        __mmask8 mask_over = _mm512_cmp_pd_mask(v_x, v_max, _CMP_GE_OQ);
        __mmask8 mask_nan = _mm512_cmp_pd_mask(v_x, v_x, _CMP_NEQ_UQ); // true if NaN
        
        __mmask8 bad_mask = mask_under | mask_over | mask_nan;
        
        if (bad_mask != 0) {
            for (size_t j = 0; j < 8; ++j) {
                double val = x[i + j];
                if (isnan(val)) { h->n_nan++; had_non_finite = true; }
                else if (val < h->min) {
                    h->underflow_weight += 1.0;
                    h->n_underflow++;

bundled/src/simd_neon.c  view on Meta::CPAN

    float64x2_t v_nbins_minus_1 = vdupq_n_f64((double)(nbins - 1));
    float64x2_t v_zero = vdupq_n_f64(0.0);

    /* Process 4 items per unrolled loop */
    for (; i + 3 < n; i += 4) {
        float64x2_t v_x0 = vld1q_f64(&x[i]);
        float64x2_t v_x1 = vld1q_f64(&x[i + 2]);
        float64x2_t v_w0 = vld1q_f64(&weights[i]);
        float64x2_t v_w1 = vld1q_f64(&weights[i + 2]);

        /* Out-of-bounds / NaN check for x */
        uint64x2_t mask_under0 = vcltq_f64(v_x0, v_min);
        uint64x2_t mask_over0  = vcgeq_f64(v_x0, v_max);
        uint64x2_t mask_nan0   = vmvnq_u64(vceqq_f64(v_x0, v_x0));

        uint64x2_t mask_under1 = vcltq_f64(v_x1, v_min);
        uint64x2_t mask_over1  = vcgeq_f64(v_x1, v_max);
        uint64x2_t mask_nan1   = vmvnq_u64(vceqq_f64(v_x1, v_x1));

        /* Non-finite check for weights (w - w != w - w) */
        float64x2_t v_w0_sub = vsubq_f64(v_w0, v_w0);

bundled/src/simd_neon.c  view on Meta::CPAN


    float64x2_t v_zero = vdupq_n_f64(0.0);

    /* Process 4 coordinate pairs per iteration (2x 128-bit NEON vectors) */
    for (; i + 3 < n; i += 4) {
        float64x2_t v_x0 = vld1q_f64(&x[i]);
        float64x2_t v_x1 = vld1q_f64(&x[i + 2]);
        float64x2_t v_y0 = vld1q_f64(&y[i]);
        float64x2_t v_y1 = vld1q_f64(&y[i + 2]);

        /* Boundary and NaN checks */
        uint64x2_t bad_x0 = vorrq_u64(vorrq_u64(vcltq_f64(v_x0, v_min_x), vcgeq_f64(v_x0, v_max_x)), vmvnq_u64(vceqq_f64(v_x0, v_x0)));
        uint64x2_t bad_x1 = vorrq_u64(vorrq_u64(vcltq_f64(v_x1, v_min_x), vcgeq_f64(v_x1, v_max_x)), vmvnq_u64(vceqq_f64(v_x1, v_x1)));
        uint64x2_t bad_y0 = vorrq_u64(vorrq_u64(vcltq_f64(v_y0, v_min_y), vcgeq_f64(v_y0, v_max_y)), vmvnq_u64(vceqq_f64(v_y0, v_y0)));
        uint64x2_t bad_y1 = vorrq_u64(vorrq_u64(vcltq_f64(v_y1, v_min_y), vcgeq_f64(v_y1, v_max_y)), vmvnq_u64(vceqq_f64(v_y1, v_y1)));

        uint64x2_t bad0 = vorrq_u64(bad_x0, bad_y0);
        uint64x2_t bad1 = vorrq_u64(bad_x1, bad_y1);
        uint64x2_t bad_comb = vorrq_u64(bad0, bad1);

        uint64_t bad_any = vgetq_lane_u64(bad_comb, 0) | vgetq_lane_u64(bad_comb, 1);

bundled/src/simd_neon.c  view on Meta::CPAN


    /* Process 4 coordinate pairs per iteration (2x 128-bit NEON vectors) */
    for (; i + 3 < n; i += 4) {
        float64x2_t v_x0 = vld1q_f64(&x[i]);
        float64x2_t v_x1 = vld1q_f64(&x[i + 2]);
        float64x2_t v_y0 = vld1q_f64(&y[i]);
        float64x2_t v_y1 = vld1q_f64(&y[i + 2]);
        float64x2_t v_w0 = vld1q_f64(&weights[i]);
        float64x2_t v_w1 = vld1q_f64(&weights[i + 2]);

        /* Boundary and NaN checks */
        uint64x2_t bad_x0 = vorrq_u64(vorrq_u64(vcltq_f64(v_x0, v_min_x), vcgeq_f64(v_x0, v_max_x)), vmvnq_u64(vceqq_f64(v_x0, v_x0)));
        uint64x2_t bad_x1 = vorrq_u64(vorrq_u64(vcltq_f64(v_x1, v_min_x), vcgeq_f64(v_x1, v_max_x)), vmvnq_u64(vceqq_f64(v_x1, v_x1)));
        uint64x2_t bad_y0 = vorrq_u64(vorrq_u64(vcltq_f64(v_y0, v_min_y), vcgeq_f64(v_y0, v_max_y)), vmvnq_u64(vceqq_f64(v_y0, v_y0)));
        uint64x2_t bad_y1 = vorrq_u64(vorrq_u64(vcltq_f64(v_y1, v_min_y), vcgeq_f64(v_y1, v_max_y)), vmvnq_u64(vceqq_f64(v_y1, v_y1)));

        float64x2_t v_w0_sub = vsubq_f64(v_w0, v_w0);
        float64x2_t v_w1_sub = vsubq_f64(v_w1, v_w1);
        uint64x2_t bad_w0 = vmvnq_u64(vceqq_f64(v_w0_sub, v_w0_sub));
        uint64x2_t bad_w1 = vmvnq_u64(vceqq_f64(v_w1_sub, v_w1_sub));

bundled/src/vendor/cJSON/cJSON.c  view on Meta::CPAN

    size_t i = 0;
    unsigned char number_buffer[26] = {0}; /* temporary buffer to print the number into */
    unsigned char decimal_point = get_decimal_point();
    double test = 0.0;

    if (output_buffer == NULL)
    {
        return false;
    }

    /* This checks for NaN and Infinity */
    if (isnan(d) || isinf(d))
    {
        length = sprintf((char*)number_buffer, "null");
    }
    else if(d == (double)item->valueint)
    {
        length = sprintf((char*)number_buffer, "%d", item->valueint);
    }
    else
    {

bundled/tools/scripts/gen_terminal_svg.py  view on Meta::CPAN


        # Error bar whisker
        err_x = bar_start_x + bar_len + 8
        if err_x + 60 < width - 10:
            svg.append(f'  <text class="term-text" x="{err_x}" y="{y}" fill="#6e7681" font-size="11px">╎±{err:.1f}╎</text>')

        y += row_height

    # Footer
    y += 6
    footer = 'Underflow: 36  │  In-Range: 99,919  │  Overflow: 45  │  Non-Finite/NaN: 0'
    svg.append(f'  <text class="term-text summary-text" x="24" y="{y}">{footer}</text>')

    svg.append('</svg>')

    os.makedirs(os.path.dirname(output_path), exist_ok=True)
    with open(output_path, "w", encoding="utf-8") as f:
        f.write("\n".join(svg) + "\n")
    print(f"Generated SVG at {output_path}")

if __name__ == "__main__":

bundled/tools/src/cmd_plot.c  view on Meta::CPAN

    /* Print out-of-range footer */
    double uflow = histo_underflow(h);
    double oflow = histo_overflow(h);
    uint64_t n_nan = histo_nan_count(h);

    char uflow_str[32], oflow_str[32], tot_str[32];
    snprintf(uflow_str, sizeof(uflow_str), (uflow == floor(uflow) && uflow >= 0.0 && uflow < 1e12) ? "%.0f" : "%.4g", uflow);
    snprintf(oflow_str, sizeof(oflow_str), (oflow == floor(oflow) && oflow >= 0.0 && oflow < 1e12) ? "%.0f" : "%.4g", oflow);
    snprintf(tot_str, sizeof(tot_str), (total_w == floor(total_w) && total_w >= 0.0 && total_w < 1e12) ? "%.0f" : "%.4g", total_w);

    fprintf(out, " Underflow: %s │ In-Range: %s │ Overflow: %s │ Non-Finite/NaN: %llu\n",
           uflow_str, tot_str, oflow_str, (unsigned long long)n_nan);
}

static void render_histogram_sparkline(const histo_t *h, const char *style, bool use_color, histo_palette_t palette, bool log_scale, bool show_stats, FILE *out) {
    if (!h || !out) return;

    uint32_t nbins = histo_nbins(h);
    double max_content = 0.0;
    for (uint32_t i = 0; i < nbins; ++i) {
        double c = 0.0;

bundled/tools/src/cmd_stats.c  view on Meta::CPAN

        fprintf(out, "fwhm\t%.8g\n", fwhm);
        fprintf(out, "rms\t%.8g\n", rms);
    } else {
        fprintf(out, "===============================================================\n");
        fprintf(out, " HISTOGRAM SUMMARY STATISTICS\n");
        fprintf(out, "===============================================================\n");
        fprintf(out, "  Total Entries:    %llu\n", (unsigned long long)n_entries);
        fprintf(out, "  Total Weight:     %.6g\n", total_w);
        fprintf(out, "  Underflow Weight: %.6g\n", histo_underflow(h));
        fprintf(out, "  Overflow Weight:  %.6g\n", histo_overflow(h));
        fprintf(out, "  Rejected NaNs:    %llu\n", (unsigned long long)histo_nan_count(h));
        fprintf(out, "  Number of Bins:   %u\n", nbins);
        fprintf(out, "  Range:            [%.6g, %.6g]\n", range_min, range_max);
        fprintf(out, "---------------------------------------------------------------\n");
        fprintf(out, "  Moments & Central Tendency:\n");
        fprintf(out, "   Mean:            %-12.6g Std Dev:          %.6g\n", mean, sdev);
        fprintf(out, "   Variance:        %-12.6g RMS:              %.6g\n", var, rms);
        fprintf(out, "   Skewness:        %-12.6g Kurtosis:         %.6g\n", skew, kurt);
        fprintf(out, "   Excess Kurtosis: %-12.6g\n", ex_kurt);
        fprintf(out, "---------------------------------------------------------------\n");
        fprintf(out, "  Order Statistics & Quantiles:\n");

bundled/tools/src/cmd_stats.c  view on Meta::CPAN

        fprintf(out, "std_dev_y\t%.8g\n", s.std_dev_y);
        fprintf(out, "covariance\t%.8g\n", s.covariance);
        fprintf(out, "correlation\t%.8g\n", s.correlation);
    } else {
        fprintf(out, "===============================================================\n");
        fprintf(out, " 2-DIMENSIONAL HISTOGRAM SUMMARY STATISTICS\n");
        fprintf(out, "===============================================================\n");
        fprintf(out, "  Grid Dimensions:  %u x %u bins\n", nx, ny);
        fprintf(out, "  Total Entries:    %llu\n", (unsigned long long)s.n_entries);
        fprintf(out, "  Total Weight:     %.6g\n", s.total_weight);
        fprintf(out, "  Rejected NaNs:    %llu\n", (unsigned long long)histo2d_nan_count(h));
        fprintf(out, "---------------------------------------------------------------\n");
        fprintf(out, "  X-Axis:  Range [%.4g, %.4g]\n", s.min_x, s.max_x);
        fprintf(out, "    Mean (X):       %-12.6g Std Dev (X):  %.6g\n", s.mean_x, s.std_dev_x);
        fprintf(out, "    Variance (X):   %-12.6g\n", s.variance_x);
        fprintf(out, "  Y-Axis:  Range [%.4g, %.4g]\n", s.min_y, s.max_y);
        fprintf(out, "    Mean (Y):       %-12.6g Std Dev (Y):  %.6g\n", s.mean_y, s.std_dev_y);
        fprintf(out, "    Variance (Y):   %-12.6g\n", s.variance_y);
        fprintf(out, "---------------------------------------------------------------\n");
        fprintf(out, "  Bivariate Correlation & Covariance:\n");
        fprintf(out, "    Covariance:     %-12.6g Pearson (rho): %.6f\n", s.covariance, s.correlation);



( run in 2.175 seconds using v1.01-cache-2.11-cpan-60884a8df76 )