unsafe public vectorINT MinusTo(vectorINT res) { fixed(int *_ptr1 = &this.rawData[0], _ptr2 = &res.rawData[0]) { int *ptr1 = _ptr1; int *ptr2 = _ptr2; for (int i = 0; i < nElem; i++) { *ptr2 = -*ptr1; ptr1++; ptr2++; } } return(res); }
unsafe public vectorINT Add(vectorINT v, int p) { // for(int i=0;i<this.nElem;i++) // { // this[i]+=v[i]*p; // } int S = nElem; fixed(int *_ptr1 = &this.rawData[0], _ptr2 = &v.rawData[0]) { int *ptr1 = _ptr1; int *ptr2 = _ptr2; for (int i = 0; i < S; i++) { *ptr1 += *ptr2 * p; ptr1++; ptr2++; } } return(this); }