C++ mpi module for stochmagnet_main Package
SM_PackedBlockGeneralMatrix.hpp
1 #ifndef SM_PackedBlockGeneralMatrix_HPP
2 #define SM_PackedBlockGeneralMatrix_HPP
3 
4 template<typename T,tUCInt P>
5 void SM_PackedBlockGeneralMatrix<T,P>::vectorProduct(const T* vX,T* vY) const {
6 
7  //P: dimension of a particle
8  //number of row-blocks
9  const tInteger &N=this->getRowBlocksNumber();
10 
11  //number of column blocks
12  const tInteger &M=this->getColumnBlocksNumber();
13 
14  //Y=0
15  memset(vY,0,sizeof(T)*N*P);
16 
17  //iterator on X
18  const T* Xj=null;
19 
20 
21  //indices of block
22  tIndex ib=0,jb=0;
23 
24 
25  //iterator on block
26  const T* vB=&this->getBlocksValues()[0];
27 
28  //iterator on block
29  const T* Bij=vB;
30 
31  //iterator on Y
32  T *Yi=vY;
33  T* eYi=Yi;eYi+=P;
34 
35  //work pointers
36  T* w1=null,*w2=null,*w3=null,*w4=null;
37 
38  for (ib=0;ib<N;ib++) {//row index of the block
39 
40  Xj=vX;
41  for (jb=0;jb<M;jb++) {//column index of the block
43 
44  //std::cout<<"M("<<functions_array::toString(SM_PackedBlockSymmetricMatrix<T,P>::BLOCK_SIZE,Bij)<<")."<<functions_array::toString(3,Xj)<<"="<<functions_array::toString(3,Yi)<<"\n";
45  //iterators at block at next column
47  Xj+=P;
48  }
49 
50  //iterators at block at next row
51  Yi=eYi;
52  eYi+=P;
53  }
54 
55 }
56 
57 
58 
59 #endif
virtual void vectorProduct(const T *vX, T *vY) const
vector product
Definition: SM_PackedBlockGeneralMatrix.hpp:5
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