transpose.cpp   transpose.cpp 
#include "testsuite.h" #include "testsuite.h"
#include <blitz/array.h> #include <blitz/array.h>
#include <random/discrete-uniform.h>
BZ_USING_NAMESPACE(blitz) BZ_USING_NAMESPACE(blitz)
int main() int main()
{ {
Array<int,3> A(3,7,11); // try with all kinds of different sizes to make sure it works for
// aligned and nonaligned lengths.
for(int i=0;i<20;++i) {
const int sx=ranlib::DiscreteUniform<int>(10).random();
const int sy=ranlib::DiscreteUniform<int>(10).random();
const int sz=ranlib::DiscreteUniform<int>(10).random();
Array<int,3> A(sx,sy,sz, contiguousArray);
// A.dumpStructureInformation(); // A.dumpStructureInformation();
A.transposeSelf(secondDim, thirdDim, firstDim); A.transposeSelf(secondDim, thirdDim, firstDim);
BZTEST(A.ordering(0) == 1 && A.ordering(1) == 0 && A.ordering(2) == 2); BZTEST(A.ordering(0) == 1 && A.ordering(1) == 0 && A.ordering(2) == 2);
BZTEST(A.length(0) == 7 && A.length(1) == 11 && A.length(2) == 3); BZTEST(A.length(0) == sy && A.length(1) == sz && A.length(2) == sx);
BZTEST(A.stride(0) == 11 && A.stride(1) == 1 && A.stride(2) == 77); BZTEST(A.stride(0) == sz && A.stride(1) == 1 && A.stride(2) == sz*sy);
}
// A.dumpStructureInformation(); // A.dumpStructureInformation();
Array<int,2> B(3,3); Array<int,2> B(3,3);
B = 0, 1, 2, B = 0, 1, 2,
3, 4, 5, 3, 4, 5,
6, 7, 8; 6, 7, 8;
// cout << B << endl; // cout << B << endl;
 End of changes. 3 change blocks. 
3 lines changed or deleted 11 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/