Gaussian elimination determinant of sparse matrix over Z or Zp.
#include <iostream>
#include <vector>
#include <utility>
#include "linbox/field/gf2.h"
#include "linbox/blackbox/sparse.h"
#include "linbox/blackbox/zero-one.h"
#include "linbox/solutions/rank.h"
#include "linbox/util/matrix-stream.h"
int main (int argc, char **argv)
{
commentator().
setMaxDetailLevel (-1);
commentator().
setMaxDepth (-1);
commentator().
setReportStream (std::cerr);
if (argc < 2 || argc > 3)
{ cerr << "Usage: sparseelimdet <matrix-file-in-supported-format> [<p>]" << endl; return -1; }
ifstream input (argv[1]);
if (!input) { cerr << "Error opening matrix file: " << argv[1] << endl; return -1; }
if (argc == 2) {
PID_integer::Element d;
cout <<
"A is " << A.
rowdim() <<
" by " << A.
coldim() << endl;
SE.strategy(Specifier::PIVOT_LINEAR);
ZZ.
write(cout <<
"Determinant is ", d) << endl;
}
if (argc == 3) {
double q = atof(argv[2]);
Field::Element d;
Field F(q);
cout <<
"B is " << B.
rowdim() <<
" by " << B.
coldim() << endl;
SE.strategy(Specifier::PIVOT_NONE);
F.write(cout << "Determinant is ", d) << endl;
SE.strategy(Specifier::PIVOT_LINEAR);
detin (d, B, SE);
F.write(cout << "Determinant is ", d) << endl;
}
return 0;
}