- Timestamp:
- 06/03/08 21:24:57 (7 months ago)
- Location:
- tests
- Files:
-
- 11 modified
-
. (modified) (1 prop)
-
Matio.h (modified) (3 diffs)
-
test-charpoly.C (modified) (2 diffs)
-
test-det.C (modified) (2 diffs)
-
test-fgemm.C (modified) (5 diffs)
-
test-ftrsm.C (modified) (5 diffs)
-
test-invert.C (modified) (2 diffs)
-
test-lqup.C (modified) (6 diffs)
-
test-rank.C (modified) (2 diffs)
-
testeur_fgemm.C (modified) (6 diffs)
-
testeur_lqup.C (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tests
-
Property
svn:ignore set
to
test-invert
test-det
dense_generator
test-frobenius
Makefile
test-charpoly
test-lqup
test-fgemm
test-fgemv
test-ftrsm
test-rank
-
Property
svn:ignore set
to
-
tests/Matio.h
r16 r62 8 8 // Reading a matrice from a (eventually zipped) file 9 9 double * read_dbl(char * mat_file,int* tni,int* tnj) { 10 char *UT , *File_Name;10 char *UT; 11 11 int is_gzipped = 0; 12 12 size_t s = strlen(mat_file); 13 13 double* X=NULL; 14 if ((mat_file[--s] == 'z') && 15 (mat_file[--s] == 'g') && 16 (mat_file[--s] == '.')) { 17 is_gzipped = 1; 18 File_Name = "/tmp/bbXXXXXX_"; 19 mkstemp(File_Name); 20 UT = new char[s+34+strlen(File_Name)]; 21 sprintf(UT,"gunzip -c %s > %s", mat_file, File_Name); 22 system(UT); 23 sprintf(UT,"\\rm %s", File_Name); 24 } else 25 File_Name = mat_file; 14 const char * File_Name = mat_file; 26 15 27 16 FILE* FileDes = fopen(File_Name, "r"); … … 65 54 typename Field::Element * read_field(const Field& F,char * mat_file,int* tni,int* tnj) 66 55 { 67 char *UT , *File_Name;56 char *UT; 68 57 int is_gzipped = 0; 69 58 size_t s = strlen(mat_file); … … 71 60 F.init(zero,0.0); 72 61 typename Field::Element * X=NULL; 73 if ((mat_file[--s] == 'z') && 74 (mat_file[--s] == 'g') && 75 (mat_file[--s] == '.')) { 76 is_gzipped = 1; 77 File_Name = "/tmp/bbXXXXXX_"; 78 mkstemp(File_Name); 79 UT = new char[s+34+strlen(File_Name)]; 80 sprintf(UT,"gunzip -c %s > %s", mat_file, File_Name); 81 system(UT); 82 sprintf(UT,"\\rm %s", File_Name); 83 } else 84 File_Name = mat_file; 62 const char * File_Name = mat_file; 85 63 FILE* FileDes = fopen(File_Name, "r"); 86 64 if (FileDes != NULL) { -
tests/test-charpoly.C
r4 r62 9 9 #include <iomanip> 10 10 #include <iostream> 11 #include "fflas-ffpack/modular- positive.h"11 #include "fflas-ffpack/modular-balanced.h" 12 12 #include "timer.h" 13 13 #include "Matio.h" … … 19 19 using namespace std; 20 20 21 typedef Modular <double> Field;21 typedef ModularBalanced<double> Field; 22 22 typedef vector<Field::Element> Polynomial; 23 23 -
tests/test-det.C
r46 r62 17 17 using namespace std; 18 18 19 typedef Modular <double> Field;19 typedef ModularBalanced<double> Field; 20 20 21 21 int main(int argc, char** argv){ … … 31 31 exit(-1); 32 32 } 33 Field F(ato i(argv[1]));33 Field F(atof(argv[1])); 34 34 Field::Element * A; 35 35 A = read_field(F,argv[2],&n,&n); -
tests/test-fgemm.C
r46 r62 7 7 //------------------------------------------------------------------------- 8 8 9 #define DEBUG 1 9 #define DEBUG 1 10 10 #define NEWWINO 11 11 #define TIME 1 … … 15 15 using namespace std; 16 16 17 #include "fflas-ffpack/modular- balanced.h"17 #include "fflas-ffpack/modular-positive.h" 18 18 #include "timer.h" 19 19 #include "Matio.h" … … 25 25 typedef Modular<double> Field; 26 26 //typedef Modular<float> Field; 27 //typedef ModularBalanced<double> Field; 28 //typedef ModularBalanced<float> Field; 27 29 //typedef Modular<int> Field; 28 30 … … 109 111 F.assign (*(Cd+i), zero); 110 112 } 111 Field::Element aij, bij, beta_alpha ;112 F.div (beta_alpha, beta, alpha);113 Field::Element aij, bij, beta_alpha, tmp; 114 //F.div (beta_alpha, beta, alpha); 113 115 for (int i = 0; i < m; ++i) 114 116 for (int j = 0; j < n; ++j){ 115 F.mulin(*(Cd+i*n+j),beta_alpha); 117 F.mulin(*(Cd+i*n+j),beta); 118 F.assign (tmp, zero); 116 119 for ( int l = 0; l < k ; ++l ){ 117 120 if ( ta == FFLAS::FflasNoTrans ) … … 123 126 else 124 127 bij = *(B+j*ldb+l); 125 F.axpyin( *(Cd+i*n+j), aij, bij ); 128 //F.mul (tmp, aij, bij); 129 //F.axpyin( *(Cd+i*n+j), alpha, tmp ); 130 F.axpyin (tmp, aij, bij); 126 131 } 127 F.mulin( *(Cd+i*n+j),alpha ); 132 F.axpyin (*(Cd+i*n+j), alpha, tmp); 133 //F.mulin( *(Cd+i*n+j),alpha ); 128 134 if ( !F.areEqual( *(Cd+i*n+j), *(C+i*n+j) ) ) { 129 135 wrong = true; -
tests/test-ftrsm.C
r43 r62 1 1 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 2 //-------------------------------------------------------------------------- 3 // Test for ftr tri: 1 computation3 // Test for ftrsm : 1 computation 4 4 // 5 5 //-------------------------------------------------------------------------- … … 20 20 using namespace std; 21 21 22 typedef Modular<double> Field; 22 //typedef ModularBalanced<double> Field; 23 typedef ModularBalanced<float> Field; 23 24 24 25 int main(int argc, char** argv){ … … 34 35 } 35 36 int nbit=atoi(argv[4]); // number of times the product is performed 36 Field F(ato i(argv[1]));37 Field F(atof(argv[1])); 37 38 F.init(zero,0.0); 38 39 F.init(one,1.0); … … 97 98 //write_field (F,cerr<<"B2="<<endl,B2,m,n,n); 98 99 //write_field (F,cerr<<"B="<<endl,B,m,n,n); 99 }else{ 100 100 } else 101 101 cerr<<"PASS"<<endl; 102 }103 104 Field::Element * C = read_field (F, argv[2], &k, &k);105 wrong = false;106 107 for (int i=0;i<k;++i)108 for (int j=0;j<k;++j)109 if ( !F.areEqual(*(A+i*k+j), *(C+i*k+j))){110 cerr<<"A ["<<i<<", "<<j<<"] = "<<(*(A+i*k+j))111 <<" ; C ["<<i<<", "<<j<<"] = "<<(*(C+i*k+j))112 <<endl;113 wrong = true;114 }115 116 delete[] C;117 118 if ( wrong ){119 cerr<<"FAIL A modifed"<<endl;120 //write_field (F,cerr<<"B2="<<endl,B2,m,n,n);121 //write_field (F,cerr<<"B="<<endl,B,m,n,n);122 }else{123 124 cerr<<"PASS"<<endl;125 }126 127 102 #endif 128 103 … … 130 105 delete[] B; 131 106 delete[] B2; 107 132 108 #if TIME 133 109 double mflops = m*n/1000000.0*nbit*n/time; -
tests/test-invert.C
r25 r62 19 19 20 20 21 22 23 typedef Modular<double> Field; 21 typedef ModularBalanced<float> Field; 24 22 25 23 int main(int argc, char** argv){ … … 37 35 exit(-1); 38 36 } 39 Field F(ato i(argv[1]));37 Field F(atof(argv[1])); 40 38 F.init(zero,0.0); 41 39 F.init(one,1.0); -
tests/test-lqup.C
r37 r62 20 20 #include "Matio.h" 21 21 #include "timer.h" 22 //#include "fflas-ffpack/modular-balanced.h" 23 #include "fflas-ffpack/modular-positive.h" 22 #include "fflas-ffpack/modular-balanced.h" 24 23 #include "fflas-ffpack/ffpack.h" 25 24 26 typedef Modular<double> Field; 25 //typedef ModularBalanced<double> Field; 26 typedef ModularBalanced<float> Field; 27 27 28 28 int main(int argc, char** argv){ … … 37 37 exit(-1); 38 38 } 39 Field F( (unsigned long)atoi(argv[1]));39 Field F(atof(argv[1])); 40 40 Field::Element * A; 41 41 … … 51 51 52 52 enum FFLAS::FFLAS_DIAG diag = FFLAS::FflasUnit; 53 enum FFLAS::FFLAS_TRANSPOSE trans = FFLAS::Fflas Trans;53 enum FFLAS::FFLAS_TRANSPOSE trans = FFLAS::FflasNoTrans; 54 54 if (trans == FFLAS::FflasTrans){ 55 55 maxP = m; … … 122 122 F.assign(*(L+i*(m+1)), one); 123 123 124 //write_field(F,cerr<<"L = "<<endl,L,m,m,m);125 //write_field(F,cerr<<"U = "<<endl,U,m,n,n);124 //write_field(F,cerr<<"L = "<<endl,L,m,m,m); 125 //write_field(F,cerr<<"U = "<<endl,U,m,n,n); 126 126 if (diag == FFLAS::FflasNonUnit) 127 127 for ( int i=0; i<R; ++i ) … … 196 196 for (int i=0; i<m; ++i) 197 197 for (int j=0; j<n; ++j) 198 if (!F.areEqual (*(B+i*n+j), *(X+i*n+j))) 198 if (!F.areEqual (*(B+i*n+j), *(X+i*n+j))){ 199 std::cerr << " B["<<i<<","<<j<<"] = " << (*(B+i*n+j)) 200 << " X["<<i<<","<<j<<"] = " << (*(X+i*n+j)) 201 << endl; 199 202 fail=true; 200 203 } 201 204 // write_field(F,cerr<<"X = "<<endl,X,m,n,n); 202 205 // write_field(F,cerr<<"B = "<<endl,B,m,n,n); … … 218 221 double numops = m*m/1000.0*(n-m/3.0); 219 222 220 cerr<<m<<"x"<< n 223 cerr<<m<<"x"<< n 224 << " Trans = "<<trans 225 << " Diag = "<<diag 221 226 << " : rank = " << R << " [" 222 227 << ((double)nbf/1000.0*(double)numops / t) -
tests/test-rank.C
r12 r62 18 18 using namespace std; 19 19 20 typedef Modular <double> Field;20 typedef ModularBalanced<double> Field; 21 21 22 22 int main(int argc, char** argv){ … … 32 32 exit(-1); 33 33 } 34 Field F(ato i(argv[1]));34 Field F(atof(argv[1])); 35 35 Field::Element * A; 36 36 A = read_field(F,argv[2],&m ,&n); -
tests/testeur_fgemm.C
r25 r62 12 12 #include <iomanip> 13 13 using namespace std; 14 //#include "fflas-ffpack/modular-int.h"15 #include "fflas-ffpack/modular-balanced.h"14 #include "fflas-ffpack/modular-int.h" 15 //#include "fflas-ffpack/modular-balanced.h" 16 16 #include "timer.h" 17 17 #include "Matio.h" … … 21 21 22 22 23 typedef Modular<double> Field; 23 //typedef ModularBalanced<float> Field; 24 typedef ModularBalanced<double> Field; 25 //typedef Modular<double> Field; 26 //typedef Modular<float> Field; 24 27 //typedef Modular<int> Field; 25 //typedef Modular<float> Field;26 28 //typedef GivaroZpz<Std32> Field; 27 29 //typedef GivaroGfq Field; … … 31 33 IntPrimeDom IPD; 32 34 Field::Element alpha, beta; 33 intp;35 long p; 34 36 size_t M, K, N, Wino; 35 37 bool keepon = true; … … 126 128 // keepon = false; 127 129 // } 128 Field::Element aij, bij, boa ;129 F.div(boa, beta, alpha);130 Field::Element aij, bij, boa, temp; 131 //F.div(boa, beta, alpha); 130 132 for (int i = 0; i < M; ++i ) 131 133 for ( int j = 0; j < N; ++j ){ 132 F.mulin(*(Cbis+i*N+j),boa); 134 // F.mulin(*(Cbis+i*N+j),boa); 135 F.mulin(*(Cbis+i*N+j),beta); 133 136 for ( int l = 0; l < K ; ++l ){ 134 137 if ( ta == FFLAS::FflasNoTrans ) … … 140 143 else 141 144 bij = *(B+j*ldb+l); 142 143 F.axpyin( *(Cbis+i*N+j), aij, bij ); 145 F.mul(temp,aij,bij); 146 F.axpyin( *(Cbis+i*N+j), alpha, temp); 147 //F.axpyin( *(Cbis+i*N+j), aij, bij ); 144 148 } 145 F.mulin( *(Cbis+i*N+j),alpha );149 //F.mulin( *(Cbis+i*N+j),alpha ); 146 150 if ( !F.areEqual( *(Cbis+i*N+j), *(C+i*N+j) ) ) { 147 151 cerr<<"error for i,j="<<i<<" "<<j<<" "<<*(C+i*N+j)<<" "<<*(Cbis+i*N+j)<<endl; … … 160 164 } 161 165 else{ 162 cerr<<"C="<<endl;163 write_field( F, cerr, C, M, N, N );164 cerr<<"Cbis="<<endl;165 write_field( F, cerr, Cbis, M, N, N );166 // cerr<<"C="<<endl; 167 // write_field( F, cerr, C, M, N, N ); 168 // cerr<<"Cbis="<<endl; 169 // write_field( F, cerr, Cbis, M, N, N ); 166 170 } 167 171 } -
tests/testeur_lqup.C
r26 r62 21 21 22 22 23 typedef Modular<double> Field; 23 //typedef Modular<double> Field; 24 typedef ModularBalanced<double> Field; 25 //typedef Modular<float> Field; 26 //typedef ModularBalanced<float> Field; 24 27 //typedef Modular<int> Field; 25 //typedef Modular<float> Field;26 28 //typedef GivaroZpz<Std32> Field; 27 29 //typedef GivaroGfq Field; … … 265 267 for (size_t i=0; i<M; ++i) 266 268 for (size_t j=0; j<N; ++j) 267 if ( !(*(Abis+i*lda+j)))268 cerr<<i+1<<" "<<j+1<<" "<<(( size_t) *(Abis+i*lda+j) )<<endl;269 if (*(Abis+i*lda+j)) 270 cerr<<i+1<<" "<<j+1<<" "<<((int) *(Abis+i*lda+j) )<<endl; 269 271 cerr<<"0 0 0"<<endl<<endl; 270 272
