MCordingley\LinearAlgebra\Matrix::getColumnCount PHP Метод

getColumnCount() публичный Метод

public getColumnCount ( ) : integer
Результат integer
    public function getColumnCount() : int
    {
        return count($this->internal[0]);
    }

Usage Example

Пример #1
0
 /**
  * @param self $value
  * @return self
  * @throws MatrixException
  */
 public function multiplyMatrix(self $value) : self
 {
     if ($this->getColumnCount() !== $value->getRowCount()) {
         throw new MatrixException('Cannot multiply matrices of these sizes.');
     }
     $literal = [];
     for ($i = 0, $rows = $this->getRowCount(); $i < $rows; $i++) {
         $row = [];
         for ($j = 0, $valueColumns = $value->getColumnCount(); $j < $valueColumns; $j++) {
             $sum = 0;
             for ($k = 0, $columns = $this->getColumnCount(); $k < $columns; $k++) {
                 $sum += $this->get($i, $k) * $value->get($k, $j);
             }
             $row[] = $sum;
         }
         $literal[] = $row;
     }
     return new static($literal);
 }
All Usage Examples Of MCordingley\LinearAlgebra\Matrix::getColumnCount