Questions tagged [transpose]

Transposition is an operation that applies to matrices wherein the rows and columns are swapped

The transpose of a matrix A is written as A'. The transpose of matrix A is another matrix B in which the element in the ith row and the jth column of A is in the jth row and the ith column of B. For example:

Suppose A =

[[11, 12, 13],
 [21, 22, 23],
 [31, 32, 33]]

Then, A' =

[[11, 21, 31],
 [12, 22, 32],
 [13, 23, 33]]

In scientific software for statistical computing and graphics, function t transposes a matrix.

3257 questions
6
votes
1 answer

ValueError: axes don't match array - Can't transpose an array

Traceback Error Traceback (most recent call last): File "C:\Users\trial2\trial.py", line 55, in image_stack(image) File "C:\Users\trial2\trial.py", line 41, in image_stack transposed_axes = np.transpose(img, axes=concat) File…
pasho_6798
  • 107
  • 1
  • 2
  • 9
6
votes
2 answers

How to transpose sheet with POI SS/XSSF?

I am using POI XSSF API and I would like to transpose a sheet. how can I do that? Thanks.
Yoni
  • 553
  • 3
  • 14
  • 24
6
votes
1 answer

Fast array permutation (generalised tensor transpose) in Armadillo (C++)

I have a project which involves a lot of permutations on 3D arrays ( arma::Cube). In particular, the required permutation is the interchange of columns by slices. In Matlab this is efficiently calculated by permute(cube,[1,3,2]) and in…
Alejandro D. Somoza
  • 391
  • 1
  • 3
  • 19
6
votes
4 answers

Transforming a list to a column vector in Python

I was wondering if there's a function that takes a list X as input and outputs a column vector corresponding to X? (I looked around and I suspect it might be: np.matrix(X).T )
user9628064
6
votes
5 answers

transpose nested list

I have a list structure which represents a table being handed to me like this > l = list(list(1, 4), list(2, 5), list(3, 6)) > str(l) List of 3 $ :List of 2 ..$ : num 1 ..$ : num 4 $ :List of 2 ..$ : num 2 ..$ : num 5 $ :List of 2 ..$ :…
Akhil Nair
  • 3,144
  • 1
  • 17
  • 32
6
votes
3 answers

numpy: compute x.T*x for a large matrix

In numpy, what's the most efficient way to compute x.T * x, where x is a large (200,000 x 1000) dense float32 matrix and .T is the transpose operator? For the avoidance of doubt, the result is 1000 x 1000. edit: In my original question I stated that…
NPE
  • 486,780
  • 108
  • 951
  • 1,012
6
votes
1 answer

Ruby Hash transpose

I have the following ruby hash: h = { i1: { q1: 1, q2:2 }, i2: { q1: 3, q2: 4} } and I want to transpose it as follows: { q1: { i1: 1, i2: 3 }, q2: { i1: 2, i2: 4 } } Now, I came up with a function that does what I want, but I wonder if there is…
6
votes
1 answer

How do I transpose a table in Pentaho Kettle from rows to columns without the header column

I'm new to Pentaho and I need to transpose a table from rows to columns, but the first column doesn't contain the headers. It looks something like this: Jan/15 Feb/15 Mar/15 Apr/15 1.1 3.4 1.7 2.0 2.5 4.5 2.4 3.3 And I…
Slaski
  • 65
  • 1
  • 1
  • 5
6
votes
3 answers

"Transposing" objects in jq

I'm unsure if "transpose" is the correct term here, but I'm looking to use jq to transpose a 2-dimensional object such as this: [ { "name": "A", "keys": ["k1", "k2", "k3"] }, { "name": "B", "keys": ["k2",…
cmbuckley
  • 40,217
  • 9
  • 77
  • 91
6
votes
1 answer

Transposing a data.table with reshape2:::dcast

I am transposing a data.table and have chosen to use reshape2:::dcast, however I am plagued by a strange handling of the data.table... here is a toy data set that replicates the behavior: > library(data.table) > library(reshape2) > DT <-…
mlegge
  • 6,763
  • 3
  • 40
  • 67
6
votes
1 answer

Singular matrix - python

The following code shows a problem of singularity of a matrix, since working in Pycharm I get raise LinAlgError("Singular matrix") numpy.linalg.linalg.LinAlgError: Singular matrix I guess the problem is K but I cannot understand exactly how: from…
johnhenry
  • 1,293
  • 5
  • 21
  • 43
6
votes
2 answers

Why is complex conjugate transpose the default in Matlab

if A matrix has complex element and I want to transpose A to A' using the command >>A' Why it is design that a+bi be transformed into a-bi ? What it use for?
Peter Zhu
  • 1,154
  • 3
  • 15
  • 27
6
votes
6 answers

Transposing a matrix from a 2D array

I'm self teaching myself some java and I'm stuck on creating a 2D array that initializes it with random values and then creates the transpose of the array. An example output is: $ java Test1 22 333 44 555 6 Enter the number of rows (1-10): 0 …
Austin Fogg
  • 93
  • 1
  • 1
  • 4
6
votes
2 answers

Matlab transpose a table vector

Seems like an embarassingly simple question, but how can I transpose a Matlab table vector? For a simple transposition of a column vector aTable to a row vector I tried standard syntaxes: aTableT = aTable.'; aTableT = reshape(aTable, 1,…
strategos
  • 75
  • 1
  • 5
6
votes
3 answers

Performance improvement for mirroring bit matrix around the diagonal

I have some code that manages data received from an array of sensors. The PIC that controls the sensors uses 8 SAR-ADCs in parallel to read 4096 data bytes. It means it reads the most significant bit for the first 8 bytes; then it reads their second…
Bovaz
  • 375
  • 6
  • 20