14 #include <dune/common/ftraits.hh>
23 template<
class T,
class A=std::allocator<T> >
139 #ifdef DUNE_ISTL_WITH_CHECKING
141 DUNE_THROW(
ISTLError,
"Can't access negative rows!");
143 DUNE_THROW(
ISTLError,
"Row index out of range!");
150 #ifdef DUNE_ISTL_WITH_CHECKING
152 DUNE_THROW(
ISTLError,
"Can't access negative rows!");
154 DUNE_THROW(
ISTLError,
"Row index out of range!");
171 #ifdef DUNE_ISTL_WITH_CHECKING
173 DUNE_THROW(
ISTLError,
"Can't compute rowdim() when there are no columns!");
184 #ifdef DUNE_ISTL_WITH_CHECKING
186 DUNE_THROW(
ISTLError,
"Can't compute coldim() when there are no rows!");
197 #ifdef DUNE_ISTL_WITH_CHECKING
199 DUNE_THROW(
ISTLError,
"Rowdim for nonexisting row " << r <<
" requested!");
201 DUNE_THROW(
ISTLError,
"Can't compute rowdim() when there are no columns!");
203 return data_[r][0].rowdim();
208 #ifdef DUNE_ISTL_WITH_CHECKING
210 DUNE_THROW(
ISTLError,
"Coldim for nonexisting column " << c <<
" requested!");
212 DUNE_THROW(
ISTLError,
"Can't compute coldim() when there are no rows!");
214 return data_[0][c].coldim();
235 #ifdef DUNE_ISTL_WITH_CHECKING
236 if(
N()!=b.
N() ||
M() != b.
M())
237 DUNE_THROW(RangeError,
"Matrix sizes do not match!");
249 #ifdef DUNE_ISTL_WITH_CHECKING
250 if(
N()!=b.
N() ||
M() != b.
M())
251 DUNE_THROW(RangeError,
"Matrix sizes do not match!");
262 out[j][i] = (*
this)[i][j];
275 out[i][j] += m1[i][k]*m2[k][j];
282 template <
class X,
class Y>
284 #ifdef DUNE_ISTL_WITH_CHECKING
285 if (m.
M()!=vec.size())
286 DUNE_THROW(
ISTLError,
"Vector size doesn't match the number of matrix columns!");
291 for (
size_type i=0; i<out.size(); i++ ) {
293 out[i] += m[i][j]*vec[j];
300 template <
class X,
class Y>
301 void mv(
const X& x, Y& y)
const
303 #ifdef DUNE_ISTL_WITH_CHECKING
304 if (x.N()!=
M()) DUNE_THROW(
ISTLError,
"vector/matrix size mismatch!");
305 if (y.N()!=
N()) DUNE_THROW(
ISTLError,
"vector/matrix size mismatch!");
311 (*
this)[i][j].umv(x[j], y[i]);
318 template<
class X,
class Y>
319 void mtv (
const X& x, Y& y)
const
321 #ifdef DUNE_ISTL_WITH_CHECKING
322 if (x.N()!=
N()) DUNE_THROW(
ISTLError,
"index out of range");
323 if (y.N()!=
M()) DUNE_THROW(
ISTLError,
"index out of range");
332 template <
class X,
class Y>
333 void umv(
const X& x, Y& y)
const
335 #ifdef DUNE_ISTL_WITH_CHECKING
336 if (x.N()!=
M()) DUNE_THROW(
ISTLError,
"vector/matrix size mismatch!");
337 if (y.N()!=
N()) DUNE_THROW(
ISTLError,
"vector/matrix size mismatch!");
343 (*
this)[i][j].umv(x[j], y[i]);
350 template<
class X,
class Y>
351 void mmv (
const X& x, Y& y)
const
353 #ifdef DUNE_ISTL_WITH_CHECKING
354 if (x.N()!=
M()) DUNE_THROW(
ISTLError,
"vector/matrix size mismatch!");
355 if (y.N()!=
N()) DUNE_THROW(
ISTLError,
"vector/matrix size mismatch!");
362 (*j).mmv(x[j.index()],y[i.index()]);
367 template <
class X,
class Y>
370 #ifdef DUNE_ISTL_WITH_CHECKING
371 if (x.N()!=
M()) DUNE_THROW(
ISTLError,
"vector/matrix size mismatch!");
372 if (y.N()!=
N()) DUNE_THROW(
ISTLError,
"vector/matrix size mismatch!");
378 (*
this)[i][j].usmv(alpha, x[j], y[i]);
385 template<
class X,
class Y>
386 void umtv (
const X& x, Y& y)
const
388 #ifdef DUNE_ISTL_WITH_CHECKING
389 if (x.N()!=
N()) DUNE_THROW(
ISTLError,
"vector/matrix size mismatch!");
390 if (y.N()!=
M()) DUNE_THROW(
ISTLError,
"vector/matrix size mismatch!");
397 (*j).umtv(x[i.index()],y[j.index()]);
402 template<
class X,
class Y>
403 void mmtv (
const X& x, Y& y)
const
405 #ifdef DUNE_ISTL_WITH_CHECKING
406 if (x.N()!=
N()) DUNE_THROW(
ISTLError,
"vector/matrix size mismatch!");
407 if (y.N()!=
M()) DUNE_THROW(
ISTLError,
"vector/matrix size mismatch!");
414 (*j).mmtv(x[i.index()],y[j.index()]);
419 template<
class X,
class Y>
422 #ifdef DUNE_ISTL_WITH_CHECKING
423 if (x.N()!=
N()) DUNE_THROW(
ISTLError,
"vector/matrix size mismatch!");
424 if (y.N()!=
M()) DUNE_THROW(
ISTLError,
"vector/matrix size mismatch!");
431 (*j).usmtv(alpha,x[i.index()],y[j.index()]);
436 template<
class X,
class Y>
437 void umhv (
const X& x, Y& y)
const
439 #ifdef DUNE_ISTL_WITH_CHECKING
440 if (x.N()!=
N()) DUNE_THROW(
ISTLError,
"vector/matrix size mismatch!");
441 if (y.N()!=
M()) DUNE_THROW(
ISTLError,
"vector/matrix size mismatch!");
448 (*j).umhv(x[i.index()],y[j.index()]);
453 template<
class X,
class Y>
454 void mmhv (
const X& x, Y& y)
const
456 #ifdef DUNE_ISTL_WITH_CHECKING
457 if (x.N()!=
N()) DUNE_THROW(
ISTLError,
"vector/matrix size mismatch!");
458 if (y.N()!=
M()) DUNE_THROW(
ISTLError,
"vector/matrix size mismatch!");
465 (*j).mmhv(x[i.index()],y[j.index()]);
470 template<
class X,
class Y>
473 #ifdef DUNE_ISTL_WITH_CHECKING
474 if (x.N()!=
N()) DUNE_THROW(
ISTLError,
"vector/matrix size mismatch!");
475 if (y.N()!=
M()) DUNE_THROW(
ISTLError,
"vector/matrix size mismatch!");
482 (*j).usmhv(alpha,x[i.index()],y[j.index()]);
512 max = std::max(max,sum);
525 max = std::max(max,sum);
535 #ifdef DUNE_ISTL_WITH_CHECKING
536 if (i<0 || i>=
N()) DUNE_THROW(
ISTLError,
"row index out of range");
537 if (j<0 || i>=
M()) DUNE_THROW(
ISTLError,
"column index out of range");