My Project
Loading...
Searching...
No Matches
factory
Functions
cf_roots.h File Reference
Go to the source code of this file.
Functions
int
*
FACTORY_PUBLIC
Zp_roots
(
const
CanonicalForm
f
)
Function Documentation
◆
Zp_roots()
int
*
FACTORY_PUBLIC
Zp_roots
(
const
CanonicalForm
f
)
Definition at line
26
of file
cf_roots.cc
.
27
{
28
int
p
=
getCharacteristic
();
29
#if defined(HAVE_FLINT) && (__FLINT_RELEASE >= 20503)
30
nmod_poly_t
FLINT_f
;
31
convertFacCF2nmod_poly_t
(
FLINT_f
,
f
);
32
nmod_poly_factor_t
fac;
33
nmod_poly_factor_init
(fac);
34
nmod_poly_roots
(fac,
FLINT_f
,0);
35
int
*
res
=
NEW_ARRAY
(
int
,1+fac->num);
36
37
int
j
=1;
38
for
(
int
i
=fac->num-1;
i
>=0;
i
--)
39
{
40
// root of (linear) factor: -absolute Term
41
if
(
nmod_poly_length
(fac->p+
i
)==2)
42
{
43
res
[
j
]=
p
-
nmod_poly_get_coeff_ui
(fac->p+
i
,0);
44
j
++;
45
}
46
}
47
res
[0]=
j
-1;
48
// cleanup
49
nmod_poly_clear
(
FLINT_f
);
50
nmod_poly_factor_clear
(fac);
51
return
res
;
52
#elif defined(HAVE_NTL)
53
if
(
fac_NTL_char
!=
p
)
54
{
55
fac_NTL_char
=
p
;
56
zz_p::init (
p
);
57
}
58
zz_pX
NTL_f
=
convertFacCF2NTLzzpX
(
f
);
59
vec_zz_p
roots=
FindRoots
(
NTL_f
);
60
int
*
res
=
NEW_ARRAY
(
int
,1+roots.
length
());
61
res
[0]=roots.
length
();
62
for
(
int
i
=roots.
length
()-1;
i
>=0;
i
--)
63
{
64
res
[
i
+1]=
to_long
(rep(roots[
i
]));
65
}
66
return
res
;
67
#else
68
factoryError
(
"NTL/FLINT missing: Zp_roots"
);
69
return
NULL
;
70
#endif
71
}
convertFacCF2NTLzzpX
zz_pX convertFacCF2NTLzzpX(const CanonicalForm &f)
Definition
NTLconvert.cc:105
fac_NTL_char
VAR long fac_NTL_char
Definition
NTLconvert.cc:46
getCharacteristic
int FACTORY_PUBLIC getCharacteristic()
Definition
cf_char.cc:70
i
int i
Definition
cfEzgcd.cc:132
p
int p
Definition
cfModGcd.cc:4086
NEW_ARRAY
#define NEW_ARRAY(T, N)
Definition
cf_defs.h:64
factoryError
VAR void(* factoryError)(const char *s)
Definition
cf_util.cc:80
f
FILE * f
Definition
checklibs.c:9
List
Definition
ftmpl_list.h:52
List::length
int length() const
Definition
ftmpl_list.cc:273
res
CanonicalForm res
Definition
facAbsFact.cc:60
j
int j
Definition
facHensel.cc:110
convertFacCF2nmod_poly_t
convertFacCF2nmod_poly_t(FLINTmipo, M)
nmod_poly_clear
nmod_poly_clear(FLINTmipo)
NULL
#define NULL
Definition
omList.c:12
Generated on Tue May 21 2024 21:52:47 for My Project by
doxygen 1.9.8
for
Singular