Transpose a Vector, return a 1xn Matrix
767159
function() {
            	var rows = this.elements.length;
            	var elements = [];

            	for (var i = 0; i < rows; i++) {
            	    elements.push([this.elements[i]]);
            	}
            	return matrix$2.create(elements);
                }
1122700
def double_matrix_to_ndarray(m):
    
    rows = javabridge.get_env().get_object_array_elements(m)
    num_rows = len(rows)
    num_cols = javabridge.get_env().get_array_length(rows[0])
    result = numpy.zeros(num_rows * num_cols).reshape((num_rows, num_cols))
    i = 0
    for row in rows:
        elements = javabridge.get_env().get_double_array_elements(row)
        n = 0
        for element in elements:
            result[i][n] = element
            n += 1
        i += 1
    return result
272128
def normalise_rows(matrix):
    

    lengths = np.apply_along_axis(np.linalg.norm, 1, matrix)
    if not (lengths > 0).all():
        # raise ValueError('Cannot normalise 0 length vector to length 1')
        # print(matrix)
        lengths[lengths == 0] = 1
    return matrix / lengths[:, np.newaxis]
610606
def T(self):
        """"""
        mycrs = matrix.to_list(self)
        trans_crs = []
        for cr in mycrs:
            trans_crs.append(_np.transpose(cr, [0, 2, 1, 3]))
        return matrix.from_list(trans_crs)
1274238
public T transpose() {
        T ret = createMatrix(mat.getNumCols(),mat.getNumRows(), mat.getType());

        ops.transpose(mat,ret.mat);

        return ret;
    }
623725
def matrix(self, _):
        """"""
        x, y, z = self.coord
        return np.array([
            [1., 0., 0., x],
            [0., 1., 0., y],
            [0., 0., 1., z],
            [0., 0., 0., 1.]
        ])
249844
def convert_transpose(node, **kwargs):
    
    name, input_nodes, attrs = get_inputs(node, kwargs)

    axes = attrs.get("axes", ())
    if axes:
        axes = tuple(map(int, re.findall(r'\d+', axes)))

        transpose_node = onnx.helper.make_node(
            "Transpose",
            input_nodes,
            [name],
            perm=axes,
            name=name
        )
    else:
        transpose_node = onnx.helper.make_node(
            "Transpose",
            input_nodes,
            [name],
            name=name
        )

    return [transpose_node]
1220441
public static double[][] transpose(final double[][] m1) {
    final int rowdim = m1.length, coldim = getColumnDimensionality(m1);
    final double[][] re = new double[coldim][rowdim];
    for(int i = 0; i < rowdim; i++) {
      final double[] row = m1[i];
      for(int j = 0; j < coldim; j++) {
        re[j][i] = row[j];
      }
    }
    return re;
  }
1246001
function transpose() {
         var tmp,
             a = this.val;
         tmp = a[1];
         a[1] = a[3];
         a[3] = tmp;
         tmp = a[2];
         a[2] = a[6];
         a[6] = tmp;
         tmp = a[5];
         a[5] = a[7];
         a[7] = tmp;
         return this;
       }
4449
private DoubleMatrix1D rDual(DoubleMatrix1D X, DoubleMatrix1D V, DoubleMatrix1D gradX) {
		if(getA()==null){
			return gradX;
		}
		//return getAT().zMult(V, gradX.copy(), 1., 1, false);
		return ColtUtils.zMult(getAT(), V, gradX, 1);
	}
1120441
def sum(a, axis=-1):
    """"""
    d = a.d
    crs = _vector.vector.to_list(a.tt if isinstance(a, _matrix.matrix) else a)
    if axis < 0:
        axis = range(a.d)
    elif isinstance(axis, int):
        axis = [axis]
    axis = list(axis)[::-1]
    for ax in axis:
        crs[ax] = _np.sum(crs[ax], axis=1)
        rleft, rright = crs[ax].shape
        if (rleft >= rright or rleft < rright and ax + 1 >= d) and ax > 0:
            crs[ax - 1] = _np.tensordot(crs[ax - 1], crs[ax], axes=(2, 0))
        elif ax + 1 < d:
            crs[ax + 1] = _np.tensordot(crs[ax], crs[ax + 1], axes=(1, 0))
        else:
            return _np.sum(crs[ax])
        crs.pop(ax)
        d -= 1
    return _vector.vector.from_list(crs)
303753
def vector_to_symmetric(v):
    ''''''
    np = len(v)
    N = (int(sqrt(1 + 8*np)) - 1)//2
    if N*(N+1)//2 != np:
        raise ValueError('Cannot convert vector to symmetric matrix')
    sym = ndarray((N,N))
    iterable = iter(v)
    for r in range(N):
        for c in range(r+1):
            sym[r,c] = sym[c,r] = iterable.next()
    return sym
231979
def flatten(self):
        
        blocksize = self.get_array()[0][0].get_width()
        width = self.get_width() * blocksize

        columnsNew = [[] for dummy in xrange(width)]

        for row in self.get_array():
            index = 0
            for submatrix in row:
                for column in submatrix.get_array(False):
                    columnsNew[index] += column
                    index += 1

        columnsFlat = sum(columnsNew, [])
        return Matrix(width, len(columnsNew[0]), columnsFlat, rowBased=False)
630566
def left(X, i):
    """"""
    if i < 0:
        return np.ones([1, 1])
    answ = np.ones([1, 1])
    cores = tt.tensor.to_list(X)
    for dim in xrange(i+1):
        answ = np.tensordot(answ, cores[dim], 1)
    answ = reshape(answ, (-1, X.r[i+1]))
    return answ
616761
def vector_to_arr(vec, dim):
    
    if len(dim) <= 1:
        return vec
    array = vec
    while len(dim) > 1:
        i = 0
        outer_array = []
        for m in range(reduce(mul, dim[0:-1])):
            inner_array = []
            for n in range(dim[-1]):
                inner_array.append(array[i])
                i += 1
            outer_array.append(inner_array)
        array = outer_array
        dim = dim[0:-1]

        return array
549051
def transpose(self, *axes):
        """"""
        if self.ndim <= 1:
            return self
        ar = np.asarray(self).transpose(*axes)
        if axes[0] != 0:
            # then axis 0 is unaffected by the transposition
            newlabels = [self.labels[ax] for ax in axes]
            return Timeseries(ar, self.tspan, newlabels)
        else:
            return ar
880616
def transpose(self):
        """"""
        ma4 = Matrix4(self.get_col(0),
                      self.get_col(1),
                      self.get_col(2),
                      self.get_col(3))
        return ma4