Math-Histogram
view release on metacpan or search on metacpan
XS/Histogram.xs view on Meta::CPAN
RETVAL = mh_hist_contract_dimension(THIS, contracted_dimension);
if (RETVAL == NULL)
croak("Contracted dimension appears to be out of range!");
OUTPUT: RETVAL
void
mh_histogram_t::cumulate(cumulation_dimension)
unsigned int cumulation_dimension;
PREINIT:
int rc;
CODE:
rc = mh_hist_cumulate(THIS, cumulation_dimension);
if (rc != 0)
croak("Cumulated dimension appears to be out of range!");
int
mh_histogram_t::data_equal_to(other)
mh_histogram_t *other;
CODE:
RETVAL = mh_hist_data_equal(THIS, other);
OUTPUT: RETVAL
int
mh_histogram_t::is_overflow_bin(dim_bin_nums)
AV *dim_bin_nums;
CODE:
av_to_unsigned_int_ary(aTHX_ dim_bin_nums, MH_HIST_ARG_BIN_BUFFER(THIS));
RETVAL = !!mh_hist_is_overflow_bin(THIS, MH_HIST_ARG_BIN_BUFFER(THIS));
OUTPUT: RETVAL
int
mh_histogram_t::is_overflow_bin_linear(linear_bin_num)
unsigned int linear_bin_num;
CODE:
RETVAL = !!mh_hist_is_overflow_bin_linear(THIS, linear_bin_num);
OUTPUT: RETVAL
void
mh_histogram_t::_debug_bin_iter_print()
CODE:
mh_hist_debug_bin_iter_print(THIS);
void
mh_histogram_t::_debug_dump_data()
CODE:
mh_hist_debug_dump_data(THIS);
void
mh_histogram_t::_as_hash()
PREINIT:
SV *rv;
SV *tmp;
HV *hash;
AV *axis_av;
AV *data_av;
unsigned int ndim, i, nbins_total;
double *data;
mh_axis_t *tmp_axis;
PPCODE:
hash = newHV();
rv = sv_2mortal(newRV_noinc((SV *)hash));
ndim = MH_HIST_NDIM(THIS);
if ( ! hv_stores(hash, "ndim", newSVuv(ndim)) )
croak("hv_stores ndim failed");
/* store axises */
axis_av = newAV();
if ( ! hv_stores(hash, "axises", newRV_noinc((SV *)axis_av)) )
croak("hv_stores ndim failed");
av_extend(axis_av, ndim-1);
for (i = 0; i < ndim; ++i) {
tmp_axis = MH_HIST_AXIS(THIS, i);
tmp = axis_to_hashref(aTHX_ MH_HIST_AXIS(THIS, i));
av_store(axis_av, i, tmp);
}
if ( ! hv_stores(hash, "nfills", newSVuv(MH_HIST_NFILLS(THIS))) )
croak("hv_stores nfills failed");
if ( !hv_stores(hash, "total", newSVnv(MH_HIST_TOTAL(THIS))) )
croak("hv_stores total failed");
/* store data */
/* FIXME: strictly speaking, this violates encapsulation */
nbins_total = THIS->nbins_total;
data_av = newAV();
if ( ! hv_stores(hash, "data", newRV_noinc((SV *)data_av)) )
croak("hv_stores data failed");
av_extend(data_av, nbins_total-1);
data = THIS->data;
for (i = 0; i < nbins_total; ++i)
av_store(data_av, i, newSVnv(data[i]));
XPUSHs(rv);
XSRETURN(1);
mh_histogram_t *
_from_hash_internal(CLASS, hash, axises)
char *CLASS;
HV *hash;
AV *axises;
PREINIT:
mh_axis_t **axis_structs;
unsigned int i, n, ndim, nfill;
double total_content;
double *data;
SV **svptr;
AV *axis_av;
AV *data_av;
CODE:
/* dimensionality */
HV_FETCHS_FATAL(svptr, hash, "ndim");
ndim = SvUV( *svptr );
if (ndim < 1)
croak("Need at least a dimension of 1");
/* nfills and total */
( run in 0.976 second using v1.01-cache-2.11-cpan-5511b514fd6 )