/** * Solve A*X = B. * @param Matrix $B Right hand side * @return Matrix ... Solution if A is square, least squares solution otherwise */ function solve($B) { if ($this->m == $this->n) { $LU = new LUDecomposition($this); return $LU->solve($B); } else { $QR = new QRDecomposition($this); return $QR->solve($B); } }
/** * Solve A*X = B. * * @param Matrix $B Right hand side * @return Matrix ... Solution if A is square, least squares solution otherwise */ public function solve($B) { if ($this->m == $this->n) { $LU = new PHPExcel_Shared_JAMA_LUDecomposition($this); return $LU->solve($B); } else { $QR = new QRDecomposition($this); return $QR->solve($B); } }