Exemplo n.º 1
0
 /**
  * @expectedException InvalidArgumentException
  */
 public function testNonSquareDet()
 {
     $this->A->det();
 }
Exemplo n.º 2
0
 /**
  * MDETERM
  *
  * @param	array	$matrixValues	A matrix of values
  * @return	float
  */
 public static function MDETERM($matrixValues)
 {
     $matrixData = array();
     if (!is_array($matrixValues)) {
         $matrixValues = array(array($matrixValues));
     }
     $row = $maxColumn = 0;
     foreach ($matrixValues as $matrixRow) {
         $column = 0;
         foreach ($matrixRow as $matrixCell) {
             if (is_string($matrixCell) || $matrixCell === null) {
                 return self::$_errorCodes['value'];
             }
             $matrixData[$column][$row] = $matrixCell;
             ++$column;
         }
         if ($column > $maxColumn) {
             $maxColumn = $column;
         }
         ++$row;
     }
     if ($row != $maxColumn) {
         return self::$_errorCodes['value'];
     }
     try {
         $matrix = new Matrix($matrixData);
         return $matrix->det();
     } catch (Exception $ex) {
         return self::$_errorCodes['value'];
     }
 }
Exemplo n.º 3
0
 /**
  * MDETERM
  *
  * @param	array	$matrixValues	A matrix of values
  * @return  float
  */
 public static function MDETERM($matrixValues)
 {
     $matrixData = array();
     $row = 0;
     foreach ($matrixValues as $matrixRow) {
         $column = 0;
         foreach ($matrixRow as $matrixCell) {
             if (is_string($matrixCell) || $matrixCell === null) {
                 return self::$_errorCodes['value'];
             }
             $matrixData[$column][$row] = $matrixCell;
             ++$column;
         }
         ++$row;
     }
     $matrix = new Matrix($matrixData);
     return $matrix->det();
 }