<commit_before>/*
    Copyright (C) 2015 <NAME>

    This file is part of FLINT.

    FLINT is free software: you can redistribute it and/or modify it under
    the terms of the GNU Lesser General Public License (LGPL) as published
    by the Free Software Foundation; either version 2.1 of the License, or
    (at your option) any later version.  See <http://www.gnu.org/licenses/>.
*/

#include "aprcl.h"

void
unity_zpq_mul(unity_zpq f, const unity_zpq g, const unity_zpq h)
{
    ulong i, j, k, p, q;
    fmpz_mod_poly_t temp;

    q = f->q;
    p = f->p;
    fmpz_mod_poly_init(temp, f->n);

    for (i = 0; i < p; i++)
    {
        fmpz_mod_poly_zero(f->polys[i]);
    }

    for (i = 0; i < p; i++)
    {
        for (j = 0; j < p; j++)
        {
            ulong qpow;

            qpow = n_addmod(i, j, p);
            fmpz_mod_poly_mul(temp, g->polys[i], h->polys[j]);

            if (temp->length == 0)
                continue;

            for (k = temp->length - 1; k >= q; k--)
            {
                fmpz_add(temp->coeffs + k - q,
                        temp->coeffs + k - q, temp->coeffs + k);
                fmpz_set_ui(temp->coeffs + k, 0);
                fmpz_mod(temp->coeffs + k - q, temp->coeffs + k - q, f->n);
            }
            _fmpz_mod_poly_normalise(temp);

            fmpz_mod_poly_add(f->polys[qpow], f->polys[qpow], temp);
        }
    }

    fmpz_mod_poly_clear(temp);
}

<commit_msg>ulong -> slong.<commit_after>/*
    Copyright (C) 2015 <NAME>

    This file is part of FLINT.

    FLINT is free software: you can redistribute it and/or modify it under
    the terms of the GNU Lesser General Public License (LGPL) as published
    by the Free Software Foundation; either version 2.1 of the License, or
    (at your option) any later version.  See <http://www.gnu.org/licenses/>.
*/

#include "aprcl.h"

void
unity_zpq_mul(unity_zpq f, const unity_zpq g, const unity_zpq h)
{
    slong i, j, k;
    ulong p, q;
    fmpz_mod_poly_t temp;

    q = f->q;
    p = f->p;
    fmpz_mod_poly_init(temp, f->n);

    for (i = 0; i < p; i++)
    {
        fmpz_mod_poly_zero(f->polys[i]);
    }

    for (i = 0; i < p; i++)
    {
        for (j = 0; j < p; j++)
        {
            ulong qpow;

            qpow = n_addmod(i, j, p);
            fmpz_mod_poly_mul(temp, g->polys[i], h->polys[j]);

            if (temp->length == 0)
                continue;

            for (k = temp->length - 1; k >= q; k--)
            {
                fmpz_add(temp->coeffs + k - q,
                        temp->coeffs + k - q, temp->coeffs + k);
                fmpz_set_ui(temp->coeffs + k, 0);
                fmpz_mod(temp->coeffs + k - q, temp->coeffs + k - q, f->n);
            }
            _fmpz_mod_poly_normalise(temp);

            fmpz_mod_poly_add(f->polys[qpow], f->polys[qpow], temp);
        }
    }

    fmpz_mod_poly_clear(temp);
}


{'fraction_non_alphanumeric': 0.13737024221453287, 'fraction_numerical': 0.008304498269896194, 'mean_word_length': 1.7120075046904315, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 44, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2318663', 'n_tokens_mistral': 1141, 'n_tokens_neox': 1079, 'n_words': 286}