Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
Seldon::DistributedMatrix_Base< T > Class Template Reference

Base class for distributed matrix over all the processors. More...

#include <DistributedMatrix.hxx>

Inheritance diagram for Seldon::DistributedMatrix_Base< T >:
Seldon::DistributedMatrix< T, Prop, Storage, Allocator >

Public Member Functions

template<class T2 >
void AssembleVec (Vector< T2 > &) const
 assembles the vector (adds values of shared rows)
 
 DistributedMatrix_Base ()
 default constructor
 
 DistributedMatrix_Base (int m, int n)
 construction of an m by n matrix More...
 
MPI_Comm & GetCommunicator ()
 returns MPI communicator (processors that will share the matrix)
 
const MPI_Comm & GetCommunicator () const
 
int GetLocalM () const
 returns the local number of rows
 
int GetLocalN () const
 returns the local number of columns
 
int GetGlobalM () const
 returns the global number of rows
 
int GetNodlScalar () const
 returns the number of scalar unknowns
 
int GetNbScalarUnknowns () const
 returns the number of scalar unknowns
 
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 More...
 
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 More...
 
long GetMaxDataSizeDistantCol () const
 returns the maximum number of values in dist_col to exchange
 
long GetMaxDataSizeDistantRow () const
 returns the maximum number of values in dist_row to exchange
 
bool IsReadyForMltAdd () const
 returns true if the matrix is ready to perform a matrix-vector product
 
void SetReadyForMltAdd (bool all_zero=true)
 tells that there are no distant rows (mltadd ready)
 
int GetDistantColSize (int i) const
 returns the number of distant non-zero entries for the local row i
 
int IndexGlobalCol (int i, int j) const
 returns the global column number of distant non-zero entry j for the local row i
 
int ProcessorDistantCol (int i, int j) const
 returns the processor associated with distant non-zero entry j for the local row i
 
const T & ValueDistantCol (int i, int j) const
 returns the value of distant non-zero entry j for the local row i
 
int GetDistantRowSize (int i) const
 returns the number of distant non-zero entries for the local column i
 
int IndexGlobalRow (int i, int j) const
 returns the global row number of distant non-zero entry j for the local column i
 
int ProcessorDistantRow (int i, int j) const
 returns the processor associated with distant non-zero entry j for the local column i
 
const T & ValueDistantRow (int i, int j) const
 returns the value of distant non-zero entry j for the local column i
 
void Init (int n, IVect *, IVect *, IVect *, int, int, IVect *, Vector< IVect > *, const MPI_Comm &)
 Initialisation of pointers. More...
 
void Init (DistributedMatrixIntegerArray &)
 Initialisation of pointers.
 
void Init (IVect &, const MPI_Comm &comm, DistributedMatrixIntegerArray &)
 Initialisation of pointers from global row numbers.
 
template<class T0 >
void Init (const DistributedMatrix_Base< T0 > &)
 inits pointers with those of A
 
void Init (Vector< IVect > &, IVect &, IVect &, IVect &, IVect &, Vector< IVect > &, const MPI_Comm &, bool distribute_row=true)
 initialisation of a distributed matrix with global row numbers
 
void Init (IVect &, IVect &, IVect &, IVect &, Vector< IVect > &, const MPI_Comm &)
 initialisation of a distributed matrix with global row numbers
 
void ReallocateDist (int m, int n)
 changing the size of the local matrix, previous values are lost
 
void Resize (int m, int n)
 changing the size of the local matrix, previous values are kept
 
void Clear ()
 matrix is cleared
 
DistributedMatrix_Base< T > & operator= (const DistributedMatrix_Base< T > &X)
 equality *this = X
 
template<class T2 >
void Copy (const DistributedMatrix_Base< T2 > &X)
 Copies content of X in the current object.
 
template<class T0 >
DistributedMatrix_Base< T > & operator*= (const T0 &x)
 multiplication by a scalar
 
IVectGetGlobalRowNumber ()
 returns local to global numbering
 
const IVectGetGlobalRowNumber () const
 
