15 {
16 int const idx = blockIdx.x * blockDim.x + threadIdx.x;
17 int const idy = blockIdx.y * blockDim.y + threadIdx.y;
18 if(idx >= (*dTotMat).rows() || idy >= (*dTotMat).cols()) return;
19 if(idx < idy) return;
20
21 int const dimLoc = (*dLocMat).cols();
22
23 (*dTotMat)(idx, idy) = {0, 0};
24 magma_index_t innerX, innerY, locIdX, locIdY;
25 for(auto valuePosX = (*subSpace).basis().outerIndexPtr()[idx];
26 valuePosX != (*subSpace).basis().outerIndexPtr()[idx + 1]; ++valuePosX) {
27 innerX = (*subSpace).basis().innerIndexPtr()[valuePosX];
28 auto conjCoeffX = conj((*subSpace).basis().valuePtr()[valuePosX]);
29
30 for(auto valuePosY = (*subSpace).basis().outerIndexPtr()[idy];
31 valuePosY != (*subSpace).basis().outerIndexPtr()[idy + 1]; ++valuePosY) {
32 innerY = (*subSpace).basis().innerIndexPtr()[valuePosY];
33 auto CoeffY = (*subSpace).basis().valuePtr()[valuePosY];
34
35
36 if(innerX / dimLoc != innerY / dimLoc) continue;
37 locIdX = innerX % dimLoc;
38 locIdY = innerY % dimLoc;
39 (*dTotMat)(idx, idy) += conjCoeffX * (*dLocMat)(locIdX, locIdY) * CoeffY;
40 }
41 }
42
43 (*dTotMat)(idy, idx) = conj((*dTotMat)(idx, idy));
44
45
46
47 return;
48}