My Project
Loading...
Searching...
No Matches
witness.cc
Go to the documentation of this file.
2#include "Singular/lists.h"
5#include "tropicalDebug.h"
6#include "initial.h"
7#include "tropicalStrategy.h"
8
9matrix divisionDiscardingRemainder(const poly f, const ideal G, const ring r)
10{
11 ring origin = currRing;
12 if (origin != r) rChangeCurrRing(r);
13 ideal F = idInit(1); F->m[0]=f;
14 ideal m = idLift(G,F);
15 F->m[0]=NULL; id_Delete(&F, currRing);
17 if (origin != r) rChangeCurrRing(origin);
18 return Q;
19}
20
21matrix divisionDiscardingRemainder(const ideal F, const ideal G, const ring r)
22{
23 ring origin = currRing;
24 if (origin != r) rChangeCurrRing(r);
25 ideal R; matrix U;
26 ideal m = idLift(G,F,&R,FALSE,FALSE,TRUE,&U);
28 id_Delete(&R,r);
29 mp_Delete(&U,r);
30 if (origin != r) rChangeCurrRing(origin);
31 return Q;
32}
33
34poly witness(const poly m, const ideal I, const ideal inI, const ring r)
35{
36 assume(IDELEMS(I)==IDELEMS(inI));
38
39 int k = IDELEMS(I);
40 poly f = p_Mult_q(p_Copy(I->m[0],r),Q->m[0],r);
41 Q->m[0] = NULL;
42 for (int i=1; i<k; i++)
43 {
44 f = p_Add_q(f,p_Mult_q(p_Copy(I->m[i],r),Q->m[i],r),r);
45 Q->m[i] = NULL;
46 }
47 mp_Delete(&Q,r);
48
49 return f;
50}
51
52ideal witness(const ideal inI, const ideal J, const ring r)
53{
54 ring origin = currRing;
55 if (origin!=r)
57 ideal NFinI = kNF(J,r->qideal,inI);
58 if (origin!=r)
59 rChangeCurrRing(origin);
60
61 int k = IDELEMS(inI);
62 ideal I = idInit(k);
63 for (int i=0; i<k; i++)
64 {
65 I->m[i] = p_Add_q(p_Copy(inI->m[i],r),p_Neg(NFinI->m[i],r),r);
66 NFinI->m[i] = NULL;
67 }
68
69 assume(areIdealsEqual(I,r,J,r));
70
71 return I;
72}
#define TRUE
Definition: auxiliary.h:100
#define FALSE
Definition: auxiliary.h:96
int m
Definition: cfEzgcd.cc:128
int i
Definition: cfEzgcd.cc:132
int k
Definition: cfEzgcd.cc:99
FILE * f
Definition: checklibs.c:9
ideal idLift(ideal mod, ideal submod, ideal *rest, BOOLEAN goodShape, BOOLEAN isSB, BOOLEAN divide, matrix *unit, GbVariant alg)
represents the generators of submod in terms of the generators of mod (Matrix(SM)*U-Matrix(rest)) = M...
Definition: ideals.cc:1105
STATIC_VAR TreeM * G
Definition: janet.cc:31
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:3182
void mp_Delete(matrix *a, const ring r)
Definition: matpol.cc:873
#define assume(x)
Definition: mod2.h:389
#define NULL
Definition: omList.c:12
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1105
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:934
static poly p_Mult_q(poly p, poly q, const ring r)
Definition: p_polys.h:1112
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:844
void rChangeCurrRing(ring r)
Definition: polys.cc:15
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
matrix id_Module2formatedMatrix(ideal mod, int rows, int cols, const ring R)
#define IDELEMS(i)
Definition: simpleideals.h:23
#define R
Definition: sirandom.c:27
#define Q
Definition: sirandom.c:26
bool areIdealsEqual(ideal I, ring r, ideal J, ring s)
implementation of the class tropicalStrategy
matrix divisionDiscardingRemainder(const poly f, const ideal G, const ring r)
Computes a division discarding remainder of f with respect to G.
Definition: witness.cc:9
poly witness(const poly m, const ideal I, const ideal inI, const ring r)
Let w be the uppermost weight vector in the matrix defining the ordering on r.
Definition: witness.cc:34