source: XMLIO_V2/external/src/BLITZ++/transpose.cpp @ 80

Last change on this file since 80 was 80, checked in by ymipsl, 14 years ago

ajout lib externe

  • Property svn:eol-style set to native
File size: 1.0 KB
Line 
1using namespace std ;
2
3#include "testsuite.h"
4#include <blitz/array.h>
5
6BZ_USING_NAMESPACE(blitz)
7
8int main()
9{
10    Array<int,3> A(3,7,11);
11
12//    A.dumpStructureInformation();
13
14    A.transposeSelf(secondDim, thirdDim, firstDim);
15
16    BZTEST(A.ordering(0) == 1 && A.ordering(1) == 0 && A.ordering(2) == 2);
17    BZTEST(A.length(0) == 7 && A.length(1) == 11 && A.length(2) == 3);
18    BZTEST(A.stride(0) == 11 && A.stride(1) == 1 && A.stride(2) == 77);
19
20//    A.dumpStructureInformation();
21
22    Array<int,2> B(3,3);
23    B = 0, 1, 2,
24        3, 4, 5,
25        6, 7, 8;
26
27//    cout << B << endl;
28
29    B.transposeSelf(secondDim, firstDim);
30    Array<int,2> C(3,3);
31    C = 0, 3, 6,
32        1, 4, 7,
33        2, 5, 8;
34    BZTEST(count(B==C) == 9);
35
36//    cout << B << endl;
37
38    Array<int,2> D(3,3,FortranArray<2>());
39    D = 0, 1, 2,
40        3, 4, 5,
41        6, 7, 8;
42    D.transposeSelf(secondDim, firstDim);
43    Array<int,2> E(3,3,FortranArray<2>());
44    E = 0, 3, 6,
45        1, 4, 7,
46        2, 5, 8;
47    BZTEST(count(D==E) == 9);
48    cout<<E<<endl;
49    return 0;
50}
51
Note: See TracBrowser for help on using the repository browser.