Loading...
Searching...
No Matches
simpleideals.h
Go to the documentation of this file.
#ifndef SIMPLEIDEALS_H
#define SIMPLEIDEALS_H
/****************************************
* Computer Algebra System SINGULAR *
****************************************/
/*
* ABSTRACT - all basic methods to manipulate ideals
*/
#include "polys/monomials/ring.h"
#include "polys/matpol.h"
/// The following sip_sideal structure has many different uses
/// throughout Singular. Basic use-cases for it are:
/// * ideal/module: nrows = 1, ncols >=0 and rank:1 for ideals, rank>=0 for modules
/// * matrix: nrows, ncols >=0, rank == nrows! see mp_* procedures
/// NOTE: the m member point to memory chunk of size (ncols*nrows*sizeof(poly)) or is NULL
struct sip_sideal
{
poly* m;
long rank;
int nrows;
int ncols;
#define IDELEMS(i) ((i)->ncols)
};
/* the settings of rank, nrows, ncols, m , entries:
* for IDEAL_CMD: 1 1 n size n poly (n>=0)
* for MODUL_CMD: r 1 n size n vector of rank<=r (n>=0, r>=0)
* for MATRIX_CMD r r c size r*c poly (r>=0, c>=0)
* for MAP_CMD: char* 1 n size n poly (n>=0)
*/
struct sip_smap
{
poly *m;
char *preimage;
int nrows;
int ncols;
};
//typedef struct sip_smap * map;
struct sideal_list;
typedef struct sideal_list * ideal_list;
struct sideal_list
{
ideal_list next;
ideal d;
#ifdef KDEBUG
int nr;
#endif
};
EXTERN_VAR omBin sip_sideal_bin;
/// creates an ideal / module
ideal idInit (int size, int rank=1);
#define id_Init(s,r,R) idInit(s,r)
/*- deletes an ideal -*/
void id_Delete (ideal* h, ring r);
void id_Delete0 (ideal* h, ring r);
void id_ShallowDelete (ideal* h, ring r);
void idSkipZeroes (ideal ide);
int idSkipZeroes0 (ideal ide);
/*gives an ideal the minimal possible size*/
/// number of non-zero polys in F
static inline int idElem(const ideal F)
{
int i=0;
for(int j=IDELEMS(F)-1;j>=0;j--)
{
if ((F->m)[j]!=NULL) i++;
}
return i;
}
#define id_Elem(F,R) idElem(F)
/// normialize all polys in id
void id_Normalize(ideal id, const ring r);
int id_MinDegW(ideal M,intvec *w, const ring r);
#ifdef PDEBUG
void id_DBTest(ideal h1, int level, const char *f,const int l, const ring lR, const ring tR );
void id_DBLmTest(ideal h1, int level, const char *f,const int l, const ring r);
#define id_Test(A, lR) id_DBTest(A, PDEBUG, __FILE__,__LINE__, lR, lR)
#define id_LmTest(A, lR) id_DBLmTest(A, PDEBUG, __FILE__,__LINE__, lR)
#else
#define id_Test(A, lR) do {} while (0)
#define id_LmTest(A, lR) do {} while (0)
#endif
ideal id_Copy (ideal h1,const ring r);
/*adds two ideals without simplifying the result*/
ideal id_SimpleAdd (ideal h1,ideal h2, const ring r);
/*adds the quotient ideal*/
ideal id_Add (ideal h1,ideal h2,const ring r);
/* h1 + h2 */
ideal id_Power(ideal given,int exp, const ring r);
BOOLEAN idIs0 (ideal h);
BOOLEAN idIsMonomial (ideal h);
BOOLEAN id_IsModule(ideal A, const ring src);
long id_RankFreeModule(ideal m, ring lmRing, ring tailRing);
static inline long id_RankFreeModule(ideal m, ring r)
{return id_RankFreeModule(m, r, r);}
ideal id_FreeModule (int i, const ring r);
int idElem(const ideal F);
int id_PosConstant(ideal id, const ring r);
ideal id_Head(ideal h,const ring r);
ideal id_MaxIdeal (const ring r);
ideal id_MaxIdeal(int deg, const ring r);
ideal id_CopyFirstK (const ideal ide, const int k,const ring r);
void id_DelMultiples(ideal id, const ring r);
void id_Norm(ideal id, const ring r);
void id_DelEquals(ideal id, const ring r);
void id_DelLmEquals(ideal id, const ring r);
void id_DelDiv(ideal id, const ring r);
BOOLEAN id_IsConstant(ideal id, const ring r);
/// sorts the ideal w.r.t. the actual ringordering
/// uses lex-ordering when nolex = FALSE
intvec *id_Sort(const ideal id, const BOOLEAN nolex, const ring r);
/// transpose a module
ideal id_Transp(ideal a, const ring rRing);
void id_Compactify(ideal id, const ring r);
ideal id_Mult (ideal h1,ideal h2, const ring r);
ideal id_Homogen(ideal h, int varnum,const ring r);
ideal id_HomogenDP(ideal h, int varnum,const ring r);
BOOLEAN id_HomIdeal (ideal id, ideal Q, const ring r);
BOOLEAN id_HomIdealDP (ideal id, ideal Q, const ring r);
BOOLEAN id_HomIdealW (ideal id, ideal Q, const intvec *w, const ring r);
BOOLEAN id_HomModuleW (ideal id, ideal Q, const intvec *w, const intvec *module_w, const ring r);
BOOLEAN id_HomModule(ideal m, ideal Q, intvec **w, const ring R);
BOOLEAN id_IsZeroDim(ideal I, const ring r);
ideal id_Jet(const ideal i,int d, const ring R);
ideal id_Jet0(const ideal i, const ring R);/*id_Jet(i,0,R)*/
ideal id_JetW(const ideal i,int d, intvec * iv, const ring R);
ideal id_Subst(ideal id, int n, poly e, const ring r);
matrix id_Module2Matrix(ideal mod, const ring R);
matrix id_Module2formatedMatrix(ideal mod,int rows, int cols, const ring R);
ideal id_ResizeModule(ideal mod,int rows, int cols, const ring R);
ideal id_Matrix2Module(matrix mat, const ring R);
ideal id_Vec2Ideal(poly vec, const ring R);
int binom (int n,int r);
/*- verschiebt die Indizes der Modulerzeugenden um i -*/
void idInitChoise (int r,int beg,int end,BOOLEAN *endch,int * choise);
void idGetNextChoise (int r,int end,BOOLEAN *endch,int * choise);
int idGetNumberOfChoise(int t, int d, int begin, int end, int * choise);
#ifdef PDEBUG
void idShow(const ideal id, const ring lmRing, const ring tailRing, const int debugPrint = 0);
#define id_Print(id, lR, tR) idShow(id, lR, tR)
#else
#define id_Print(A, lR, tR) do {} while (0)
#endif
/// insert h2 into h1 depending on the two boolean parameters:
/// - if zeroOk is true, then h2 will also be inserted when it is zero
/// - if duplicateOk is true, then h2 will also be inserted when it is
/// already present in h1
/// return TRUE iff h2 was indeed inserted
BOOLEAN id_InsertPolyWithTests (ideal h1, const int validEntries,
const poly h2, const bool zeroOk,
const bool duplicateOk, const ring r);
intvec * id_QHomWeight(ideal id, const ring r);
ideal id_ChineseRemainder(ideal *xx, number *q, int rl, const ring r);
void id_Shift(ideal M, int s, const ring r);
ideal id_Delete_Pos(const ideal I, const int pos, const ring r);
/// for julia: convert an array of poly to vector
poly id_Array2Vector(poly *m, unsigned n, const ring R);
/// mapping ideals/matrices to other rings
ideal id_PermIdeal(ideal I,int R, int C,const int *perm, const ring src,
const ring dst, nMapFunc nMap, const int *par_perm, int P, BOOLEAN use_mult);
#endif
BOOLEAN
int BOOLEAN
Definition auxiliary.h:88
size
int size(const CanonicalForm &f, const Variable &v)
int size ( const CanonicalForm & f, const Variable & v )
Definition cf_ops.cc:600
mod
CF_NO_INLINE FACTORY_PUBLIC CanonicalForm mod(const CanonicalForm &, const CanonicalForm &)
level
int level(const CanonicalForm &f)
Definition canonicalform.h:331
l
int l
Definition cfEzgcd.cc:100
m
int m
Definition cfEzgcd.cc:128
i
int i
Definition cfEzgcd.cc:132
k
int k
Definition cfEzgcd.cc:99
f
FILE * f
Definition checklibs.c:9
intvec
Definition intvec.h:24
nMapFunc
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition coeffs.h:80
s
const CanonicalForm int s
Definition facAbsFact.cc:51
w
const CanonicalForm & w
Definition facAbsFact.cc:51
vec
fq_nmod_poly_t * vec
Definition facHensel.cc:108
j
int j
Definition facHensel.cc:110
EXTERN_VAR
#define EXTERN_VAR
Definition globaldefs.h:6
h
STATIC_VAR Poly * h
Definition janet.cc:971
matpol.h
matrix
ip_smatrix * matrix
Definition matpol.h:43
exp
gmp_float exp(const gmp_float &a)
Definition mpr_complex.cc:349
NULL
#define NULL
Definition omList.c:12
omBin
omBin_t * omBin
Definition omStructs.h:12
ring.h
sip_sideal_bin
VAR omBin sip_sideal_bin
Definition simpleideals.cc:27
idInit
ideal idInit(int size, int rank=1)
creates an ideal / module
Definition simpleideals.cc:35
id_DBLmTest
void id_DBLmTest(ideal h1, int level, const char *f, const int l, const ring r)
Internal verification for ideals/modules and dense matrices!
Definition simpleideals.cc:605
id_Add
ideal id_Add(ideal h1, ideal h2, const ring r)
h1 + h2
Definition simpleideals.cc:906
id_Vec2Ideal
ideal id_Vec2Ideal(poly vec, const ring R)
Definition simpleideals.cc:1528
id_PosConstant
int id_PosConstant(ideal id, const ring r)
index of generator with leading term in ground ring (if any); otherwise -1
Definition simpleideals.cc:80
binom
int binom(int n, int r)
Definition simpleideals.cc:1212
id_Delete
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
Definition simpleideals.cc:123
id_IsModule
BOOLEAN id_IsModule(ideal A, const ring src)
Definition simpleideals.cc:1011
idSkipZeroes0
int idSkipZeroes0(ideal ide)
Definition simpleideals.cc:237
id_Array2Vector
poly id_Array2Vector(poly *m, unsigned n, const ring R)
for julia: convert an array of poly to vector
Definition simpleideals.cc:1537
id_Sort
intvec * id_Sort(const ideal id, const BOOLEAN nolex, const ring r)
sorts the ideal w.r.t. the actual ringordering uses lex-ordering when nolex = FALSE
Definition simpleideals.cc:695
sideal_list::next
ideal_list next
Definition simpleideals.h:47
id_QHomWeight
intvec * id_QHomWeight(ideal id, const ring r)
Definition simpleideals.cc:1917
idShow
void idShow(const ideal id, const ring lmRing, const ring tailRing, const int debugPrint=0)
Definition simpleideals.cc:57
id_Norm
void id_Norm(ideal id, const ring r)
ideal id = (id[i]), result is leadcoeff(id[i]) = 1
Definition simpleideals.cc:282
id_HomIdeal
BOOLEAN id_HomIdeal(ideal id, ideal Q, const ring r)
Definition simpleideals.cc:1033
IDELEMS
#define IDELEMS(i)
Definition simpleideals.h:23
id_HomModuleW
BOOLEAN id_HomModuleW(ideal id, ideal Q, const intvec *w, const intvec *module_w, const ring r)
Definition simpleideals.cc:1105
idGetNextChoise
void idGetNextChoise(int r, int end, BOOLEAN *endch, int *choise)
Definition simpleideals.cc:1154
sip_sideal::nrows
int nrows
Definition simpleideals.h:21
id_Transp
ideal id_Transp(ideal a, const ring rRing)
transpose a module
Definition simpleideals.cc:2014
id_Delete0
void id_Delete0(ideal *h, ring r)
Definition simpleideals.cc:155
id_FreeModule
ideal id_FreeModule(int i, const ring r)
the free module of rank i
Definition simpleideals.cc:1235
id_IsZeroDim
BOOLEAN id_IsZeroDim(ideal I, const ring r)
Definition simpleideals.cc:1964
id_Homogen
ideal id_Homogen(ideal h, int varnum, const ring r)
Definition simpleideals.cc:1503
id_Power
ideal id_Power(ideal given, int exp, const ring r)
Definition simpleideals.cc:1433
id_HomIdealDP
BOOLEAN id_HomIdealDP(ideal id, ideal Q, const ring r)
Definition simpleideals.cc:1059
sip_sideal::ncols
int ncols
Definition simpleideals.h:22
id_Module2Matrix
matrix id_Module2Matrix(ideal mod, const ring R)
Definition simpleideals.cc:1594
id_Normalize
void id_Normalize(ideal id, const ring r)
normialize all polys in id
Definition simpleideals.cc:1983
sip_smap::ncols
int ncols
Definition simpleideals.h:37
idElem
static int idElem(const ideal F)
number of non-zero polys in F
Definition simpleideals.h:69
id_Head
ideal id_Head(ideal h, const ring r)
returns the ideals of initial terms
Definition simpleideals.cc:1483
id_Copy
ideal id_Copy(ideal h1, const ring r)
copy an ideal
Definition simpleideals.cc:542
id_IsConstant
BOOLEAN id_IsConstant(ideal id, const ring r)
test if the ideal has only constant polynomials NOTE: zero ideal/module is also constant
Definition simpleideals.cc:529
idIs0
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
Definition simpleideals.cc:960
id_HomIdealW
BOOLEAN id_HomIdealW(ideal id, ideal Q, const intvec *w, const ring r)
Definition simpleideals.cc:1082
id_Jet0
ideal id_Jet0(const ideal i, const ring R)
Definition simpleideals.cc:1860
id_MaxIdeal
ideal id_MaxIdeal(const ring r)
initialise the maximal ideal (at 0)
Definition simpleideals.cc:98
id_DelDiv
void id_DelDiv(ideal id, const ring r)
delete id[j], if LT(j) == coeff*mon*LT(i) and vice versa, i.e., delete id[i], if LT(i) == coeff*mon*L...
Definition simpleideals.cc:463
id_MinDegW
int id_MinDegW(ideal M, intvec *w, const ring r)
Definition simpleideals.cc:1994
id_DelMultiples
void id_DelMultiples(ideal id, const ring r)
ideal id = (id[i]), c any unit if id[i] = c*id[j] then id[j] is deleted for j > i
Definition simpleideals.cc:296
id_ShallowDelete
void id_ShallowDelete(ideal *h, ring r)
Shallowdeletes an ideal/matrix.
Definition simpleideals.cc:177
id_InsertPolyWithTests
BOOLEAN id_InsertPolyWithTests(ideal h1, const int validEntries, const poly h2, const bool zeroOk, const bool duplicateOk, const ring r)
insert h2 into h1 depending on the two boolean parameters:
Definition simpleideals.cc:878
sip_sideal::m
poly * m
Definition simpleideals.h:19
id_DBTest
void id_DBTest(ideal h1, int level, const char *f, const int l, const ring lR, const ring tR)
Internal verification for ideals/modules and dense matrices!
Definition simpleideals.cc:554
id_CopyFirstK
ideal id_CopyFirstK(const ideal ide, const int k, const ring r)
copies the first k (>= 1) entries of the given ideal/module and returns these as a new ideal/module (...
Definition simpleideals.cc:266
id_Module2formatedMatrix
matrix id_Module2formatedMatrix(ideal mod, int rows, int cols, const ring R)
Definition simpleideals.cc:1640
id_Matrix2Module
ideal id_Matrix2Module(matrix mat, const ring R)
converts mat to module, destroys mat
Definition simpleideals.cc:1560
id_ResizeModule
ideal id_ResizeModule(ideal mod, int rows, int cols, const ring R)
Definition simpleideals.cc:1672
sip_smap::m
poly * m
Definition simpleideals.h:34
sip_smap::preimage
char * preimage
Definition simpleideals.h:35
id_DelEquals
void id_DelEquals(ideal id, const ring r)
ideal id = (id[i]) if id[i] = id[j] then id[j] is deleted for j > i
Definition simpleideals.cc:331
id_Jet
ideal id_Jet(const ideal i, int d, const ring R)
Definition simpleideals.cc:1847
id_Mult
ideal id_Mult(ideal h1, ideal h2, const ring r)
h1 * h2 one h_i must be an ideal (with at least one column) the other h_i may be a module (with no co...
Definition simpleideals.cc:919
id_Delete_Pos
ideal id_Delete_Pos(const ideal I, const int pos, const ring r)
Definition simpleideals.cc:2210
id_DelLmEquals
void id_DelLmEquals(ideal id, const ring r)
Delete id[j], if Lm(j) == Lm(i) and both LC(j), LC(i) are units and j > i.
Definition simpleideals.cc:354
id_JetW
ideal id_JetW(const ideal i, int d, intvec *iv, const ring R)
Definition simpleideals.cc:1873
sip_sideal::rank
long rank
Definition simpleideals.h:20
id_HomogenDP
ideal id_HomogenDP(ideal h, int varnum, const ring r)
Definition simpleideals.cc:1515
idSkipZeroes
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
Definition simpleideals.cc:201
id_Shift
void id_Shift(ideal M, int s, const ring r)
Definition simpleideals.cc:2196
idGetNumberOfChoise
int idGetNumberOfChoise(int t, int d, int begin, int end, int *choise)
Definition simpleideals.cc:1180
id_RankFreeModule
long id_RankFreeModule(ideal m, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
Definition simpleideals.cc:992
sip_smap::nrows
int nrows
Definition simpleideals.h:36
idInitChoise
void idInitChoise(int r, int beg, int end, BOOLEAN *endch, int *choise)
Definition simpleideals.cc:1132
id_PermIdeal
ideal id_PermIdeal(ideal I, int R, int C, const int *perm, const ring src, const ring dst, nMapFunc nMap, const int *par_perm, int P, BOOLEAN use_mult)
mapping ideals/matrices to other rings
Definition simpleideals.cc:2219
id_ChineseRemainder
ideal id_ChineseRemainder(ideal *xx, number *q, int rl, const ring r)
Definition simpleideals.cc:2147
id_SimpleAdd
ideal id_SimpleAdd(ideal h1, ideal h2, const ring r)
concat the lists h1 and h2 without zeros
Definition simpleideals.cc:790
sideal_list::d
ideal d
Definition simpleideals.h:48
sideal_list::nr
int nr
Definition simpleideals.h:50
id_Compactify
void id_Compactify(ideal id, const ring r)
Definition simpleideals.cc:1459
idIsMonomial
BOOLEAN idIsMonomial(ideal h)
returns true if h is generated by monomials
Definition simpleideals.cc:972
id_HomModule
BOOLEAN id_HomModule(ideal m, ideal Q, intvec **w, const ring R)
Definition simpleideals.cc:1724
id_Subst
ideal id_Subst(ideal id, int n, poly e, const ring r)
Definition simpleideals.cc:1709
sideal_list
Definition simpleideals.h:46
sip_sideal
The following sip_sideal structure has many different uses throughout Singular. Basic use-cases for i...
Definition simpleideals.h:18
sip_smap
Definition simpleideals.h:33
R
#define R
Definition sirandom.c:27
A
#define A
Definition sirandom.c:24
M
#define M
Definition sirandom.c:25
Q
#define Q
Definition sirandom.c:26