/
MAPIDIF.c,v
64 lines (50 loc) · 1.12 KB
/
MAPIDIF.c,v
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
head 1.1;
access;
symbols;
locks
saclib:1.1; strict;
comment @ * @;
1.1
date 95.08.16.22.34.37; author Mark; state new;
branches;
next ;
desc
@Modular array polynomial in-place difference.
@
1.1
log
@Initial revision
@
text
@/*===========================================================================
MAPIDIF(m,A,B)
Modular array polynomial in-place difference.
Inputs
m : a positive BETA-digit.
A,B : in Z/(m)[x], A and B are in array representation. The
array A should be at least as large as the array B.
Side effects
A - B is computed and put in A.
===========================================================================*/
#include "saclib.h"
void MAPIDIF(m,A,B)
Word m,*A,*B;
{
Word d,e,i;
Step1: /* Initialize. */
d = MAPDEG(A);
e = MAPDEG(B);
for (i = d + 1; i <= e; i++)
MAPCF(A,i) = 0;
Step2: /* Compute. */
for (i = 0; i <= e; i++)
MAPCF(A,i) = MDDIF(m,MAPCF(A,i),MAPCF(B,i));
Step3: /* Determine degree. */
i = maxm(d,e);
while (MAPCF(A,i) == 0 && i > 0)
i--;
MAPDEG(A) = i;
Return: /* Prepare for return. */
return;
}
@