From 6dcee30b1ae85920241c5f7f58341c783948fd1a Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 4 May 2018 18:21:22 -0400 Subject: [PATCH] replace variable length arrays in fix gle with new/delete --- src/USER-MISC/fix_gle.cpp | 81 ++++++++++++++++++++++----------------- 1 file changed, 45 insertions(+), 36 deletions(-) diff --git a/src/USER-MISC/fix_gle.cpp b/src/USER-MISC/fix_gle.cpp index 5857bafc2e..584b33bfe7 100644 --- a/src/USER-MISC/fix_gle.cpp +++ b/src/USER-MISC/fix_gle.cpp @@ -44,6 +44,7 @@ using namespace FixConst; enum{NOBIAS,BIAS}; enum{CONSTANT,EQUAL,ATOM}; + //#define GLE_DEBUG 1 #define MAXLINE 1024 @@ -62,35 +63,37 @@ namespace GLE { //"stabilized" cholesky decomposition. does a LDL^t decomposition, then sets to zero the negative diagonal elements and gets MM^t void StabCholesky(int n, const double* MMt, double* M) { - double L[n*n], D[n]; + double *L = new double[n*n]; + double *D = new double[n]; - int i,j,k; - for(i=0; i0.?sqrt(D[i]):0.); - } + D[i]=(D[i]>0.0) ? sqrt(D[i]):0.0; + } - for(i=0; i=0; p--) - { - MyMult(n, n, n, SM, EM, TMP); for (int i=0; i=0; p--) { + MyMult(n, n, n, SM, EM, TMP); for (int i=0; i