File: concat.c

package info (click to toggle)
flint 2.9.0-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 46,744 kB
  • sloc: ansic: 557,455; cpp: 11,280; sh: 762; makefile: 272; python: 63
file content (32 lines) | stat: -rw-r--r-- 887 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
    Copyright (C) 2008, 2009 William Hart
    Copyright (C) 2010 Fredrik Johansson

    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 <https://www.gnu.org/licenses/>.
*/

#include <gmp.h>
#include "flint.h"
#include "fmpz.h"
#include "fmpz_vec.h"

void
_fmpz_factor_concat(fmpz_factor_t factor1, fmpz_factor_t factor2, ulong exp)
{
    slong i;

    _fmpz_factor_fit_length(factor1, factor1->num + factor2->num);
    
    for (i = 0; i < factor2->num; i++)
    {
       fmpz_set(factor1->p + factor1->num + i, factor2->p + i);
       factor1->exp[factor1->num + i] = factor2->exp[i]*exp;
    }

    factor1->num += factor2->num;
}