Skip to content
Snippets Groups Projects
Commit 7a890ae7 authored by Giovanni La Mura's avatar Giovanni La Mura
Browse files

Makw W matrix contiguous

parent 3c7665e8
No related branches found
No related tags found
No related merge requests found
...@@ -77,7 +77,6 @@ void frfme(string data_file, string output_path) { ...@@ -77,7 +77,6 @@ void frfme(string data_file, string output_path) {
Swap2 *tt2 = NULL; Swap2 *tt2 = NULL;
char namef[7]; char namef[7];
char more; char more;
dcomplex **w = NULL;
dcomplex *wk = NULL; dcomplex *wk = NULL;
const dcomplex cc0 = 0.0 + 0.0 * I; const dcomplex cc0 = 0.0 + 0.0 * I;
const dcomplex uim = 0.0 + 1.0 * I; const dcomplex uim = 0.0 + 1.0 * I;
...@@ -375,22 +374,17 @@ void frfme(string data_file, string output_path) { ...@@ -375,22 +374,17 @@ void frfme(string data_file, string output_path) {
#ifdef USE_NVTX #ifdef USE_NVTX
nvtxRangePop(); nvtxRangePop();
#endif #endif
dcomplex *vec_w = new dcomplex[nkv * nkv]();
dcomplex **w = new dcomplex*[nkv];
for (int wi = 0; wi < nkv; wi++) w[wi] = vec_w + wi * nkv;
#ifdef USE_NVTX #ifdef USE_NVTX
nvtxRangePush("j80 loop"); nvtxRangePush("j80 loop");
#endif #endif
for (int j80 = jlmf; j80 <= jlml; j80++) { for (int j80 = jlmf; j80 <= jlml; j80++) {
dcomplex *tt1_wk = tt1->get_vector();
int wk_index = 0; int wk_index = 0;
// w matrix
if (w != NULL) {
for (int wi = nkv - 1; wi > -1; wi--) delete[] w[wi];
delete[] w;
}
w = new dcomplex*[nkv];
for (int wi = 0; wi < nkv; wi++) w[wi] = new dcomplex[nkv]();
for (int jy50 = 0; jy50 < nkv; jy50++) { for (int jy50 = 0; jy50 < nkv; jy50++) {
for (int jx50 = 0; jx50 < nkv; jx50++) { for (int jx50 = 0; jx50 < nkv; jx50++) {
for (int wi = 0; wi < nlmmt; wi++) wk[wi] = tt1_wk[wk_index++]; for (int wi = 0; wi < nlmmt; wi++) wk[wi] = tt1->vec_wk[wk_index++];
w[jx50][jy50] = wk[j80 - 1]; w[jx50][jy50] = wk[j80 - 1];
} // jx50 } // jx50
} // jy50 loop } // jy50 loop
...@@ -426,6 +420,8 @@ void frfme(string data_file, string output_path) { ...@@ -426,6 +420,8 @@ void frfme(string data_file, string output_path) {
} // iy70 loop } // iy70 loop
} // iz75 loop } // iz75 loop
} // j80 loop } // j80 loop
delete[] vec_w;
delete[] w;
#ifdef USE_NVTX #ifdef USE_NVTX
nvtxRangePop(); nvtxRangePop();
#endif #endif
...@@ -467,10 +463,6 @@ void frfme(string data_file, string output_path) { ...@@ -467,10 +463,6 @@ void frfme(string data_file, string output_path) {
if (tfrfme != NULL) delete tfrfme; if (tfrfme != NULL) delete tfrfme;
delete[] file_lines; delete[] file_lines;
if (tt2 != NULL) delete tt2; if (tt2 != NULL) delete tt2;
if (w != NULL) {
for (int wi = nkv - 1; wi > -1; wi--) delete[] w[wi];
delete[] w;
}
if (wk != NULL) delete[] wk; if (wk != NULL) delete[] wk;
if (tt1 != NULL) delete tt1; if (tt1 != NULL) delete tt1;
#ifdef USE_NVTX #ifdef USE_NVTX
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment