root / tests / test-det.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 det
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
17using namespace std;
18
19typedef ModularBalanced<double> Field;
20
21int main(int argc, char** argv){
22
23        int n;
24        int nbit=atoi(argv[3]); // number of times the product is performed
25        cerr<<setprecision(10);
26        if (argc != 4)  {
27                cerr<<"Usage : test-det <p> <A> <<i>"
28                    <<endl
29                    <<"         to compute the determinant of A mod p (i computations)"
30                    <<endl;
31                exit(-1);
32        }
33        Field F(atof(argv[1]));
34        Field::Element * A;
35        A = read_field(F,argv[2],&n,&n);
36               
37        Timer tim,t; t.clear();tim.clear(); 
38        Field::Element d=0;
39        for(int i = 0;i<nbit;++i){
40                t.clear();
41                t.start();
42                d = FFPACK::Det (F, n, n, A, n);
43                t.stop();
44                tim+=t;
45                if (i+1<nbit){
46                        delete[] A;
47                        A = read_field(F,argv[2],&n,&n);
48                }
49        }
50               
51        double mflops = 2.0/3.0*(n*n/1000000.0)*nbit*n/tim.usertime();
52        F.write (cerr<<"n = "<<n<<" Det (A) = ",d)
53                     << " mod "<<atoi(argv[1])<<" : t= "
54                     << tim.usertime()/nbit 
55                     << " s, Mffops = "<<mflops
56                     << endl;
57       
58        cout<<n<<" "<<mflops<<" "<<tim.usertime()/nbit<<endl;
59}
Note: See TracBrowser for help on using the browser.