20 #ifndef SELDON_FILE_DISTRIBUTED_MATRIX_INLINE_CXX
22 #include "DistributedMatrix.hxx"
52 return dist_col.GetM();
60 return dist_row.GetM();
84 return nb_unknowns_scal_;
101 if (local_number_distant_values)
102 SwitchToGlobalNumbers();
104 AddDistantValue(dist_col(i), proc_col(i), jglob, proc2, val);
119 int proc2,
const T& val)
121 if (local_number_distant_values)
122 SwitchToGlobalNumbers();
124 AddDistantValue(dist_row(j), proc_row(j), iglob, proc2, val);
133 return size_max_distant_col;
142 return size_max_distant_row;
151 return local_number_distant_values;
159 local_number_distant_values = all_zero;
167 return dist_col(i).GetM();
175 if (this->local_number_distant_values)
176 return global_col_to_recv(dist_col(i).Index(j));
178 return dist_col(i).Index(j);
186 return proc_col(i)(j);
194 return dist_col(i).Value(j);
202 return dist_row(i).GetM();
210 if (this->local_number_distant_values)
211 return global_row_to_recv(dist_row(i).Index(j));
213 return dist_row(i).Index(j);
221 return proc_row(i)(j);
229 return dist_row(i).Value(j);
239 template<
class T,
class Prop,
class Storage,
class Allocator>
248 template<
class T,
class Prop,
class Storage,
class Allocator>
256 #ifdef SELDON_WITH_VIRTUAL
257 template <
class T,
class Prop,
class Storage,
class Allocator>
260 const typename ClassComplexType<T>::Treal& omega,
261 int nb_iter,
int stage_ssor)
const
263 SOR(trans, *
this, x, r, omega, nb_iter, stage_ssor);
266 template <
class T,
class Prop,
class Storage,
class Allocator>
267 inline void DistributedMatrix<T, Prop, Storage, Allocator>
268 ::ApplySor(
const SeldonTranspose& trans, Vector<Tcplx>& x,
const Vector<Tcplx>& r,
269 const typename ClassComplexType<T>::Treal& omega,
270 int nb_iter,
int stage_ssor)
const
272 SOR(trans, *
this, x, r, omega, nb_iter, stage_ssor);
275 template <
class T,
class Prop,
class Storage,
class Allocator>
276 inline void DistributedMatrix<T, Prop, Storage, Allocator>
277 ::MltAddVector(
const Treal& alpha,
const Vector<Treal>& x,
278 const Treal& beta, Vector<Treal>& y)
const
280 MltAdd(alpha, *
this, x, beta, y);
283 template <
class T,
class Prop,
class Storage,
class Allocator>
284 inline void DistributedMatrix<T, Prop, Storage, Allocator>
285 ::MltAddVector(
const Tcplx& alpha,
const Vector<Tcplx>& x,
286 const Tcplx& beta, Vector<Tcplx>& y)
const
288 MltAdd(alpha, *
this, x, beta, y);
291 template <
class T,
class Prop,
class Storage,
class Allocator>
292 inline void DistributedMatrix<T, Prop, Storage, Allocator>
293 ::MltAddVector(
const Treal& alpha,
const SeldonTranspose& trans,
294 const Vector<Treal>& x,
295 const Treal& beta, Vector<Treal>& y)
const
297 MltAdd(alpha, trans, *
this, x, beta, y);
300 template <
class T,
class Prop,
class Storage,
class Allocator>
301 inline void DistributedMatrix<T, Prop, Storage, Allocator>
302 ::MltAddVector(
const Tcplx& alpha,
const SeldonTranspose& trans,
303 const Vector<Tcplx>& x,
304 const Tcplx& beta, Vector<Tcplx>& y)
const
306 MltAdd(alpha, trans, *
this, x, beta, y);
309 template <
class T,
class Prop,
class Storage,
class Allocator>
310 inline void DistributedMatrix<T, Prop, Storage, Allocator>
311 ::MltVector(
const Vector<Treal>& x, Vector<Treal>& y)
const
316 template <
class T,
class Prop,
class Storage,
class Allocator>
317 inline void DistributedMatrix<T, Prop, Storage, Allocator>
318 ::MltVector(
const Vector<Tcplx>& x, Vector<Tcplx>& y)
const
323 template <
class T,
class Prop,
class Storage,
class Allocator>
324 inline void DistributedMatrix<T, Prop, Storage, Allocator>
325 ::MltVector(
const SeldonTranspose& trans,
326 const Vector<Treal>& x, Vector<Treal>& y)
const
328 Mlt(trans, *
this, x, y);
331 template <
class T,
class Prop,
class Storage,
class Allocator>
332 inline void DistributedMatrix<T, Prop, Storage, Allocator>
333 ::MltVector(
const SeldonTranspose& trans,
334 const Vector<Tcplx>& x, Vector<Tcplx>& y)
const
336 Mlt(trans, *
this, x, y);
342 template<
class T,
class Prop1,
class Storage1,
class Allocator1,
343 class Prop2,
class Storage2,
class Allocator2>
356 template<
class T,
class Prop,
class Storage,
class Allocator>
357 inline void Mlt(
const T& alpha,
358 DistributedMatrix<T, Prop, Storage, Allocator>& A)
363 template<
class T,
class Prop,
class Storage,
class Allocator>
364 inline void Mlt(
const T& alpha,
365 DistributedMatrix<complex<T>, Prop, Storage, Allocator>& A)
372 template <
class T0,
class Prop0,
class Storage0,
class Allocator0,
373 class T1,
class Storage1,
class Allocator1,
374 class T2,
class Storage2,
class Allocator2>
381 SetComplexZero(zero);
383 MltAddVector(one, M, X, zero, Y, assemble);
388 template <
class T1,
class Prop1,
class Storage1,
class Allocator1,
389 class T2,
class Storage2,
class Allocator2,
390 class T3,
class Storage3,
class Allocator3>
391 inline void MltVector(
const T3& alpha,
397 SetComplexZero(zero);
399 MltAddVector(alpha, M, X, zero, Y, assemble);
404 template <
class T1,
class Prop1,
class Storage1,
class Allocator1,
405 class T2,
class Storage2,
class Allocator2,
406 class T3,
class Storage3,
class Allocator3>
414 SetComplexZero(zero);
416 MltAddVector(one, Trans, M, X, zero, Y, assemble);
421 template<
class T0,
class T1,
class Prop1,
class Storage1,
class Allocator1>
430 class Prop1,
class Storage1,
class Allocator1,
431 class Prop2,
class Storage2,
class Allocator2>
432 inline void Add(
const T& alpha,
433 const DistributedMatrix<T, Prop1, Storage1, Allocator1>& A,
434 DistributedMatrix<T, Prop2, Storage2, Allocator2>& B)
440 class Prop1,
class Storage1,
class Allocator1,
441 class Prop2,
class Storage2,
class Allocator2>
442 inline void Add(
const complex<T>& alpha,
443 const DistributedMatrix<T, Prop1, Storage1, Allocator1>& A,
444 DistributedMatrix<complex<T>, Prop2, Storage2, Allocator2>& B)
451 class Prop1,
class Storage1,
class Allocator1,
452 class Prop2,
class Storage2,
class Allocator2>
453 inline void Add(
const T& alpha,
454 const DistributedMatrix<complex<T>, Prop1, Storage1, Allocator1>& A,
455 DistributedMatrix<complex<T>, Prop2, Storage2, Allocator2>& B)
461 class Prop1,
class Storage1,
class Allocator1,
462 class Prop2,
class Storage2,
class Allocator2>
463 inline void Add(
const T& alpha,
464 const DistributedMatrix<complex<T>, Prop1, Storage1, Allocator1>& A,
465 DistributedMatrix<T, Prop2, Storage2, Allocator2>& B)
467 throw WrongArgument(
"Add",
"incompatible types");
470 template<
class T0,
class Prop0,
class Storage0,
class Allocator0>
471 inline void Mlt(
const DistributedMatrix<T0, Prop0, Storage0, Allocator0>& A,
472 const Vector<T0>& X, Vector<T0>& Y,
bool assemble)
474 MltVector(A, X, Y, assemble);
477 template<
class T0,
class Prop0,
class Storage0,
class Allocator0>
478 inline void Mlt(
const DistributedMatrix<T0, Prop0, Storage0, Allocator0>& A,
479 const Vector<complex<T0> >& X, Vector<complex<T0> >& Y,
482 MltVector(A, X, Y, assemble);
485 template<
class T0,
class Prop0,
class Storage0,
class Allocator0>
486 inline void Mlt(
const DistributedMatrix<complex<T0>, Prop0, Storage0, Allocator0>& A,
487 const Vector<T0>& X, Vector<T0>& Y,
bool assemble)
489 throw WrongArgument(
"MltComplex",
"Incompatible matrix-vector product");
492 template<
class T0,
class Prop0,
class Storage0,
class Allocator0>
493 inline void Mlt(
const SeldonTranspose& trans,
494 const DistributedMatrix<T0, Prop0, Storage0, Allocator0>& A,
495 const Vector<T0>& X, Vector<T0>& Y,
bool assemble)
497 MltVector(trans, A, X, Y, assemble);
500 template<
class T0,
class Prop0,
class Storage0,
class Allocator0>
501 inline void Mlt(
const SeldonTranspose& trans,
502 const DistributedMatrix<T0, Prop0, Storage0, Allocator0>& A,
503 const Vector<complex<T0> >& X, Vector<complex<T0> >& Y,
506 MltVector(trans, A, X, Y, assemble);
509 template<
class T0,
class Prop0,
class Storage0,
class Allocator0>
510 inline void Mlt(
const SeldonTranspose& trans,
511 const DistributedMatrix<complex<T0>, Prop0, Storage0, Allocator0>& A,
512 const Vector<T0>& X, Vector<T0>& Y,
bool assemble)
514 throw WrongArgument(
"MltComplex",
"Incompatible matrix-vector product");
517 template<
class T0,
class Prop0,
class Storage0,
class Allocator0>
518 inline void MltAdd(
const T0& alpha,
519 const DistributedMatrix<T0, Prop0, Storage0, Allocator0>& A,
520 const Vector<T0>& X,
const T0& beta, Vector<T0>& Y,
bool assemble)
522 MltAddVector(alpha, A, X, beta, Y, assemble);
525 template<
class T0,
class Prop0,
class Storage0,
class Allocator0>
526 inline void MltAdd(
const complex<T0>& alpha,
527 const DistributedMatrix<T0, Prop0, Storage0, Allocator0>& A,
528 const Vector<complex<T0> >& X,
const complex<T0>& beta,
529 Vector<complex<T0> >& Y,
bool assemble)
531 MltAddVector(alpha, A, X, beta, Y, assemble);
534 template<
class T0,
class Prop0,
class Storage0,
class Allocator0>
535 inline void MltAdd(
const T0& alpha,
536 const DistributedMatrix<complex<T0>, Prop0, Storage0, Allocator0>& A,
537 const Vector<T0>& X,
const T0& beta, Vector<T0>& Y,
bool assemble)
539 throw WrongArgument(
"MltAddComplex",
"Incompatible matrix-vector product");
542 template<
class T0,
class Prop0,
class Storage0,
class Allocator0>
543 inline void MltAdd(
const T0& alpha,
const SeldonTranspose& trans,
544 const DistributedMatrix<T0, Prop0, Storage0, Allocator0>& A,
545 const Vector<T0>& X,
const T0& beta, Vector<T0>& Y,
bool assemble)
547 MltAddVector(alpha, trans, A, X, beta, Y, assemble);
550 template<
class T0,
class Prop0,
class Storage0,
class Allocator0>
551 inline void MltAdd(
const complex<T0>& alpha,
const SeldonTranspose& trans,
552 const DistributedMatrix<T0, Prop0, Storage0, Allocator0>& A,
553 const Vector<complex<T0> >& X,
const complex<T0>& beta,
554 Vector<complex<T0> >& Y,
bool assemble)
556 MltAddVector(alpha, trans, A, X, beta, Y, assemble);
559 template<
class T0,
class Prop0,
class Storage0,
class Allocator0>
560 inline void MltAdd(
const T0& alpha,
const SeldonTranspose& trans,
561 const DistributedMatrix<complex<T0>, Prop0, Storage0, Allocator0>& A,
562 const Vector<T0>& X,
const T0& beta, Vector<T0>& Y,
bool assemble)
564 throw WrongArgument(
"MltAddComplex",
"Incompatible matrix-vector product");
567 template <
class T,
class Prop0,
class Storage0,
class Allocator0,
568 class Storage1,
class Allocator1,
569 class Storage2,
class Allocator2>
570 inline void SOR(
const DistributedMatrix<T, Prop0, Storage0, Allocator0>& M,
571 Vector<T, Storage2, Allocator2>& Y,
572 const Vector<T, Storage1, Allocator1>& X,
573 const T& omega,
int iter,
int type_ssor)
575 SorVector(M, Y, X, omega, iter, type_ssor);
579 template <
class T,
class Prop0,
class Storage0,
class Allocator0,
580 class Storage1,
class Allocator1,
581 class Storage2,
class Allocator2>
582 inline void SOR(
const SeldonTranspose& trans,
583 const DistributedMatrix<T, Prop0, Storage0, Allocator0>& M,
584 Vector<T, Storage2, Allocator2>& Y,
585 const Vector<T, Storage1, Allocator1>& X,
586 const T& omega,
int iter,
int type_ssor)
588 SorVector(trans, M, Y, X, omega, iter, type_ssor);
592 template <
class T,
class Prop0,
class Storage0,
class Allocator0,
593 class Storage1,
class Allocator1,
594 class Storage2,
class Allocator2>
595 inline void SOR(
const DistributedMatrix<T, Prop0, Storage0, Allocator0>& M,
596 Vector<complex<T>, Storage2, Allocator2>& Y,
597 const Vector<complex<T>, Storage1, Allocator1>& X,
598 const T& omega,
int iter,
int type_ssor)
600 SorVector(M, Y, X, omega, iter, type_ssor);
604 template <
class T,
class Prop0,
class Storage0,
class Allocator0,
605 class Storage1,
class Allocator1,
606 class Storage2,
class Allocator2>
607 inline void SOR(
const SeldonTranspose& trans,
608 const DistributedMatrix<T, Prop0, Storage0, Allocator0>& M,
609 Vector<complex<T>, Storage2, Allocator2>& Y,
610 const Vector<complex<T>, Storage1, Allocator1>& X,
611 const T& omega,
int iter,
int type_ssor)
613 SorVector(trans, M, Y, X, omega, iter, type_ssor);
617 template <
class T,
class Prop0,
class Storage0,
class Allocator0,
618 class Storage1,
class Allocator1,
619 class Storage2,
class Allocator2>
620 inline void SOR(
const DistributedMatrix<complex<T>, Prop0, Storage0, Allocator0>& M,
621 Vector<T, Storage2, Allocator2>& Y,
622 const Vector<T, Storage1, Allocator1>& X,
623 const T& omega,
int iter,
int type_ssor)
625 throw WrongArgument(
"SorVector",
"Incompatible matrix-vector product");
629 template <
class T,
class Prop0,
class Storage0,
class Allocator0,
630 class Storage1,
class Allocator1,
631 class Storage2,
class Allocator2>
632 inline void SOR(
const SeldonTranspose&,
633 const DistributedMatrix<complex<T>, Prop0, Storage0, Allocator0>& M,
634 Vector<T, Storage2, Allocator2>& Y,
635 const Vector<T, Storage1, Allocator1>& X,
636 const T& omega,
int iter,
int type_ssor)
638 throw WrongArgument(
"SorVector",
"Incompatible matrix-vector product");
643 #define SELDON_FILE_DISTRIBUTED_MATRIX_INLINE_CXX