Click here to Skip to main content
15,949,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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

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.
 
Share this answer
 
Looks like homework?

Try here[^]
 
Share this answer
 
I can't give you an example, but Math.Net Numerics can do it:

http://mathnetnumerics.codeplex.com/[^]
 
Share this answer
 

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



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