IVectGetOverlapRowNumber ()
 returns rows already counted in another processor
 
const IVectGetOverlapRowNumber () const
 
IVectGetOverlapProcNumber ()
 returns processor numbers of the original rows
 
const IVectGetOverlapProcNumber () const
 
IVectGetProcessorSharingRows ()
 returns processor numbers for each set of shared rows
 
const IVectGetProcessorSharingRows () const
 
Vector< IVect > & GetSharingRowNumbers ()
 returns row numbers for each set of shared rows
 
const Vector< IVect > & GetSharingRowNumbers () const
 
size_t GetMemorySize () const
 returns the size of memory used to store the matrix
 
long GetNonZeros () const
 returns the number of non-zero entries stored in the matrix More...
 
long GetDataSize () const
 returns the number of elements stored More...
 
template<class T0 >
void RemoveSmallEntry (const T0 &epsilon)
 removes small entries of the matrix More...
 
void SetIdentity ()
 sets matrix to identity matrix
 
void Zero ()
 sets values of non-zero entries to 0
 
void Fill ()
 sets values of non-zero entries to 0, 1, 2, etc More...
 
template<class T0 >
void Fill (const T0 &x)
 sets values of non-zero entries to x More...
 
void FillRand ()
 sets values of non-zero entries to random values
 
void WriteText (ostream &FileStream, Vector< int > &Indow, Vector< int > &IndCol, Vector< T > &Value, bool cplx) const
 writes the matrix in text format
 
template<class T2 , class T3 , class T4 , class Storage4 , class Allocator4 >
void InitMltAdd (bool &proceed_distant_row, bool &proceed_distant_col, const Vector< T2 > &X, Vector< T2 > &Xcol, const T3 &beta, Vector< T4, Storage4, Allocator4 > &Y, Vector< T4, Storage4, Allocator4 > &Yres) const
 Initializes the matrix-vector product

 
template<class T2 , class T3 , class T4 , class Storage4 , class Allocator4 >
void FinalizeMltAdd (bool proceed_distant_row, bool proceed_distant_col, const Vector< T2 > &X, Vector< T2 > &Xcol, const T3 &alpha, const T3 &beta, Vector< T4, Storage4, Allocator4 > &Y, Vector< T4, Storage4, Allocator4 > &Yres, bool assemble) const
 Finalizes the matrix-vector product.
 
template<class T2 , class T3 , class T4 , class Storage4 , class Allocator4 >
void InitMltAdd (bool &proceed_distant_row, bool &proceed_distant_col, const SeldonTranspose &trans, const Vector< T2 > &X, Vector< T2 > &Xrow, const T3 &beta, Vector< T4, Storage4, Allocator4 > &Y, Vector< T4, Storage4, Allocator4 > &Yres) const
 Initializes the matrix-vector product

 
template<class T2 , class T3 , class T4 , class Storage4 , class Allocator4 >
void FinalizeMltAdd (bool proceed_distant_row, bool proceed_distant_col, const SeldonTranspose &trans, const Vector< T2 > &X, Vector< T2 > &Xrow, const T3 &alpha, const T3 &beta, Vector< T4, Storage4, Allocator4 > &Y, Vector< T4, Storage4, Allocator4 > &Yres, bool assemble) const
 Finalizes the matrix-vector product.
 
void InitMltMin (Vector< int > &Y, Vector< int > &Yproc, Vector< int > &Xcol, Vector< int > &Xcol_proc) const
 Initializes the matrix-vector product MltMin

 
void FinalizeMltMin (Vector< int > &Y, Vector< int > &Yproc, Vector< int > &Xcol, Vector< int > &Xcol_proc) const
 Finalizes the matrix-vector product MltMin.
 
template<class T0 , class T1 >
void AddDistributedMatrix (const T0 &alpha, const DistributedMatrix_Base< T1 > &A)
 Adds alpha A to the current matrix (only distant values)
 
void GetMaxAbsDistant (typename ClassComplexType< T >::Treal &res) const
 Computes res = max(res, maximum absolute value of non-zero entries)
 
template<class T0 >
void AddRowSumDistant (Vector< T0 > &vec_sum) const
 Adds \sum |a_ij| to vec_sum(i) for distant non-zero entries.
 
template<class T0 >
void AddColSumDistant (Vector< T0 > &vec_sum) const
 Adds \sum |a_ij| to vec_sum(j) for distant non-zero entries.
 
template<class T0 >
void AddRowColSumDistant (Vector< T0 > &sum_row, Vector< T0 > &sum_col) const
 Adds \sum |a_ij| to sum_row(i) and sum_col(j) for distant non-zero entries.
 
void ExchangeParallelData (int &smax_row, int &smax_col, bool &local_number, Vector< Vector< T, VectSparse >, VectFull, NewAlloc< Vector< T, VectSparse > > > &dist_row_, Vector< Vector< T, VectSparse >, VectFull, NewAlloc< Vector< T, VectSparse > > > &dist_col_, Vector< IVect > &proc_row_, Vector< IVect > &proc_col_, IVect &global_row_to_recv_, IVect &global_col_to_recv_, IVect &ptr_global_row_to_recv_, IVect &ptr_global_col_to_recv_, Vector< IVect > &local_row_to_send_, Vector< IVect > &local_col_to_send_, IVect &proc_row_to_recv_, IVect &proc_col_to_recv_, IVect &proc_row_to_send_, IVect &proc_col_to_send_)
 Swaps arrays contained in the current structure with arrays given as parameters.
 
void ConjugateDistant ()
 Conjugates distant non-zero entries.
 
void TransposeDistant (const DistributedMatrix_Base< T > &A)
 Computes *this = A^T for non-zero entries.
 
template<class T0 >
void ScaleLeftDistant (const Vector< T0 > &Drow)
 Multiplies a_ij by Drow(i) for distant non-zero entries.
 
template<class T0 >
void ScaleRightDistant (const Vector< T0 > &Dcol)
 Multiplies a_ij by Dcol(j) for distant non-zero entries.
 
template<class T0 , class T1 >
void ScaleDistant (const Vector< T0 > &Drow, const Vector< T1 > &Dcol)
 Multiplies a_ij by Drow(i) Dcol(i) for distant non-zero entries.
 
void EraseColDistant (const IVect &num, bool sym)
 erases columns num(i)
 
void EraseRowDistant (const IVect &num, bool sym)
 erases rows num(i)
 
template<class T1 >
void CopySubDistant (const DistributedMatrix_Base< T1 > &A, const IVect &row, const IVect &col, bool sym)
 Copies A(row, col) to the current matrix.
 
bool SameDistributedRows (const DistributedMatrix_Base< T > &A)
 returns true if the distributed rows of A coincide with the distributed rows of the current matrix
 
void AssembleParallel (Matrix< T, General, ArrayRowSparse > &B, Vector< IVect > &procB, Symmetric &sym, IVect &row_numbers, IVect &local_row_numbers, IVect &OverlappedCol, bool sym_pattern, bool reorder)
 Method called by AssembleDistributed.
 
void AssembleParallel (Matrix< T, General, ArrayColSparse > &B, Vector< IVect > &procB, General &prop, IVect &col_numbers, IVect &local_col_numbers, IVect &OverlappedCol, bool sym_pattern, bool reorder)
 Method called by AssembleDistributed

 
template<class T0 , class Allocator0 >
void GetDistributedRows (Matrix< T0, General, ArrayRowSparse, Allocator0 > &rows, Vector< IVect > &proc, bool sym) const
 grouping all the local rows of the matrix into CSR form More...
 
template<class T0 , class Allocator0 >
void GetDistributedColumns (Matrix< T0, General, ArrayColSparse, Allocator0 > &B, Vector< IVect > &procB, Vector< long > &Ptr, IVect &Ind, Vector< T0 > &Val, bool sym_pattern) const
 grouping all the local columns of the matrix into CSC form More...
 

Static Public Member Functions

