DistributedMatrixInline.cxx
1 // Copyright (C) 2014 INRIA
2 // Author(s): Marc DuruflĂ©
3 //
4 // This file is part of the linear-algebra library Seldon,
5 // http://seldon.sourceforge.net/.
6 //
7 // Seldon is free software; you can redistribute it and/or modify it under the
8 // terms of the GNU Lesser General Public License as published by the Free
9 // Software Foundation; either version 2.1 of the License, or (at your option)
10 // any later version.
11 //
12 // Seldon is distributed in the hope that it will be useful, but WITHOUT ANY
13 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
15 // more details.
16 //
17 // You should have received a copy of the GNU Lesser General Public License
18 // along with Seldon. If not, see http://www.gnu.org/licenses/.
19 
20 #ifndef SELDON_FILE_DISTRIBUTED_MATRIX_INLINE_CXX
21 
22 #include "DistributedMatrix.hxx"
23 
24 namespace Seldon
25 {
26 
27  /**************************
28  * DistributedMatrix_Base *
29  **************************/
30 
31 
33  template<class T>
35  {
36  return comm_;
37  }
38 
39 
41  template<class T>
42  inline const MPI_Comm& DistributedMatrix_Base<T>::GetCommunicator() const
43  {
44  return comm_;
45  }
46 
47 
49  template<class T>
51  {
52  return dist_col.GetM();
53  }
54 
55 
57  template<class T>
59  {
60  return dist_row.GetM();
61  }
62 
63 
65  template<class T>
67  {
68  return nglob_;
69  }
70 
71 
73  template<class T>
75  {
76  return nodl_scalar_;
77  }
78 
79 
81  template<class T>
83  {
84  return nb_unknowns_scal_;
85  }
86 
87 
90 
97  template<class T>
98  inline void DistributedMatrix_Base<T>::
99  AddDistantInteraction(int i, int jglob, int proc2, const T& val)
100  {
101  if (local_number_distant_values)
102  SwitchToGlobalNumbers();
103 
104  AddDistantValue(dist_col(i), proc_col(i), jglob, proc2, val);
105  }
106 
107 
109 
116  template<class T>
117  inline void DistributedMatrix_Base<T>
119  int proc2, const T& val)
120  {
121  if (local_number_distant_values)
122  SwitchToGlobalNumbers();
123 
124  AddDistantValue(dist_row(j), proc_row(j), iglob, proc2, val);
125  }
126 
127 
129  template<class T>
130  inline long DistributedMatrix_Base<T>
132  {
133  return size_max_distant_col;
134  }
135 
136 
138  template<class T>
139  inline long DistributedMatrix_Base<T>
141  {
142  return size_max_distant_row;
143  }
144 
145 
147  template<class T>
148  inline bool DistributedMatrix_Base<T>
150  {
151  return local_number_distant_values;
152  }
153 
154 
156  template<class T>
158  {
159  local_number_distant_values = all_zero;
160  }
161 
162 
164  template<class T>
166  {
167  return dist_col(i).GetM();
168  }
169 
170 
172  template<class T>
173  inline int DistributedMatrix_Base<T>::IndexGlobalCol(int i, int j) const
174  {
175  if (this->local_number_distant_values)
176  return global_col_to_recv(dist_col(i).Index(j));
177 
178  return dist_col(i).Index(j);
179  }
180 
181 
183  template<class T>
184  inline int DistributedMatrix_Base<T>::ProcessorDistantCol(int i, int j) const
185  {
186  return proc_col(i)(j);
187  }
188 
189 
191  template<class T>
192  inline const T& DistributedMatrix_Base<T>::ValueDistantCol(int i, int j) const
193  {
194  return dist_col(i).Value(j);
195  }
196 
197 
199  template<class T>
201  {
202  return dist_row(i).GetM();
203  }
204 
205 
207  template<class T>
208  inline int DistributedMatrix_Base<T>::IndexGlobalRow(int i, int j) const
209  {
210  if (this->local_number_distant_values)
211  return global_row_to_recv(dist_row(i).Index(j));
212 
213  return dist_row(i).Index(j);
214  }
215 
216 
218  template<class T>
219  inline int DistributedMatrix_Base<T>::ProcessorDistantRow(int i, int j) const
220  {
221  return proc_row(i)(j);
222  }
223 
224 
226  template<class T>
227  inline const T& DistributedMatrix_Base<T>::ValueDistantRow(int i, int j) const
228  {
229  return dist_row(i).Value(j);
230  }
231 
232 
233  /*********************
234  * DistributedMatrix *
235  *********************/
236 
237 
239  template<class T, class Prop, class Storage, class Allocator>
241  ::AddDistantInteraction(int i, int jglob, int proc, const T& val)
242  {
244  }
245 
246 
248  template<class T, class Prop, class Storage, class Allocator>
250  ::AddRowDistantInteraction(int iglob, int j, int proc, const T& val)
251  {
253  }
254 
255 
256 #ifdef SELDON_WITH_VIRTUAL
257  template <class T, class Prop, class Storage, class Allocator>
259  ::ApplySor(const SeldonTranspose& trans, Vector<Treal>& x, const Vector<Treal>& r,
260  const typename ClassComplexType<T>::Treal& omega,
261  int nb_iter, int stage_ssor) const
262  {
263  SOR(trans, *this, x, r, omega, nb_iter, stage_ssor);
264  }
265 
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
271  {
272  SOR(trans, *this, x, r, omega, nb_iter, stage_ssor);
273  }
274 
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
279  {
280  MltAdd(alpha, *this, x, beta, y);
281  }
282 
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
287  {
288  MltAdd(alpha, *this, x, beta, y);
289  }
290 
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
296  {
297  MltAdd(alpha, trans, *this, x, beta, y);
298  }
299 
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
305  {
306  MltAdd(alpha, trans, *this, x, beta, y);
307  }
308 
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
312  {
313  Mlt(*this, x, y);
314  }
315 
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
319  {
320  Mlt(*this, x, y);
321  }
322 
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
327  {
328  Mlt(trans, *this, x, y);
329  }
330 
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
335  {
336  Mlt(trans, *this, x, y);
337  }
338 #endif
339 
340 
342  template<class T, class Prop1, class Storage1, class Allocator1,
343  class Prop2, class Storage2, class Allocator2>
344  inline void Copy(const DistributedMatrix<complex<T>, Prop1, Storage1, Allocator1>& A,
346  {
347  throw WrongArgument("Copy", "incompatible types");
348  }
349 
350 
351  /****************************************
352  * Mlt, MltAdd for distributed matrices *
353  ****************************************/
354 
355 
356  template<class T, class Prop, class Storage, class Allocator>
357  inline void Mlt(const T& alpha,
358  DistributedMatrix<T, Prop, Storage, Allocator>& A)
359  {
360  MltScalar(alpha, A);
361  }
362 
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)
366  {
367  MltScalar(alpha, A);
368  }
369 
370 
372  template <class T0, class Prop0, class Storage0, class Allocator0,
373  class T1, class Storage1, class Allocator1,
374  class T2, class Storage2, class Allocator2>
377  Vector<T2, Storage2, Allocator2>& Y, bool assemble)
378  {
379  T2 one, zero;
380  SetComplexOne(one);
381  SetComplexZero(zero);
382  Y.Fill(zero);
383  MltAddVector(one, M, X, zero, Y, assemble);
384  }
385 
386 
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,
394  Vector<T3, Storage3, Allocator3>& Y, bool assemble)
395  {
396  T3 zero;
397  SetComplexZero(zero);
398  Y.Fill(zero);
399  MltAddVector(alpha, M, X, zero, Y, assemble);
400  }
401 
402 
404  template <class T1, class Prop1, class Storage1, class Allocator1,
405  class T2, class Storage2, class Allocator2,
406  class T3, class Storage3, class Allocator3>
407  inline void MltVector(const SeldonTranspose& Trans,
410  Vector<T3, Storage3, Allocator3>& Y, bool assemble)
411  {
412  T3 one, zero;
413  SetComplexOne(one);
414  SetComplexZero(zero);
415  Y.Fill(zero);
416  MltAddVector(one, Trans, M, X, zero, Y, assemble);
417  }
418 
419 
421  template<class T0, class T1, class Prop1, class Storage1, class Allocator1>
422  inline void MltScalar(const T0& alpha,
424  {
425  A *= alpha;
426  }
427 
428 
429  template <class T,
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)
435  {
436  AddMatrix(alpha, A, B);
437  }
438 
439  template <class T,
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)
445  {
446  AddMatrix(alpha, A, B);
447  }
448 
449 
450  template <class T,
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)
456  {
457  AddMatrix(alpha, A, B);
458  }
459 
460  template <class T,
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)
466  {
467  throw WrongArgument("Add", "incompatible types");
468  }
469 
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)
473  {
474  MltVector(A, X, Y, assemble);
475  }
476 
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,
480  bool assemble)
481  {
482  MltVector(A, X, Y, assemble);
483  }
484 
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)
488  {
489  throw WrongArgument("MltComplex", "Incompatible matrix-vector product");
490  }
491 
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)
496  {
497  MltVector(trans, A, X, Y, assemble);
498  }
499 
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,
504  bool assemble)
505  {
506  MltVector(trans, A, X, Y, assemble);
507  }
508 
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)
513  {
514  throw WrongArgument("MltComplex", "Incompatible matrix-vector product");
515  }
516 
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)
521  {
522  MltAddVector(alpha, A, X, beta, Y, assemble);
523  }
524 
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)
530  {
531  MltAddVector(alpha, A, X, beta, Y, assemble);
532  }
533 
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)
538  {
539  throw WrongArgument("MltAddComplex", "Incompatible matrix-vector product");
540  }
541 
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)
546  {
547  MltAddVector(alpha, trans, A, X, beta, Y, assemble);
548  }
549 
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)
555  {
556  MltAddVector(alpha, trans, A, X, beta, Y, assemble);
557  }
558 
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)
563  {
564  throw WrongArgument("MltAddComplex", "Incompatible matrix-vector product");
565  }
566 
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)
574  {
575  SorVector(M, Y, X, omega, iter, type_ssor);
576  }
577 
578 
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)
587  {
588  SorVector(trans, M, Y, X, omega, iter, type_ssor);
589  }
590 
591 
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)
599  {
600  SorVector(M, Y, X, omega, iter, type_ssor);
601  }
602 
603 
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)
612  {
613  SorVector(trans, M, Y, X, omega, iter, type_ssor);
614  }
615 
616 
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)
624  {
625  throw WrongArgument("SorVector", "Incompatible matrix-vector product");
626  }
627 
628 
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)
637  {
638  throw WrongArgument("SorVector", "Incompatible matrix-vector product");
639  }
640 
641 }
642 
643 #define SELDON_FILE_DISTRIBUTED_MATRIX_INLINE_CXX
644 #endif
645 
Seldon::DistributedMatrix_Base::GetLocalN
int GetLocalN() const
returns the local number of columns
Definition: DistributedMatrixInline.cxx:58
Seldon::DistributedMatrix_Base::GetNbScalarUnknowns
int GetNbScalarUnknowns() const
returns the number of scalar unknowns
Definition: DistributedMatrixInline.cxx:82
Seldon::SeldonTranspose
Definition: MatrixFlag.hxx:32
Seldon::MltScalar
void MltScalar(const T0 &alpha, Array3D< T, Allocator > &A)
Multiplication of all elements of a 3D array by a scalar.
Definition: Array3D.cxx:539
Seldon::Vector< Treal >
Seldon::DistributedMatrix::AddRowDistantInteraction
void AddRowDistantInteraction(int iglob, int j, int proc, const T &val)
Adds val for global row iglob and local column j (proc owns the row)
Definition: DistributedMatrixInline.cxx:250
Seldon::DistributedMatrix_Base::GetDistantRowSize
int GetDistantRowSize(int i) const
returns the number of distant non-zero entries for the local column i
Definition: DistributedMatrixInline.cxx:200
Seldon::DistributedMatrix_Base::IndexGlobalCol
int IndexGlobalCol(int i, int j) const
returns the global column number of distant non-zero entry j for the local row i
Definition: DistributedMatrixInline.cxx:173
Seldon::DistributedMatrix_Base::GetDistantColSize
int GetDistantColSize(int i) const
returns the number of distant non-zero entries for the local row i
Definition: DistributedMatrixInline.cxx:165
Seldon::DistributedMatrix_Base::AddRowDistantInteraction
void AddRowDistantInteraction(int iglob, int j, int proc, const T &val)
adding a non-zero entry, between a local row and a non-local row
Definition: DistributedMatrixInline.cxx:118
Seldon::DistributedMatrix_Base::ValueDistantCol
const T & ValueDistantCol(int i, int j) const
returns the value of distant non-zero entry j for the local row i
Definition: DistributedMatrixInline.cxx:192
Seldon::DistributedMatrix_Base::GetGlobalM
int GetGlobalM() const
returns the global number of rows
Definition: DistributedMatrixInline.cxx:66
Seldon::DistributedMatrix_Base::GetMaxDataSizeDistantRow
long GetMaxDataSizeDistantRow() const
returns the maximum number of values in dist_row to exchange
Definition: DistributedMatrixInline.cxx:140
Seldon::DistributedMatrix_Base::GetNodlScalar
int GetNodlScalar() const
returns the number of scalar unknowns
Definition: DistributedMatrixInline.cxx:74
Seldon::DistributedMatrix
matrix distributed over all the processors
Definition: DistributedMatrix.hxx:506
Seldon::WrongArgument
Definition: Errors.hxx:76
Seldon::DistributedMatrix_Base::ProcessorDistantRow
int ProcessorDistantRow(int i, int j) const
returns the processor associated with distant non-zero entry j for the local column i
Definition: DistributedMatrixInline.cxx:219
Seldon::DistributedMatrix_Base::GetLocalM
int GetLocalM() const
returns the local number of rows
Definition: DistributedMatrixInline.cxx:50
Seldon::SorVector
void SorVector(const Matrix< T0, Prop0, Storage0, Allocator0 > &M, Vector< T2, Storage2, Allocator2 > &Y, const Vector< T1, Storage1, Allocator1 > &X, const T3 &omega, int iter, int type_ssor)
Solve M Y = X with S.O.R. method.
Definition: Functions_MatVect.cxx:1638
Seldon
Seldon namespace.
Definition: Array.cxx:24
Seldon::DistributedMatrix::AddDistantInteraction
void AddDistantInteraction(int i, int jglob, int proc, const T &val)
Adds val for local row i and global column jglob (proc owns this column)
Definition: DistributedMatrixInline.cxx:241
Seldon::DistributedMatrix_Base::ProcessorDistantCol
int ProcessorDistantCol(int i, int j) const
returns the processor associated with distant non-zero entry j for the local row i
Definition: DistributedMatrixInline.cxx:184
Seldon::AddMatrix
void AddMatrix(const T0 &alpha, const Matrix< T1, Prop1, Storage1, Allocator1 > &A, Matrix< T2, Prop2, Storage2, Allocator2 > &B)
Adds two matrices.
Definition: Functions_Matrix.cxx:1619
Seldon::DistributedMatrix_Base::GetCommunicator
MPI_Comm & GetCommunicator()
returns MPI communicator (processors that will share the matrix)
Definition: DistributedMatrixInline.cxx:34
Seldon::DistributedMatrix_Base::ValueDistantRow
const T & ValueDistantRow(int i, int j) const
returns the value of distant non-zero entry j for the local column i
Definition: DistributedMatrixInline.cxx:227
Seldon::DistributedMatrix_Base::SetReadyForMltAdd
void SetReadyForMltAdd(bool all_zero=true)
tells that there are no distant rows (mltadd ready)
Definition: DistributedMatrixInline.cxx:157
Seldon::DistributedMatrix_Base::IsReadyForMltAdd
bool IsReadyForMltAdd() const
returns true if the matrix is ready to perform a matrix-vector product
Definition: DistributedMatrixInline.cxx:149
Seldon::DistributedMatrix_Base::IndexGlobalRow
int IndexGlobalRow(int i, int j) const
returns the global row number of distant non-zero entry j for the local column i
Definition: DistributedMatrixInline.cxx:208
Seldon::DistributedMatrix_Base::AddDistantInteraction
void AddDistantInteraction(int i, int jglob, int proc, const T &val)
adding a non-zero entry, between a local column and a non-local column
Definition: DistributedMatrixInline.cxx:99
Seldon::DistributedMatrix_Base::GetMaxDataSizeDistantCol
long GetMaxDataSizeDistantCol() const
returns the maximum number of values in dist_col to exchange
Definition: DistributedMatrixInline.cxx:131