#ifndef DISABLE_COMMENTATOR
#define DISABLE_COMMENTATOR
#endif
#define __LB_VALENCE_REPORTING__ 1
#define __LB_CRA_REPORTING__ 1
#define __LB_CRA_TIMING__ 1
#include <iostream>
#include <givaro/givintfactor.h>
#include <fflas-ffpack/paladin/parallel.h>
#include <vector>
int main (
int argc,
char **argv)
{
if (argc < 2 || argc > 4) {
std::cerr << "Usage: smithvalence <matrix-file-in-supported-format> [-ata|-aat|valence] [coprime]" << std::endl;
std::cerr << " Optional parameters valence and coprime are integers." << std::endl;
std::cerr << " Prime factors of valence will be used for local computation." << std::endl;
std::cerr << " coprime will be used for overall Z rank computation." << std::endl;
return -1;
}
const std::string filename(argv[1]);
std::ifstream input (filename);
if (!input) { std::cerr << "Error opening matrix file " << filename << std::endl; return -1; }
Givaro::ZRing<Integer> ZZ;
input.close();
std::clog << "A is " << A.rowdim() << " by " << A.coldim() << std::endl;
size_t method=0;
Givaro::Integer val_A(0);
if (argc >= 3) {
if (strcmp(argv[2],"-ata") == 0) {
method=2;
}
else if (strcmp(argv[2],"-aat") == 0) {
method=1;
}
else {
std::clog << "Suppose primes are contained in " << argv[2] << std::endl;
}
}
Givaro::Integer coprimeV=1;
if (argc >= 4) {
std::clog << "Suppose " << argv[3] << " is coprime with Smith form" << std::endl;
coprimeV =Givaro::Integer(argv[3]);
}
std::vector<Givaro::Integer> SmithDiagonal;
#ifdef __LINBOX_USE_OPENMP
std::clog << "num procs: " << omp_get_num_procs() << std::endl;
std::clog << "max threads: " << MAX_THREADS << std::endl;
#endif
PAR_BLOCK {
smithValence(SmithDiagonal, val_A, A, filename, coprimeV, method);
}
chrono.stop();
std::clog << "Integer Smith Form (" << SmithDiagonal.size() << "):" << std::endl;
std::clog << chrono << std::endl;
return 0;
}
MatrixStream.
Definition matrix-stream.h:200
Definition sparse-matrix.h:47
linbox base configuration file
Namespace in which all linbox code resides.
Definition alt-blackbox-block-container.h:4
Givaro::Timer Timer
Definition timer.h:55
Givaro::Integer Integer
Definition integer.h:56
std::vector< Givaro::Integer > & smithValence(std::vector< Givaro::Integer > &SmithDiagonal, Givaro::Integer &valence, const Blackbox &A, const std::string &filename, Givaro::Integer &coprimeV, size_t method=0)
Definition smith-form-valence.h:407
std::ostream & writeCompressedSmith(std::ostream &out, const std::vector< typename PIR::Element > &SmithDiagonal, const PIR &ZZ, const size_t m, const size_t n)
Definition smith-form-valence.h:513
int main()
Definition test-tutorial.C:54