getN() public method

Get column count (n)
public getN ( ) : integer
return integer number of columns
Beispiel #1
0
 /**
  * Augment a matrix from below
  * An augmented matrix is a matrix obtained by appending the rows of two given matrices
  *
  *     [1, 2, 3]
  * A = [2, 3, 4]
  *     [3, 4, 5]
  *
  * B = [4, 5, 6]
  *
  *         [1, 2, 3]
  * (A_B) = [2, 3, 4]
  *         [3, 4, 5]
  *         [4, 5, 6]
  *
  * @param  Matrix $B Matrix rows to add to matrix A
  *
  * @return Matrix
  *
  * @throws MatrixException if matrices do not have the same number of columns
  */
 public function augmentBelow(Matrix $B) : Matrix
 {
     if ($B->getN() !== $this->n) {
         throw new Exception\MatrixException('Matrices to augment do not have the same number of columns');
     }
     $⟮A∣B⟯ = array_merge($this->A, $B->getMatrix());
     return MatrixFactory::create($⟮A∣B⟯);
 }