Changeset d14343a in git
- Timestamp:
- May 9, 2005, 3:47:30 PM (18 years ago)
- Branches:
- (u'spielwiese', 'd1ec153efbb92b07a03c829a7f893fe854f169d2')
- Children:
- 9850430deebdde40b9b692de71cd82543d4f6968
- Parents:
- b553e559f98a3781f6cfd18ddbcb12a123420c3b
- Location:
- kernel
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/int64vec.cc
rb553e5 rd14343a 2 2 * Computer Algebra System SINGULAR * 3 3 *****************************************/ 4 /* $Id: int64vec.cc,v 1. 2 2005-05-09 12:14:57Singular Exp $ */4 /* $Id: int64vec.cc,v 1.3 2005-05-09 13:47:29 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT: class int64vec: lists/vectors of int64 … … 96 96 } 97 97 98 void int64vec::resize(int new_length)99 {100 assume(new_length > 0 && col == 1);101 v = (int64*) omRealloc0Size(v, row*sizeof(int64), new_length*sizeof(int64));102 row = new_length;103 }104 105 98 char * int64vec::String(int dim) 106 99 { … … 116 109 } 117 110 118 void int64vec::operator+=(int64 intop)119 {120 for (int i=0; i<row*col; i++) { v[i] += intop; }121 }122 123 void int64vec::operator-=(int64 intop)124 {125 for (int i=0; i<row*col; i++) { v[i] -= intop; }126 }127 128 111 void int64vec::operator*=(int64 intop) 129 112 { 130 for (int i= 0; i<row*col; i++) { v[i] *= intop; }113 for (int i=row*col-1; i>=0; i--) { v[i] *= intop; } 131 114 } 132 115 … … 135 118 if (intop == 0) return; 136 119 int64 bb=ABS(intop); 137 for (int i= 0; i<row*col; i++)120 for (int i=row*col-1; i>=0; i--) 138 121 { 139 122 int64 r=v[i]; … … 145 128 } 146 129 147 void int64vec::operator%=(int64 intop)148 {149 if (intop == 0) return;150 int64 bb=ABS(intop);151 for (int i=0; i<row*col; i++)152 {153 int64 r=v[i];154 int64 c=r%bb;155 if (c<0) c+=bb;156 v[i]=c;157 }158 }159 160 130 int int64vec::compare(int64vec* op) 161 131 { … … 190 160 } 191 161 return 0; 192 }193 int int64vec::compare(int64 o)194 {195 for (int i=0; i<row*col; i++)196 {197 if (v[i] <o) return -1;198 if (v[i] >o) return 1;199 }200 return 0;201 }202 203 int64vec * iv64Copy(int64vec * o)204 {205 int64vec * iv=new int64vec(o);206 return iv;207 162 } 208 163 … … 267 222 } 268 223 269 int64vec * iv64Tranp(int64vec * o)270 {271 int i, j, r = o->rows(), c = o->cols();272 int64vec * iv= new int64vec(c, r, 0);273 for (i=0; i<r; i++)274 {275 for (j=0; j<c; j++)276 (*iv)[j*r+i] = (*o)[i*c+j];277 }278 return iv;279 }280 281 int64 iv64Trace(int64vec * o)282 {283 int i, m = si_min(o->rows(),o->cols()), c = o->cols();284 int64 s = 0;285 for (i=0; i<m; i++)286 {287 s += (*o)[i*c+i];288 }289 return s;290 }291 292 int64vec * iv64Mult(int64vec * a, int64vec * b)293 {294 int i, j, k,295 ra = a->rows(), ca = a->cols(),296 rb = b->rows(), cb = b->cols();297 int64 sum;298 int64vec * iv;299 if (ca != rb) return NULL;300 iv = new int64vec(ra, cb, 0);301 for (i=0; i<ra; i++)302 {303 for (j=0; j<cb; j++)304 {305 sum = 0;306 for (k=0; k<ca; k++)307 sum += (*a)[i*ca+k]*(*b)[k*cb+j];308 (*iv)[i*cb+j] = sum;309 }310 }311 return iv;312 }313 314 224 /* def. internals */ 315 225 static int64 iv64Gcd(int, int); -
kernel/int64vec.h
rb553e5 rd14343a 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: int64vec.h,v 1. 2 2005-05-09 12:14:57Singular Exp $ */6 /* $Id: int64vec.h,v 1.3 2005-05-09 13:47:29 Singular Exp $ */ 7 7 /* 8 8 * ABSTRACT: class intvec: lists/vectors of int64 … … 31 31 int64vec(int64vec* iv); 32 32 int64vec(intvec* iv); 33 void resize(int new_length);34 int range(int i)35 { return ((i<row) && (i>=0) && (col==1)); }36 int range(int i, int j)37 { return ((i<row) && (i>=0) && (j<col) && (j>=0)); }38 33 int64& operator[](int i) 39 34 { … … 46 41 return v[i]; 47 42 } 48 void operator+=(int64 intop);49 void operator-=(int64 intop);50 43 void operator*=(int64 intop); 51 44 void operator/=(int64 intop); 52 void operator%=(int64 intop);53 45 // -2: not compatible, -1: <, 0:=, 1: > 54 46 int compare(int64vec* o); 55 int compare(int64 o);56 47 int length() const { return col*row; } 57 48 int cols() const { return col; } 58 49 int rows() const { return row; } 59 void length(int l) { row = l; col = 1; }60 50 void show(int mat=0,int spaces=0); 61 void makeVector() { row*=col;col=1; }62 51 char * String(int dim = 2); 63 52 char * iv64String(int not_mat=1,int mat=0,int spaces=0, int dim=2); 64 // keiner (ausser obachman) darf das folgenden benutzen !!!65 53 int64 * iv64GetVec() { return v; } 66 54 ~int64vec() … … 77 65 } 78 66 }; 79 int64vec * iv64Copy(int64vec * o); 67 inline int64vec * iv64Copy(int64vec * o) 68 { 69 int64vec * iv=new int64vec(o); 70 return iv; 71 }; 72 80 73 int64vec * iv64Add(int64vec * a, int64vec * b); 81 74 int64vec * iv64Sub(int64vec * a, int64vec * b); 82 int64vec * iv64Tranp(int64vec * o);83 int64 iv64Trace(int64vec * o);84 int64vec * iv64Mult(int64vec * a, int64vec * b);85 75 86 76 #ifdef MDEBUG -
kernel/walkSupport.cc
rb553e5 rd14343a 217 217 for (n=2; n<=pertdeg; n++) 218 218 { 219 temp64=iv64Copy(taun64); 220 (*taun64)*=inveps64; 221 for(int i=0; i<currRing->N;i++) 222 { 223 if((*temp64)[i]!=0 && (((*taun64)[i])/((*temp64)[i]))!=inveps64) 224 overflow_error=12; 225 } 226 delete temp64; 219 if (inveps64!=1) 220 { 221 temp64=iv64Copy(taun64); 222 (*taun64)*=inveps64; 223 for(int i=0; i<currRing->N;i++) 224 { 225 if((*temp64)[i]!=0 && (((*taun64)[i])/((*temp64)[i]))!=inveps64) 226 overflow_error=12; 227 } 228 delete temp64; 229 } 227 230 temp64=iv64Copy(taun64); 228 231 add64=getNthRow64(targm,n);
Note: See TracChangeset
for help on using the changeset viewer.