computes doubleDet.
computes doubleDet.
#include <iostream>
#include <givaro/zring.h>
#include <linbox/util/matrix-stream.h>
#include <linbox/algorithms/double-det.h>
int main (
int argc,
char **argv)
{
if (argc != 2) {
cerr << "Usage: doubledet <matrix-file-in-supported-format>" << endl;
}
Givaro::ZRing<Integer> ZZ;
ifstream input (argv[1]);
if (!input)
{ cerr << "Error opening matrix file " << argv[1] << endl;
return -1;
}
MatrixStream <Givaro::ZRing<Integer> > ms (ZZ, input);
DenseMatrix <Givaro::ZRing<Integer> > A (ms);
cout <<
"Matrix is " << A.
rowdim() <<
" by " << A.
coldim() << endl;
cerr<<"Wrong dimensions: A must be (n+1) x n"<<endl;
exit (-1);
}
Timer tim; tim.clear();
tim.start();
bool proof=false;
if (argc > 2)
proof = true;
doubleDet (det1, det2, A, proof);
tim.stop();
for (size_t i=0; i<n-1; ++i)
for (size_t j=0; j<n; ++j)
for (size_t j=0; j<n; ++j)
det (db, B);
for (size_t j=0; j<n; ++j)
Timer tim2;
tim2.clear();
tim2.start();
det(dc, B);
tim2.stop();
if ((det1 != db) || (det2 != dc))
std::cerr<<"Check FAIL"<<endl;
cout<< "Det 1 = " << det1 << endl;
cout<< "Det 2 = " << det2 << endl;
cerr << "Double Det: " << tim.usertime() << "s" << endl;
cerr << "Each single Det: "<<tim2.usertime() << "s" << endl;
return 0 ;
}
Dense matrix representation.
Definition blas-matrix.h:62
size_t rowdim() const
Get the number of rows in the matrix.
Definition blas-matrix.h:233
const Element & getEntry(size_t i, size_t j) const
Get a read-only reference to the entry in the (i, j) position.
Definition blas-matrix.h:283
void setEntry(size_t i, size_t j, const Element &a_ij)
Set the entry at the (i, j) position to a_ij.
Definition blas-matrix.h:260
size_t coldim() const
Get the number of columns in the matrix.
Definition blas-matrix.h:238
int main()
no command line args
Definition ex-fields-archetype.C:70
Givaro::Integer integer
Integers in LinBox.
Definition integer.h:55
linbox base configuration file
Namespace in which all linbox code resides.
Definition alt-blackbox-block-container.h:4