Exemple #1
0
 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  *
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $matrixA = new NumArray([[49, -525, 7, -315], [-525, 6921, -3279, 3483], [7, -3279, 8178, -328], [-315, 3483, -328, 624556]]);
     $output->writeln('<comment>Matrix A:</comment>');
     $output->writeln($matrixA->__toString());
     $output->writeln('<info>Cholesky:</info>');
     $time = microtime(true);
     $matrixL = LinAlg::cholesky($matrixA);
     $timeDiff = microtime(true) - $time;
     $output->writeln($matrixL->__toString());
     $output->writeln('<info>Time for calculation: ' . $timeDiff . ' sec</info>');
 }
 public function testCholeskyCache()
 {
     $numArray = new NumArray(5);
     $numArray->setCache(LinAlg\CholeskyDecomposition::CACHE_KEY_CHOLESKY, 8);
     $this->assertSame(8, LinAlg::cholesky($numArray));
 }