Matrix transposition: Difference between revisions

Content added Content deleted
No edit summary
Line 301: Line 301:
After execution, the memory maps of a and b will be those of m by n arrays instead
After execution, the memory maps of a and b will be those of m by n arrays instead
of n by m.
of n by m.

=={{header|C++}}==

{{libheader|Boost.uBLAS}}
<lang C++>
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/io.hpp>

int main()
{
using namespace boost::numeric::ublas;

matrix<double> m(3,3);

for(int i=0; i!=m.size1(); ++i)
for(int j=0; j!=m.size2(); ++j)
m(i,j)=3*i+j;

std::cout << trans(m) << std::endl;
}</lang>

Output:

[3,3]((0,3,6),(1,4,7),(2,5,8))


=={{header|Clojure}}==
=={{header|Clojure}}==