public function reshape(int $m, int $n) : Matrix
    {
        if (($m * $n) !== $this->n) {
            throw new DimensionalityMismatchException("($m * $n) elements"
                . " are needed but vector has $this->n.");
        }

        $k = 0;

        $b = [];

        for ($i = 0; $i < $m; $i++) {
            $temp = [];

            for ($j = 0; $j < $n; $j++) {
                $temp[] = $this->a[$k++];
            }

            $b[] = $temp;
        }

        return Matrix::quick($b);
    }
public function reshape(int $m, int $n) : Matrix
    {
        if (($m * $n) !== $this->n) {
            throw new DimensionalityMismatchException("($m * $n) elements"
                . " are needed but vector has $this->n.");
        }

        $k = 0;

        $b = [];

        for ($i = 0; $i < $m; $i++) {
            $temp = [];

            for ($j = 0; $j < $n; $j++) {
                $temp[] = $this->a[$k++];
            }

            $b[] = $temp;
        }

        return Matrix::quick($b);
    }
public function reshape ( int $ m , int $ n ) : Matrix { if ( ( $ m * $ n ) !== $ this -> n ) { throw new DimensionalityMismatchException ( "($m * $n) elements" . " are needed but vector has $this->n." ) ; } $ k = 0 ; $ b = [ ] ; for ( $ i = 0 ; $ i < $ m ; $ i ++ ) { $ temp = [ ] ; for ( $ j = 0 ; $ j < $ n ; $ j ++ ) { $ temp [ ] = $ this -> a [ $ k ++ ] ; } $ b [ ] = $ temp ; } return Matrix :: quick ( $ b ) ; }
Return a matrix in the shape specified.

@param int $m
@param int $n
@throws \Rubix\Tensor\Exceptions\DimensionalityMismatchException
@return \Rubix\Tensor\Matrix
Return a matrix in the shape specified .