Ticket #9806: band_transpose.cpp

File band_transpose.cpp, 604 bytes (added by michele.de.stefano@…, 9 years ago)

A small example that shows the problem.

Line 
1#include <boost/numeric/ublas/banded.hpp>
2#include <boost/numeric/ublas/matrix.hpp>
3#include <boost/numeric/ublas/io.hpp>
4
5int main () {
6 using namespace boost::numeric::ublas;
7 using namespace std;
8
9 banded_matrix<double> m(3, 3, 1, 1),tm;
10
11 for (signed i = 0; i < signed (m.size1 ()); ++ i)
12 for (signed j = std::max (i - 1, 0); j < std::min (i + 2, signed (m.size2 ())); ++ j)
13 m (i, j) = 3 * i + j;
14
15 std::cout << m << std::endl;
16
17 tm = banded_matrix<double>(3,3,1,1);
18 tm = trans(m);
19
20 cout << "\ntm = \n" << tm << endl;
21
22 return 0;
23}