#include <cmath>
#include <givaro/givinteger.h>
#include <givaro/givintnumtheo.h>
#include <givaro/givpower.h>
#include <givaro/givpoly1padic.h>
|
#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) |
|
◆ _GIVARO_GFQ_ADD
#define _GIVARO_GFQ_ADD |
( |
|
c, |
|
|
|
a, |
|
|
|
b, |
|
|
|
mun, |
|
|
|
plun |
|
) |
| |
Value: {
if ((
b)==0) (
c)=(
a);
else if ((
a)==0) (
c)=(
b);
else { \
(
c) = ((
c)>0)?(
c):(
c)+ (TT)(mun); \
(
c) = ((
c)>0)?(
c):(
c)+(TT)(mun); \
} } }
MG & a
Definition: rmadd.h:143
MG const rmint< K, MG > const T & c
Definition: rmadd.h:143
MG const rmint< K, MG > & b
Definition: rmadd.h:143
◆ _GIVARO_GFQ_NEG
#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) ) ; } }
◆ _GIVARO_GFQ_SUB
#define _GIVARO_GFQ_SUB |
( |
|
c, |
|
|
|
a, |
|
|
|
b, |
|
|
|
mo, |
|
|
|
mun, |
|
|
|
plun |
|
) |
| |
Value:
(
c) = (
b)-(
a)-(TT)(mo); \
(
c) = ((
c)>0)?(
c):(
c)+(TT)(mun); \
(
c) = ((
c)>0)?(
c):(
c)+ (TT)(mun); \
(
c) = ((
c)>0)?(
c):(
c)+(TT)(mun); \
} } }
#define _GIVARO_GFQ_NEG(res, a, mo, mun)
Definition: gfq.inl:38
◆ _GIVARO_GFQ_AUTOSUB
#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) = ((
c)>0)?(
c)-(TT)(mo):(
c)+(TT)(mo); \
(
c) = ((
c)>0)?(
c):(
c)+(TT)(mun); \
} } }
◆ _GIVARO_GFQ_MUL
#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); } } |
◆ _GIVARO_GFQ_INV
#define _GIVARO_GFQ_INV |
( |
|
res, |
|
|
|
a, |
|
|
|
mun |
|
) |
| { (res) = (Rep)( (Rep)(mun)-(a) ); (res)= (Rep) ( (res)?(res):(Rep)(mun) ); } |
◆ _GIVARO_GFQ_DIV
#define _GIVARO_GFQ_DIV |
( |
|
res, |
|
|
|
a, |
|
|
|
b, |
|
|
|
mun |
|
) |
| |
Value: { \
if ( (
a)==0 ) { (res)=0; }
else { (res) = (((res)=(
a)-(
b))>0)?(res):(res)+(TT)(mun); } }
◆ _GIVARO_GFQ_SQ
#define _GIVARO_GFQ_SQ |
( |
|
res, |
|
|
|
a, |
|
|
|
mun |
|
) |
| |
Value: {
if ( (
a)==0) (res) = 0;
else \
{ (res) = ( (
a) << 1) - (mun); \
(res) = ((res)>0)?(res):(res)+ (mun); } }
◆ _GIVARO_GFQ_SQADD
#define _GIVARO_GFQ_SQADD |
( |
|
c, |
|
|
|
a, |
|
|
|
b, |
|
|
|
mun, |
|
|
|
plun |
|
) |
| |
Value: { \
(
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); } \
}\
}
◆ _GIVARO_GFQ_MULADD
#define _GIVARO_GFQ_MULADD |
( |
|
c, |
|
|
|
a1, |
|
|
|
a2, |
|
|
|
b, |
|
|
|
mun, |
|
|
|
plun |
|
) |
| |
Value: { \
if (((a1)==0) || ((a2)==0)) { (
c)=(
b); \
(
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); }\
}\
}
◆ _GIVARO_GFQ_MULSUB
#define _GIVARO_GFQ_MULSUB |
( |
|
c, |
|
|
|
a1, |
|
|
|
a2, |
|
|
|
b, |
|
|
|
mo, |
|
|
|
mun, |
|
|
|
plun |
|
) |
| |
Value: { \
if (((a1)==0) || ((a2)==0)) { (
c)=(
b); \
(
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); }\
}\
}