Esempio n. 1
0
        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;
    }
}
// end MagicSquareExample
$benchmark = new Benchmark();
switch ($_REQUEST['decomposition']) {
    case 'cholesky':
        $m = array();
        for ($i = 2; $i <= 8; $i *= 2) {
            $t = 32 / $i;
            echo "<b>Cholesky decomposition: {$t} random {$i}x{$i} matrices</b><br />";
            $s = $benchmark->displayStats($benchmark->runCholesky($i, $t));
            $m[$i] = $s['mean'];
            echo "<br />";
        }
        echo '<pre>';
        foreach ($m as $x => $y) {
            echo "{$x}\t" . 1000 * $y . "\n";
        }
        echo '</pre>';
        break;
    case 'eigenvalue':
        $m = array();
        for ($i = 2; $i <= 8; $i *= 2) {
            $t = 32 / $i;
            echo "<b>Eigenvalue decomposition: {$t} random {$i}x{$i} matrices</b><br />";
            $s = $benchmark->displayStats($benchmark->runEig($i, $t));