protected function doTransform(Matrix $mA, $extra = null)
    {
        $this->assertMatrixIsComplete($mA);

        if ($mA->is('empty')) {
            return new Matrix(array());
        }
        $transposed = array();
        $data = $mA->toArray();
        foreach ($data as $rowKey => $row) {
            if (is_array($row) && !empty($row)) { //check to see if there is a second dimension
                foreach ($row as $columnKey => $element) {
                    $transposed[$columnKey][$rowKey] = $element;
                }
            }
        }

        return new Matrix($transposed);
    }
protected function doTransform(Matrix $mA, $extra = null)
    {
        $this->assertMatrixIsComplete($mA);

        if ($mA->is('empty')) {
            return new Matrix(array());
        }
        $transposed = array();
        $data = $mA->toArray();
        foreach ($data as $rowKey => $row) {
            if (is_array($row) && !empty($row)) { //check to see if there is a second dimension
                foreach ($row as $columnKey => $element) {
                    $transposed[$columnKey][$rowKey] = $element;
                }
            }
        }

        return new Matrix($transposed);
    }
protected function doTransform ( Matrix $ mA , $ extra = null ) { $ this -> assertMatrixIsComplete ( $ mA ) ; if ( $ mA -> is ( 'empty' ) ) { return new Matrix ( array ( ) ) ; } $ transposed = array ( ) ; $ data = $ mA -> toArray ( ) ; foreach ( $ data as $ rowKey => $ row ) { if ( is_array ( $ row ) && ! empty ( $ row ) ) { //check to see if there is a second dimension foreach ( $ row as $ columnKey => $ element ) { $ transposed [ $ columnKey ] [ $ rowKey ] = $ element ; } } } return new Matrix ( $ transposed ) ; }
Transpose the matrix

@param Matrix $mA First matrix operand - required
@param void $extra ignored

@return Matrix

@throws MatrixException
Transpose the matrix