448,560 Members | 1,541 Online Need help? Post your question and get tips & solutions from a community of 448,560 IT Pros & Developers. It's quick & easy.

# transpose of a nx1 matrix

 P: n/a Hi, i need to transpose a nx1 matrix to 1xn matrix inorder to multiply with nxn matrix in c language ... can anyone help in this coding ..the nx1 matrix is pi[i] the data type is double *pi..this is used through out the program ..now i need this transpose for further calculations.... Kindly help as soon as possible.....if this is not possible kindly suggest me something... Nov 14 '05 #1
7 Replies

 P: n/a 911 is busy. Please call later. Nov 14 '05 #2

 P: n/a sangeetha wrote: Hi, i need to transpose a nx1 matrix to 1xn matrix inorder to multiply with nxn matrix in c language ... can anyone help in this coding ..the nx1 matrix is pi[i] the data type is double *pi..this is used through out the program ..now i need this transpose for further calculations.... Kindly help as soon as possible.....if this is not possible kindly suggest me something... I suggest you write the code for the matrix multiplication, have a long look at it and try to find out what happens if you exchange your index variables. If you still have problems, then come back here -- with code. -Michael -- E-Mail: Mine is an /at/ gmx /dot/ de address. Nov 14 '05 #3

 P: n/a sangeetha wrote: Hi, i need to transpose a nx1 matrix to 1xn matrix inorder to multiply with nxn matrix in c language ... can anyone help in this coding ..the nx1 matrix is pi[i] the data type is double *pi..this is used through out the program ..now i need this transpose for further calculations.... Kindly help as soon as possible.....if this is not possible kindly suggest me something... General notes about transposes of matrices: If A = B^t, then A is the transpose of B and also if B = b(i,j) then A = a(j,i) --- Writing code to find A given B (general transpose algorithm) is much easier than writing code to mulitply two matrices. If you are the one who coded your matrix multiplying functions, then you should have no problem doing this. In your case, you are starting with a column vector and require transposing to a row vector. Just treat the column vector as a row vector whenever you need the transpose (an array with one dimension can be treated as a column or a row). Just pass your column vector to the matrix multiplying function (along with your nxn matrix) in a way that the function thinks it's receiving a row vector. More specific help will require more details about the current state of your code. Good luck. Nov 14 '05 #4

 P: n/a CAN EXPLAIN ME WITH THE CODING .... "Kiru Sengal" wrote in message news:<11*********************@l41g2000cwc.googlegr oups.com>... sangeetha wrote: Hi, i need to transpose a nx1 matrix to 1xn matrix inorder to multiply with nxn matrix in c language ... can anyone help in this coding ..the nx1 matrix is pi[i] the data type is double *pi..this is used through out the program ..now i need this transpose for further calculations.... Kindly help as soon as possible.....if this is not possible kindly suggest me something... General notes about transposes of matrices: If A = B^t, then A is the transpose of B and also if B = b(i,j) then A = a(j,i) --- Writing code to find A given B (general transpose algorithm) is much easier than writing code to mulitply two matrices. If you are the one who coded your matrix multiplying functions, then you should have no problem doing this. In your case, you are starting with a column vector and require transposing to a row vector. Just treat the column vector as a row vector whenever you need the transpose (an array with one dimension can be treated as a column or a row). Just pass your column vector to the matrix multiplying function (along with your nxn matrix) in a way that the function thinks it's receiving a row vector. More specific help will require more details about the current state of your code. Good luck. Nov 14 '05 #5

 P: n/a CAN YOU EXPLAIN ME WITH THE CODING... "Kiru Sengal" wrote in message news:<11*********************@l41g2000cwc.googlegr oups.com>... sangeetha wrote: Hi, i need to transpose a nx1 matrix to 1xn matrix inorder to multiply with nxn matrix in c language ... can anyone help in this coding ..the nx1 matrix is pi[i] the data type is double *pi..this is used through out the program ..now i need this transpose for further calculations.... Kindly help as soon as possible.....if this is not possible kindly suggest me something... General notes about transposes of matrices: If A = B^t, then A is the transpose of B and also if B = b(i,j) then A = a(j,i) --- Writing code to find A given B (general transpose algorithm) is much easier than writing code to mulitply two matrices. If you are the one who coded your matrix multiplying functions, then you should have no problem doing this. In your case, you are starting with a column vector and require transposing to a row vector. Just treat the column vector as a row vector whenever you need the transpose (an array with one dimension can be treated as a column or a row). Just pass your column vector to the matrix multiplying function (along with your nxn matrix) in a way that the function thinks it's receiving a row vector. More specific help will require more details about the current state of your code. Good luck. Nov 14 '05 #6

 P: n/a sangeetha wrote: I need to transpose a nx1 matrix to 1xn matrix in order to multiply with nxn matrix in C. No. You don't. Can anyone help in this coding? The nx1 matrix is pi[i] the data type is double *pi. This is used through out the program. Now I need this transpose for further calculations. Kindly help as soon as possible. If this is not possible kindly suggest me something. The C computer programming language doesn't know anything about matrices, rows or columns. Your 1-dimensional array double pi[]; can represent either a row or a column. you don't need to "transpose" it. Nov 14 '05 #7

 P: n/a >> I need to transpose a nx1 matrix to 1xn matrix in order to multiply with nxn matrix in C. No. You don't. The nx1 matrix is pi[i] the data type is double *pi. Now I need this transpose for further calculations. The C computer programming language doesn't know anything about matrices, rows or columns. Your 1-dimensional array double pi[]; can represent either a row or a column. you don't need to "transpose" it. Oh - Good spotting Robert If all your matricies are one dimensional then transposition does not come into play. However, if you have ordinary matricies that need transposed then it is all in the way you traverse the array. A series of nested for loops to be exact. If you can read Fortran code take a look at http://www.netlib.org/blas/dgemm.f for code to multiply 2 dimensional matricies. Regards Dawn Nov 14 '05 #8

### This discussion thread is closed

Replies have been disabled for this discussion. 