数值计算工具库,C语言编写的,可以直接调用.

源代码在线查看: transpose.cpp

软件大小: 523 K
上传用户: qinghuatong
关键词: 数值 计算工具 编写 语言
下载地址: 免注册下载 普通下载 VIP

相关代码

				#include "testsuite.h"
				#include 
				
				BZ_USING_NAMESPACE(blitz)
				
				int main()
				{
				    Array A(3,7,11);
				
				//    A.dumpStructureInformation();
				
				    A.transposeSelf(secondDim, thirdDim, firstDim);
				
				    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.stride(0) == 11 && A.stride(1) == 1 && A.stride(2) == 77);
				
				//    A.dumpStructureInformation();
				
				    Array B(3,3);
				    B = 0, 1, 2,
				        3, 4, 5,
				        6, 7, 8;
				
				//    cout 				
				    B.transposeSelf(secondDim, firstDim);
				    Array C(3,3);
				    C = 0, 3, 6,
				        1, 4, 7,
				        2, 5, 8;
				    BZTEST(count(B==C) == 9);
				
				//    cout 				
				    Array D(3,3,FortranArray());
				    D = 0, 1, 2,
				        3, 4, 5,
				        6, 7, 8;
				    D.transposeSelf(secondDim, firstDim);
				    Array E(3,3,FortranArray());
				    E = 0, 3, 6,
				        1, 4, 7,
				        2, 5, 8;
				    BZTEST(count(D==E) == 9);
				
				    return 0;
				}
				
							

相关资源