diff --git a/src/include/Commons.h b/src/include/Commons.h index f24de7d3de940c524f3807623c52415c359e1a5d..1022fb3bbc343e057b637e470adcf4bf1eea34ee 100644 --- a/src/include/Commons.h +++ b/src/include/Commons.h @@ -266,6 +266,8 @@ public: //! \brief QUESTION: definition? dcomplex **am0m; //! \brief QUESTION: definition? + dcomplex *am0v; + //! \brief QUESTION: definition? dcomplex *vintm; //! \brief QUESTION: definition? dcomplex *vintt; diff --git a/src/libnptm/Commons.cpp b/src/libnptm/Commons.cpp index 65af7359cadf9a90623bd07a2a5a4d0f49ee04f5..d5a9cb4ef96fa55b12bee4e4adee5fc9304b87db 100644 --- a/src/libnptm/Commons.cpp +++ b/src/libnptm/Commons.cpp @@ -225,9 +225,10 @@ C1_AddOns::C1_AddOns(C4 *c4) { vj = new dcomplex[1](); vyhj = new dcomplex[(nsph * nsph - 1) * litpos](); vyj0 = new dcomplex[nsph * lmtpos](); + am0v = new dcomplex[nlemt * nlemt](); am0m = new dcomplex*[nlemt]; for (int ai = 0; ai < nlemt; ai++) { - am0m[ai] = new dcomplex[nlemt](); + am0m[ai] = (am0v + nlemt * ai); } vintm = new dcomplex[16](); vintt = new dcomplex[16](); @@ -279,10 +280,11 @@ C1_AddOns::C1_AddOns(const C1_AddOns& rhs) { int vyj0size = nsph * lmtpos; vyj0 = new dcomplex[vyj0size](); for (int hi=0; hi<vyj0size; hi++) vyj0[hi] = rhs.vyj0[hi]; + am0v = new dcomplex[nlemt * nlemt](); am0m = new dcomplex*[nlemt]; for (int ai = 0; ai < nlemt; ai++) { - am0m[ai] = new dcomplex[nlemt](); - for (int aj = 0; aj < nlemt; aj++) am0m[ai][aj] = rhs.am0m[ai][aj]; + for (int aj = 0; aj < nlemt; aj++) am0v[nlemt * ai + aj] = rhs.am0v[nlemt * ai + aj]; + am0m[ai] = (am0v + nlemt * ai); } vintm = new dcomplex[16](); vintt = new dcomplex[16](); @@ -342,10 +344,8 @@ C1_AddOns::~C1_AddOns() { delete[] vh; delete[] vj0; delete[] vj; - for (int ai = nlemt - 1; ai > -1; ai--) { - delete[] am0m[ai]; - } delete[] am0m; + delete[] am0v; delete[] vintm; delete[] vintt; for (int fi = 1; fi > -1; fi--) {