#include <iostream>
#include <linbox/blackbox/transpose.h>
#include <linbox/blackbox/compose.h>
#include <linbox/solutions/valence.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) {
std::cerr << "Usage: valence <matrix-file-in-supported-format> [-ata|-aat]" << std::endl;
return -1;
}
std::ifstream input (argv[1]);
if (!input) { std::cerr << "Error opening matrix file " << argv[1] << std::endl; return -1; }
Givaro::ZRing<Integer> ZZ;
typedef SparseMatrix<Givaro::ZRing<Integer> > Blackbox;
Blackbox A (ms);
std::cout << "A is " << A.rowdim() << " by " << A.coldim() << std::endl;
Givaro::ZRing<Integer>::Element val_A;
if (argc == 3) {
if (strcmp(argv[2],"-aat")) {
std::cout <<
"A^T A is " << C.
rowdim() <<
" by " << C.
coldim() << std::endl;
valence(val_A, C);
}
else {
std::cout <<
"A A^T is " << C.
rowdim() <<
" by " << C.
coldim() << std::endl;
valence(val_A, C);
}
}
else {
if (A.rowdim() != A.coldim()) {
std::cerr << "Valence works only on square matrices, try either to change the dimension in the matrix file, or to compute the valence of A A^T or A^T A, via the -aat or -ata options." << std::endl;
exit(0);
}
else
valence (val_A, A);
}
std::cout << "Valence is " << val_A << std::endl;
return 0;
}