root / tests / test-fsquare.C

Revision 1, 1.7 kB (checked in by pernet, 2 years ago)

Import de fflas-ffpack

Line 
1/* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2//--------------------------------------------------------------------------
3//                        Test for fsquare : 1 computation
4//                 
5//--------------------------------------------------------------------------
6// Clement Pernet
7//-------------------------------------------------------------------------
8
9#define DEBUG 0
10#define TIME 1
11
12#include <iomanip>
13#include <iostream>
14#include "fflas-ffpack/modular-balanced.h"
15#include "timer.h"
16#include "Matio.h"
17#include "fflas-ffpack/fflas.h"
18
19
20using namespace std;
21
22typedef Modular<double> Field;
23
24int main(int argc, char** argv){
25
26        int n;
27
28        cerr<<setprecision(10);
29        if (argc != 6)  {
30                cerr<<"Usage : test-fsquare <p> <A> <i>"
31                    <<"<alpha> <beta>"
32                    <<"         to do i computations of C <- AA"
33                    <<endl;
34                exit(-1);
35        }
36        Field F(atoi(argv[1]));
37
38        Field::Element * A;
39        Field::Element * C;
40        size_t lda;
41        size_t ldb;
42       
43        A = read_field(F,argv[2],&n,&n);
44        int nbit=atoi(argv[3]); // number of times the product is performed
45
46        Field::Element alpha,beta;
47        F.init (alpha, (double)atoi(argv[4]));
48        F.init (beta, (double)atoi(argv[5]));
49
50        C = new Field::Element[n*n];
51        Timer tim,t; t.clear();tim.clear(); 
52        for(int i = 0;i<nbit;++i){
53                t.clear();
54                t.start();
55                FFLAS::fsquare (F, FFLAS::FflasNoTrans,n, alpha, A,n, beta, C, n);
56                t.stop();
57                tim+=t;
58        }
59
60#if TIME
61        double mflops = (2.0*(n*n/1000000.0)*nbit*n/tim.usertime());
62        cerr << n <<"x" <<n <<" : fsquare over Z/"
63             <<atoi(argv[1])<<"Z : [ "
64             <<mflops<<" MFops in "<<tim.usertime()/nbit<<"s]"
65             << endl;
66       
67        cerr<<"alpha, beta = "<<alpha <<", "<<beta <<endl;
68
69        cout<<n<<" "<<n<<" "<<mflops<<" "<<tim.usertime()/nbit<<endl;
70#endif
71} 
72
Note: See TracBrowser for help on using the browser.