template<class Tint0 , class Tint1 >
static void ConvertToCSR (Matrix< T, General, ArrayRowSparse > &B, IVect &OverlappedCol, Vector< Tint0 > &PtrA, Vector< Tint1 > &IndA, Vector< T > &ValA)
 Fills PtrA, IndA and ValA from values contained in B.
 
template<class Tint0 , class Tint1 >
static void ConvertToCSC (Matrix< T, General, ArrayColSparse > &B, IVect &OverlappedCol, Vector< Tint0 > &PtrA, Vector< Tint1 > &IndA, Vector< T > &ValA)
 Fills PtrA, IndA and ValA from values contained in B.
 

Protected Member Functions

void EraseArrayForMltAdd ()
 erases any array used for MltAdd
 
void SwitchToGlobalNumbers ()
 erases informations for matrix-vector product and reverts dist_row/dist_col to global numbers
 
template<class TypeDist >
void SortAndAssembleDistantInteractions (TypeDist &dist_val, Vector< IVect > &dist_proc, IVect &glob_num, IVect &ptr_glob_num, IVect &proc_glob, Vector< IVect > &local_num, IVect &proc_local)
 changes global numbers in proc_row to local numbers More...
 
template<class T2 >
void ScatterValues (const Vector< T2 > &X, const IVect &num_recv, const IVect &, const IVect &proc_recv, const Vector< IVect > &num_send, const IVect &proc_send, Vector< T2 > &Xcol) const
 internal function
 
template<class T2 >
void AssembleValues (const Vector< T2 > &Xcol, const IVect &num_recv, const IVect &, const IVect &proc_recv, const Vector< IVect > &num_send, const IVect &proc_send, Vector< T2 > &X) const
 internal function
 
void AssembleValuesMin (const IVect &Xcol, const IVect &Xcol_proc, const IVect &num_recv, const IVect &ptr_num_recv, const IVect &proc_recv, const Vector< IVect > &num_send, const IVect &proc_send, IVect &Y, IVect &Yproc) const
 assembles the results for each row, by taking the minimum of Yproc then the minimum of Y More...
 
void AssembleVecMin (Vector< int > &X, Vector< int > &Xproc) const
 assembles the vector (by taking the minimum instead of summing for AssembleVec More...
 
template<class T0 , class TypeDist >
void RemoveSmallEntryDistant (const T0 &, TypeDist &, Vector< IVect > &)
 removes non-zero entries contained in dist_vec below epsilon dist_proc is modified in the same way
 
template<class T0 >
void GetRowSumDistantCol (Vector< T0 > &vec_sum) const
 adds contribution of dist_col for GetRowSum
 
template<class T0 >
void GetRowSumDistantRow (Vector< T0 > &vec_sum) const
 adds contribution of dist_row for GetRowSum
 
template<class T0 >
void GetColSumDistantCol (Vector< T0 > &vec_sum) const
 adds contribution of dist_col for GetColSum
 
template<class T0 >
void GetColSumDistantRow (Vector< T0 > &vec_sum) const
 adds contribution of dist_row for GetColSum
 
void PrepareMltAdd ()
 prepares a matrix vector product with the distributed matrix More...
 
template<class T2 >
void ScatterRowValues (const Vector< T2 > &X, Vector< T2 > &Xcol) const
 Sends/receives values of X on distant rows (similar to ScatterColValues)
 
template<class T2 >
void ScatterColValues (const Vector< T2 > &X, Vector< T2 > &Xcol) const
 Sends/receives values of X on distant columns. More...
 
template<class T2 >
void AssembleRowValues (const Vector< T2 > &Xrow, Vector< T2 > &X) const
 Sends/receives values of Xrow on distant rows and adds them to X. More...
 
template<class T2 >
void AssembleColValues (const Vector< T2 > &Xrow, Vector< T2 > &X) const
 Sends/receives values of Xcol on distant columns and adds them to X.
 
template<class T2 , class Storage2 , class Allocator2 , class T4 , class Storage4 , class Allocator4 >
void MltAddCol (const SeldonTranspose &Trans, const Vector< T2, Storage2, Allocator2 > &X, Vector< T4, Storage4, Allocator4 > &Y) const
 Y = Y + alpha A X with only distant columns of A.
 
template<class T2 , class Storage2 , class Allocator2 , class T4 , class Storage4 , class Allocator4 >
void MltAddRow (const SeldonTranspose &Trans, const Vector< T2, Storage2, Allocator2 > &X, Vector< T4, Storage4, Allocator4 > &Y) const
 Y = Y + alpha A^T X with only distant rows of A.
 

Static Protected Member Functions

static void AddDistantValue (Vector< T, VectSparse > &dist_col_, IVect &proc_col_, int jglob, int proc2, const T &val)
 adding a non-zero entry, between a local row/column and a non-local row/column More...
 
static void SendAndReceiveDistributed (const MPI_Comm &comm, IVect &nsend_int, Vector< IVect > &EntierToSend, Vector< Vector< T > > &FloatToSend, IVect &nrecv_int, Vector< IVect > &EntierToRecv, Vector< Vector< T > > &FloatToRecv)
 Sends EntierToSend and FloatToSend to the required processors. More...
 
static void AddReceivedInteractions (const MPI_Comm &comm, Matrix< T, General, ArrayRowSparse > &B, Vector< IVect > &EntierToRecv, Vector< Vector< T > > &FloatToRecv, IVect &nrecv_int, Vector< IVect > &EntierToSend, Vector< Vector< T > > &FloatToSend, IVect &nsend_int, IVect &Glob_to_local, const IVect &OverlappedCol, const IVect &OverlapProcNumber, Vector< IVect > &procB, bool reorder)
 Adds received non-zero entries to the matrix B.
 
static void AddReceivedInteractions (const MPI_Comm &comm, Matrix< T, General, ArrayColSparse > &B, Vector< IVect > &EntierToRecv, Vector< Vector< T > > &FloatToRecv, IVect &nrecv_int, Vector< IVect > &EntierToSend, Vector< Vector< T > > &FloatToSend, IVect &nsend_int, IVect &Glob_to_local, const IVect &OverlappedCol, const IVect &OverlapProcNumber, Vector< IVect > &procB, bool reorder)
 Adds received non-zero entries to the matrix B.
 
template<class TypeDist >
static void EraseDistantEntries (MPI_Comm &comm, const Vector< bool > &IsRowDropped, const Vector< bool > &IsRowDroppedDistant, TypeDist &dist_row_, Vector< IVect > &proc_row_, TypeDist &dist_col_, Vector< IVect > &proc_col_)
 clears distant numbers in a sparse matrix
 

Protected Attributes

IVectOverlapRowNumbers
 row numbers shared with other processors More...
 
IVectOverlapProcNumbers
 processor where each shared row should be assembled More...
 
IVectGlobalRowNumbers
 global row numbers
 
IVectProcSharingRows
 list of processors sharing rows with the current one
 
Vector< IVect > * SharingRowNumbers
 for each processor sharing rows, list of "local numbers" shared More...
 
int nodl_scalar_
 number of "scalar" unknowns
 
int nb_unknowns_scal_
 
int nglob_
 total number of rows (on all processors)
 
MPI_Comm comm_
 MPI communicator.
 
Vector< Vector< T, VectSparse >, VectFull, NewAlloc< Vector< T, VectSparse > > > dist_col
 additional values on rows with non-local columns
 
Vector< Vector< T, VectSparse >, VectFull, NewAlloc< Vector< T, VectSparse > > > dist_row
 additional values on columns with non-local rows
 
Vector< IVectproc_col
 distant processor for additional values
 
Vector< IVectproc_row
 
IVect global_row_to_recv
 global row/col numbers (needed for MltAdd)
 
IVect global_col_to_recv
 
IVect ptr_global_row_to_recv
 
IVect ptr_global_col_to_recv
 
Vector< IVectlocal_row_to_send
 local row/col numbers (needed for MltAdd)
 
Vector< IVectlocal_col_to_send
 
IVect proc_col_to_recv
 processor numbers (needed for MltAdd)
 
IVect proc_col_to_send
 
IVect proc_row_to_recv
 
IVect proc_row_to_send
 
bool local_number_distant_values
 if true local numbers are present in dist_row/dist_col instead of global numbers
 
long size_max_distant_row
 number of distant non-zero entries
 
long size_max_distant_col
 

Detailed Description

template<class T>
class Seldon::DistributedMatrix_Base< T >

Base class for distributed matrix over all the processors.

In this class, distant non-zero entries are stored. It can contain non-zero entries corresponding to distant rows (i.e. the column belongs to the current processor, but the row belongs to another processor) or distant columns (i.e. the row belongs to the current processor, but the column belongs to another processor)

Only one storage is implemented (equivalent of ArrayRowSparse).

Definition at line 103 of file DistributedMatrix.hxx.

Constructor & Destructor Documentation

◆ DistributedMatrix_Base()

template<class T >
Seldon::DistributedMatrix_Base< T >::DistributedMatrix_Base ( int  m,
int  n 
)
explicit

construction of an m by n matrix

Here m and n are the number of rows and columns of the local matrix

Definition at line 1717 of file DistributedMatrix.cxx.

Member Function Documentation

◆ AddDistantInteraction()

template<class T >
void Seldon::DistributedMatrix_Base< T >::AddDistantInteraction ( int  i,
int  jglob,
int  proc2,
const T &  val 
)
inline

adding a non-zero entry, between a local column and a non-local column

We assume here that the row number is local to the current processor

Parameters
[in]ilocal row number
[in]jglobglobal column number
[in]proc2distant processor containing the global column
[in]valvalue of the non-zero entry

Definition at line 99 of file DistributedMatrixInline.cxx.

◆ AddDistantValue()

template<class T >
void Seldon::DistributedMatrix_Base< T >::AddDistantValue ( Vector< T, VectSparse > &  dist_col_,
IVect proc_col_,
int  jglob,
int  proc2,
const T &  val 
)
staticprotected

adding a non-zero entry, between a local row/column and a non-local row/column

This method is used only internally

Parameters
[in]dist_colarray to which entry is added
[in]proc_colprocessors associated with dist_col
[in]jglobglobal row/column number
[in]proc2distant processor containing the global row/column
[in]valvalue of the non-zero entry

Definition at line 1164 of file DistributedMatrix.cxx.

◆ AddRowDistantInteraction()

template<class T >
void Seldon::DistributedMatrix_Base< T >::AddRowDistantInteraction ( int  iglob,
int  j,
int  proc2,
const T &  val 
)
inline

adding a non-zero entry, between a local row and a non-local row

We assume here that the column number is local to the current processor

Parameters
[in]iglobglobal row number
[in]jlocal column number
[in]proc2distant processor containing the global row
[in]valvalue of the non-zero entry

Definition at line 118 of file DistributedMatrixInline.cxx.

◆ AssembleRowValues()

template<class T >
template<class T2 >
void Seldon::DistributedMatrix_Base< T >::AssembleRowValues ( const Vector< T2 > &  Xrow,
Vector< T2 > &  X 
) const
protected

Sends/receives values of Xrow on distant rows and adds them to X.

this method exchanges values of Xrow between processors, and adds them to X so that X will sum the results of distant rows dist_row

Definition at line 1028 of file DistributedMatrix.cxx.

◆ AssembleValuesMin()

template<class T >
void Seldon::DistributedMatrix_Base< T >::AssembleValuesMin ( const IVect Xcol,
const IVect Xcol_proc,
const IVect num_recv,
const IVect ptr_num_recv,
const IVect proc_recv,
const Vector< IVect > &  num_send,
const IVect proc_send,
IVect Y,
IVect Yproc 
) const
protected

assembles the results for each row, by taking the minimum of Yproc then the minimum of Y

Instead of summing values as in function AssembleRowValues, the minimum is taken for Yproc, and if there is equality in Yproc, the minimum is taken for Y

Definition at line 764 of file DistributedMatrix.cxx.

◆ AssembleVecMin()

template<class T >
void Seldon::DistributedMatrix_Base< T >::AssembleVecMin ( Vector< int > &  X,
Vector< int > &  Xproc 
) const
protected

assembles the vector (by taking the minimum instead of summing for AssembleVec

The minimal Xproc is search, if equality the minimal X is searched

Definition at line 837 of file DistributedMatrix.cxx.

◆ Fill() [1/2]

template<class T >
void Seldon::DistributedMatrix_Base< T >::Fill

sets values of non-zero entries to 0, 1, 2, etc

The result will be different from a sequential execution since values can be stored in different processors

Definition at line 2313 of file DistributedMatrix.cxx.

◆ Fill() [2/2]

template<class T >
template<class T0 >
void Seldon::DistributedMatrix_Base< T >::Fill ( const T0 &  x)

sets values of non-zero entries to x

The result will be different from a sequential execution since values can be stored in different processors

Definition at line 2338 of file DistributedMatrix.cxx.

◆ GetDataSize()

template<class T >
long Seldon::DistributedMatrix_Base< T >::GetDataSize

returns the number of elements stored

It returns the number of elements (of type T) stored on the current processor. To obtain an "estimation" of the global number of elements MPI_Reduce should be called

Definition at line 2228 of file DistributedMatrix.cxx.

◆ GetDistributedColumns()

template<class T >
template<class T0 , class Allocator0 >
void Seldon::DistributedMatrix_Base< T >::GetDistributedColumns ( Matrix< T0, General, ArrayColSparse, Allocator0 > &  B,
Vector< IVect > &  procB,
Vector< long > &  Ptr,
IVect Ind,
Vector< T0 > &  Val,
bool  sym_pattern 
) const

grouping all the local columns of the matrix into CSC form

Creation of a sparse matrix B, that will contain the local columns of the current matrix. The row numbers are global. Values placed on non-local columns are ignored

Definition at line 4703 of file DistributedMatrix.cxx.

◆ GetDistributedRows()

template<class T >
template<class T0 , class Allocator0 >
void Seldon::DistributedMatrix_Base< T >::GetDistributedRows ( Matrix< T0, General, ArrayRowSparse, Allocator0 > &  B,
Vector< IVect > &  procB,
bool  sym 
) const

grouping all the local rows of the matrix into CSR form

Creation of a sparse matrix B, that will contain the local rows of the current matrix. The column numbers are global. Values placed on non-local rows are ignored

Definition at line 4579 of file DistributedMatrix.cxx.

◆ GetNonZeros()

template<class T >
long Seldon::DistributedMatrix_Base< T >::GetNonZeros

returns the number of non-zero entries stored in the matrix

It returns the number of non-zero entries stored on the current processor. To obtain an "estimation" of the global number of non-zero entries, MPI_Reduce should be called

Definition at line 2207 of file DistributedMatrix.cxx.

◆ Init()

template<class T >
void Seldon::DistributedMatrix_Base< T >::Init ( int  n,
IVect row_num,
IVect overlap_num,
IVect proc_num,
int  Nvol,
int  nb_u,
IVect MatchingProc,
Vector< IVect > *  MatchingDofNumber,
const MPI_Comm &  comm 
)

Initialisation of pointers.

This method is mandatory, otherwise pointers are set to NULL

Parameters
[in]nglobal number of rows (as if it was on a single processor)
[in]row_numlocal to global numbering
[in]overlap_numrows already counted in another processor
[in]proc_numoriginal processor for overlapped rows

Definition at line 1750 of file DistributedMatrix.cxx.

◆ PrepareMltAdd()

template<class T >
void Seldon::DistributedMatrix_Base< T >::PrepareMltAdd
protected

prepares a matrix vector product with the distributed matrix

This method prepares the matrix-vector, such that a call to MltAdd with a distributed will perform exchanges of values between values in order to produce the correct result.

Definition at line 956 of file DistributedMatrix.cxx.

◆ RemoveSmallEntry()

template<class T >
template<class T0 >
void Seldon::DistributedMatrix_Base< T >::RemoveSmallEntry ( const T0 &  epsilon)

removes small entries of the matrix

The result of this function will be different from a sequential execution since values stored on different processors may add up and be eliminated or not

Definition at line 2268 of file DistributedMatrix.cxx.

◆ ScatterColValues()

template<class T >
template<class T2 >
void Seldon::DistributedMatrix_Base< T >::ScatterColValues ( const Vector< T2 > &  X,
Vector< T2 > &  Xcol 
) const
protected

Sends/receives values of X on distant columns.

this method exchanges values of X between processors so that Xcol will contain the values of X on distant columns dist_col

Definition at line 1012 of file DistributedMatrix.cxx.

◆ SendAndReceiveDistributed()

template<class T >
void Seldon::DistributedMatrix_Base< T >::SendAndReceiveDistributed ( const MPI_Comm &  comm,
IVect nsend_int,
Vector< IVect > &  EntierToSend,
Vector< Vector< T > > &  FloatToSend,
IVect nrecv_int,
Vector< IVect > &  EntierToRecv,
Vector< Vector< T > > &  FloatToRecv 
)
staticprotected

Sends EntierToSend and FloatToSend to the required processors.

nsend_int(i) contains the number of integers to send to processor i The targets retrieves the results in EntierToRecv and FloatToRecv

Definition at line 1219 of file DistributedMatrix.cxx.

◆ SortAndAssembleDistantInteractions()

template<class T >
template<class TypeDist >
void Seldon::DistributedMatrix_Base< T >::SortAndAssembleDistantInteractions ( TypeDist &  dist_val,
Vector< IVect > &  dist_proc,
IVect glob_num,
IVect ptr_glob_num,
IVect proc_glob,
Vector< IVect > &  local_num,
IVect proc_local 
)
protected

changes global numbers in proc_row to local numbers

Parameters
[in]dist_vallist of distant non-zero entries. the distant row numbers are contained in dist_val(i).Index(j) for each column i
[in]dist_procprocessor rank for each distant non-zero entry
[out]glob_numlist of distant row numbers, sorted by processor rank it will contain row numbers for processor proc_glob(0), then processor proc_glob(1), etc
[out]ptr_glob_numbeginning of index for each processor in array glob_num the row numbers of processor proc_glob(i) in array glob_num are stored in glob_num(ptr_glob_num(i):ptr_glob_num(i+1))
[out]proc_globlist of distant processors involved in array dist_num
[out]local_numfor each processor proc_local(i) local_num(i) will store the local row numbers that should be sent to processor proc_local(i) (since these local rows will be distant in distant processor proc_local(i)), somehow glob_num stores the distants rows that will be received, whereas local_num stores the local rows that will be sent
[out]proc_locallist of distant processors that will receive local row numbers

Definition at line 470 of file DistributedMatrix.cxx.

Member Data Documentation

◆ OverlapProcNumbers

template<class T >
IVect* Seldon::DistributedMatrix_Base< T >::OverlapProcNumbers
protected

processor where each shared row should be assembled

For rows which have already been counted in other processors, you specify on which processor these rows are assembled

Definition at line 121 of file DistributedMatrix.hxx.

◆ OverlapRowNumbers

template<class T >
IVect* Seldon::DistributedMatrix_Base< T >::OverlapRowNumbers
protected

row numbers shared with other processors

It is the same array required in a distributed vector. Some rows can be shared by several processors.

Definition at line 114 of file DistributedMatrix.hxx.

◆ SharingRowNumbers

template<class T >
Vector<IVect>* Seldon::DistributedMatrix_Base< T >::SharingRowNumbers
protected

for each processor sharing rows, list of "local numbers" shared

It is assumed that these local numbers are "sorted", such that local numbers shared with processor j on processor i are corresponding with local numbers shared with processor i on processor j

Definition at line 135 of file DistributedMatrix.hxx.


The documentation for this class was generated from the following files: