22 template<
class T,
class A=std::allocator<T> >
138 #ifdef DUNE_ISTL_WITH_CHECKING
140 DUNE_THROW(
ISTLError,
"Can't access negative rows!");
142 DUNE_THROW(
ISTLError,
"Row index out of range!");
149 #ifdef DUNE_ISTL_WITH_CHECKING
151 DUNE_THROW(
ISTLError,
"Can't access negative rows!");
153 DUNE_THROW(
ISTLError,
"Row index out of range!");
170 #ifdef DUNE_ISTL_WITH_CHECKING
172 DUNE_THROW(
ISTLError,
"Can't compute rowdim() when there are no columns!");
183 #ifdef DUNE_ISTL_WITH_CHECKING
185 DUNE_THROW(
ISTLError,
"Can't compute coldim() when there are no rows!");
196 #ifdef DUNE_ISTL_WITH_CHECKING
198 DUNE_THROW(
ISTLError,
"Rowdim for nonexisting row " << r <<
" requested!");
200 DUNE_THROW(
ISTLError,
"Can't compute rowdim() when there are no columns!");
202 return data_[r][0].rowdim();
207 #ifdef DUNE_ISTL_WITH_CHECKING
209 DUNE_THROW(
ISTLError,
"Coldim for nonexisting column " << c <<
" requested!");
211 DUNE_THROW(
ISTLError,
"Can't compute coldim() when there are no rows!");
213 return data_[0][c].coldim();
234 #ifdef DUNE_ISTL_WITH_CHECKING
235 if(
N()!=b.
N() ||
M() != b.
M())
236 DUNE_THROW(RangeError,
"Matrix sizes do not match!");
248 #ifdef DUNE_ISTL_WITH_CHECKING
249 if(
N()!=b.
N() ||
M() != b.
M())
250 DUNE_THROW(RangeError,
"Matrix sizes do not match!");
261 out[j][i] = (*
this)[i][j];
269 template <
class X,
class Y>
280 out[i][j] += m1[i][k]*m2[k][j];
287 template <
class X,
class Y>
289 #ifdef DUNE_ISTL_WITH_CHECKING
290 if (m.
M()!=vec.size())
291 DUNE_THROW(
ISTLError,
"Vector size doesn't match the number of matrix columns!");
296 for (
size_type i=0; i<out.size(); i++ ) {
298 out[i] += m[i][j]*vec[j];
305 template <
class X,
class Y>
306 void mv(
const X& x, Y& y)
const
308 #ifdef DUNE_ISTL_WITH_CHECKING
309 if (x.N()!=
M()) DUNE_THROW(
ISTLError,
"vector/matrix size mismatch!");
310 if (y.N()!=
N()) DUNE_THROW(
ISTLError,
"vector/matrix size mismatch!");
316 (*
this)[i][j].umv(x[j], y[i]);
323 template<
class X,
class Y>
324 void mtv (
const X& x, Y& y)
const
326 #ifdef DUNE_ISTL_WITH_CHECKING
327 if (x.N()!=
N()) DUNE_THROW(
ISTLError,
"index out of range");
328 if (y.N()!=
M()) DUNE_THROW(
ISTLError,
"index out of range");
337 template <
class X,
class Y>
338 void umv(
const X& x, Y& y)
const
340 #ifdef DUNE_ISTL_WITH_CHECKING
341 if (x.N()!=
M()) DUNE_THROW(
ISTLError,
"vector/matrix size mismatch!");
342 if (y.N()!=
N()) DUNE_THROW(
ISTLError,
"vector/matrix size mismatch!");
348 (*
this)[i][j].umv(x[j], y[i]);
355 template<
class X,
class Y>
356 void mmv (
const X& x, Y& y)
const
358 #ifdef DUNE_ISTL_WITH_CHECKING
359 if (x.N()!=
M()) DUNE_THROW(
ISTLError,
"vector/matrix size mismatch!");
360 if (y.N()!=
N()) DUNE_THROW(
ISTLError,
"vector/matrix size mismatch!");
367 (*j).mmv(x[j.index()],y[i.index()]);
372 template <
class X,
class Y>
375 #ifdef DUNE_ISTL_WITH_CHECKING
376 if (x.N()!=
M()) DUNE_THROW(
ISTLError,
"vector/matrix size mismatch!");
377 if (y.N()!=
N()) DUNE_THROW(
ISTLError,
"vector/matrix size mismatch!");
383 (*
this)[i][j].usmv(alpha, x[j], y[i]);
390 template<
class X,
class Y>
391 void umtv (
const X& x, Y& y)
const
393 #ifdef DUNE_ISTL_WITH_CHECKING
394 if (x.N()!=
N()) DUNE_THROW(
ISTLError,
"vector/matrix size mismatch!");
395 if (y.N()!=
M()) DUNE_THROW(
ISTLError,
"vector/matrix size mismatch!");
402 (*j).umtv(x[i.index()],y[j.index()]);
407 template<
class X,
class Y>
408 void mmtv (
const X& x, Y& y)
const
410 #ifdef DUNE_ISTL_WITH_CHECKING
411 if (x.N()!=
N()) DUNE_THROW(
ISTLError,
"vector/matrix size mismatch!");
412 if (y.N()!=
M()) DUNE_THROW(
ISTLError,
"vector/matrix size mismatch!");
419 (*j).mmtv(x[i.index()],y[j.index()]);
424 template<
class X,
class Y>
427 #ifdef DUNE_ISTL_WITH_CHECKING
428 if (x.N()!=
N()) DUNE_THROW(
ISTLError,
"vector/matrix size mismatch!");
429 if (y.N()!=
M()) DUNE_THROW(
ISTLError,
"vector/matrix size mismatch!");
436 (*j).usmtv(alpha,x[i.index()],y[j.index()]);
441 template<
class X,
class Y>
442 void umhv (
const X& x, Y& y)
const
444 #ifdef DUNE_ISTL_WITH_CHECKING
445 if (x.N()!=
N()) DUNE_THROW(
ISTLError,
"vector/matrix size mismatch!");
446 if (y.N()!=
M()) DUNE_THROW(
ISTLError,
"vector/matrix size mismatch!");
453 (*j).umhv(x[i.index()],y[j.index()]);
458 template<
class X,
class Y>
459 void mmhv (
const X& x, Y& y)
const
461 #ifdef DUNE_ISTL_WITH_CHECKING
462 if (x.N()!=
N()) DUNE_THROW(
ISTLError,
"vector/matrix size mismatch!");
463 if (y.N()!=
M()) DUNE_THROW(
ISTLError,
"vector/matrix size mismatch!");
470 (*j).mmhv(x[i.index()],y[j.index()]);
475 template<
class X,
class Y>
478 #ifdef DUNE_ISTL_WITH_CHECKING
479 if (x.N()!=
N()) DUNE_THROW(
ISTLError,
"vector/matrix size mismatch!");
480 if (y.N()!=
M()) DUNE_THROW(
ISTLError,
"vector/matrix size mismatch!");
487 (*j).usmhv(alpha,x[i.index()],y[j.index()]);
517 max = std::max(max,sum);
530 max = std::max(max,sum);
540 #ifdef DUNE_ISTL_WITH_CHECKING
541 if (i<0 || i>=
N()) DUNE_THROW(
ISTLError,
"row index out of range");
542 if (j<0 || i>=
M()) DUNE_THROW(
ISTLError,
"column index out of range");
564 template<
class T,
class A>
565 template<
class X,
class Y>
568 #ifdef DUNE_ISTL_WITH_CHECKING
570 DUNE_THROW(
ISTLError,
"Vector size doesn't match the number of matrix rows!");
575 for (
size_type i=0; i<out.size(); i++ ) {
577 out[i] += (*
this)[j][i]*vec[j];