ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
Benchmark Class Reference

Example of use of Matrix Class, featuring magic squares. More...

+ Collaboration diagram for Benchmark:

Public Member Functions

 microtime_float ()
 Simple function to replicate PHP 5 behaviour.
 displayStats ($times=null)
 runEig ($n=4, $t=100)
 runLU ($n=4, $t=100)
 runQR ($n=4, $t=100)
 runCholesky ($n=4, $t=100)
 runSVD ($n=4, $t=100)
 run ()
 __construct ()

Data Fields

 $stat

Detailed Description

Example of use of Matrix Class, featuring magic squares.

Definition at line 16 of file benchmark.php.

Constructor & Destructor Documentation

Benchmark::__construct ( )

Definition at line 159 of file benchmark.php.

{
$this->stat = new Base();
} // function Benchmark()

Member Function Documentation

Benchmark::displayStats (   $times = null)

Definition at line 30 of file benchmark.php.

Referenced by run().

{
$this->stat->setData($times);
$stats = $this->stat->calcFull();
echo '<table style="margin-left:32px;">';
echo '<tr><td style="text-align:right;"><b>n:</b><td style="text-align:right;">' . $stats['count'] . ' </td></tr>';
echo '<tr><td style="text-align:right;"><b>Mean:</b><td style="text-align:right;">' . $stats['mean'] . ' </td></tr>';
echo '<tr><td style="text-align:right;"><b>Min.:</b><td style="text-align:right;">' . $stats['min'] . ' </td></tr>';
echo '<tr><td style="text-align:right;"><b>Max.:</b><td style="text-align:right;">' . $stats['max'] . ' </td></tr>';
echo '<tr><td style="text-align:right;"><b>&sigma;:</b><td style="text-align:right;">' . $stats['stdev'] . ' </td></tr>';
echo '<tr><td style="text-align:right;"><b>Variance:</b><td style="text-align:right;">' . $stats['variance'] . ' </td></tr>';
echo '<tr><td style="text-align:right;"><b>Range:</b><td style="text-align:right;">' . $stats['range'] . ' </td></tr>';
echo '</table>';
return $stats;
} // function displayStats()

+ Here is the caller graph for this function:

Benchmark::microtime_float ( )

Simple function to replicate PHP 5 behaviour.

Definition at line 23 of file benchmark.php.

Referenced by runCholesky(), runEig(), runLU(), runQR(), and runSVD().

{
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
} // function microtime_float()

+ Here is the caller graph for this function:

Benchmark::run ( )

Definition at line 123 of file benchmark.php.

References $n, $t, displayStats(), runCholesky(), runEig(), runLU(), runQR(), and runSVD().

{
$n = 8;
$t = 16;
$sum = 0;
echo "<b>Cholesky decomposition: $t random {$n}x{$n} matrices</b><br />";
$r = $this->displayStats($this->runCholesky($n, $t));
$sum += $r['mean'] * $n;
echo '<hr />';
echo "<b>Eigenvalue decomposition: $t random {$n}x{$n} matrices</b><br />";
$r = $this->displayStats($this->runEig($n, $t));
$sum += $r['mean'] * $n;
echo '<hr />';
echo "<b>LU decomposition: $t random {$n}x{$n} matrices</b><br />";
$r = $this->displayStats($this->runLU($n, $t));
$sum += $r['mean'] * $n;
echo '<hr />';
echo "<b>QR decomposition: $t random {$n}x{$n} matrices</b><br />";
$r = $this->displayStats($this->runQR($n, $t));
$sum += $r['mean'] * $n;
echo '<hr />';
echo "<b>Singular Value decomposition: $t random {$n}x{$n} matrices</b><br />";
$r = $this->displayStats($this->runSVD($n, $t));
$sum += $r['mean'] * $n;
return $sum;
} // function run()

+ Here is the call graph for this function:

Benchmark::runCholesky (   $n = 4,
  $t = 100 
)

Definition at line 93 of file benchmark.php.

References $n, $t, microtime_float(), and Matrix\random().

Referenced by run().

{
$times = array();
for ($i = 0; $i < $t; ++$i) {
$start_time = $this->microtime_float();
$E = new CholeskyDecomposition($M);
$stop_time = $this->microtime_float();
$times[] = $stop_time - $start_time;
}
return $times;
} // function runCholesky()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Benchmark::runEig (   $n = 4,
  $t = 100 
)

Definition at line 48 of file benchmark.php.

References $n, $t, microtime_float(), and Matrix\random().

Referenced by run().

{
$times = array();
for ($i = 0; $i < $t; ++$i) {
$start_time = $this->microtime_float();
$stop_time = $this->microtime_float();
$times[] = $stop_time - $start_time;
}
return $times;
} // function runEig()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Benchmark::runLU (   $n = 4,
  $t = 100 
)

Definition at line 63 of file benchmark.php.

References $n, $t, microtime_float(), and Matrix\random().

Referenced by run().

{
$times = array();
for ($i = 0; $i < $t; ++$i) {
$start_time = $this->microtime_float();
$E = new LUDecomposition($M);
$stop_time = $this->microtime_float();
$times[] = $stop_time - $start_time;
}
return $times;
} // function runLU()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Benchmark::runQR (   $n = 4,
  $t = 100 
)

Definition at line 78 of file benchmark.php.

References $n, $t, microtime_float(), and Matrix\random().

Referenced by run().

{
$times = array();
for ($i = 0; $i < $t; ++$i) {
$start_time = $this->microtime_float();
$E = new QRDecomposition($M);
$stop_time = $this->microtime_float();
$times[] = $stop_time - $start_time;
}
return $times;
} // function runQR()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Benchmark::runSVD (   $n = 4,
  $t = 100 
)

Definition at line 108 of file benchmark.php.

References $n, $t, microtime_float(), and Matrix\random().

Referenced by run().

{
$times = array();
for ($i = 0; $i < $t; ++$i) {
$start_time = $this->microtime_float();
$stop_time = $this->microtime_float();
$times[] = $stop_time - $start_time;
}
return $times;
} // function runSVD()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

Benchmark::$stat

Definition at line 17 of file benchmark.php.


The documentation for this class was generated from the following file: