source: git/Singular/modulop.h @ 63be42

spielwiese
Last change on this file since 63be42 was 6ae4f5, checked in by Hans Schönemann <hannes@…>, 27 years ago
* hannes: - corrected scanner.l: parsing of strings in blocks: if (1) { write("","}"); } - corrected ipassign.cc: assignment of "dummy" types: DEF, NONE - corrected sleftv::Print(_), initialisation of _ - added conversion int->def - added CopyD(DEF) - in insert(..): object should not be of type NONE (lists.cc:lInsert0) - added int*intvec, int*intmat to iparith.cc git-svn-id: file:///usr/local/Singular/svn/trunk@145 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 1.9 KB
Line 
1#ifndef MODULOP_H
2#define MODULOP_H
3/****************************************
4*  Computer Algebra System SINGULAR     *
5****************************************/
6/* $Id: modulop.h,v 1.3 1997-04-09 12:20:01 Singular Exp $ */
7/*
8* ABSTRACT: numbers modulo p (<=32003)
9*/
10#include "structs.h"
11
12extern int npPrimeM;
13extern int npGen;
14extern int npMapPrime;
15
16BOOLEAN npGreaterZero (number k);
17number  npMult        (number a, number b);
18number  npInit        (int i);
19int     npInt         (number &n);
20number  npCopy        (number k1);
21number  npAdd         (number a, number b);
22number  npSub         (number a, number b);
23void    npPower       (number a, int i, number * result);
24BOOLEAN npIsZero      (number a);
25BOOLEAN npIsOne       (number a);
26BOOLEAN npIsMOne       (number a);
27number  npDiv         (number a, number b);
28number  npNeg         (number c);
29number  npInvers      (number c);
30BOOLEAN npGreater     (number a, number b);
31BOOLEAN npEqual       (number a, number b);
32void    npWrite       (number &a);
33char *  npRead        (char *s, number *a);
34number  npIntMod      (number a, number b);
35#ifdef LDEBUG
36BOOLEAN npDBTest      (number a, char *f, int l);
37#endif
38void    npSetChar(int c);
39//int     npGetChar();
40
41BOOLEAN npSetMap(int c, char ** par, int nop, number minpol);
42number  npMapP(number from);
43/*-------specials for spolys, do NOT use otherwise--------------------------*/
44/* for npMultM, npSubM, npNegM, npEqualM : */
45extern int npPminus1M;
46extern CARDINAL *npExpTable;
47extern CARDINAL *npLogTable;
48
49inline number npMultM(number a, number b)
50{
51  int x = npLogTable[(int)a]+npLogTable[(int)b];
52  return (number)npExpTable[x<npPminus1M ? x : x-npPminus1M];
53}
54/*
55*inline number npMultM(number a, number b)
56*{
57*  return (number)(((int)a*(int)b) % npPrimeM);
58*}
59*/
60#define npSubM(a,b)    (number)((int)a<(int)b ?\
61                       npPrimeM-(int)b+(int)a : (int)a-(int)b)
62#define npNegM(A)      (number)(npPrimeM-(int)(A))
63#define npEqualM(A,B)  ((int)A==(int)B)
64
65#endif
66
Note: See TracBrowser for help on using the repository browser.