Ranks of sparse matrix modulo 2^k.
#include <iostream>
#include <givaro/modular.h>
template<class Int_type, class Ring_type = Givaro::ZRing<Int_type> >
input.close();
cout << "A is " << A.rowdim() << " by " << A.coldim() << endl;
Givaro::Timer tim;
tim.clear(); tim.start();
if (StPr)
PGD(local, A, Q, exponent, StPr);
else
PGD(local, A, Q, exponent);
tim.stop();
R.write(std::cout << "Local Smith Form ") << " : " << std::endl << '(';
int num = A.rowdim();
for (auto p = local.begin(); p != local.end(); ++p) {
std::cout << '[' << p->first << ',' << p->second << "] ";
num -= p->second;
}
if (num > 0) std::cout <<
'[' << F2.
zero <<
',' << num <<
"] ";
std::cout << ')' << std::endl;
if (A.rowdim() <= 20 && A.coldim() <= 20) {
}
std::cerr << tim << std::endl;
}
int main (
int argc,
char **argv) {
if (argc < 3 || argc > 5)
{ cerr << "Usage: rank <matrix-file-in-supported-format> <power of two exponent> [<method>] [<flag>]" << endl; return -1; }
ifstream input (argv[1]);
if (!input) { cerr << "Error opening matrix file: " << argv[1] << endl; return -1; }
int method( argc>3? atoi(argv[3]): 0 );
Givaro::Timer tim;
int exponent = atoi(argv[2]);
size_t StPr( argc>4? atoi(argv[4]): 0);
if ((method == 2) || ((method == 0) && (exponent >= (1<<11))) ) {
} else {
if ((method == 1) || ((method == 0) && (exponent < 64)) ) {
} else {
switch (method) {
default: std::cerr << "Choose between ruint<6> ... ruint<11>" << std::endl;
break;
}
}
}
std::cerr << tim << std::endl;
return 0;
}
SparseMatrix< Field, SparseMatrixFormat::TPL_omp > SparseMat
Definition block-coppersmith-benchmark.C:25
Definition field/gf2.h:71
const bool zero
Definition field/gf2.h:73
MatrixStream.
Definition matrix-stream.h:200
Definition permutation.h:48
std::ostream & write(std::ostream &os) const
Definition permutation.h:351
Repository of functions for rank modulo a prime power by elimination on sparse matrices.
Definition smith-form-sparseelim-poweroftwo.h:61
Definition sparse-matrix.h:47
linbox base configuration file
@ Maple
Definition linbox-tags.h:87
Namespace in which all linbox code resides.
Definition alt-blackbox-block-container.h:4
std::list< SmithPair< PIR > > SmithList
Definition smith-form.h:42
void runpoweroftworank(ifstream &input, const size_t exponent, size_t StPr)
Definition poweroftwo_ranks.C:43
A SparseMatrix<_Field, _Storage> ....
Commentator & commentator()
Definition commentator.h:998
Givaro::ZRing< Integer > Ring
Definition test-hadamard-bound.C:34
int main()
Definition test-tutorial.C:54