cvs: pear /Math_Histogram Histogram.php Histogram3D.php Histogram4D.php README-Math_Histogram package.xml /Math_Histogram/examples ex_histogram3d.php
ex_histogram4d.php

From: Date: Wed, 22 May 2002 07:34:37 +0000
Subject: cvs: pear /Math_Histogram Histogram.php Histogram3D.php Histogram4D.php README-Math_Histogram package.xml /Math_Histogram/examples ex_histogram3d.php
ex_histogram4d.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-4032@lists.php.net to get a copy of this message
jmcastagnetto Wed May 22 03:34:37 2002 EDT Added files: /pear/Math_Histogram README-Math_Histogram /pear/Math_Histogram/examples ex_histogram3d.php ex_histogram4d.php Modified files: /pear/Math_Histogram Histogram.php Histogram3D.php Histogram4D.php package.xml Log: Minor modifications to classes. Added examples and readme. Index: pear/Math_Histogram/Histogram.php diff -u pear/Math_Histogram/Histogram.php:1.6 pear/Math_Histogram/Histogram.php:1.7 --- pear/Math_Histogram/Histogram.php:1.6 Tue May 21 23:01:16 2002 +++ pear/Math_Histogram/Histogram.php Wed May 22 03:34:37 2002 @@ -16,13 +16,12 @@ // | Authors: Jesus M. Castagnetto <jmcastagnetto@php.net> | // +----------------------------------------------------------------------+ // -// $Id: Histogram.php,v 1.6 2002/05/22 03:01:16 jmcastagnetto Exp $ +// $Id: Histogram.php,v 1.7 2002/05/22 07:34:37 jmcastagnetto Exp $ // // Last change: Tuesday 2002-05-21 19:58:48 PDT. // -//include_once "Math/AbstractHistogram.php"; -include_once "AbstractHistogram.php"; +include_once "Math/AbstractHistogram.php"; /** * Class to calculate the histogram distribution of a numerical data set. @@ -74,7 +73,7 @@ * Originally this class was part of NumPHP (Numeric PHP package) * * @author Jesus M. Castagnetto <jmcastagnetto@php.net> - * @version 1.0 + * @version 0.9.0 * @access public * @package Math_Histogram */ @@ -283,6 +282,7 @@ return $out.sprintf(" (%.1f%%)", $freq/$total * 100); }/*}}}*/ + /** * Returns a subset of the bins array by bin value type * Index: pear/Math_Histogram/Histogram3D.php diff -u pear/Math_Histogram/Histogram3D.php:1.3 pear/Math_Histogram/Histogram3D.php:1.4 --- pear/Math_Histogram/Histogram3D.php:1.3 Wed May 22 03:14:31 2002 +++ pear/Math_Histogram/Histogram3D.php Wed May 22 03:34:37 2002 @@ -16,13 +16,24 @@ // | Authors: Jesus M. Castagnetto <jmcastagnetto@php.net> | // +----------------------------------------------------------------------+ // -// $Id: Histogram3D.php,v 1.3 2002/05/22 07:14:31 jmcastagnetto Exp $ +// $Id: Histogram3D.php,v 1.4 2002/05/22 07:34:37 jmcastagnetto Exp $ // // Last change: 22-May-2002. // -require_once 'AbstractHistogram.php'; +include_once "Math/AbstractHistogram.php"; +/** + * Class to generate 3D histograms from bi-dimensional numeric + * arrays. + * + * Originally this class was part of NumPHP (Numeric PHP package) + * + * @author Jesus M. Castagnetto <jmcastagnetto@php.net> + * @version 0.9.0 + * @access public + * @package Math_Histogram + */ class Math_Histogram3D extends Math_AbstractHistogram {/*{{{*/ /** Index: pear/Math_Histogram/Histogram4D.php diff -u pear/Math_Histogram/Histogram4D.php:1.2 pear/Math_Histogram/Histogram4D.php:1.3 --- pear/Math_Histogram/Histogram4D.php:1.2 Wed May 22 03:14:31 2002 +++ pear/Math_Histogram/Histogram4D.php Wed May 22 03:34:37 2002 @@ -16,13 +16,24 @@ // | Authors: Jesus M. Castagnetto <jmcastagnetto@php.net> | // +----------------------------------------------------------------------+ // -// $Id: Histogram4D.php,v 1.2 2002/05/22 07:14:31 jmcastagnetto Exp $ +// $Id: Histogram4D.php,v 1.3 2002/05/22 07:34:37 jmcastagnetto Exp $ // // Last change: 22-May-2002. // -require_once 'AbstractHistogram.php'; +include_once "Math/AbstractHistogram.php"; +/** + * Class to generate 4D histograms from tri-dimensional numeric + * arrays. + * + * Originally this class was part of NumPHP (Numeric PHP package) + * + * @author Jesus M. Castagnetto <jmcastagnetto@php.net> + * @version 0.9.0 + * @access public + * @package Math_Histogram + */ class Math_Histogram4D extends Math_AbstractHistogram {/*{{{*/ /** Index: pear/Math_Histogram/package.xml diff -u pear/Math_Histogram/package.xml:1.1 pear/Math_Histogram/package.xml:1.2 --- pear/Math_Histogram/package.xml:1.1 Wed May 22 00:03:25 2002 +++ pear/Math_Histogram/package.xml Wed May 22 03:34:37 2002 @@ -47,7 +47,7 @@ </filelist> <deps> <dep type="php" rel="ge" version="4.1" /> - <dep type="pkg" rel="ge" version="0.8.0">Math_Stats</dep> + <dep type="pkg" rel="has">Math_Stats</dep> </deps> </release> @@ -77,7 +77,7 @@ </filelist> <deps> <dep type="php" rel="ge" version="4.1" /> - <dep type="pkg" rel="ge" version="0.8.0">Math_Stats</dep> + <dep type="pkg" rel="has">Math_Stats</dep> </deps> </release> </changelog> Index: pear/Math_Histogram/examples/ex_histogram3d.php +++ pear/Math_Histogram/examples/ex_histogram3d.php <?php require 'Math/Histogram3D.php'; // let's generate some values; for ($i=0; $i < 100; $i++) { $a['x'][$i] = rand(-1,6); $a['y'][$i] = rand(-1,6); } $h = new Math_Histogram3D(); $h->setData($a); $h->calculate(); // and output a tab delimited data set echo $h->toSeparated(HISTOGRAM_MID_BINS, "\t"); // finally, let's get all the histogram info print_r($h->getHistogramInfo()); // now, let's change the options a wee bit $h->setBinOptions( array( 'low' => array( 'x' => 0, 'y' => 0), 'high' => array( 'x' => 5, 'y' => 5), 'nbins' => array( 'x' => 5, 'y' => 5) ) ); $h->setType(HISTOGRAM_CUMMULATIVE); $h->calculate(); // and print the whole histogram info, not the different // statistics for the data and the histogram data entries print_r($h->getHistogramInfo()); ?> Index: pear/Math_Histogram/examples/ex_histogram4d.php +++ pear/Math_Histogram/examples/ex_histogram4d.php <?php include 'Math/Histogram4D.php'; // let's generate some data for ($i=0; $i < 100; $i++) { $a['x'][$i] = rand(0,4); $a['y'][$i] = rand(0,4); $a['z'][$i] = rand(0,4); } // and create a histogram from the data // with specific options $h = new Math_Histogram4D(); $h->setBinOptions( array( 'low' => array( 'x' => 0, 'y' => 0, 'z'=>0), 'high' => array( 'x' => 4.0, 'y' => 4.0, 'z'=>4.0), 'nbins' => array( 'x' => 4, 'y' => 4, 'z'=>4) ) ); $h->setData($a); $h->calculate(); // now we print out a comma separated set echo $h->toSeparated(); // and the whole Histogram information print_r($h->getHistogramInfo()); ?>

« previous php.pear.cvs (#4032) next »