function _denseTranspose(m, rows, columns) {
    // matrix array
    var data = m._data; // transposed matrix data

    var transposed = [];
    var transposedRow; // loop columns

    for (var j = 0; j < columns; j++) {
      // initialize row
      transposedRow = transposed[j] = []; // loop rows

      for (var i = 0; i < rows; i++) {
        // set data
        transposedRow[i] = clone(data[i][j]);
      }
    } // return matrix


    return new DenseMatrix({
      data: transposed,
      size: [columns, rows],
      datatype: m._datatype
    });
  }
Transpose a matrix. All values of the matrix are reflected over its
main diagonal. Only applicable to two dimensional matrices containing
a vector (i.e. having size `[1,n]` or `[n,1]`). One dimensional
vectors and scalars return the input unchanged.

Syntax:

    math.transpose(x)

Examples:

    const A = [[1, 2, 3], [4, 5, 6]]
    math.transpose(A)               // returns [[1, 4], [2, 5], [3, 6]]

See also:

    diag, inv, subset, squeeze

@param {Array | Matrix} x  Matrix to be transposed
@return {Array | Matrix}   The transposed matrix