Determinant of sparse matrix over Z or Zp.
#define __LINBOX_HAVE_MPI
#include"mpi.h"
#include <iostream>
#include <string>
#include <linbox/util/matrix-stream.h>
int main (int argc, char **argv)
{
#ifdef __LINBOX_HAVE_MPI
if (argc < 2) {
cerr << "Usage: det <matrix-file-in-supported-format>" << endl;
return -1;
}
else{
Communicator *Cptr = NULL;
Cptr = new Communicator(&argc, &argv);
typedef Givaro::ZRing<Integer> Integers;
Integers ZZ;
ifstream input (argv[1]);
if (!input)
{ cerr << "Error opening matrix file " << argv[1] << endl;
return -1;
}
SparseMatrix<Integers>A(ZZ);
A.read(input);
if(!Cptr->rank()){
cout << "A is " << A.rowdim() << " by " << A.coldim() << endl;
cout << "Beginning parallel computation with " << Cptr->size()
<< " processes." << endl;
}
Integers::Element det_A;
if(!Cptr->rank()){
cout << "Determinant is ";
ZZ.write(cout, det_A) << endl;
}
MPI_Finalize();
}
return 0;
#else
cerr << "Compile with -D__LINBOX_HAVE_MPI" << endl;
return -1 ;
#endif
}