19 #define REPORT { static ExeCounter ExeCount(__LINE__,2); ++ExeCount; } 26 #define MONITOR(what,store,storage) {} 34 int f = mrc.
skip;
int l = f + mrc.
storage;
int lx = skip + storage;
35 if (f < skip) f = skip;
if (l > lx) l = lx; l -= f;
38 while (l--) *elx++ += *el++;
45 int f = mrc.
skip;
int l = f + mrc.
storage;
int lx = skip + storage;
46 if (f < skip) f = skip;
if (l > lx) l = lx; l -= f;
49 while (l--) *elx++ += *el++ *
x;
56 int f = mrc.
skip;
int l = f + mrc.
storage;
int lx = skip + storage;
57 if (f < skip) f = skip;
if (l > lx) l = lx; l -= f;
60 while (l--) *elx++ -= *el++;
67 int f = mrc.
skip;
int l = f + mrc.
storage;
int lx = skip + storage;
68 if (f < skip) f = skip;
if (l > lx) l = lx; l -= f;
71 while (l--) *elx++ = *ely++;
77 int f = mrc1.
skip;
int f2 = mrc2.
skip;
79 if (f < f2) f = f2;
if (l > l2) l = l2; l -= f;
84 while (l--) sum += *el1++ * *el2++;
91 int f = skip;
int l = skip + storage;
93 if (f1<f) f1=f;
if (l1>l) l1=l;
95 if (f2<f) f2=f;
if (l2>l) l2=l;
96 Real* el = data + (f-skip);
100 int i = f1-f;
while (i--) *el++ = 0.0;
104 i = l1-f1;
while (i--) *el++ = *el1++;
105 i = f2-l1;
while (i--) *el++ = 0.0;
106 i = l2-f2;
while (i--) *el++ = *el2++;
107 i = l-l2;
while (i--) *el++ = 0.0;
111 i = f2-f1;
while (i--) *el++ = *el1++;
115 i = l1-f2;
while (i--) *el++ = *el1++ + *el2++;
116 i = l2-l1;
while (i--) *el++ = *el2++;
117 i = l-l2;
while (i--) *el++ = 0.0;
122 i = l2-f2;
while (i--) *el++ = *el1++ + *el2++;
123 i = l1-l2;
while (i--) *el++ = *el1++;
124 i = l-l1;
while (i--) *el++ = 0.0;
130 int i = f2-f;
while (i--) *el++ = 0.0;
134 i = l2-f2;
while (i--) *el++ = *el2++;
135 i = f1-l2;
while (i--) *el++ = 0.0;
136 i = l1-f1;
while (i--) *el++ = *el1++;
137 i = l-l1;
while (i--) *el++ = 0.0;
141 i = f1-f2;
while (i--) *el++ = *el2++;
145 i = l2-f1;
while (i--) *el++ = *el1++ + *el2++;
146 i = l1-l2;
while (i--) *el++ = *el1++;
147 i = l-l1;
while (i--) *el++ = 0.0;
152 i = l1-f1;
while (i--) *el++ = *el1++ + *el2++;
153 i = l2-l1;
while (i--) *el++ = *el2++;
154 i = l-l2;
while (i--) *el++ = 0.0;
163 int f = skip;
int l = skip + storage;
165 if (f1<f) f1=f;
if (l1>l) l1=l;
167 if (f2<f) f2=f;
if (l2>l) l2=l;
168 Real* el = data + (f-skip);
172 int i = f1-f;
while (i--) *el++ = 0.0;
176 i = l1-f1;
while (i--) *el++ = *el1++;
177 i = f2-l1;
while (i--) *el++ = 0.0;
178 i = l2-f2;
while (i--) *el++ = - *el2++;
179 i = l-l2;
while (i--) *el++ = 0.0;
183 i = f2-f1;
while (i--) *el++ = *el1++;
187 i = l1-f2;
while (i--) *el++ = *el1++ - *el2++;
188 i = l2-l1;
while (i--) *el++ = - *el2++;
189 i = l-l2;
while (i--) *el++ = 0.0;
194 i = l2-f2;
while (i--) *el++ = *el1++ - *el2++;
195 i = l1-l2;
while (i--) *el++ = *el1++;
196 i = l-l1;
while (i--) *el++ = 0.0;
202 int i = f2-f;
while (i--) *el++ = 0.0;
206 i = l2-f2;
while (i--) *el++ = - *el2++;
207 i = f1-l2;
while (i--) *el++ = 0.0;
208 i = l1-f1;
while (i--) *el++ = *el1++;
209 i = l-l1;
while (i--) *el++ = 0.0;
213 i = f1-f2;
while (i--) *el++ = - *el2++;
217 i = l2-f1;
while (i--) *el++ = *el1++ - *el2++;
218 i = l1-l2;
while (i--) *el++ = *el1++;
219 i = l-l1;
while (i--) *el++ = 0.0;
224 i = l1-f1;
while (i--) *el++ = *el1++ - *el2++;
225 i = l2-l1;
while (i--) *el++ = - *el2++;
226 i = l-l2;
while (i--) *el++ = 0.0;
237 if (!storage)
return;
238 int f = mrc1.
skip;
int l = f + mrc1.
storage;
int lx = skip + storage;
239 if (f < skip) { f = skip;
if (l < f) l = f; }
240 if (l > lx) { l = lx;
if (f > lx) f = lx; }
244 int l1 = f-skip;
while (l1--) *elx++ =
x;
245 l1 = l-f;
while (l1--) *elx++ = *ely++ +
x;
246 lx -= l;
while (lx--) *elx++ =
x;
253 if (!storage)
return;
254 int f = mrc1.
skip;
int l = f + mrc1.
storage;
int lx = skip + storage;
255 if (f < skip) { f = skip;
if (l < f) l = f; }
256 if (l > lx) { l = lx;
if (f > lx) f = lx; }
260 int l1 = f-skip;
while (l1--) *elx++ =
x;
261 l1 = l-f;
while (l1--) *elx++ =
x - *ely++;
262 lx -= l;
while (lx--) *elx++ =
x;
269 if (!storage)
return;
270 int f = mrc1.
skip;
int l = f + mrc1.
storage;
int lx = skip + storage;
271 if (f < skip) { f = skip;
if (l < f) l = f; }
272 if (l > lx) { l = lx;
if (f > lx) f = lx; }
276 int l1 = f-skip;
while (l1--) { *elx = - *elx; elx++; }
277 l1 = l-f;
while (l1--) { *elx = *ely++ - *elx; elx++; }
278 lx -= l;
while (lx--) { *elx = - *elx; elx++; }
285 int f1 = mrc1.
skip;
int l1 = f1 + mrc1.
storage;
int lx = skip + storage;
286 if (f1 < skip) { f1 = skip;
if (l1 < f1) l1 = f1; }
287 if (l1 > lx) { l1 = lx;
if (f1 > lx) f1 = lx; }
291 int i = f1-skip;
while (i--) *elx++ =0.0;
294 {
Real* ely = mrc1.
data+(f1-mrc1.
skip);
while (i--) *elx++ = *ely++; }
297 int skipx = l1 - i; lx -= i;
298 if (f2 < skipx) { f2 = skipx;
if (l2 < f2) l2 = f2; }
299 if (l2 > lx) { l2 = lx;
if (f2 > lx) f2 = lx; }
301 i = f2-skipx;
while (i--) *elx++ = 0.0;
304 {
Real* ely = mrc2.
data+(f2-mrc2.
skip);
while (i--) *elx++ = *ely++; }
305 lx -= l2;
while (lx--) *elx++ = 0.0;
312 if (!storage)
return;
313 int f = mrc1.
skip;
int l = f + mrc1.
storage;
int lx = skip + storage;
314 if (f < skip) { f = skip;
if (l < f) l = f; }
315 if (l > lx) { l = lx;
if (f > lx) f = lx; }
319 int l1 = f-skip;
while (l1--) *elx++ = 0;
320 l1 = l-f;
while (l1--) *elx++ *= *ely++;
321 lx -= l;
while (lx--) *elx++ = 0;
327 int f = skip;
int l = skip + storage;
329 if (f1<f) f1=f;
if (l1>l) l1=l;
331 if (f2<f) f2=f;
if (l2>l) l2=l;
332 Real* el = data + (f-skip);
int i;
333 if (f1<f2) f1 = f2;
if (l1>l2) l1 = l2;
334 if (l1<=f1) {
REPORT i = l-f;
while (i--) *el++ = 0.0; }
340 i = f1-f ;
while (i--) *el++ = 0.0;
341 i = l1-f1;
while (i--) *el++ = *el1++ * *el2++;
342 i = l-l1;
while (i--) *el++ = 0.0;
349 int f = skip;
int s = storage;
Real* el = data;
int i;
354 i -= f; f = 0;
if (i > s) { i = s; s = 0; }
else s -= i;
355 while (i--) *el++ = 0.0;
361 int mrc2_skip = mrc2.
skip;
int mrc2_storage = mrc2.
storage;
362 int mrc2_length = mrc2.
length;
363 int mrc2_remain = mrc2_length - mrc2_skip - mrc2_storage;
367 if (f == 0 && mrc2_length <= s)
369 j = mrc2_skip; s -= j;
while (j--) *el++ = 0.0;
370 j = mrc2_storage; s -= j;
while (j--) *el++ = vel1 * *el2++;
371 j = mrc2_remain; s -= j;
while (j--) *el++ = 0.0;
373 else if (f >= mrc2_length) f -= mrc2_length;
379 j -= f; f = 0;
if (j > s) { j = s; s = 0; }
else s -= j;
380 while (j--) *el++ = 0.0;
387 j -= f; el2 += f; f = 0;
if (j > s) { j = s; s = 0; }
else s -= j;
388 while (j--) *el++ = vel1 * *el2++;
395 j -= f; f = 0;
if (j > s) { j = s; s = 0; }
else s -= j;
396 while (j--) *el++ = 0.0;
407 i -= f;
if (i > s) i = s;
408 while (i--) *el++ = 0.0;
417 if (!storage)
return;
418 int f = mrc1.
skip;
int l = f + mrc1.
storage;
int lx = skip + storage;
419 if (f < skip) { f = skip;
if (l < f) l = f; }
420 if (l > lx) { l = lx;
if (f > lx) f = lx; }
424 if (l-f) ely = mrc1.
data+(f-mrc1.
skip);
426 int l1 = f-skip;
while (l1--) *elx++ = 0.0;
427 l1 = l-f;
while (l1--) *elx++ = *ely++;
428 lx -= l;
while (lx--) *elx++ = 0.0;
435 if (!storage)
return;
436 int f = mrc1.
skip;
int l = f + mrc1.
storage;
int lx = skip + storage;
441 int l1 = f-skip;
while (l1--) *elx++ = 0.0;
442 l1 = l-f;
while (l1--) *elx++ = *ely++;
443 lx -= l;
while (lx--) *elx++ = 0.0;
450 int f = mrc1.
skip;
int l = f + mrc1.
storage;
int lx = skip + storage;
460 if (skip!=0 || storage!=length)
468 if (!storage)
return;
469 int f = mrc1.
skip;
int l = f + mrc1.
storage;
int lx = skip + storage;
470 if (f < skip) { f = skip;
if (l < f) l = f; }
471 if (l > lx) { l = lx;
if (f > lx) f = lx; }
475 int l1 = f-skip;
while (l1--) *elx++ = 0.0;
476 l1 = l-f;
while (l1--) *elx++ = - *ely++;
477 lx -= l;
while (lx--) *elx++ = 0.0;
484 if (!storage)
return;
485 int f = mrc1.
skip;
int l = f + mrc1.
storage;
int lx = skip + storage;
486 if (f < skip) { f = skip;
if (l < f) l = f; }
487 if (l > lx) { l = lx;
if (f > lx) f = lx; }
491 int l1 = f-skip;
while (l1--) *elx++ = 0.0;
492 l1 = l-f;
while (l1--) *elx++ = *ely++ * s;
493 lx -= l;
while (lx--) *elx++ = 0.0;
500 int f = mrc1.
skip;
int f0 = mrc.
skip;
502 if (f < f0) { f = f0;
if (l < f) l = f; }
503 if (l > lx) { l = lx;
if (f > lx) f = lx; }
507 int l1 = f-f0;
while (l1--) *elx++ = 0.0;
508 l1 = l-f;
while (l1--) *elx++ /= *eld++;
509 lx -= l;
while (lx--) *elx++ = 0.0;
517 int f = mrc1.
skip;
int f0 = mrc.
skip;
519 if (f < f0) { f = f0;
if (l < f) l = f; }
520 if (l > lx) { l = lx;
if (f > lx) f = lx; }
524 int l1 = f-f0;
while (l1--) *elx++ = 0.0;
525 l1 = l-f;
while (l1--) *elx++ /= eldv;
526 lx -= l;
while (lx--) *elx++ = 0.0;
534 Real* elx = data;
const Real* ely = r+skip; r += length;
535 int l = storage;
while (l--) *elx++ = *ely++;
542 Real* elx = data;
const int* ely = r+skip; r += length;
543 int l = storage;
while (l--) *elx++ = *ely++;
549 REPORT Real* elx = data;
int l = storage;
while (l--) *elx++ = r;
555 REPORT Real* elx = data;
int l = storage;
while (l--) *elx++ = 0;
561 REPORT Real* elx = data;
int l = storage;
while (l--) *elx++ *= r;
568 Real* elx = data;
int l = storage;
while (l--) *elx++ += r;
574 Real sum = 0.0;
Real* elx = data;
int l = storage;
575 while (l--) sum += std::fabs(*elx++);
585 Real* elx = data;
int l = storage;
int li = -1;
586 while (l--) {
Real f = std::fabs(*elx++);
if (r <= f) { r = f; li = l; } }
587 i = (li >= 0) ? storage - li + skip : 0;
595 Real* elx = data;
int l = storage;
int li = -1;
596 while (l--) {
Real f = std::fabs(*elx++);
if (r >= f) { r = f; li = l; } }
597 i = (li >= 0) ? storage - li + skip : 0;
605 Real* elx = data;
int l = storage;
int li = -1;
606 while (l--) {
Real f = *elx++;
if (r <= f) { r = f; li = l; } }
607 i = (li >= 0) ? storage - li + skip : 0;
615 Real* elx = data;
int l = storage;
int li = -1;
616 while (l--) {
Real f = *elx++;
if (r >= f) { r = f; li = l; } }
617 i = (li >= 0) ? storage - li + skip : 0;
624 Real sum = 0.0;
Real* elx = data;
int l = storage;
625 while (l--) sum += *elx++;
631 mrc.
length = l1;
int d = skip - skip1;
632 if (d<0) { mrc.
skip = 0; mrc.
data = data - d; }
633 else { mrc.
skip = d; mrc.
data = data; }
634 d = skip + storage - skip1;
635 d = ((l1 < d) ? l1 : d) - mrc.
skip; mrc.
storage = (d < 0) ? 0 : d;
Real DotProd(const MatrixRowCol &mrc1, const MatrixRowCol &mrc2)
void Copy(const MatrixRowCol &)
void NegAdd(const MatrixRowCol &, Real)
void KP(const MatrixRowCol &, const MatrixRowCol &)
void RevSub(const MatrixRowCol &)
void Add(const MatrixRowCol &)
void ConCat(const MatrixRowCol &, const MatrixRowCol &)
void AddScaled(const MatrixRowCol &, Real)
void CopyCheck(const MatrixRowCol &)
void Negate(const MatrixRowCol &)
void Multiply(const MatrixRowCol &)
Real Maximum1(Real r, int &i)
void Sub(const MatrixRowCol &)
void SubRowCol(MatrixRowCol &, int, int) const
Real MaximumAbsoluteValue1(Real r, int &i)
void Solver(MatrixColX &, const MatrixColX &)
void Solver(MatrixColX &, const MatrixColX &)
Real MinimumAbsoluteValue1(Real r, int &i)
void Inject(const MatrixRowCol &)
Real Minimum1(Real r, int &i)