1 #ifndef SMOMPI_PackedBlockSymmetricMatrix_HPP
2 #define SMOMPI_PackedBlockSymmetricMatrix_HPP
5 #include "MPI_WorldToWorldMessage.h"
7 template<
typename T,tUCInt P>
10 const tIndex &N=this->getRowBlocksNumber();
13 memset(vY,0,
sizeof(T)*P*N);
19 const tMPICoreId& coreId=mpiEnv.
getCoreId();
24 std::valarray<int> valuesLengthPerCore;
25 valuesLengthPerCore.resize(coresNumber);
27 std::valarray<int> valuesOffset;
28 valuesOffset.resize(coresNumber);
31 tIndex start=coreId*N/coresNumber;
34 tIndex end=(coreId+1)*N/coresNumber;
37 const T* vD=&this->getDiagonalValues()[0];
40 const T* vB=&this->getSupBlocksValues()[0];
58 const T* Di=&vD[start];
71 T* Yi_d,*Yi=&vY[start*P];
77 for (ib=start;ib<end;ib++) {
88 for (jb=0;jb<ib;jb++) {
112 (*Yi_d)+=(*Di)*(*Xj);
155 &vY[0],valuesLengthPerCore,valuesOffset);
161 template<
typename T,tUCInt P>
164 const tIndex &N=this->getRowBlocksNumber();
167 memset(vY,0,
sizeof(T)*P*N);
174 const tMPICoreId& coreId=mpiEnv.
getCoreId();
179 std::valarray<int> valuesLengthPerCore;
180 valuesLengthPerCore.resize(coresNumber);
181 std::valarray<int> valuesOffset;
182 valuesOffset.resize(coresNumber);
185 tIndex start=coreId*N/coresNumber;
188 tIndex end=(coreId+1)*N/coresNumber;
191 const T* vD=&this->getDiagonalValues()[0];
194 const T* vB=&this->getSupBlocksValues()[0];
213 const T* Di=&vD[start];
230 tReal Xj_x,Xj_y,Xj_z;
231 tReal *Yi_x,*Yi_y,*Yi_z;
232 for (ib=start;ib<end;ib++) {
243 for (jb=0;jb<ib;jb++) {
253 (*Yi_x)+=(*Bij)*Xj_x;
257 (*Yi_x)+=(*Bij)*Xj_y;
258 (*Yi_y)+=(*Bij)*Xj_x;
262 (*Yi_y)+=(*Bij)*Xj_y;
266 (*Yi_x)+=(*Bij)*Xj_z;
267 (*Yi_z)+=(*Bij)*Xj_x;
271 (*Yi_y)+=(*Bij)*Xj_z;
272 (*Yi_z)+=(*Bij)*Xj_y;
276 (*Yi_z)+=(*Bij)*Xj_z;
328 (*Yi_x)+=(*Bij)*Xj_x;
332 (*Yi_x)+=(*Bij)*Xj_y;
333 (*Yi_y)+=(*Bij)*Xj_x;
337 (*Yi_y)+=(*Bij)*Xj_y;
341 (*Yi_x)+=(*Bij)*Xj_z;
342 (*Yi_z)+=(*Bij)*Xj_x;
346 (*Yi_y)+=(*Bij)*Xj_z;
347 (*Yi_z)+=(*Bij)*Xj_y;
351 (*Yi_z)+=(*Bij)*Xj_z;
387 &vY[0],valuesLengthPerCore,valuesOffset);
This class is a Environment class to define MPI world.
Definition: MPI_Environment.h:36
const tMPICoreId & getCoreId() const
get the id of the current process of this environment
Definition: MPI_Environment.h:200
const tMPICoreId & getCoresNumber() const
get the number of cores of this environment of common environment
Definition: MPI_Environment.h:180
static MPI_Environment & GetEnvironment()
get the environment
Definition: MPI_Run.h:114
static tBoolean AllGather(const MPI_Environment &env, const T &srcData, std::valarray< T > &dstData)
blocking gathering a data from all cores of enviroments to all cores
Definition: MPI_WorldToWorldMessage.h:414
static int BuildOffset(const std::valarray< tMPIIndex > &dataLength, std::valarray< tMPIIndex > &dataOffset)
compute the displacement from the data length per core
Definition: MPI_WorldToWorldMessage.h:467
This class describes an OpenMP/MPI implemntation of symmetric matrix by block of size in a packed st...
Definition: SMOMPI_PackedBlockSymmetricMatrix.h:19
static void BlockVectorProduct(const T *B, const T *X, T *Y, const T *eY, const T *Xi, const T *Xj, T *Yi, T *Yj)
compute sthe vector product of the packed symmetric block B of dimension P by X to obtain Y=B....
Definition: SM_PackedBlockMatrix.h:188
This class described a symmetric matrix by block of size PxP in a packed storage.
Definition: SM_PackedBlockSymmetricMatrix.h:18