My Project  debian-1:4.1.2-p1+ds-2
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 "misc/auxiliary.h"
11 
12 #include "misc/auxiliary.h"
13 #include "omalloc/omalloc.h"
14 #ifdef HAVE_OMALLOC
15 #include "omalloc/omallocClass.h"
16 #endif
17 
18 #include "misc/intvec.h"
19 
20 class int64vec
21 #ifdef HAVE_OMALLOC
22  :public omallocClass
23 #endif
24 {
25 private:
26  int64 *v;
27  int row;
28  int col;
29 public:
30 
31  int64vec(int l = 1)
32  {
33  v = (int64 *)omAlloc0(sizeof(int64)*l);
34  row = l;
35  col = 1;
36  }
37  int64vec(int r, int c, int64 init);
38  int64vec(int64vec* iv);
39  int64vec(intvec* iv);
41  {
42 #ifndef SING_NDEBUG
43  if((i<0)||(i>=row*col))
44  {
45  Werror("wrong int64vec index:%d\n",i);
46  }
47 #endif
48  return v[i];
49  }
50  inline const int64& operator[](int i) const
51  {
52 #ifndef SING_NDEBUG
53  if((i<0)||(i>=row*col))
54  {
55  Werror("wrong int64vec index:%d\n",i);
56  }
57 #endif
58  return v[i];
59  }
60  void operator*=(int64 intop);
61  void operator/=(int64 intop);
62  // -2: not compatible, -1: <, 0:=, 1: >
63  int compare(const int64vec* o) const;
64  int length() const { return col*row; }
65  int cols() const { return col; }
66  int rows() const { return row; }
67  void show(int mat=0,int spaces=0);
68  char * String(int dim = 2);
69  char * iv64String(int not_mat=1,int mat=0,int spaces=0, int dim=2);
70  int64 * iv64GetVec() { return v; }
72  {
73  if (v!=NULL)
74  {
75  omFreeSize((ADDRESS)v,sizeof(int64)*row*col);
76  v=NULL;
77  }
78  }
79  void iv64TEST()
80  {
82  }
83 };
84 inline int64vec * iv64Copy(int64vec * o)
85 {
86  int64vec * iv=new int64vec(o);
87  return iv;
88 }
89 
92 
93 #ifdef MDEBUG
94 #define iv64Test(v) v->iv64TEST()
95 #else
96 #define iv64Test(v) do {} while (0)
97 #endif
98 
99 #endif
All the auxiliary stuff.
long int64
Definition: auxiliary.h:68
void * ADDRESS
Definition: auxiliary.h:135
int l
Definition: cfEzgcd.cc:93
int i
Definition: cfEzgcd.cc:125
CanonicalForm b
Definition: cfModGcd.cc:4044
int col
Definition: int64vec.h:28
int64 & operator[](int i)
Definition: int64vec.h:40
void show(int mat=0, int spaces=0)
Definition: int64vec.cc:104
int compare(const int64vec *o) const
Definition: int64vec.cc:138
int length() const
Definition: int64vec.h:64
int64vec(int l=1)
Definition: int64vec.h:31
void iv64TEST()
Definition: int64vec.h:79
int64 * v
Definition: int64vec.h:26
~int64vec()
Definition: int64vec.h:71
char * String(int dim=2)
Definition: int64vec.cc:99
int64 * iv64GetVec()
Definition: int64vec.h:70
const int64 & operator[](int i) const
Definition: int64vec.h:50
int row
Definition: int64vec.h:27
char * iv64String(int not_mat=1, int mat=0, int spaces=0, int dim=2)
Definition: int64vec.cc:56
void operator*=(int64 intop)
Definition: int64vec.cc:119
int rows() const
Definition: int64vec.h:66
int cols() const
Definition: int64vec.h:65
void operator/=(int64 intop)
Definition: int64vec.cc:124
Definition: intvec.h:23
int64vec * iv64Add(int64vec *a, int64vec *b)
Definition: int64vec.cc:172
int64vec * iv64Sub(int64vec *a, int64vec *b)
Definition: int64vec.cc:202
int64vec * iv64Copy(int64vec *o)
Definition: int64vec.h:84
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
#define omCheckAddrSize(addr, size)
Definition: omAllocDecl.h:327
#define omAlloc0(size)
Definition: omAllocDecl.h:211
#define NULL
Definition: omList.c:12
void Werror(const char *fmt,...)
Definition: reporter.cc:189
int dim(ideal I, ring r)