public function PHPExcel_Shared_JAMA_Matrix::getMatrix in Loft Data Grids 6.2
Same name and namespace in other branches
- 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/JAMA/Matrix.php \PHPExcel_Shared_JAMA_Matrix::getMatrix()
* getMatrix * * Get a submatrix *
Parameters
int $i0 Initial row index: * @param int $iF Final row index * @param int $j0 Initial column index * @param int $jF Final column index * @return Matrix Submatrix
2 calls to PHPExcel_Shared_JAMA_Matrix::getMatrix()
- PHPExcel_Shared_JAMA_Matrix::getMatrixByCol in vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Shared/ JAMA/ Matrix.php - * getMatrixByCol * * Get a submatrix by column index/range *
- PHPExcel_Shared_JAMA_Matrix::getMatrixByRow in vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Shared/ JAMA/ Matrix.php - * getMatrixByRow * * Get a submatrix by row index/range *
File
- vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Shared/ JAMA/ Matrix.php, line 171
Class
Code
public function getMatrix() {
if (func_num_args() > 0) {
$args = func_get_args();
$match = implode(",", array_map('gettype', $args));
switch ($match) {
//A($i0...; $j0...)
case 'integer,integer':
list($i0, $j0) = $args;
if ($i0 >= 0) {
$m = $this->m - $i0;
}
else {
throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
}
if ($j0 >= 0) {
$n = $this->n - $j0;
}
else {
throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
}
$R = new PHPExcel_Shared_JAMA_Matrix($m, $n);
for ($i = $i0; $i < $this->m; ++$i) {
for ($j = $j0; $j < $this->n; ++$j) {
$R
->set($i, $j, $this->A[$i][$j]);
}
}
return $R;
break;
//A($i0...$iF; $j0...$jF)
case 'integer,integer,integer,integer':
list($i0, $iF, $j0, $jF) = $args;
if ($iF > $i0 && $this->m >= $iF && $i0 >= 0) {
$m = $iF - $i0;
}
else {
throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
}
if ($jF > $j0 && $this->n >= $jF && $j0 >= 0) {
$n = $jF - $j0;
}
else {
throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
}
$R = new PHPExcel_Shared_JAMA_Matrix($m + 1, $n + 1);
for ($i = $i0; $i <= $iF; ++$i) {
for ($j = $j0; $j <= $jF; ++$j) {
$R
->set($i - $i0, $j - $j0, $this->A[$i][$j]);
}
}
return $R;
break;
//$R = array of row indices; $C = array of column indices
case 'array,array':
list($RL, $CL) = $args;
if (count($RL) > 0) {
$m = count($RL);
}
else {
throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
}
if (count($CL) > 0) {
$n = count($CL);
}
else {
throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
}
$R = new PHPExcel_Shared_JAMA_Matrix($m, $n);
for ($i = 0; $i < $m; ++$i) {
for ($j = 0; $j < $n; ++$j) {
$R
->set($i - $i0, $j - $j0, $this->A[$RL[$i]][$CL[$j]]);
}
}
return $R;
break;
//$RL = array of row indices; $CL = array of column indices
case 'array,array':
list($RL, $CL) = $args;
if (count($RL) > 0) {
$m = count($RL);
}
else {
throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
}
if (count($CL) > 0) {
$n = count($CL);
}
else {
throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
}
$R = new PHPExcel_Shared_JAMA_Matrix($m, $n);
for ($i = 0; $i < $m; ++$i) {
for ($j = 0; $j < $n; ++$j) {
$R
->set($i, $j, $this->A[$RL[$i]][$CL[$j]]);
}
}
return $R;
break;
//A($i0...$iF); $CL = array of column indices
case 'integer,integer,array':
list($i0, $iF, $CL) = $args;
if ($iF > $i0 && $this->m >= $iF && $i0 >= 0) {
$m = $iF - $i0;
}
else {
throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
}
if (count($CL) > 0) {
$n = count($CL);
}
else {
throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
}
$R = new PHPExcel_Shared_JAMA_Matrix($m, $n);
for ($i = $i0; $i < $iF; ++$i) {
for ($j = 0; $j < $n; ++$j) {
$R
->set($i - $i0, $j, $this->A[$RL[$i]][$j]);
}
}
return $R;
break;
//$RL = array of row indices
case 'array,integer,integer':
list($RL, $j0, $jF) = $args;
if (count($RL) > 0) {
$m = count($RL);
}
else {
throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
}
if ($jF >= $j0 && $this->n >= $jF && $j0 >= 0) {
$n = $jF - $j0;
}
else {
throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException);
}
$R = new PHPExcel_Shared_JAMA_Matrix($m, $n + 1);
for ($i = 0; $i < $m; ++$i) {
for ($j = $j0; $j <= $jF; ++$j) {
$R
->set($i, $j - $j0, $this->A[$RL[$i]][$j]);
}
}
return $R;
break;
default:
throw new PHPExcel_Calculation_Exception(self::PolymorphicArgumentException);
break;
}
}
else {
throw new PHPExcel_Calculation_Exception(self::PolymorphicArgumentException);
}
}