#include "machdefs.h" #include #include #include #include "tarrinit.h" #include "array.h" #include "pexceptions.h" #include "srandgen.h" #include "sophyainit.h" #include "ctimer.h" #include "timing.h" #include "smtx.h" //-------------------------------------------------------- // Test d'expression template sur tableaux // Reza - Avril 2003 // revisite : Mars 2012 //-------------------------------------------------------- //------- Le code de smtx.cc #include "smtx.cc" //------- // ------------------------------------------------ // programme de test template expressions // ------------------------------------------------ int main(int narg, char* arg[]) { SophyaInit(); InitTim(); // Initializing the CPU timer if (narg < 3) { cout << "\n te/ TemplateExpression Test - missing arguments\n" << " Usage: te NLoop NRow NCol \n" << endl; return 1; } int N = 10; int nrow = 2; int ncol = 2; N = atoi(arg[1]); nrow = atoi(arg[2]); ncol = atoi(arg[3]); cout << " te/ TemplateExpression Test - NLoop = " << N << " NRow=" << nrow << " NCol= " << ncol << " Size=nr*nc= " << nrow*ncol << endl; try { cout << " ---- Verification operation ------ " << endl; SimpleMatrix mx1(4,6); mx1 = 3; mx1 *= 2; cout << " mx1=3; mx1*=2; : " << endl; cout << mx1 << endl; SimpleMatrix mx2(4,6); mx2.Init(1,1); SimpleMatrix mx3(4,6), mx4; mx3.Init(1000,100); mx4 = mx3+mx2*2 ; cout << " mx2, mx3, mx4=mx3+2mx2 " << endl; cout << mx2 << endl << mx3 << endl << mx4 << endl; cout << ">> Test with SimpleMatrix/JET " << endl; PrtTim(" (0) -- "); int i,j,k; { SimpleMatrix m1(nrow, ncol); SimpleMatrix m2(nrow, ncol); SimpleMatrix m3(nrow, ncol); SimpleMatrix m4(nrow, ncol); SimpleMatrix m5(nrow, ncol); for(k=0; k, SMExprMtx >( SMExprMtx(m1), SMExprMtx (m2) ); // Calcul m1*c1 + m1*(m2+c2) + m2*c3; m5 = m1*c1 + m1*(m2+c2) + m2*c3; } cout << " (5) JET: m5 = m1*c1 + m1*(m2+c2) + m2*c3 ---" << endl; PrtTim(" (5) -- "); for(k=0; k>>>> test with SOPHYA::TArray / TMatrix " << endl; TMatrix m1(nrow, ncol); TMatrix m2(nrow, ncol); TMatrix m3(nrow, ncol); TMatrix m4(nrow, ncol); TMatrix m5(nrow, ncol); for(k=0; k>>>> test with r_8 * p = new double[size] " << endl; r_8 * m1 = new r_8[nrow*ncol]; r_8 * m2 = new r_8[nrow*ncol]; r_8 * m3 = new r_8[nrow*ncol]; r_8 * m5 = new r_8[nrow*ncol]; for(k=0; k