root / tests / test-rank.C

Revision 62, 1.5 kB (checked in by pernet, 6 months ago)

* Change the design of fflas-bounds
* Modular<double> -> ModularBalanced?<double>
* Fix the winograd recursion issue (when some steps are done over the field)
* Fix a bunch of bugs
* Remove the template specialization by the Element (incompatible with the soon coming compressed representations over small fields)
* Create a randiter file, generic wrt the modular field

Line 
1/* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2//--------------------------------------------------------------------------
3//                        Test for rank
4//                 
5//--------------------------------------------------------------------------
6// Clement Pernet
7//-------------------------------------------------------------------------
8
9#include <iomanip>
10#include <iostream>
11#include "fflas-ffpack/modular-balanced.h"
12#include "timer.h"
13#include "Matio.h"
14#include "fflas-ffpack/ffpack.h"
15
16
17
18using namespace std;
19
20typedef ModularBalanced<double> Field;
21
22int main(int argc, char** argv){
23
24        int n,m;
25        int nbit=atoi(argv[3]); // number of times the product is performed
26        cerr<<setprecision(10);
27        if (argc !=  4) {
28                cerr<<"Usage : test-rank <p> <A> <<i>"
29                    <<endl
30                    <<"         to compute the rank of A mod p (i computations)"
31                    <<endl;
32                exit(-1);
33        }
34        Field F(atof(argv[1]));
35        Field::Element * A;
36        A = read_field(F,argv[2],&m ,&n);
37               
38        Timer tim,t; t.clear();tim.clear(); 
39        Field::Element r=0;
40        for(int i = 0;i<nbit;++i){
41                t.clear();
42                t.start();
43                r = FFPACK::Rank (F, m, n, A, n);
44                t.stop();
45                tim+=t;
46                if (i+1<nbit){
47                        delete[] A;
48                        A = read_field(F,argv[2],&m,&n);
49                }
50        }
51
52        double mflops = 2.0/3.0*(n*r/1000000.0)*nbit*n/tim.usertime();
53        F.write (cerr<<"m,n = "<<m<<", "<<n<<" Rank (A) = ",r)
54                     << " mod "<<atoi(argv[1])<<" : t= "
55                     << tim.usertime()/nbit 
56                     << " s, Mffops = "<<mflops
57                     << endl;
58       
59        cout<<m<<" "<<n<<" "<<r<<" "<<mflops<<" "<<tim.usertime()/nbit<<endl;
60}
Note: See TracBrowser for help on using the browser.