From ae9c559c44cda3821471485a5f24e9b8b1796f07 Mon Sep 17 00:00:00 2001 From: zaikunzhang Date: Sun, 7 Apr 2024 16:34:56 +0800 Subject: [PATCH] 240407.163456.HKT revise the wording of comments on automatic deallocation --- c/bobyqa_c.f90 | 4 ++-- c/cobyla_c.f90 | 4 ++-- c/lincoa_c.f90 | 4 ++-- c/newuoa_c.f90 | 4 ++-- c/uobyqa_c.f90 | 4 ++-- fortran/classical/lincoa/lincoa.f90 | 2 +- fortran/cobyla/cobyla.f90 | 2 +- fortran/lincoa/lincoa.f90 | 2 +- matlab/mex_gateways/bobyqa_mex.F90 | 4 ++-- matlab/mex_gateways/cobyla_mex.F90 | 4 ++-- matlab/mex_gateways/fmxapi.F90 | 6 +++--- matlab/mex_gateways/lincoa_mex.F90 | 4 ++-- matlab/mex_gateways/newuoa_mex.F90 | 4 ++-- matlab/mex_gateways/uobyqa_mex.F90 | 4 ++-- 14 files changed, 26 insertions(+), 26 deletions(-) diff --git a/c/bobyqa_c.f90 b/c/bobyqa_c.f90 index 0c8dc3e20e..6f318ec742 100644 --- a/c/bobyqa_c.f90 +++ b/c/bobyqa_c.f90 @@ -120,7 +120,7 @@ subroutine bobyqa_c(cobj_ptr, data_ptr, n, x, f, xl, xu, nf, rhobeg, rhoend, & nf = int(nf_loc, kind(nf)) info = int(info_loc, kind(info)) -! Deallocate variables not needed any more. Indeed, automatic deallocation will take place at exit. +! Deallocate variables not needed any more. We prefer explicit deallocation to the automatic one. if (allocated(npt_loc)) deallocate (npt_loc) if (allocated(maxfun_loc)) deallocate (maxfun_loc) if (allocated(rhoend_loc)) deallocate (rhoend_loc) @@ -226,7 +226,7 @@ subroutine callback_fcn(x_sub, f_sub, nf_sub, tr, cstrv_sub, nlconstr_sub, termi terminate = logical(terminate_loc, kind(terminate)) end if -! Deallocate variables not needed any more. Indeed, automatic deallocation will take place at exit. +! Deallocate variables not needed any more. We prefer explicit deallocation to the automatic one. if (allocated(nlconstr_sub_loc)) deallocate (nlconstr_sub_loc) end subroutine callback_fcn diff --git a/c/cobyla_c.f90 b/c/cobyla_c.f90 index 0cbff5b07a..e0ac273e01 100644 --- a/c/cobyla_c.f90 +++ b/c/cobyla_c.f90 @@ -160,7 +160,7 @@ subroutine cobyla_c(m_nlcon, cobjcon_ptr, data_ptr, n, x, f, cstrv, nlconstr, m_ info = int(info_loc, kind(info)) nlconstr = real(nlconstr_loc, kind(nlconstr)) -! Deallocate variables not needed any more. Indeed, automatic deallocation will take place at exit. +! Deallocate variables not needed any more. We prefer explicit deallocation to the automatic one. if (allocated(maxfun_loc)) deallocate (maxfun_loc) if (allocated(rhoend_loc)) deallocate (rhoend_loc) if (allocated(rhobeg_loc)) deallocate (rhobeg_loc) @@ -268,7 +268,7 @@ subroutine callback_fcn(x_sub, f_sub, nf_sub, tr, cstrv_sub, nlconstr_sub, termi terminate = logical(terminate_loc, kind(terminate)) end if -! Deallocate variables not needed any more. Indeed, automatic deallocation will take place at exit. +! Deallocate variables not needed any more. We prefer explicit deallocation to the automatic one. if (allocated(nlconstr_sub_loc)) deallocate (nlconstr_sub_loc) end subroutine callback_fcn diff --git a/c/lincoa_c.f90 b/c/lincoa_c.f90 index 4b9639244a..cb399bfef2 100644 --- a/c/lincoa_c.f90 +++ b/c/lincoa_c.f90 @@ -148,7 +148,7 @@ subroutine lincoa_c(cobj_ptr, data_ptr, n, x, f, cstrv, m_ineq, Aineq, bineq, m_ nf = int(nf_loc, kind(nf)) info = int(info_loc, kind(info)) -! Deallocate variables not needed any more. Indeed, automatic deallocation will take place at exit. +! Deallocate variables not needed any more. We prefer explicit deallocation to the automatic one. if (allocated(npt_loc)) deallocate (npt_loc) if (allocated(maxfun_loc)) deallocate (maxfun_loc) if (allocated(rhoend_loc)) deallocate (rhoend_loc) @@ -254,7 +254,7 @@ subroutine callback_fcn(x_sub, f_sub, nf_sub, tr, cstrv_sub, nlconstr_sub, termi terminate = logical(terminate_loc, kind(terminate)) end if -! Deallocate variables not needed any more. Indeed, automatic deallocation will take place at exit. +! Deallocate variables not needed any more. We prefer explicit deallocation to the automatic one. if (allocated(nlconstr_sub_loc)) deallocate (nlconstr_sub_loc) end subroutine callback_fcn diff --git a/c/newuoa_c.f90 b/c/newuoa_c.f90 index ced7b99c24..21f1eb8efe 100644 --- a/c/newuoa_c.f90 +++ b/c/newuoa_c.f90 @@ -101,7 +101,7 @@ subroutine newuoa_c(cobj_ptr, data_ptr, n, x, f, nf, rhobeg, rhoend, ftarget, ma nf = int(nf_loc, kind(nf)) info = int(info_loc, kind(info)) -! Deallocate variables not needed any more. Indeed, automatic deallocation will take place at exit. +! Deallocate variables not needed any more. We prefer explicit deallocation to the automatic one. if (allocated(npt_loc)) deallocate (npt_loc) if (allocated(maxfun_loc)) deallocate (maxfun_loc) if (allocated(rhoend_loc)) deallocate (rhoend_loc) @@ -205,7 +205,7 @@ subroutine callback_fcn(x_sub, f_sub, nf_sub, tr, cstrv_sub, nlconstr_sub, termi terminate = logical(terminate_loc, kind(terminate)) end if -! Deallocate variables not needed any more. Indeed, automatic deallocation will take place at exit. +! Deallocate variables not needed any more. We prefer explicit deallocation to the automatic one. if (allocated(nlconstr_sub_loc)) deallocate (nlconstr_sub_loc) end subroutine callback_fcn diff --git a/c/uobyqa_c.f90 b/c/uobyqa_c.f90 index 03d1adcdd7..c38f01dcf9 100644 --- a/c/uobyqa_c.f90 +++ b/c/uobyqa_c.f90 @@ -96,7 +96,7 @@ subroutine uobyqa_c(cobj_ptr, data_ptr, n, x, f, nf, rhobeg, rhoend, ftarget, ma nf = int(nf_loc, kind(nf)) info = int(info_loc, kind(info)) -! Deallocate variables not needed any more. Indeed, automatic deallocation will take place at exit. +! Deallocate variables not needed any more. We prefer explicit deallocation to the automatic one. if (allocated(maxfun_loc)) deallocate (maxfun_loc) if (allocated(rhoend_loc)) deallocate (rhoend_loc) if (allocated(rhobeg_loc)) deallocate (rhobeg_loc) @@ -199,7 +199,7 @@ subroutine callback_fcn(x_sub, f_sub, nf_sub, tr, cstrv_sub, nlconstr_sub, termi terminate = logical(terminate_loc, kind(terminate)) end if -! Deallocate variables not needed any more. Indeed, automatic deallocation will take place at exit. +! Deallocate variables not needed any more. We prefer explicit deallocation to the automatic one. if (allocated(nlconstr_sub_loc)) deallocate (nlconstr_sub_loc) end subroutine callback_fcn diff --git a/fortran/classical/lincoa/lincoa.f90 b/fortran/classical/lincoa/lincoa.f90 index 0aa6f8ce64..612604f15e 100644 --- a/fortran/classical/lincoa/lincoa.f90 +++ b/fortran/classical/lincoa/lincoa.f90 @@ -392,7 +392,7 @@ subroutine lincoa(calfun, x, f, & & int(size(chist_loc), kind=IK)) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -! Deallocate A_LOC, B_LOC, etc. Indeed, automatic deallocation will take place at exit. +! Deallocate A_LOC, B_LOC, etc. We prefer explicit deallocation to the automatic one. deallocate (A_loc) deallocate (b_loc) deallocate (iact) diff --git a/fortran/cobyla/cobyla.f90 b/fortran/cobyla/cobyla.f90 index e29bfaa8e5..bc8ee2d163 100644 --- a/fortran/cobyla/cobyla.f90 +++ b/fortran/cobyla/cobyla.f90 @@ -635,7 +635,7 @@ subroutine cobyla(calcfc, m_nlcon, x, & end if !--------------------------------------------------------------------------------------------------! -! Deallocate variables not needed any more. Indeed, automatic deallocation will take place at exit. +! Deallocate variables not needed any more. We prefer explicit deallocation to the automatic one. deallocate (Aineq_loc, Aeq_loc, amat, bineq_loc, beq_loc, bvec) diff --git a/fortran/lincoa/lincoa.f90 b/fortran/lincoa/lincoa.f90 index 5ada2684a7..82a2db4c06 100644 --- a/fortran/lincoa/lincoa.f90 +++ b/fortran/lincoa/lincoa.f90 @@ -533,7 +533,7 @@ subroutine lincoa(calfun, x, & end if !--------------------------------------------------------------------------------------------------! -! Deallocate variables not needed any more. Indeed, automatic deallocation will take place at exit. +! Deallocate variables not needed any more. We prefer explicit deallocation to the automatic one. deallocate (Aineq_loc, Aeq_loc, amat, bineq_loc, beq_loc, bvec) diff --git a/matlab/mex_gateways/bobyqa_mex.F90 b/matlab/mex_gateways/bobyqa_mex.F90 index aa82e2e636..1e6f7745ad 100644 --- a/matlab/mex_gateways/bobyqa_mex.F90 +++ b/matlab/mex_gateways/bobyqa_mex.F90 @@ -11,7 +11,7 @@ ! ! Started in July 2020 ! -! Last Modified: Sunday, February 25, 2024 AM11:38:39 +! Last Modified: Sunday, April 07, 2024 PM04:31:30 !--------------------------------------------------------------------------------------------------! #include "fintrf.h" @@ -119,7 +119,7 @@ subroutine mexFunction(nargout, poutput, nargin, pinput) ! It can happen that 0 < SIZE(XHIST, 2) < MAXHIST or 0 < SIZE(FHIST) < MAXHIST due to the memory ! limit in the Fortran code. -! Free memory. Indeed, automatic deallocation would take place. +! Free memory. We prefer explicit deallocation to the automatic one. deallocate (x) ! Allocated by fmxReadMPtr. deallocate (lb) ! Allocated by fmxReadMPtr. deallocate (ub) ! Allocated by fmxReadMPtr. diff --git a/matlab/mex_gateways/cobyla_mex.F90 b/matlab/mex_gateways/cobyla_mex.F90 index c5a3a00f49..1cae3c4e49 100644 --- a/matlab/mex_gateways/cobyla_mex.F90 +++ b/matlab/mex_gateways/cobyla_mex.F90 @@ -11,7 +11,7 @@ ! ! Started in July 2020 ! -! Last Modified: Sunday, February 25, 2024 AM11:26:21 +! Last Modified: Sunday, April 07, 2024 PM04:31:08 !--------------------------------------------------------------------------------------------------! #include "fintrf.h" @@ -169,7 +169,7 @@ subroutine mexFunction(nargout, poutput, nargin, pinput) ! It can happen that 0 < SIZE(XHIST, 2) < MAXHIST or 0 < SIZE(FHIST) < MAXHIST due to the memory ! limit in the Fortran code. Similar for CHIST and CONHIST. -! Free memory. Indeed, automatic deallocation would take place. +! Free memory. We prefer explicit deallocation to the automatic one. deallocate (x) ! Allocated by fmxReadMPtr. deallocate (nlconstr0) ! Allocated by fmxReadMPtr. deallocate (Aineq) ! Allocated by fmxReadMPtr. diff --git a/matlab/mex_gateways/fmxapi.F90 b/matlab/mex_gateways/fmxapi.F90 index 28b3b5e4ad..702e2577be 100644 --- a/matlab/mex_gateways/fmxapi.F90 +++ b/matlab/mex_gateways/fmxapi.F90 @@ -12,7 +12,7 @@ module fmxapi_mod ! ! Started in July 2020 ! -! Last Modified: Tuesday, January 02, 2024 PM02:27:24 +! Last Modified: Sunday, April 07, 2024 PM04:30:44 !--------------------------------------------------------------------------------------------------! ! N.B.: @@ -460,7 +460,7 @@ subroutine read_rvector(px, x) end if end if -! Deallocate X_DP. Indeed, automatic deallocation would take place. +! Deallocate X_DP. We prefer explicit deallocation to the automatic one. deallocate (x_dp) end subroutine read_rvector @@ -514,7 +514,7 @@ subroutine read_rmatrix(px, x) end if end if -! Deallocate X_DP. Indeed, automatic deallocation would take place. +! Deallocate X_DP. We prefer explicit deallocation to the automatic one. deallocate (x_dp) end subroutine read_rmatrix diff --git a/matlab/mex_gateways/lincoa_mex.F90 b/matlab/mex_gateways/lincoa_mex.F90 index fa4b695a27..ddee416b57 100644 --- a/matlab/mex_gateways/lincoa_mex.F90 +++ b/matlab/mex_gateways/lincoa_mex.F90 @@ -11,7 +11,7 @@ ! ! Started in July 2020 ! -! Last Modified: Sunday, February 25, 2024 AM11:26:14 +! Last Modified: Sunday, April 07, 2024 PM04:31:37 !--------------------------------------------------------------------------------------------------! #include "fintrf.h" @@ -139,7 +139,7 @@ subroutine mexFunction(nargout, poutput, nargin, pinput) ! It can happen that 0 < SIZE(XHIST, 2) < MAXHIST or 0 < SIZE(FHIST) < MAXHIST due to the memory ! limit in the Fortran code. Similar for CHIST. -! Free memory. Indeed, automatic deallocation would take place. +! Free memory. We prefer explicit deallocation to the automatic one. deallocate (x) ! Allocated by fmxReadMPtr. deallocate (Aineq) ! Allocated by fmxReadMPtr. deallocate (bineq) ! Allocated by fmxReadMPtr. diff --git a/matlab/mex_gateways/newuoa_mex.F90 b/matlab/mex_gateways/newuoa_mex.F90 index 8501e4075e..b9d0afd92b 100644 --- a/matlab/mex_gateways/newuoa_mex.F90 +++ b/matlab/mex_gateways/newuoa_mex.F90 @@ -11,7 +11,7 @@ ! ! Started in July 2020 ! -! Last Modified: Sunday, February 25, 2024 AM11:28:20 +! Last Modified: Sunday, April 07, 2024 PM04:30:58 !--------------------------------------------------------------------------------------------------! #include "fintrf.h" @@ -115,7 +115,7 @@ subroutine mexFunction(nargout, poutput, nargin, pinput) ! It can happen that 0 < SIZE(XHIST, 2) < MAXHIST or 0 < SIZE(FHIST) < MAXHIST due to the memory ! limit in the Fortran code. -! Free memory. Indeed, automatic deallocation would take place. +! Free memory. We prefer explicit deallocation to the automatic one. deallocate (x) ! Allocated by fmxReadMPtr. deallocate (xhist) ! Allocated by the solver deallocate (fhist) ! Allocated by the solver diff --git a/matlab/mex_gateways/uobyqa_mex.F90 b/matlab/mex_gateways/uobyqa_mex.F90 index a8fcf60285..725d5713e3 100644 --- a/matlab/mex_gateways/uobyqa_mex.F90 +++ b/matlab/mex_gateways/uobyqa_mex.F90 @@ -11,7 +11,7 @@ ! ! Started in July 2020 ! -! Last Modified: Sunday, February 25, 2024 AM11:27:25 +! Last Modified: Sunday, April 07, 2024 PM04:31:18 !--------------------------------------------------------------------------------------------------! #include "fintrf.h" @@ -113,7 +113,7 @@ subroutine mexFunction(nargout, poutput, nargin, pinput) ! It can happen that 0 < SIZE(XHIST, 2) < MAXHIST or 0 < SIZE(FHIST) < MAXHIST due to the memory ! limit in the Fortran code. -! Free memory. Indeed, automatic deallocation would take place. +! Free memory. We prefer explicit deallocation to the automatic one. deallocate (x) ! Allocated by fmxReadMPtr. deallocate (xhist) ! Allocated by the solver deallocate (fhist) ! Allocated by the solver