PHPML\Exception\MatrixException::columnOutOfRange PHP Method

columnOutOfRange() public static method

public static columnOutOfRange ( ) : MatrixException
return MatrixException
    public static function columnOutOfRange()
    {
        return new self('Column out of range');
    }

Usage Example

Example #1
0
 /**
  * @param $column
  *
  * @return array
  *
  * @throws MatrixException
  */
 public function getColumnValues($column)
 {
     if ($column >= $this->columns) {
         throw MatrixException::columnOutOfRange();
     }
     $values = [];
     for ($i = 0; $i < $this->rows; ++$i) {
         $values[] = $this->matrix[$i][$column];
     }
     return $values;
 }