15,879,683 members
See more:
can anyone help me in finding the transpose of a non square matrix by ging code...plz give steps to solve this or give code if u can in c# many examples on internet show code only for square matrix..
Posted

## Solution 3

You know the transpose of a matrix is defined this way:

ATij = Aji

That implies that, for instance, a `2x3` matrix, transposed, will become `3x2`.

Suppose the input matrix is represented by an array `a` having dimensions `M,N`, your code has to:
• Create a new array, say `b`, having dimensions `N,M.`
• Set all the new array items according to the above rule, namely `b[i][j] = a[j][i]`.

That's all.

## Solution 1

Looks like homework?

Try here[^]

## Solution 2

I can't give you an example, but Math.Net Numerics can do it:

http://mathnetnumerics.codeplex.com/[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Top Experts
Last 24hrsThis month
 Pete O'Hanlon 115 OriginalGriff 85 Dave Kreskowiak 75 Andre Oosthuizen 45 Richard MacCutchan 40
 Pete O'Hanlon 1,790 OriginalGriff 1,315 Graeme_Grant 835 Richard Deeming 743 Dave Kreskowiak 634

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900