Echelon form of matrix over Zp.
Echelon form of matrix over Zp.
#include <iostream>
#include <linbox/solutions/echelon.h>
#include <fflas-ffpack/ffpack/ffpack.h>
#define COMPARE_FFPACK
int main (
int argc,
char **argv)
{
if (argc < 3 || argc > 3) {
cerr << "Usage: echelon <matrix-file-in-SMS-format> <p>" << endl;
return -1;
}
ifstream input (argv[1]);
if (!input) { cerr << "Error opening matrix file " << argv[1] << endl; return -1; }
typedef Givaro::Modular<double> Field;
double q = atof(argv[2]);
Field F(q);
cout <<
"A is " << A.
rowdim() <<
" by " << A.
coldim() << endl;
reducedRowEchelon(E,A);
#ifdef COMPARE_FFPACK
size_t * P =
new size_t[G.
rowdim()];
size_t * Q =
new size_t[G.
coldim()];
FFPACK::getReducedEchelonForm (F, FFLAS::FflasUpper, G.
rowdim(), G.
coldim(), r,
G.
write(cerr<<
"FFPACK::Echelon = "<<endl)<<endl;
delete[] P ;
delete[] Q ;
#endif
E.
write(cerr<<
"LinBox::Echelon = "<<endl)<<endl;
return 0;
}
size_t rowdim() const
Get the number of rows in the matrix.
Definition: blas-matrix.inl:502
size_t coldim() const
Get the number of columns in the matrix.
Definition: blas-matrix.inl:508
std::istream & read(std::istream &file)
Read the matrix from an input stream.
Definition: blas-matrix.inl:423
pointer & getWritePointer()
 
Definition: blas-matrix.inl:584
std::ostream & write(std::ostream &os) const
Write the matrix in MatrixMarket format.
Definition: blas-matrix.h:562
int main()
no command line args
Definition: ex-fields-archetype.C:70
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