D
dorcas
i would like to have a C++ code for the transpose of a matrix if
anyone could assist me with it i would be glad to have it
anyone could assist me with it i would be glad to have it
dorcas said:i would like to have a C++ code for the transpose of a matrix if
anyone could assist me with it i would be glad to have it
Victor said:If you're too lazy to do your own homework, don't ask us. Go to
any Web search engine and look for it. At least then nobody will
have assisted you in cheating.
Lionel said:I know this is not what the OP requested, but if the exercice is to
perform an "in situ" transpose - i.e. perform the transpose by swapping
matrix elements - it turns out to be surprisingly difficult. Try it if
you've nothing better to do.
Victor said:Lionel said:Victor said:dorcas wrote:
i would like to have a C++ code for the transpose of a matrix if
anyone could assist me with it i would be glad to have it
[...]
I know this is not what the OP requested, but if the exercice is to
perform an "in situ" transpose - i.e. perform the transpose by
swapping matrix elements - it turns out to be surprisingly
difficult. Try it if you've nothing better to do.
I am not sure whom you're addressing in your last sentence.
Lionel said:Victor said:Lionel said:Victor Bazarov wrote:
dorcas wrote:
i would like to have a C++ code for the transpose of a matrix if
anyone could assist me with it i would be glad to have it
[...]
I know this is not what the OP requested, but if the exercice is to
perform an "in situ" transpose - i.e. perform the transpose by
swapping matrix elements - it turns out to be surprisingly
difficult. Try it if you've nothing better to do.
I am not sure whom you're addressing in your last sentence.
The World (sorry if that wasn't clear).
Lionel said:I know this is not what the OP requested, but if the exercice is to
perform an "in situ" transpose - i.e. perform the transpose by swapping
matrix elements - it turns out to be surprisingly difficult. Try it if
you've nothing better to do.
Ares said:Why ?
Transposing the matrix in place can be done easily by looping trough
all elements (i,j) of the upper triangular part of the matrix, and
swap each element (i,j) with element (j,i).
Lionel said:Try that for a non-square matrix ;-)
Victor said:With certain data structures it's by definition impossible.
dorcas said:I would like to have a C++ code for the transpose of a matrix if
anyone could assist me with it i would be glad to have it
E. Robert Tisdale said:dorcas said:I would like to have a C++ code for the transpose of a matrix if
anyone could assist me with it i would be glad to have it
Take a look at
The C++ Scalar, Vector, Matrix and Tensor class Library
http://www.netwood.net/~edwin/svmtl/
[...]
Lionel said:E. Robert Tisdale said:dorcas said:I would like to have a C++ code for the transpose of a matrix if
anyone could assist me with it i would be glad to have it
Take a look at
The C++ Scalar, Vector, Matrix and Tensor class Library
http://www.netwood.net/~edwin/svmtl/
[...]
Interesting... is this your own algorithm?
Having another look at the paper:
Windley, P. F. "Transposing Matrices in a Digital Computer."
Computer J. 2, 47-48, Apr. 1959.
mentioned in a previous post of mine,
I think your algorithm is the same as
one attributed there to one "J. C. Gower".
The author's own algorithm, he says,
"... saves going around each cycle once, but ...
involves more reading and writing operations ...".
Knuth (natch) also gives several variations in:
Knuth, D. E. "Transposing a Rectangular Matrix." Ch. 1.3.3 Ex. 12. The
Art of Computer Programming, Vol. 1: Fundamental Algorithms, 3rd ed.
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.