/* * examples/sparseelimrank.C * * Copyright (C) 2017 J-G Dumas * ========LICENCE======== * This file is part of the library LinBox. * * LinBox is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * ========LICENCE======== */ /** \file examples/sparseelimrankgf2.C * @example examples/sparseelimrankgf2.C \brief Gaussian elimination Rank of sparse matrix mod 2 \ingroup examples */ #include #include #include #include using namespace LinBox; int main (int argc, char **argv) { if (argc <2) { std::cerr << "Usage: sparseelimrankgf2 " << std::endl; return -1; } std::ifstream input (argv[1]); if (!input) { std::cerr << "Error opening matrix file: " << argv[1] << std::endl; return -1; } LinBox::GF2::Element d; LinBox::ZeroOne A; A.read(input); // input in SMS format std::cout << "A is " << A.rowdim() << " by " << A.coldim() << std::endl; if (A.rowdim() <= 20 && A.coldim() <= 20) A.write(std::cout) << std::endl; // using Sparse Elimination with linear pivoting GaussDomain GD ( A.field() ); GD.detin (d, A, Specifier::PIVOT_LINEAR); if (A.rowdim() <= 20 && A.coldim() <= 20) A.write(std::cout,Tag::FileFormat::Maple) << std::endl; A.field().write(std::cout << "Det is ", d) << " over GF2" << std::endl; return 0; } // vim:sts=4:sw=4:ts=4:noet:sr:cino=>s,f0,{0,g0,(0,:0,t0,+0,=s // Local Variables: // mode: C++ // tab-width: 4 // indent-tabs-mode: nil // c-basic-offset: 4 // End: