/usr/include/flint/fmpz_mod_poly_factorxx.h is in libflint-dev 2.5.2-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | /*=============================================================================
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) 2013 Tom Bachmann
******************************************************************************/
#ifndef FMPZ_MOD_POLY_FACTORXX_H
#define FMPZ_MOD_POLY_FACTORXX_H
#include "fmpz_mod_poly.h"
namespace flint {
class fmpz_mod_poly_factorxx
{
private:
fmpz_mod_poly_factor_t inner;
public:
fmpz_mod_poly_factorxx() {fmpz_mod_poly_factor_init(inner);}
~fmpz_mod_poly_factorxx() {fmpz_mod_poly_factor_clear(inner);}
fmpz_mod_poly_factorxx(const fmpz_mod_poly_factorxx& o)
{
fmpz_mod_poly_factor_init(inner);
fmpz_mod_poly_factor_set(inner, o.inner);
}
bool operator==(const fmpz_mod_poly_factorxx& o)
{
if(o.size() != size())
return false;
for(slong i = 0;i < size();++i)
if(p(i) != o.p(i) || exp(i) != o.exp(i))
return false;
return true;
}
fmpz_mod_poly_factorxx& operator=(const fmpz_mod_poly_factorxx& o)
{
fmpz_mod_poly_factor_set(inner, o.inner);
return *this;
}
slong size() const {return inner->num;}
slong exp(slong i) const {return inner->exp[i];}
slong& exp(slong i) {return inner->exp[i];}
fmpz_mod_polyxx_srcref p(slong i) const
{return fmpz_mod_polyxx_srcref::make(inner->poly + i);}
fmpz_mod_polyxx_ref p(slong i) {return fmpz_mod_polyxx_ref::make(inner->poly + i);}
fmpz_mod_poly_factor_t& _data() {return inner;}
const fmpz_mod_poly_factor_t& _data() const {return inner;}
void realloc(slong a) {fmpz_mod_poly_factor_realloc(inner, a);}
void fit_length(slong a) {fmpz_mod_poly_factor_fit_length(inner, a);}
void print() const {fmpz_mod_poly_factor_print(inner);}
template<class Fmpz_mod_poly>
void insert(const Fmpz_mod_poly& p, slong e,
typename mp::enable_if<traits::is_fmpz_mod_polyxx<Fmpz_mod_poly> >::type* = 0)
{fmpz_mod_poly_factor_insert(_data(), p.evaluate()._poly(), e);}
void concat(const fmpz_mod_poly_factorxx& o)
{fmpz_mod_poly_factor_concat(_data(), o._data());}
void pow(slong exp) {fmpz_mod_poly_factor_pow(_data(), exp);}
#define FMPZ_MOD_POLY_FACTORXX_DEFINE_SET_FACTOR(name) \
template<class Fmpz_mod_poly> \
void set_##name(const Fmpz_mod_poly& p, \
typename mp::enable_if<traits::is_fmpz_mod_polyxx<Fmpz_mod_poly> >::type* = 0) \
{fmpz_mod_poly_##name(_data(), p.evaluate()._poly());}
FMPZ_MOD_POLY_FACTORXX_DEFINE_SET_FACTOR(factor)
FMPZ_MOD_POLY_FACTORXX_DEFINE_SET_FACTOR(factor_squarefree)
FMPZ_MOD_POLY_FACTORXX_DEFINE_SET_FACTOR(factor_cantor_zassenhaus)
FMPZ_MOD_POLY_FACTORXX_DEFINE_SET_FACTOR(factor_berlekamp)
FMPZ_MOD_POLY_FACTORXX_DEFINE_SET_FACTOR(factor_kaltofen_shoup)
template<class Fmpz_mod_poly>
bool set_factor_equal_deg_probab(frandxx& state, const Fmpz_mod_poly& p, slong d,
typename mp::enable_if<traits::is_fmpz_mod_polyxx<Fmpz_mod_poly> >::type* = 0)
{
return fmpz_mod_poly_factor_equal_deg_prob(_data(), state._data(),
p.evaluate()._poly(), d);
}
template<class Fmpz_mod_poly>
void set_factor_equal_deg(const Fmpz_mod_poly& p, slong d,
typename mp::enable_if<traits::is_fmpz_mod_polyxx<Fmpz_mod_poly> >::type* = 0)
{
fmpz_mod_poly_factor_equal_deg(_data(), p.evaluate()._poly(), d);
}
template<class Fmpz_mod_poly>
void set_factor_distinct_deg(const Fmpz_mod_poly& p, std::vector<slong>& degs,
typename mp::enable_if<traits::is_fmpz_mod_polyxx<Fmpz_mod_poly> >::type* = 0)
{
slong* dgs = °s.front();
fmpz_mod_poly_factor_distinct_deg(_data(), p.evaluate()._poly(), &dgs);
}
};
#define FMPZ_MOD_POLY_FACTORXX_DEFINE_FACTOR(name) \
template<class Fmpz_mod_poly> \
fmpz_mod_poly_factorxx name(const Fmpz_mod_poly& p, \
typename mp::enable_if<traits::is_fmpz_mod_polyxx<Fmpz_mod_poly> >::type* = 0) \
{ \
fmpz_mod_poly_factorxx res; \
res.set_##name(p); \
return res; \
}
FMPZ_MOD_POLY_FACTORXX_DEFINE_FACTOR(factor)
FMPZ_MOD_POLY_FACTORXX_DEFINE_FACTOR(factor_squarefree)
FMPZ_MOD_POLY_FACTORXX_DEFINE_FACTOR(factor_cantor_zassenhaus)
FMPZ_MOD_POLY_FACTORXX_DEFINE_FACTOR(factor_berlekamp)
FMPZ_MOD_POLY_FACTORXX_DEFINE_FACTOR(factor_kaltofen_shoup)
// TODO do we want global versions of factor_distinct_deg etc?
inline void print(const fmpz_mod_poly_factorxx& f)
{
f.print();
}
} // flint
#endif
|