42 template <
class T,
class OP>
54 if (a_nr != b_nr || a_nc != b_nc)
65 bool ja_lt_max= ja < ja_max;
69 bool jb_lt_max = jb < jb_max;
71 while (ja_lt_max || jb_lt_max )
75 (ja_lt_max && (a.
ridx (ja) < b.
ridx (jb))))
81 ja_lt_max= ja < ja_max;
83 else if (( !ja_lt_max ) ||
84 (jb_lt_max && (b.
ridx (jb) < a.
ridx (ja)) ) )
90 jb_lt_max= jb < jb_max;
94 if (op (a.
data (ja), b.
data (jb)) != 0.)
101 ja_lt_max= ja < ja_max;
103 jb_lt_max= jb < jb_max;
115 template <
typename T>
122 template <
typename T>
126 return plus_or_minus (a, b, std::minus<T> (),
"operator -=");
132 template <
class T,
class OP>
147 template <
typename T>
154 template <
typename T>
162 template <
class T,
class OP>
183 template <
typename T>
190 template <
typename T>
200 template <
class T,
class OP>
215 template <
typename T>
222 template <
typename T>
229 template <
class T,
class OP>
267 template <
class T,
class OP>
270 const char* op_name,
bool negate)
280 if (a_nr == 1 && a_nc == 1)
282 if (a.
elem (0,0) == 0.)
304 else if (b_nr == 1 && b_nc == 1)
306 if (b.
elem (0,0) == 0.)
325 else if (a_nr != b_nr || a_nc != b_nc)
337 bool ja_lt_max= ja < ja_max;
341 bool jb_lt_max = jb < jb_max;
343 while (ja_lt_max || jb_lt_max )
347 (ja_lt_max && (a.
ridx (ja) < b.
ridx (jb))))
353 ja_lt_max= ja < ja_max;
355 else if (( !ja_lt_max ) ||
356 (jb_lt_max && (b.
ridx (jb) < a.
ridx (ja)) ) )
362 jb_lt_max= jb < jb_max;
366 if (op (a.
data (ja), b.
data (jb)) != 0.)
373 ja_lt_max= ja < ja_max;
375 jb_lt_max= jb < jb_max;
391 return plus_or_minus (a, b, std::plus<T> (),
"operator +",
false);
398 return plus_or_minus (a, b, std::minus<T> (),
"operator -",
true);
413 if (a_nr == 1 && a_nc == 1)
415 if (a.
elem (0,0) == 0.)
430 else if (b_nr == 1 && b_nc == 1)
432 if (b.
elem (0,0) == 0.)
447 else if (a_nr != b_nr || a_nc != b_nc)
459 bool ja_lt_max= ja < ja_max;
463 bool jb_lt_max = jb < jb_max;
465 while (ja_lt_max || jb_lt_max )
469 (ja_lt_max && (a.
ridx (ja) < b.
ridx (jb))))
471 ja++; ja_lt_max= ja < ja_max;
473 else if (( !ja_lt_max ) ||
474 (jb_lt_max && (b.
ridx (jb) < a.
ridx (ja)) ) )
476 jb++; jb_lt_max= jb < jb_max;
480 if ((a.
data (ja) * b.
data (jb)) != 0.)
486 ja++; ja_lt_max= ja < ja_max;
487 jb++; jb_lt_max= jb < jb_max;
512 if (a_nr == 1 && a_nc == 1)
514 T val = a.
elem (0,0);
540 else if (b_nr == 1 && b_nc == 1)
542 T val = b.
elem (0,0);
568 else if (a_nr != b_nr || a_nc != b_nc)
578 bool ja_lt_max= ja < ja_max;
582 bool jb_lt_max = jb < jb_max;
584 while (ja_lt_max || jb_lt_max )
588 (ja_lt_max && (a.
ridx (ja) < b.
ridx (jb))))
591 ja++; ja_lt_max= ja < ja_max;
593 else if (( !ja_lt_max ) ||
594 (jb_lt_max && (b.
ridx (jb) < a.
ridx (ja)) ) )
597 jb++; jb_lt_max= jb < jb_max;
602 ja++; ja_lt_max= ja < ja_max;
603 jb++; jb_lt_max= jb < jb_max;
632 retval.
data (i) = - retval.
data (i);