int64vec.h
Go to the documentation of this file.
1 #ifndef INT64VEC_H
2 #define INT64VEC_H
3 /****************************************
4 * Computer Algebra System SINGULAR *
5 ****************************************/
6 /*
7 * ABSTRACT: class intvec: lists/vectors of int64
8 */
9 #include <string.h>
10 #include <omalloc/omalloc.h>
11 #include <misc/auxiliary.h>
12 #include <misc/intvec.h>
13 
14 class int64vec
15 {
16 private:
17  int64 *v;
18  int row;
19  int col;
20 public:
21 
22  int64vec(int l = 1)
23  {
24  v = (int64 *)omAlloc0(sizeof(int64)*l);
25  row = l;
26  col = 1;
27  }
28  int64vec(int r, int c, int64 init);
29  int64vec(int64vec* iv);
30  int64vec(intvec* iv);
32  {
33 #ifndef SING_NDEBUG
34  if((i<0)||(i>=row*col))
35  {
36  Werror("wrong int64vec index:%d\n",i);
37  }
38 #endif
39  return v[i];
40  }
41  inline const int64& operator[](int i) const
42  {
43 #ifndef SING_NDEBUG
44  if((i<0)||(i>=row*col))
45  {
46  Werror("wrong int64vec index:%d\n",i);
47  }
48 #endif
49  return v[i];
50  }
51  void operator*=(int64 intop);
52  void operator/=(int64 intop);
53  // -2: not compatible, -1: <, 0:=, 1: >
54  int compare(const int64vec* o) const;
55  int length() const { return col*row; }
56  int cols() const { return col; }
57  int rows() const { return row; }
58  void show(int mat=0,int spaces=0);
59  char * String(int dim = 2);
60  char * iv64String(int not_mat=1,int mat=0,int spaces=0, int dim=2);
61  int64 * iv64GetVec() { return v; }
63  {
64  if (v!=NULL)
65  {
66  omFreeSize((ADDRESS)v,sizeof(int64)*row*col);
67  v=NULL;
68  }
69  }
70  void iv64TEST()
71  {
72  omCheckAddrSize((ADDRESS)v,sizeof(int64)*row*col);
73  }
74 };
75 inline int64vec * iv64Copy(int64vec * o)
76 {
77  int64vec * iv=new int64vec(o);
78  return iv;
79 }
80 
82 int64vec * iv64Sub(int64vec * a, int64vec * b);
83 
84 #ifdef MDEBUG
85 #define iv64Test(v) v->iv64TEST()
86 #else
87 #define iv64Test(v) do {} while (0)
88 #endif
89 
90 #endif
91 
92 
93 
94 
95 
96 
97 
98 
99 
100 
101 
#define omCheckAddrSize(addr, size)
Definition: omAllocDecl.h:327
const poly a
Definition: syzextra.cc:212
int64 & operator[](int i)
Definition: int64vec.h:31
int64vec * iv64Sub(int64vec *a, int64vec *b)
Definition: int64vec.cc:203
int64vec * iv64Copy(int64vec *o)
Definition: int64vec.h:75
char * String(int dim=2)
Definition: int64vec.cc:100
int64vec(int l=1)
Definition: int64vec.h:22
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
long int64
Definition: auxiliary.h:112
int col
Definition: int64vec.h:19
void * ADDRESS
Definition: auxiliary.h:161
void show(int mat=0, int spaces=0)
Definition: int64vec.cc:105
char * iv64String(int not_mat=1, int mat=0, int spaces=0, int dim=2)
Definition: int64vec.cc:57
const int64 & operator[](int i) const
Definition: int64vec.h:41
const ring r
Definition: syzextra.cc:208
int compare(const int64vec *o) const
Definition: int64vec.cc:139
Definition: intvec.h:16
int rows() const
Definition: int64vec.h:57
~int64vec()
Definition: int64vec.h:62
void iv64TEST()
Definition: int64vec.h:70
All the auxiliary stuff.
int dim(ideal I, ring r)
int i
Definition: cfEzgcd.cc:123
int cols() const
Definition: int64vec.h:56
int length() const
Definition: int64vec.h:55
#define NULL
Definition: omList.c:10
void operator/=(int64 intop)
Definition: int64vec.cc:125
int64vec * iv64Add(int64vec *a, int64vec *b)
Definition: int64vec.cc:173
void operator*=(int64 intop)
Definition: int64vec.cc:120
int row
Definition: int64vec.h:18
const poly b
Definition: syzextra.cc:213
void Werror(const char *fmt,...)
Definition: reporter.cc:199
int64 * iv64GetVec()
Definition: int64vec.h:61
#define omAlloc0(size)
Definition: omAllocDecl.h:211
int l
Definition: cfEzgcd.cc:94
int64 * v
Definition: int64vec.h:17