[fc5095] | 1 | #ifndef INT64VEC_H |
---|
| 2 | #define INT64VEC_H |
---|
| 3 | /**************************************** |
---|
| 4 | * Computer Algebra System SINGULAR * |
---|
| 5 | ****************************************/ |
---|
[d14343a] | 6 | /* $Id: int64vec.h,v 1.3 2005-05-09 13:47:29 Singular Exp $ */ |
---|
[fc5095] | 7 | /* |
---|
| 8 | * ABSTRACT: class intvec: lists/vectors of int64 |
---|
| 9 | */ |
---|
| 10 | #include <string.h> |
---|
| 11 | #include "structs.h" |
---|
| 12 | #include "omalloc.h" |
---|
| 13 | #include "febase.h" |
---|
| 14 | #include "intvec.h" |
---|
| 15 | |
---|
| 16 | class int64vec |
---|
| 17 | { |
---|
| 18 | private: |
---|
| 19 | int64 *v; |
---|
| 20 | int row; |
---|
| 21 | int col; |
---|
| 22 | public: |
---|
| 23 | |
---|
| 24 | int64vec(int l = 1) |
---|
| 25 | { |
---|
| 26 | v = (int64 *)omAlloc0(sizeof(int64)*l); |
---|
| 27 | row = l; |
---|
| 28 | col = 1; |
---|
| 29 | } |
---|
| 30 | int64vec(int r, int c, int64 init); |
---|
| 31 | int64vec(int64vec* iv); |
---|
| 32 | int64vec(intvec* iv); |
---|
| 33 | int64& operator[](int i) |
---|
| 34 | { |
---|
| 35 | #ifndef NDEBUG |
---|
| 36 | if((i<0)||(i>=row*col)) |
---|
| 37 | { |
---|
| 38 | Werror("wrong int64vec index:%d\n",i); |
---|
| 39 | } |
---|
| 40 | #endif |
---|
| 41 | return v[i]; |
---|
| 42 | } |
---|
| 43 | void operator*=(int64 intop); |
---|
| 44 | void operator/=(int64 intop); |
---|
| 45 | // -2: not compatible, -1: <, 0:=, 1: > |
---|
| 46 | int compare(int64vec* o); |
---|
| 47 | int length() const { return col*row; } |
---|
| 48 | int cols() const { return col; } |
---|
| 49 | int rows() const { return row; } |
---|
| 50 | void show(int mat=0,int spaces=0); |
---|
| 51 | char * String(int dim = 2); |
---|
| 52 | char * iv64String(int not_mat=1,int mat=0,int spaces=0, int dim=2); |
---|
| 53 | int64 * iv64GetVec() { return v; } |
---|
| 54 | ~int64vec() |
---|
| 55 | { |
---|
| 56 | if (v!=NULL) |
---|
| 57 | { |
---|
| 58 | omFreeSize((ADDRESS)v,sizeof(int64)*row*col); |
---|
| 59 | v=NULL; |
---|
| 60 | } |
---|
| 61 | } |
---|
| 62 | void iv64TEST() |
---|
| 63 | { |
---|
| 64 | omCheckAddrSize((ADDRESS)v,sizeof(int64)*row*col); |
---|
| 65 | } |
---|
| 66 | }; |
---|
[d14343a] | 67 | inline int64vec * iv64Copy(int64vec * o) |
---|
| 68 | { |
---|
| 69 | int64vec * iv=new int64vec(o); |
---|
| 70 | return iv; |
---|
| 71 | }; |
---|
| 72 | |
---|
[fc5095] | 73 | int64vec * iv64Add(int64vec * a, int64vec * b); |
---|
| 74 | int64vec * iv64Sub(int64vec * a, int64vec * b); |
---|
| 75 | |
---|
| 76 | #ifdef MDEBUG |
---|
| 77 | #define iv64Test(v) v->iv64TEST() |
---|
| 78 | #else |
---|
| 79 | #define iv64Test(v) ((void)0) |
---|
| 80 | #endif |
---|
| 81 | |
---|
| 82 | #endif |
---|
| 83 | |
---|
| 84 | |
---|
| 85 | |
---|
| 86 | |
---|
| 87 | |
---|
| 88 | |
---|
| 89 | |
---|
| 90 | |
---|
| 91 | |
---|
| 92 | |
---|
| 93 | |
---|