<commit_before>/*=============================================================================

    This file is part of FLINT.

    FLINT is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    FLINT 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 General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with FLINT; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA

=============================================================================*/
/******************************************************************************

    Copyright (C) 2014 <NAME>

******************************************************************************/

/* Rounding modes */
#define FE_TONEAREST 0x0000
#define FE_DOWNWARD 0x0400
#define FE_UPWARD 0x0800
#define FE_TOWARDZERO 0x0c00
#define _ROUND_MASK (FE_TONEAREST | FE_DOWNWARD | \
FE_UPWARD | FE_TOWARDZERO)

#ifndef __GNUC__
#define __asm__ asm
#define __inline__ inline
#endif

static __inline__ int
fegetround(void)
{
    int cw;

    /* Store control word */
    __asm__ volatile ("fnstcw %0":"=m" (cw));

    return (cw & _ROUND_MASK);
}

static __inline__ int
fesetround(int __rounding_direction)
{
    int cw;

    /* Check whether requested rounding direction is supported */
    if (__rounding_direction & ~_ROUND_MASK)
        return -1;

    /* Store control word */
    __asm__ volatile ("fnstcw %0":"=m" (cw));

    /* Set the rounding direction */
    cw &= ~_ROUND_MASK;
    cw |= __rounding_direction;

    /* Load control word */
    __asm__ volatile ("fldcw %0"::"m" (cw));

    return 0;
}

#include "fmpz_lll.h"

int
fmpz_lll_is_reduced_d(const fmpz_mat_t B, const fmpz_lll_t fl)
{
    if (fl->rt == Z_BASIS)
    {
        slong i, j, k, m, n;
        d_mat_t A, Q, R, V, Wu, Wd, bound, bound2, bound3, boundt, mm, rm, mn,
            rn, absR;
        double *du, *dd;
        double s, norm = 0, ti, tj;
        int rounding_direction = fegetround();

        if (B->r == 0 || B->r == 1)
            return 1;

        m = B->c;
        n = B->r;

        d_mat_init(A, m, n);
        d_mat_init(Q, m, n);
        d_mat_init(R, n, n);
        d_mat_init(V, n, n);
        d_mat_zero(R);
        d_mat_zero(V);
<commit_msg>or do include it<commit_after>/*=============================================================================

    This file is part of FLINT.

    FLINT is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    FLINT 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 General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with FLINT; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA

=============================================================================*/
/******************************************************************************

    Copyright (C) 2014 <NAME>

******************************************************************************/

#include <fenv.h>
#include "fmpz_lll.h"

int
fmpz_lll_is_reduced_d(const fmpz_mat_t B, const fmpz_lll_t fl)
{
    if (fl->rt == Z_BASIS)
    {
        slong i, j, k, m, n;
        d_mat_t A, Q, R, V, Wu, Wd, bound, bound2, bound3, boundt, mm, rm, mn,
            rn, absR;
        double *du, *dd;
        double s, norm = 0, ti, tj;
        int rounding_direction = fegetround();

        if (B->r == 0 || B->r == 1)
            return 1;

        m = B->c;
        n = B->r;

        d_mat_init(A, m, n);
        d_mat_init(Q, m, n);
        d_mat_init(R, n, n);
        d_mat_init(V, n, n);
        d_mat_zero(R);
        d_mat_zero(V);

{'fraction_non_alphanumeric': 0.22366030881017257, 'fraction_numerical': 0.015440508628519528, 'mean_word_length': 3.082483781278962, 'pattern_counts': {'":': 3, '<': 6, '<?xml version=': 0, '>': 16, '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': '1169046', 'n_tokens_mistral': 1423, 'n_tokens_neox': 1314, 'n_words': 480}