From c3b20e89c63d7b10a4650bb1f43502942813d06a Mon Sep 17 00:00:00 2001 From: zaikunzhang Date: Mon, 17 Jul 2023 00:08:13 +0800 Subject: [PATCH] 230717.000813.CST revise cobyla.f90.new --- fortran/cobyla/cobyla.f90.new | 6 ++++-- fortran/common/linalg.f90 | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/fortran/cobyla/cobyla.f90.new b/fortran/cobyla/cobyla.f90.new index 8fb8fdcc5d..40e9506d4c 100644 --- a/fortran/cobyla/cobyla.f90.new +++ b/fortran/cobyla/cobyla.f90.new @@ -614,17 +614,19 @@ real(RP), intent(in) :: x_internal(:) real(RP), intent(out) :: f_internal real(RP), intent(out) :: constr_internal(:) ! Local variables -integer(IK), allocatable :: ixl(:), ixu(:) +integer(IK), allocatable :: ixl(:), ixu(:), mxl, mxu real(RP) :: constr_nlc(m_nonlcon) call calcfc(x_internal, f_internal, constr_nlc) +mxl = int(count(xl > -REALMAX), IK) +mxu = int(count(xu < REALMAX), IK) call safealloc(ixl, mxl) call safealloc(ixu, mxu) ixl = trueloc(xl > -REALMAX) ixu = trueloc(xu < REALMAX) constr_internal = [x_internal(ixl) - xl(ixl), xu(ixu) - x_internal(ixu), & & matprod(Aeq, x_internal) - beq, beq - matprod(Aeq, x_internal), & - & matprod(Aineq, x_internal) - bineq, constr_nlc] + & bineq - matprod(Aineq, x_internal), constr_nlc] end subroutine end subroutine cobyla diff --git a/fortran/common/linalg.f90 b/fortran/common/linalg.f90 index 9035f1931a..285dd57494 100644 --- a/fortran/common/linalg.f90 +++ b/fortran/common/linalg.f90 @@ -39,7 +39,7 @@ module linalg_mod ! ! Started: July 2020 ! -! Last Modified: Wednesday, July 05, 2023 PM03:44:51 +! Last Modified: Sunday, July 16, 2023 PM11:51:27 !--------------------------------------------------------------------------------------------------! implicit none @@ -1062,7 +1062,7 @@ function lsqr_Rfull(b, Q, R) result(x) ! This function solves the linear least squares problem min ||A*x - b||_2 by the QR factorization. ! This function is used in LINCOA, where, ! 1. The economy-size QR factorization is supplied externally (Q is called QFAC and R is called RFAC); -! 3. R is non-singular. +! 2. R is non-singular. !--------------------------------------------------------------------------------------------------! use, non_intrinsic :: consts_mod, only : RP, IK, EPS, DEBUGGING use, non_intrinsic :: debug_mod, only : assert