transpose of a nx1 matrix

S

sangeetha

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 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...
 
M

Michael Mair

sangeetha said:
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 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
 
K

Kiru Sengal

sangeetha said:
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 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.
 
S

sangeetha

CAN EXPLAIN ME WITH THE CODING ....


Kiru Sengal said:
sangeetha said:
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 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.
 
S

sangeetha

CAN YOU EXPLAIN ME WITH THE CODING...


Kiru Sengal said:
sangeetha said:
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 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.
 
E

E. Robert Tisdale

sangeetha said:
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 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.
 
D

Dawn Minnis

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 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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,831
Latest member
RusselWill

Latest Threads

Top