You are here

public function PHPExcel_Shared_JAMA_QRDecomposition::getQ in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/JAMA/QRDecomposition.php \PHPExcel_Shared_JAMA_QRDecomposition::getQ()

* Generate and return the (economy-sized) orthogonal factor * *

Return value

Matrix orthogonal factor

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/JAMA/QRDecomposition.php, line 156

Class

PHPExcel_Shared_JAMA_QRDecomposition
@package JAMA

Code

public function getQ() {
  for ($k = $this->n - 1; $k >= 0; --$k) {
    for ($i = 0; $i < $this->m; ++$i) {
      $Q[$i][$k] = 0.0;
    }
    $Q[$k][$k] = 1.0;
    for ($j = $k; $j < $this->n; ++$j) {
      if ($this->QR[$k][$k] != 0) {
        $s = 0.0;
        for ($i = $k; $i < $this->m; ++$i) {
          $s += $this->QR[$i][$k] * $Q[$i][$j];
        }
        $s = -$s / $this->QR[$k][$k];
        for ($i = $k; $i < $this->m; ++$i) {
          $Q[$i][$j] += $s * $this->QR[$i][$k];
        }
      }
    }
  }

  /*
  for($i = 0; $i < count($Q); ++$i) {
  	for($j = 0; $j < count($Q); ++$j) {
  		if(! isset($Q[$i][$j]) ) {
  			$Q[$i][$j] = 0;
  		}
  	}
  }
  */
  return new PHPExcel_Shared_JAMA_Matrix($Q);
}