<commit_before>/* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/**\file examples/valence.C
\brief Valence of sparse matrix over Z or Zp.
\ingroup examples
*/
//#include "linbox-config.h"
#include <iostream>

#include "linbox/field/modular-double.h"
#include "linbox/field/gmp-integers.h"
#include "linbox/blackbox/transpose.h"
#include "linbox/blackbox/compose.h"
#include "linbox/blackbox/sparse.h"
#include "linbox/solutions/valence.h"
#include "linbox/util/matrix-stream.h"

using namespace LinBox;

int main (int argc, char **argv)
{

	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; }

        PID_integer ZZ;
        MatrixStream< PID_integer > ms( ZZ, input );
        typedef SparseMatrix<PID_integer>  Blackbox;
        Blackbox A (ms);
        
        std::cout << "A is " << A.rowdim() << " by " << A.coldim() << std::endl;
        
        PID_integer::Element val_A;


        if (argc == 3) {
            Transpose<Blackbox> T(&A);
            if (argv[2] == "-ata") {
                Compose< Transpose<Blackbox>, Blackbox > C (&T, &A);
                std::cout << "A^T A is " << C.rowdim() << " by " << C.coldim() << std::endl;
                valence(val_A, C);
            } else {
                Compose< Blackbox, Transpose<Blackbox> > C (&A, &T);<commit_msg>corrected strcmp<commit_after>/* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/**\file examples/valence.C
\brief Valence of sparse matrix over Z or Zp.
\ingroup examples
*/
//#include "linbox-config.h"
#include <iostream>

#include "linbox/field/modular-double.h"
#include "linbox/field/gmp-integers.h"
#include "linbox/blackbox/transpose.h"
#include "linbox/blackbox/compose.h"
#include "linbox/blackbox/sparse.h"
#include "linbox/solutions/valence.h"
#include "linbox/util/matrix-stream.h"

using namespace LinBox;

int main (int argc, char **argv)
{

	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; }

        PID_integer ZZ;
        MatrixStream< PID_integer > ms( ZZ, input );
        typedef SparseMatrix<PID_integer>  Blackbox;
        Blackbox A (ms);
        
        std::cout << "A is " << A.rowdim() << " by " << A.coldim() << std::endl;
        
        PID_integer::Element val_A;


        if (argc == 3) {
            Transpose<Blackbox> T(&A);
            if (strcmp(argv[2],"-aat")) {
                Compose< Transpose<Blackbox>, Blackbox > C (&T, &A);
                std::cout << "A^T A is " << C.rowdim() << " by " << C.coldim() << std::endl;
                valence(val_A, C);
            } else {
                Compose< Blackbox, Transpose<Blackbox> > C (&A, &T);
{'fraction_non_alphanumeric': 0.18202614379084966, 'fraction_numerical': 0.006535947712418301, 'mean_word_length': 2.6182033096926713, 'pattern_counts': {'":': 0, '<': 83, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2941285', 'n_tokens_mistral': 1131, 'n_tokens_neox': 1080, 'n_words': 257}