transpose

Tranpose matrix
@return Matrix Transposed matrix
965024
public function transpose()
    {
        $R = new PHPExcel_Shared_JAMA_Matrix($this->n, $this->m);
        for ($i = 0; $i < $this->m; ++$i) {
            for ($j = 0; $j < $this->n; ++$j) {
                $R->set($j, $i, $this->A[$i][$j]);
            }
        }
        return $R;
    }
459033
public float[] matrix() {
		float[] matrix = new float[8];
		float cosX = (float) Math.cos(rotationRadians);
		float sinX = (float) Math.sin(rotationRadians);
		matrix[AX] = plainWidth * cosX;
		matrix[AY] = plainWidth * sinX;
		matrix[BX] = (-plainHeight) * sinX;
		matrix[BY] = plainHeight * cosX;
		if (rotationRadians < Math.PI / 2f) {
			matrix[CX] = matrix[BX];
			matrix[CY] = 0;
			matrix[DX] = matrix[AX];
			matrix[DY] = matrix[AY] + matrix[BY];
		} else if (rotationRadians < Math.PI) {
			matrix[CX] = matrix[AX] + matrix[BX];
			matrix[CY] = matrix[BY];
			matrix[DX] = 0;
			matrix[DY] = matrix[AY];
		} else if (rotationRadians < Math.PI * 1.5f) {
			matrix[CX] = matrix[AX];
			matrix[CY] = matrix[AY] + matrix[BY];
			matrix[DX] = matrix[BX];
			matrix[DY] = 0;
		} else {
			matrix[CX] = 0;
			matrix[CY] = matrix[AY];
			matrix[DX] = matrix[AX] + matrix[BX];
			matrix[DY] = matrix[BY];
		}
		return matrix;
	}
1364487
public Matrix3d transpose(Matrix3d dest) {
        dest.set(m00, m10, m20,
                 m01, m11, m21,
                 m02, m12, m22);
        return dest;
    }
1316473
public Matrix getWorldToViewTransformation() {
		if (viewState.getScale() > 0) {
			double dX = -(viewState.getX() * viewState.getScale()) + width / 2;
			double dY = viewState.getY() * viewState.getScale() + height / 2;
			return new Matrix(viewState.getScale(), 0, 0, -viewState.getScale(), dX, dY);
		}
		return new Matrix(1, 0, 0, 1, 0, 0);
	}
880920
public Matrix copy()
    {
        Matrix X = new Matrix(m, n);
        double[][] C = X.getArray();
        for (int i = 0; i < m; i++)
        {
            for (int j = 0; j < n; j++)
            {
                C[i][j] = A[i][j];
            }
        }
        return X;
    }
434982
public long[] transposeShapeArray(long[] shape) {
        if (shape.length == 2) {
            return ArrayUtil.reverseCopy(shape);
        } else if (shape.length == 3) {
            return new long[] {shape[0], shape[2], shape[1]};
        } else {
            throw new IllegalArgumentException("Matrix input has to be of length 2 or 3, got: " + shape.length );
        }

    }
889290
public static Frame transpose(Frame src, Frame tgt){
    if(src.numRows() != tgt.numCols() || src.numCols() != tgt.numRows())
      throw new IllegalArgumentException("dimension do not match!");
    for(Vec v:src.vecs()) {
      if (v.isCategorical())
        throw new IllegalArgumentException("transpose can only be applied to all-numeric frames (representing a matrix)");
      if(v.length() > 1000000)
        throw new IllegalArgumentException("too many rows, transpose only works for frames with < 1M rows.");
    }
    new TransposeTsk(tgt).doAll(src);
    return tgt;
  }
172290
public static function transpose(Matrix $matrix)
    {
        $grid = call_user_func_array(
            'array_map',
            array_merge(
                [null],
                $matrix->toArray()
            )
        );

        return new Matrix($grid);
    }
405829
function transpose(out, a) {
  // If we are transposing ourselves we can skip a few steps but have to cache some values
  if (out === a) {
    var a1 = a[1]
    out[1] = a[2]
    out[2] = a1
  } else {
    out[0] = a[0]
    out[1] = a[2]
    out[2] = a[1]
    out[3] = a[3]
  }

  return out
}
468313
public static void transpose( DMatrix6x6 m ) {
        double tmp;
        tmp = m.a12; m.a12 = m.a21; m.a21 = tmp;
        tmp = m.a13; m.a13 = m.a31; m.a31 = tmp;
        tmp = m.a14; m.a14 = m.a41; m.a41 = tmp;
        tmp = m.a15; m.a15 = m.a51; m.a51 = tmp;
        tmp = m.a16; m.a16 = m.a61; m.a61 = tmp;
        tmp = m.a23; m.a23 = m.a32; m.a32 = tmp;
        tmp = m.a24; m.a24 = m.a42; m.a42 = tmp;
        tmp = m.a25; m.a25 = m.a52; m.a52 = tmp;
        tmp = m.a26; m.a26 = m.a62; m.a62 = tmp;
        tmp = m.a34; m.a34 = m.a43; m.a43 = tmp;
        tmp = m.a35; m.a35 = m.a53; m.a53 = tmp;
        tmp = m.a36; m.a36 = m.a63; m.a63 = tmp;
        tmp = m.a45; m.a45 = m.a54; m.a54 = tmp;
        tmp = m.a46; m.a46 = m.a64; m.a64 = tmp;
        tmp = m.a56; m.a56 = m.a65; m.a65 = tmp;
    }
164831
public BigInteger[][] getMatrix()
    {
        BigInteger[][] ret = new BigInteger[rows.size()][rows.get(0).size()];

        final int height = ret.length;
        final int width = ret[0].length;
        for (int i = 0; i < height; i++)
        {
            for (int j = 0; j < width; j++)
            {
                ret[i][j] = rows.get(i).getColumn(j);
            }
        }

        return ret;
    }
1185311
@Nonnull
  @ReturnsMutableCopy
  public Matrix getL ()
  {
    final Matrix aNewMatrix = new Matrix (m_nRows, m_nCols);
    final double [] [] aNewArray = aNewMatrix.internalGetArray ();
    for (int nRow = 0; nRow < m_nRows; nRow++)
    {
      final double [] aSrcRow = m_aLU[nRow];
      final double [] aDstRow = aNewArray[nRow];
      for (int nCol = 0; nCol < m_nCols; nCol++)
        if (nRow > nCol)
          aDstRow[nCol] = aSrcRow[nCol];
        else
          if (nRow == nCol)
            aDstRow[nCol] = 1.0;
          else
            aDstRow[nCol] = 0.0;
    }
    return aNewMatrix;
  }
678582
public void transformPose(Matrix4f trans)
    {
        Bone bone = mBones[0];

        bone.LocalMatrix.set(trans);
        bone.WorldMatrix.set(trans);
        bone.Changed = WORLD_POS | WORLD_ROT;
        mNeedSync = true;
        sync();
    }
1329613
def transpose(self):
        '''
        
        '''
        def _t(item):
            if type(item) == list:
                for n, it in enumerate(item):
                    if type(it) == tuple:
                        it = list(it)
                        item[n] = it
                    if type(it) == list:
                        _t(it)
                    if isinstance(it, np.ndarray) and it.shape == s:
                        item[n] = it.T

        s = self.coeffs['shape']

        for item in self.coeffs.values():
            if type(item) == dict:
                for item2 in item.values():
                    _t(item2)
            else:
                _t(item)

        self.coeffs['shape'] = s[::-1]
858998
function transpose(m, dst) {
  dst = dst || new MatType(16);
  if (dst === m) {
    let t;

    t = m[1];
    m[1] = m[4];
    m[4] = t;

    t = m[2];
    m[2] = m[8];
    m[8] = t;

    t = m[3];
    m[3] = m[12];
    m[12] = t;

    t = m[6];
    m[6] = m[9];
    m[9] = t;

    t = m[7];
    m[7] = m[13];
    m[13] = t;

    t = m[11];
    m[11] = m[14];
    m[14] = t;
    return dst;
  }

  const m00 = m[0 * 4 + 0];
  const m01 = m[0 * 4 + 1];
  const m02 = m[0 * 4 + 2];
  const m03 = m[0 * 4 + 3];
  const m10 = m[1 * 4 + 0];
  const m11 = m[1 * 4 + 1];
  const m12 = m[1 * 4 + 2];
  const m13 = m[1 * 4 + 3];
  const m20 = m[2 * 4 + 0];
  const m21 = m[2 * 4 + 1];
  const m22 = m[2 * 4 + 2];
  const m23 = m[2 * 4 + 3];
  const m30 = m[3 * 4 + 0];
  const m31 = m[3 * 4 + 1];
  const m32 = m[3 * 4 + 2];
  const m33 = m[3 * 4 + 3];

  dst[ 0] = m00;
  dst[ 1] = m10;
  dst[ 2] = m20;
  dst[ 3] = m30;
  dst[ 4] = m01;
  dst[ 5] = m11;
  dst[ 6] = m21;
  dst[ 7] = m31;
  dst[ 8] = m02;
  dst[ 9] = m12;
  dst[10] = m22;
  dst[11] = m32;
  dst[12] = m03;
  dst[13] = m13;
  dst[14] = m23;
  dst[15] = m33;

  return dst;
}
759834
def transpose
      return @list.clone if @list.size == 0
      row_count = @list.size
      max_column_count = @list.map{|row| row.cells.size}.max
      result = Array.new(max_column_count) { Array.new(row_count) }
      # yes, I know it is silly, but that warning is really annoying
      row_count.times do |row_index|
         max_column_count.times do |column_index|
          datum = if @list[row_index].cells.size >= max_column_count
                    @list[row_index].cells[column_index]
                  elsif block_given?
                    yield(column_index, row_index)
                  end
          result[column_index][row_index] = datum
        end
      end
      result
    end
37046
function() {
                var rows = this.elements.length, i, cols = this.elements[0].length, j;
            	var elements = [], i = cols;
            	while (i--) {
            	    j = rows;
            	    elements[i] = [];
            	    while (j--) {
            		elements[i][j] = this.elements[j][i];
            	    }
            	}
            	return Matrix$b.create(elements);
                }