By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,649 Members | 1,560 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,649 IT Pros & Developers. It's quick & easy.

Transpose of a non-square matrix

P: 25
Hello,
Can anybody tell me how i shud go about to perform the transpose of a nonsquare matrix array. Pls give me an idea so that i can write one based on that and then post queries if errors r found. Say i have an array a[10] whose transpose is reqd?
Thanks,
Prads
Nov 3 '07 #1
Share this Question
Share on Google+
2 Replies


Expert 100+
P: 671
An array of 10 of is effectively one row and 10 columns. It's transpose is one 1 column and 10 rows.

Before you can assign any numbers, you need to get the appropriate data type. It's multi-dimensional arrays obviously, so let's see some code (or pseudocode logic) that shows how you create the array for the transpose.
Nov 4 '07 #2

weaknessforcats
Expert Mod 5K+
P: 9,197
And keep in mind that in C++
Expand|Select|Wrap|Line Numbers
  1.  
  2. int array[10][1];
  3.  
  4. int arrayA[1][10];
  5.  
have exactly the same memory layout as int arr[10]

Expand|Select|Wrap|Line Numbers
  1.  
  2. int array[5][10];
  3.  
  4. int arrayA[10][5];
  5.  
have exactly the same memory layout as int arr[50].

I believe you can do the transpose with a typecast.
Nov 4 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.