3 error_reporting(E_ALL);
9 require_once
'../Matrix.php';
10 require_once
'Stats.php';
24 list($usec, $sec) = explode(
" ", microtime());
26 return ((
float)$usec + (
float)$sec);
31 $this->stat->setData($times);
32 $stats = $this->stat->calcFull();
34 echo
'<table style="margin-left:32px;">';
35 echo
'<tr><td style="text-align:right;"><b>n:</b><td style="text-align:right;">' . $stats[
'count'] .
' </td></tr>';
36 echo
'<tr><td style="text-align:right;"><b>Mean:</b><td style="text-align:right;">' . $stats[
'mean'] .
' </td></tr>';
37 echo
'<tr><td style="text-align:right;"><b>Min.:</b><td style="text-align:right;">' . $stats[
'min'] .
' </td></tr>';
38 echo
'<tr><td style="text-align:right;"><b>Max.:</b><td style="text-align:right;">' . $stats[
'max'] .
' </td></tr>';
39 echo
'<tr><td style="text-align:right;"><b>σ:</b><td style="text-align:right;">' . $stats[
'stdev'] .
' </td></tr>';
40 echo
'<tr><td style="text-align:right;"><b>Variance:</b><td style="text-align:right;">' . $stats[
'variance'] .
' </td></tr>';
41 echo
'<tr><td style="text-align:right;"><b>Range:</b><td style="text-align:right;">' . $stats[
'range'] .
' </td></tr>';
51 for ($i = 0; $i <
$t; ++$i) {
56 $times[] = $stop_time - $start_time;
66 for ($i = 0; $i <
$t; ++$i) {
71 $times[] = $stop_time - $start_time;
81 for ($i = 0; $i <
$t; ++$i) {
86 $times[] = $stop_time - $start_time;
96 for ($i = 0; $i <
$t; ++$i) {
101 $times[] = $stop_time - $start_time;
111 for ($i = 0; $i <
$t; ++$i) {
116 $times[] = $stop_time - $start_time;
127 echo
"<b>Cholesky decomposition: $t random {$n}x{$n} matrices</b><br />";
129 $sum += $r[
'mean'] *
$n;
133 echo
"<b>Eigenvalue decomposition: $t random {$n}x{$n} matrices</b><br />";
135 $sum += $r[
'mean'] *
$n;
139 echo
"<b>LU decomposition: $t random {$n}x{$n} matrices</b><br />";
141 $sum += $r[
'mean'] *
$n;
145 echo
"<b>QR decomposition: $t random {$n}x{$n} matrices</b><br />";
147 $sum += $r[
'mean'] *
$n;
151 echo
"<b>Singular Value decomposition: $t random {$n}x{$n} matrices</b><br />";
153 $sum += $r[
'mean'] *
$n;
160 $this->stat =
new Base();
168 switch($_REQUEST[
'decomposition']) {
171 for ($i = 2; $i <= 8; $i *= 2) {
173 echo
"<b>Cholesky decomposition: $t random {$i}x{$i} matrices</b><br />";
179 foreach($m as
$x =>
$y) {
180 echo
"$x\t" . 1000*
$y .
"\n";
186 for ($i = 2; $i <= 8; $i *= 2) {
188 echo
"<b>Eigenvalue decomposition: $t random {$i}x{$i} matrices</b><br />";
194 foreach($m as
$x =>
$y) {
195 echo
"$x\t" . 1000*
$y .
"\n";
201 for ($i = 2; $i <= 8; $i *= 2) {
203 echo
"<b>LU decomposition: $t random {$i}x{$i} matrices</b><br />";
209 foreach($m as
$x =>
$y) {
210 echo
"$x\t" . 1000*
$y .
"\n";
216 for ($i = 2; $i <= 8; $i *= 2) {
218 echo
"<b>QR decomposition: $t random {$i}x{$i} matrices</b><br />";
224 foreach($m as
$x =>
$y) {
225 echo
"$x\t" . 1000*
$y .
"\n";
231 for($i = 2; $i <= 8; $i *= 2) {
233 echo
"<b>Singular value decomposition: $t random {$i}x{$i} matrices</b><br />";
239 foreach($m as
$x =>
$y) {
240 echo
"$x\t" . 1000*
$y .
"\n";
246 print(
"<br /><b>Total<b>: {$s}s<br />");
251 <li><a href=
"benchmark.php?decomposition=all">Complete
Benchmark</a>
253 <li><a href=
"benchmark.php?decomposition=cholesky">Cholesky</a></li>
254 <li><a href=
"benchmark.php?decomposition=eigenvalue">Eigenvalue</a></li>
255 <li><a href=
"benchmark.php?decomposition=lu">LU</a></li>
256 <li><a href=
"benchmark.php?decomposition=qr">QR</a></li>
257 <li><a href=
"benchmark.php?decomposition=svd">Singular Value</a></li>