Commit 7a890ae7 authored by Giovanni La Mura's avatar Giovanni La Mura
Browse files

Makw W matrix contiguous

parent 3c7665e8
Loading
Loading
Loading
Loading
+6 −14
Original line number Diff line number Diff line
@@ -77,7 +77,6 @@ void frfme(string data_file, string output_path) {
  Swap2 *tt2 = NULL;
  char namef[7];
  char more;
  dcomplex **w = NULL;
  dcomplex *wk = NULL;
  const dcomplex cc0 = 0.0 + 0.0 * I;
  const dcomplex uim = 0.0 + 1.0 * I;
@@ -375,22 +374,17 @@ void frfme(string data_file, string output_path) {
#ifdef USE_NVTX
	  nvtxRangePop();
#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
	  nvtxRangePush("j80 loop");
#endif
	  for (int j80 = jlmf; j80 <= jlml; j80++) {
	    dcomplex *tt1_wk = tt1->get_vector();
	    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 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];
	      } // jx50
	    } // jy50 loop
@@ -426,6 +420,8 @@ void frfme(string data_file, string output_path) {
	      } // iy70 loop
	    } // iz75 loop
	  } // j80 loop
	  delete[] vec_w;
	  delete[] w;
#ifdef USE_NVTX
	  nvtxRangePop();
#endif
@@ -467,10 +463,6 @@ void frfme(string data_file, string output_path) {
  if (tfrfme != NULL) delete tfrfme;
  delete[] file_lines;
  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 (tt1 != NULL) delete tt1;
#ifdef USE_NVTX