#include <math.h>
#include <givaro/givinteger.h>
#include <givaro/givintnumtheo.h>
#include <givaro/givpower.h>
#include <givaro/givpoly1padic.h>
Namespaces |
namespace | Givaro |
| Namespace in which the whole Givaro library resides.
|
Macros |
#define | _GIVARO_GFQ_ADD(c, a, b, mun, plun) |
#define | _GIVARO_GFQ_NEG(res, a, mo, mun) |
#define | _GIVARO_GFQ_SUB(c, a, b, mo, mun, plun) |
#define | _GIVARO_GFQ_AUTOSUB(c, b, mo, mun, plun) |
#define | _GIVARO_GFQ_MUL(res, a, b, mun) { if ( ((a)==0) || ((b)==0) ) { (res) =0; } else { (res) = (((res) = (a)+(b) )>(TT)(mun))?(res)-(TT)(mun):(res); } } |
#define | _GIVARO_GFQ_INV(res, a, mun) { (res) = (Rep)( (Rep)(mun)-(a) ); (res)= (Rep) ( (res)?(res):(Rep)(mun) ); } |
#define | _GIVARO_GFQ_DIV(res, a, b, mun) |
#define | _GIVARO_GFQ_SQ(res, a, mun) |
#define | _GIVARO_GFQ_SQADD(c, a, b, mun, plun) |
#define | _GIVARO_GFQ_MULADD(c, a1, a2, b, mun, plun) |
#define | _GIVARO_GFQ_MULSUB(c, a1, a2, b, mo, mun, plun) |
Macro Definition Documentation
#define _GIVARO_GFQ_ADD |
( |
|
c, |
|
|
|
a, |
|
|
|
b, |
|
|
|
mun, |
|
|
|
plun |
|
) |
| |
Value:{ if ((b)==0) (c)=(a); else if ((a)==0) (c)=(b); else { \
(c) = (a)-(b); \
(c) = ((c)>0)?(c):(c)+ (TT)(mun); \
(c) = (plun)[(UT)(c)]; \
if (c) { \
(c) = (c)+(b); \
(c) = ((c)>0)?(c):(c)+(TT)(mun); \
} } }
#define _GIVARO_GFQ_NEG |
( |
|
res, |
|
|
|
a, |
|
|
|
mo, |
|
|
|
mun |
|
) |
| |
Value:{ if ( (a)==0 ) (res)=0; else\
{ (res) = (Rep) ( (a) - (Rep) (mo) ) ; (res) = (Rep) ( ((res)>0)?(res):(res)+(Rep)(mun) ) ; } }
#define _GIVARO_GFQ_SUB |
( |
|
c, |
|
|
|
a, |
|
|
|
b, |
|
|
|
mo, |
|
|
|
mun, |
|
|
|
plun |
|
) |
| |
Value:{
if ((a)==0) {
_GIVARO_GFQ_NEG(c,b,mo,mun);}
else if ((b)==0) (c)=(a);
else { \
(c) = (b)-(a)-(TT)(mo); \
(c) = ((c)>0)?(c):(c)+(TT)(mun); \
(c) = ((c)>0)?(c):(c)+ (TT)(mun); \
(c) = (plun)[(UT)(c)]; \
if (c) { \
(c) = (c)+(a); \
(c) = ((c)>0)?(c):(c)+(TT)(mun); \
} } }
#define _GIVARO_GFQ_AUTOSUB |
( |
|
c, |
|
|
|
b, |
|
|
|
mo, |
|
|
|
mun, |
|
|
|
plun |
|
) |
| |
Value:
(c) = (c)-(b)-(TT)(mo); \
(c) = ((c)>0)?(c):(c)+(TT)(mun); \
(c) = ((c)>0)?(c):(c)+ (TT)(mun); \
(c) = (plun)[(UT)(c)]; \
if (c) { \
(c) = (c)+(b); \
(c) = ((c)>0)?(c)-(TT)(mo):(c)+(TT)(mo); \
(c) = ((c)>0)?(c):(c)+(TT)(mun); \
} } }
#define _GIVARO_GFQ_MUL |
( |
|
res, |
|
|
|
a, |
|
|
|
b, |
|
|
|
mun |
|
) |
| { if ( ((a)==0) || ((b)==0) ) { (res) =0; } else { (res) = (((res) = (a)+(b) )>(TT)(mun))?(res)-(TT)(mun):(res); } } |
#define _GIVARO_GFQ_INV |
( |
|
res, |
|
|
|
a, |
|
|
|
mun |
|
) |
| { (res) = (Rep)( (Rep)(mun)-(a) ); (res)= (Rep) ( (res)?(res):(Rep)(mun) ); } |
#define _GIVARO_GFQ_DIV |
( |
|
res, |
|
|
|
a, |
|
|
|
b, |
|
|
|
mun |
|
) |
| |
Value:{ \
if ( (a)==0 ) { (res)=0; } else { (res) = (((res)=(a)-(b))>0)?(res):(res)+(TT)(mun); } }
#define _GIVARO_GFQ_SQ |
( |
|
res, |
|
|
|
a, |
|
|
|
mun |
|
) |
| |
Value:{ if ( (a)==0) (res) = 0; else \
{ (res) = ( (a) << 1) - (mun); \
(res) = ((res)>0)?(res):(res)+ (mun); } }
#define _GIVARO_GFQ_SQADD |
( |
|
c, |
|
|
|
a, |
|
|
|
b, |
|
|
|
mun, |
|
|
|
plun |
|
) |
| |
Value:{ \
if ((a)==0) { (c)=(b); \
} else if ((b)==0) { \
(c) = (( (c)=((a) << 1) - (mun) )>0)?(c):(c) + (mun); \
} else { \
(c) = (( (c) = ((a) << 1)-(b)-(mun) )<0)?(c)+(mun):(c); \
if ( (c) = (plun)[(UT)(((c)>0)?(c):(c)+(mun))] ) { \
(c) = (( (c) = (c)+(b) )>0)?(c):(c)+(mun); } \
}\
}
#define _GIVARO_GFQ_MULADD |
( |
|
c, |
|
|
|
a1, |
|
|
|
a2, |
|
|
|
b, |
|
|
|
mun, |
|
|
|
plun |
|
) |
| |
Value:{ \
if (((a1)==0) || ((a2)==0)) { (c)=(b); \
} else if ((b)==0) { \
(c) = (( (c)=(a1)+(a2) - (TT)(mun) )>0)?(c):(c) + (TT)(mun); \
} else { \
(c) = (( (c) = (a1)+(a2)-(b)-(TT)(mun) )<0)?(c)+(TT)(mun):(c); \
if (( (c) = (plun)[(UT)( ((c)>0)?(c):(c)+(TT)(mun) )]) ) { \
(c) = (( (c) = (c)+(b) )>0)?(c):(c)+(TT)(mun); }\
}\
}
#define _GIVARO_GFQ_MULSUB |
( |
|
c, |
|
|
|
a1, |
|
|
|
a2, |
|
|
|
b, |
|
|
|
mo, |
|
|
|
mun, |
|
|
|
plun |
|
) |
| |
Value:{ \
if (((a1)==0) || ((a2)==0)) { (c)=(b); \
} else if ((b)==0) { \
(c) = (( (c)=(a1)+(a2) - (mo) -(mun) )>0)?(c):(c) + (mun); \
(c) = (c)>0?(c):(c) + (mun); \
} else { \
(c) = (( (c) = (a1)+(a2)-(b)-(mun) - (mo) )<0)?(c)+(mun):(c); \
(c) = (c)<0?(c)+(mun):(c); \
if ( (c) = (plun)[(UT)( ((c)>0)?(c):(c)+(mun) )] ) { \
(c) = (( (c) = (c)+(b) )>0)?(c):(c)+(mun); }\
}\
}