Gaussian elimination determinant of sparse matrix over Z or Zp.
Gaussian elimination determinant of sparse matrix over Z or Zp.
#include <iostream>
#include <vector>
#include <utility>
int main (
int argc,
char **argv)
{
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) {
Givaro::ZRing<Integer> ZZ;
A.read(input);
cout << "A is " << A.rowdim() << " by " << A.coldim() << endl;
Givaro::ZRing<Integer>::Element d;
ZZ.write(cout << "Determinant is ", d) << endl;
}
if (argc == 3) {
typedef Givaro::Modular<double>
Field;
double q = atof(argv[2]);
B.read(input);
cout << "B is " << B.rowdim() << " by " << B.coldim() << endl;
if (B.rowdim() <= 20 && B.coldim() <= 20) B.write(cout) << endl;
Field::Element d;
if (B.rowdim() <= 20 && B.coldim() <= 20)
B.write(cout) << endl;
F.write(cout << "Determinant is ", d) << endl;
if (B.rowdim() <= 20 && B.coldim() <= 20)
B.write(cout) << endl;
F.write(cout << "Determinant is ", d) << endl;
}
return 0;
}
Definition sparse-matrix.h:47
Givaro::Modular< uint32_t > Field
Definition dot-product.C:49
Blackbox::Field::Element & det(typename Blackbox::Field::Element &d, const Blackbox &A, const DomainCategory &tag, const DetMethod &Meth)
Compute the determinant of A.
linbox base configuration file
A Givaro::Modular ring is a representations of Z/mZ.
Namespace in which all linbox code resides.
Definition alt-blackbox-block-container.h:4
@ Linear
Definition methods.h:179
@ None
Definition methods.h:178
Blackbox::Field::Element & detInPlace(typename Blackbox::Field::Element &d, Blackbox &A, const DomainCategory &tag, const DetMethod &Meth)
Definition det.h:77
A SparseMatrix<_Field, _Storage> ....
PivotStrategy pivotStrategy
Definition methods.h:218
Commentator & commentator()
Definition commentator.h:998
int main()
Definition test-tutorial.C:54