From a3ca003c39de6996448c517c9cf57d2b6176e822 Mon Sep 17 00:00:00 2001 From: Nick Gould Date: Sat, 27 Jan 2024 17:03:08 +0000 Subject: [PATCH] a bunch of minor real <-> integer conversions formalised --- include/galahad_blas.h | 8 ++ include/galahad_lapack.h | 4 + src/clls/clls.F90 | 29 ++--- src/cqp/cqp.F90 | 47 ++++---- src/dum/hsl_ma48d.f90 | 7 -- src/dum/hsl_ma48s.f90 | 7 -- src/dum/hsl_ma57d.f90 | 2 - src/dum/hsl_ma57s.f90 | 2 - src/dum/hsl_ma77d.f90 | 12 +- src/dum/hsl_ma77s.f90 | 12 +- src/dum/hsl_ma86d.f90 | 42 +++---- src/dum/hsl_ma86s.f90 | 32 ++---- src/dum/mkl_pardiso.F90 | 10 ++ src/filtrane/filtrane.F90 | 16 +-- src/fit/fit.F90 | 6 +- src/l2rt/l2rt.F90 | 8 +- src/lapack/blas_interface.F90 | 3 +- src/lapack/lapack_interface.F90 | 4 +- src/lapack/rebuild.F90 | 8 +- src/lms/lms.F90 | 40 +++---- src/lpb/lpb.F90 | 46 ++++---- src/lsqp/lsqp.F90 | 37 ++++--- src/lsrt/lsrt.F90 | 8 +- src/lstr/lstr.F90 | 8 +- src/miqr/miqr.F90 | 7 +- src/nls/nls.F90 | 8 +- src/presolve/presolve.F90 | 9 +- src/qpa/inqpa.F90 | 7 +- src/qpb/qpb.F90 | 5 +- src/qpc/qpc.F90 | 10 +- src/roots/roots.F90 | 8 +- src/rqs/rqs.F90 | 13 ++- src/sbls/sbls.F90 | 10 +- src/scale/scale.F90 | 4 +- src/sils/sils.F90 | 7 +- src/sls/sls.F90 | 10 +- src/space/space.F90 | 188 ++++++++++++++++---------------- src/spral/matrix_util.F90 | 60 +++++----- src/spral/random.F90 | 7 +- src/spral/rutherford_boeing.F90 | 4 +- src/ssids/cpu_iface.F90 | 42 +++---- src/trs/trs.F90 | 11 +- src/wcp/wcp.F90 | 20 ++-- 43 files changed, 398 insertions(+), 430 deletions(-) diff --git a/include/galahad_blas.h b/include/galahad_blas.h index 217bfd67cd..411900ad14 100644 --- a/include/galahad_blas.h +++ b/include/galahad_blas.h @@ -1,6 +1,8 @@ #ifdef GALAHAD_64BIT_INTEGER #define GALAHAD_BLAS_interface GALAHAD_BLAS_interface_64 #ifdef GALAHAD_NO_UNDERSCORE_64BIT_INTEGER +#define LSAME LSAME64 +#define XERBLA XERBLA64 #define DASUM DASUM64 #define DCABS1 DCABS164 #define DDOT DDOT64 @@ -66,6 +68,8 @@ #define ZTRMV ZTRMV64 #define ZTRSM ZTRSM64 #elif GALAHAD_DOUBLE_UNDERSCORE_64BIT_INTEGER +#define LSAME LSAME__64 +#define XERBLA XERBLA__64 #define DASUM DASUM__64 #define DCABS1 DCABS1__64 #define DDOT DDOT__64 @@ -131,6 +135,8 @@ #define ZTRMV ZTRMV__64 #define ZTRSM ZTRSM__64 #elif GALAHAD_NO_SYMBOL_64BIT_INTEGER +#define LSAME LSAME +#define XERBLA XERBLA #define DASUM DASUM #define DCABS1 DCABS1 #define DDOT DDOT @@ -196,6 +202,8 @@ #define ZTRMV ZTRMV #define ZTRSM ZTRSM #else +#define LSAME LSAME_64 +#define XERBLA XERBLA_64 #define DASUM DASUM_64 #define DCABS1 DCABS1_64 #define DDOT DDOT_64 diff --git a/include/galahad_lapack.h b/include/galahad_lapack.h index 196f185023..61b7ac9cba 100644 --- a/include/galahad_lapack.h +++ b/include/galahad_lapack.h @@ -1,6 +1,7 @@ #ifdef GALAHAD_64BIT_INTEGER #define GALAHAD_LAPACK_interface GALAHAD_LAPACK_interface_64 #ifdef GALAHAD_NO_UNDERSCORE_64BIT_INTEGER +#define ILAENV ILAENV64 #define DISNAN DISNAN64 #define DLADIV DLADIV64 #define DLAISN DLAISN64 @@ -267,6 +268,7 @@ #define ZLARFG ZLARFG64 #define ZLARFT ZLARFT64 #elif GALAHAD_DOUBLE_UNDERSCORE_64BIT_INTEGER +#define ILAENV ILAENV__64 #define DISNAN DISNAN__64 #define DLADIV DLADIV__64 #define DLAISN DLAISN__64 @@ -533,6 +535,7 @@ #define ZLARFG ZLARFG__64 #define ZLARFT ZLARFT__64 #elif GALAHAD_NO_SYMBOL_64BIT_INTEGER +#define ILAENV ILAENV #define DISNAN DISNAN #define DLADIV DLADIV #define DLAISN DLAISN @@ -799,6 +802,7 @@ #define ZLARFG ZLARFG #define ZLARFT ZLARFT #else +#define ILAENV ILAENV_64 #define DISNAN DISNAN_64 #define DLADIV DLADIV_64 #define DLAISN DLAISN_64 diff --git a/src/clls/clls.F90 b/src/clls/clls.F90 index 9fb357323b..23111e11fd 100644 --- a/src/clls/clls.F90 +++ b/src/clls/clls.F90 @@ -1,4 +1,4 @@ -! THIS VERSION: GALAHAD 4.3 - 2024-01-17 AT 16:10 GMT. +! THIS VERSION: GALAHAD 4.3 - 2024-01-27 AT 16:10 GMT. #include "galahad_modules.h" @@ -2595,7 +2595,7 @@ SUBROUTINE CLLS_solve_main( dims, n, o, m, weight, Ao_val, Ao_row, & REAL ( KIND = rp_ ) :: one_plus_2_sigma_mu, two_sigma_mu2, two_sigma_mu REAL ( KIND = rp_ ) :: opt_alpha_guarantee, opt_merit_guarantee REAL ( KIND = rp_ ) :: stop_p, stop_d, stop_c, two_mu - + REAL ( KIND = rp_ ) :: rnbnds, rnbnds_x, rnbnds_c LOGICAL :: set_printt, set_printi, set_printw, set_printd, set_printe LOGICAL :: printt, printi, printe, printd, printw, set_printp, printp LOGICAL :: maxpiv, guarantee, optimal, present_weight @@ -3316,6 +3316,9 @@ SUBROUTINE CLLS_solve_main( dims, n, o, m, weight, Ao_val, Ao_row, & ! find the max-norm of the residual nbnds = nbnds_x + nbnds_c + rnbnds_x = REAL( nbnds_x, KIND = rp_ ) + rnbnds_c = REAL( nbnds_c, KIND = rp_ ) + rnbnds = REAL( nbnds, KIND = rp_ ) IF ( printi .AND. use_scale_c .AND. m > 0 .AND. & dims%c_l_start <= dims%c_u_end ) & WRITE( out, "( A, ' largest/smallest scale factor', 2ES11.4 )" ) & @@ -3391,13 +3394,13 @@ SUBROUTINE CLLS_solve_main( dims, n, o, m, weight, Ao_val, Ao_row, & ! record the slackness and the deviation from the central path IF ( nbnds_x > 0 ) THEN - slknes_x = slknes_x / nbnds_x + slknes_x = slknes_x / rnbnds_x ELSE slknes_x = zero END IF IF ( nbnds_c > 0 ) THEN - slknes_c = slknes_c / nbnds_c + slknes_c = slknes_c / rnbnds_c ELSE slknes_c = zero END IF @@ -3408,7 +3411,7 @@ SUBROUTINE CLLS_solve_main( dims, n, o, m, weight, Ao_val, Ao_row, & ELSE gamma_f = one END IF - slknes = slknes / nbnds + slknes = slknes / rnbnds gamma_c = control%gamma_c * slkmin / slknes ELSE gamma_f = zero ; slknes = zero ; gamma_c = zero @@ -5399,7 +5402,7 @@ SUBROUTINE CLLS_solve_main( dims, n, o, m, weight, Ao_val, Ao_row, & ! record the initial slope along the search arc - slope = - ( merit - mu * nbnds ) + slope = - ( merit - mu * rnbnds ) ! define an interval [alhpa_l,alpha_u] containing the required stepsize @@ -5493,11 +5496,11 @@ SUBROUTINE CLLS_solve_main( dims, n, o, m, weight, Ao_val, Ao_row, & ! record the initial slope along the search arc IF ( arc == 'ZP' ) THEN - slope = - two * ( merit - mu * nbnds ) + tau * res_primal_dual + slope = - two * ( merit - mu * rnbnds ) + tau * res_primal_dual ELSE IF ( puiseux ) THEN - slope = - two * ( merit - mu * nbnds ) + slope = - two * ( merit - mu * rnbnds ) ELSE - slope = - ( merit - mu * nbnds ) + slope = - ( merit - mu * rnbnds ) END IF IF ( printw ) WRITE( out, "( A, ' value and slope = ', 1P, 2D12.4)") & prefix, merit, slope @@ -5754,7 +5757,7 @@ SUBROUTINE CLLS_solve_main( dims, n, o, m, weight, Ao_val, Ao_row, & Y_u( dims%c_u_start : dims%c_u_end ) ) IF ( nbnds > 0 ) THEN - slknes = slknes / nbnds + slknes = slknes / rnbnds ELSE slknes = zero END IF @@ -6071,18 +6074,18 @@ SUBROUTINE CLLS_solve_main( dims, n, o, m, weight, Ao_val, Ao_row, & MAXVAL( - Y_u( dims%c_u_start : dims%c_u_end ) ) ) IF ( nbnds_x > 0 ) THEN - slknes_x = slknes_x / nbnds_x + slknes_x = slknes_x / rnbnds_x ELSE slknes_x = zero END IF IF ( nbnds_c > 0 ) THEN - slknes_c = slknes_c / nbnds_c + slknes_c = slknes_c / rnbnds_c ELSE slknes_c = zero END IF IF ( nbnds > 0 ) THEN - slknes = slknes / nbnds + slknes = slknes / rnbnds inform%complementary_slackness = slknes ELSE slknes = zero diff --git a/src/cqp/cqp.F90 b/src/cqp/cqp.F90 index 631b328269..36b6cc08d0 100644 --- a/src/cqp/cqp.F90 +++ b/src/cqp/cqp.F90 @@ -1,4 +1,4 @@ -! THIS VERSION: GALAHAD 4.3 - 2024-01-17 AT 16:10 GMT. +! THIS VERSION: GALAHAD 4.3 - 2024-01-27 AT 16:10 GMT. #include "galahad_modules.h" @@ -3358,7 +3358,7 @@ SUBROUTINE CQP_solve_main( dims, n, m, A_val, A_col, A_ptr, & REAL ( KIND = rp_ ) :: one_plus_2_sigma_mu, two_sigma_mu2, two_sigma_mu REAL ( KIND = rp_ ) :: opt_alpha_guarantee, opt_merit_guarantee REAL ( KIND = rp_ ) :: stop_p, stop_d, stop_c, two_mu - + REAL ( KIND = rp_ ) :: rnbnds, rnbnds_x, rnbnds_c LOGICAL :: set_printt, set_printi, set_printw, set_printd, set_printe LOGICAL :: printt, printi, printe, printd, printw, set_printp, printp LOGICAL :: maxpiv, stat_required, guarantee, unbounded, lbfgs @@ -4125,6 +4125,9 @@ SUBROUTINE CQP_solve_main( dims, n, m, A_val, A_col, A_ptr, & ! find the max-norm of the residual nbnds = nbnds_x + nbnds_c + rnbnds_x = REAL( nbnds_x, KIND = rp_ ) + rnbnds_c = REAL( nbnds_c, KIND = rp_ ) + rnbnds = REAL( nbnds, KIND = rp_ ) IF ( printi .AND. use_scale_c .AND. m > 0 .AND. & dims%c_l_start <= dims%c_u_end ) & WRITE( out, "( A, ' largest/smallest scale factor', 2ES11.4 )" ) & @@ -4200,13 +4203,13 @@ SUBROUTINE CQP_solve_main( dims, n, m, A_val, A_col, A_ptr, & ! record the slackness and the deviation from the central path IF ( nbnds_x > 0 ) THEN - slknes_x = slknes_x / nbnds_x + slknes_x = slknes_x / rnbnds_x ELSE slknes_x = zero END IF IF ( nbnds_c > 0 ) THEN - slknes_c = slknes_c / nbnds_c + slknes_c = slknes_c / rnbnds_c ELSE slknes_c = zero END IF @@ -4217,7 +4220,7 @@ SUBROUTINE CQP_solve_main( dims, n, m, A_val, A_col, A_ptr, & ELSE gamma_f = one END IF - slknes = slknes / nbnds + slknes = slknes / rnbnds gamma_c = control%gamma_c * slkmin / slknes ELSE gamma_f = zero ; slknes = zero ; gamma_c = zero @@ -4622,10 +4625,10 @@ SUBROUTINE CQP_solve_main( dims, n, m, A_val, A_col, A_ptr, & IF ( inform%feasible .AND. Hessian_kind == 0 .AND. & gradient_kind == 0 ) THEN IF ( inform%potential < control%potential_unbounded * & - ( ( dims%x_l_end - dims%x_free ) + & - ( n - dims%x_u_start + 1 ) + & - ( dims%c_l_end - dims%c_l_start + 1 ) + & - ( dims%c_u_end - dims%c_u_start + 1 ) ) ) THEN + REAL( ( dims%x_l_end - dims%x_free ) + & + ( n - dims%x_u_start + 1 ) + & + ( dims%c_l_end - dims%c_l_start + 1 ) + & + ( dims%c_u_end - dims%c_u_start + 1 ), KIND = rp_ ) ) THEN inform%status = GALAHAD_error_no_center ; GO TO 600 END IF @@ -6420,7 +6423,7 @@ SUBROUTINE CQP_solve_main( dims, n, m, A_val, A_col, A_ptr, & ! record the initial slope along the search arc - slope = - ( merit - mu * nbnds ) + slope = - ( merit - mu * rnbnds ) ! define an interval [alhpa_l,alpha_u] containing the required stepsize @@ -6515,11 +6518,11 @@ SUBROUTINE CQP_solve_main( dims, n, m, A_val, A_col, A_ptr, & ! record the initial slope along the search arc IF ( arc == 'ZP' ) THEN - slope = - two * ( merit - mu * nbnds ) + tau * res_primal_dual + slope = - two * ( merit - mu * rnbnds ) + tau * res_primal_dual ELSE IF ( puiseux ) THEN - slope = - two * ( merit - mu * nbnds ) + slope = - two * ( merit - mu * rnbnds ) ELSE - slope = - ( merit - mu * nbnds ) + slope = - ( merit - mu * rnbnds ) END IF IF ( printw ) WRITE( out, "( A, ' value and slope = ', 1P, 2D12.4)") & prefix, merit, slope @@ -6778,7 +6781,7 @@ SUBROUTINE CQP_solve_main( dims, n, m, A_val, A_col, A_ptr, & Y_u( dims%c_u_start : dims%c_u_end ) ) IF ( nbnds > 0 ) THEN - slknes = slknes / nbnds + slknes = slknes / rnbnds ELSE slknes = zero END IF @@ -7165,18 +7168,18 @@ SUBROUTINE CQP_solve_main( dims, n, m, A_val, A_col, A_ptr, & MAXVAL( - Y_u( dims%c_u_start : dims%c_u_end ) ) ) IF ( nbnds_x > 0 ) THEN - slknes_x = slknes_x / nbnds_x + slknes_x = slknes_x / rnbnds_x ELSE slknes_x = zero END IF IF ( nbnds_c > 0 ) THEN - slknes_c = slknes_c / nbnds_c + slknes_c = slknes_c / rnbnds_c ELSE slknes_c = zero END IF IF ( nbnds > 0 ) THEN - slknes = slknes / nbnds + slknes = slknes / rnbnds inform%complementary_slackness = slknes ELSE slknes = zero @@ -8907,7 +8910,7 @@ SUBROUTINE CQP_compute_stepsize( dims, n, m, nbnds, order, puiseux, & ! ... and both (x-x_l)_i(z_l)_i - (gamma_c / nbds) * comp >= 0 and ! (x-x_u)_i(z_u)_i - (gamma_c / nbds) * comp >= 0 - scomp = comp * gamma_c / nbnds + scomp = comp * gamma_c / REAL( nbnds, KIND = rp_ ) DO i = dims%x_free + 1, dims%x_u_start - 1 IF ( ( X( i ) - X_l( i ) ) * Z_l( i ) < scomp ) THEN @@ -9144,7 +9147,7 @@ SUBROUTINE CQP_compute_lmaxstep( dims, n, m, nbnds, X, X_l, X_u, DX, & ! Local variables - REAL ( KIND = rp_ ) :: compc, compl, compq, coef0, coef1, coef2 + REAL ( KIND = rp_ ) :: compc, compl, compq, coef0, coef1, coef2, rnbnds REAL ( KIND = rp_ ) :: coef0_f, coef1_f, coef2_f, root1, root2, tol REAL ( KIND = rp_ ) :: alpha_max_b, alpha_max_f, alpha, infeas_gamma_f @@ -9155,6 +9158,7 @@ SUBROUTINE CQP_compute_lmaxstep( dims, n, m, nbnds, X, X_l, X_u, DX, & RETURN END IF tol = epsmch ** 0.75 + rnbnds = REAL( nbnds, KIND = rp_ ) ! ================================================ ! part to compute alpha_max_b @@ -9191,8 +9195,9 @@ SUBROUTINE CQP_compute_lmaxstep( dims, n, m, nbnds, X, X_l, X_u, DX, & ! Scale these coefficients - compc = - gamma_c * coef0_f / nbnds ; compl = - gamma_c * coef1_f / nbnds - compq = - gamma_c * coef2_f / nbnds + compc = - gamma_c * coef0_f / rnbnds + compl = - gamma_c * coef1_f / rnbnds + compq = - gamma_c * coef2_f / rnbnds ! Compute the coefficients for the quadratic expression ! for the individual complementarity diff --git a/src/dum/hsl_ma48d.f90 b/src/dum/hsl_ma48d.f90 index 76bb25f7c2..14a3c380bf 100644 --- a/src/dum/hsl_ma48d.f90 +++ b/src/dum/hsl_ma48d.f90 @@ -152,10 +152,6 @@ subroutine ma48_analyse_double(matrix,factors,control,ainfo,finfo, & integer(ip_), intent(in), optional :: perm(matrix%m+matrix%n) ! Init perm integer(ip_), intent(in), optional :: lastcol(matrix%n) ! last cols - integer(ip_), allocatable :: iwork(:) - integer(ip_) :: i,job,k,la,lkeep,m,n,ne,stat,icntl(20),info(20) - real(dp_):: rinfo(10),cntl(10) - IF ( control%lp >= 0 ) WRITE( control%lp, & "( ' We regret that the solution options that you have ', /, & & ' chosen are not all freely available with GALAHAD.', /, & @@ -202,9 +198,6 @@ subroutine ma48_solve_double(matrix,factors,rhs,x,control,sinfo,trans, & integer(ip_), optional, intent(in) :: trans real(dp_), optional :: resid(2) real(dp_), optional :: error - integer icntl(20),info(20),job,m,n,stat - real(dp_) cntl(10),err(3) - logical(lp_) trans48 IF ( control%lp >= 0 ) WRITE( control%lp, & "( ' We regret that the solution options that you have ', /, & diff --git a/src/dum/hsl_ma48s.f90 b/src/dum/hsl_ma48s.f90 index e40b7935c1..7ee206e0ca 100644 --- a/src/dum/hsl_ma48s.f90 +++ b/src/dum/hsl_ma48s.f90 @@ -152,10 +152,6 @@ subroutine ma48_analyse_single(matrix,factors,control,ainfo,finfo, & integer(ip_), intent(in), optional :: perm(matrix%m+matrix%n) ! Init perm integer(ip_), intent(in), optional :: lastcol(matrix%n) ! last cols - integer(ip_), allocatable :: iwork(:) - integer(ip_) :: i,job,k,la,lkeep,m,n,ne,stat,icntl(20),info(20) - real(sp_):: rinfo(10),cntl(10) - IF ( control%lp >= 0 ) WRITE( control%lp, & "( ' We regret that the solution options that you have ', /, & & ' chosen are not all freely available with GALAHAD.', /, & @@ -202,9 +198,6 @@ subroutine ma48_solve_single(matrix,factors,rhs,x,control,sinfo,trans, & integer(ip_), optional, intent(in) :: trans real(sp_), optional :: resid(2) real(sp_), optional :: error - integer icntl(20),info(20),job,m,n,stat - real(sp_) cntl(10),err(3) - logical(lp_) trans48 IF ( control%lp >= 0 ) WRITE( control%lp, & "( ' We regret that the solution options that you have ', /, & diff --git a/src/dum/hsl_ma57d.f90 b/src/dum/hsl_ma57d.f90 index 9f13573c3f..17cdd26512 100644 --- a/src/dum/hsl_ma57d.f90 +++ b/src/dum/hsl_ma57d.f90 @@ -162,8 +162,6 @@ module hsl_ma57_double subroutine ma57_initialize(factors,control) type(ma57_factors), intent(out), optional :: factors type(ma57_control), intent(out), optional :: control - integer icntl(20),stat - real(dp_) cntl(5) ! Dummy subroutine available with GALAHAD diff --git a/src/dum/hsl_ma57s.f90 b/src/dum/hsl_ma57s.f90 index 6b7231ccff..f401113dbc 100644 --- a/src/dum/hsl_ma57s.f90 +++ b/src/dum/hsl_ma57s.f90 @@ -162,8 +162,6 @@ module hsl_ma57_single subroutine ma57_initialize(factors,control) type(ma57_factors), intent(out), optional :: factors type(ma57_control), intent(out), optional :: control - integer icntl(20),stat - real(sp_) cntl(5) ! Dummy subroutine available with GALAHAD diff --git a/src/dum/hsl_ma77d.f90 b/src/dum/hsl_ma77d.f90 index e320e96a3f..d56f27184c 100644 --- a/src/dum/hsl_ma77d.f90 +++ b/src/dum/hsl_ma77d.f90 @@ -1,26 +1,18 @@ -! THIS VERSION: GALAHAD 4.3 - 2024-01-06 AT 10:15 GMT. +! THIS VERSION: GALAHAD 4.3 - 2024-01-06 AT 13:30 GMT. !-*-*-*-*- G A L A H A D - D U M M Y M A 7 7 M O D U L E -*-*-*- module hsl_MA77_double use GALAHAD_KINDS -! use hsl_ma54_double -! use hsl_ma64_double use hsl_of01_double, of01_rdata => of01_data - use hsl_of01_integer, of01_idata => of01_data + use hsl_of01_integer, of01_idata => of01_data implicit none - integer(ip_), parameter, private :: wp = kind(0.0d0) real (dp_), parameter, private :: one = 1.0_dp_ real (dp_), parameter, private :: zero = 0.0_dp_ - real (dp_), parameter, private :: half = 0.5_dp_ integer(ip_), parameter, private :: nemin_default = 8 - integer(ip_), parameter, private :: lup1 = huge(0_ip_)/8 - integer(ip_), parameter, private :: nb54_default = 150 - integer(ip_), parameter, private :: nb64_default = 120 - integer(ip_), parameter, private :: nbi_default = 40 interface MA77_open module procedure MA77_open_double diff --git a/src/dum/hsl_ma77s.f90 b/src/dum/hsl_ma77s.f90 index 73fbec4a65..81f5ab5014 100644 --- a/src/dum/hsl_ma77s.f90 +++ b/src/dum/hsl_ma77s.f90 @@ -1,26 +1,18 @@ -! THIS VERSION: GALAHAD 4.3 - 2024-01-06 AT 10:15 GMT. +! THIS VERSION: GALAHAD 4.3 - 2024-01-27 AT 13:30 GMT. !-*-*-*-*- G A L A H A D - D U M M Y M A 7 7 M O D U L E -*-*-*- module hsl_MA77_single use GALAHAD_KINDS -! use hsl_ma54_single -! use hsl_ma64_single use hsl_of01_single, of01_rdata => of01_data - use hsl_of01_integer, of01_idata => of01_data + use hsl_of01_integer, of01_idata => of01_data implicit none - integer(ip_), parameter, private :: wp = kind(0.0d0) real (sp_), parameter, private :: one = 1.0_sp_ real (sp_), parameter, private :: zero = 0.0_sp_ - real (sp_), parameter, private :: half = 0.5_sp_ integer(ip_), parameter, private :: nemin_default = 8 - integer(ip_), parameter, private :: lup1 = huge(0_ip_)/8 - integer(ip_), parameter, private :: nb54_default = 150 - integer(ip_), parameter, private :: nb64_default = 120 - integer(ip_), parameter, private :: nbi_default = 40 interface MA77_open module procedure MA77_open_single diff --git a/src/dum/hsl_ma86d.f90 b/src/dum/hsl_ma86d.f90 index 2577214d63..2e4a86536b 100644 --- a/src/dum/hsl_ma86d.f90 +++ b/src/dum/hsl_ma86d.f90 @@ -100,12 +100,12 @@ module hsl_MA86_double end interface MA86_get_n__ type block_type - integer(ip_) :: bcol ! block column that blk belongs to - integer(ip_) :: blkm ! height of block (number of rows in blk) - integer(ip_) :: blkn ! width of block (number of columns in blk) - integer(long_) :: dblk ! id of the block on the diagonal within the + integer(ip_) :: bcol ! block column that blk belongs to + integer(ip_) :: blkm ! height of block (number of rows in blk) + integer(ip_) :: blkn ! width of block (number of columns in blk) + integer(long_) :: dblk ! id of the block on the diagonal within the ! block column to which blk belongs - integer(ip_) :: dep_initial ! initial dependency count for block, + integer(ip_) :: dep_initial ! initial dependency count for block, ! In indef case, countdown occurs in bcol on a block column basis integer(long_) :: id ! The block identitifier (ie, its number blk) integer(long_) :: last_blk ! id of the last block within the @@ -151,24 +151,24 @@ module hsl_MA86_double end type node_type type thread_info - integer(ip_) :: num_delay = 0 ! number of delayed pivots - integer(long_) :: num_flops = 0 ! number of floating point operations + integer(ip_) :: num_delay = 0 ! number of delayed pivots + integer(long_) :: num_flops = 0 ! number of floating point operations integer(long_) :: num_factor = 0 ! number of entries in factors - integer(ip_) :: num_neg = 0 ! number of negative pivots in the real + integer(ip_) :: num_neg = 0 ! number of negative pivots in the real ! or complex Hermitian case. integer(ip_) :: num_nothresh = 0 ! number of pivots not satisfying ! pivot threshold test with control%u integer(ip_) :: num_perturbed = 0 ! number of perturbed pivots - integer(ip_) :: num_two = 0 ! number of 2x2 pivots + integer(ip_) :: num_two = 0 ! number of 2x2 pivots integer(ip_) :: num_zero_pivots = 0 ! number of zero pivots - real (dp_) :: usmall = -one ! Set to zero if num_perturbed > 0. + real (dp_) :: usmall = -one ! Set to zero if num_perturbed > 0. ! Otherwise, if q < p, it holds the value of cntl%umin that ! would have led to a greater value of q and if q = p, it holds ! the smallest relative pivot value of the chosen pivots. - real(dp_) :: detlog = zero ! logarithm of abs value of det A - integer(ip_) :: detsign = 1 ! in the real or complex Hermitian case, - ! holds sign of determinant or 0 if A is - ! singular + real(dp_) :: detlog = zero ! logarithm of abs value of det A + integer(ip_) :: detsign = 1 ! in the real or complex Hermitian case, + ! holds sign of determinant or 0 if A is + ! singular end type thread_info type lfactor @@ -572,20 +572,6 @@ subroutine factorize_posdef(a, order, keep, control, info, nrhs, ldr, rhs) integer(ip_), intent(in) :: nrhs ! number of right-hand sides (maybe = 0) integer(ip_), intent(in) :: ldr ! leading extent of rhs real(dp_), intent(inout) :: rhs(ldr*nrhs) ! On entry holds rhs data. - ! Overwritten by partial solution (forward substitution performed). - - ! local derived types - type(dagtask) :: task ! see description of derived type - type(taskstack) :: stack ! see description of derived type - - ! local arrays - real(dp_), dimension(:), allocatable :: detlog ! per thread sum of log pivot - integer(ip_), dimension(:), allocatable :: invp ! holds inverse ordering - integer(ip_), dimension(:), allocatable :: map ! allocated to have size n - ! used in copying entries of user's matrix a into factor storage - ! (keep%fact). - real(dp_), dimension(:,:), allocatable :: rhs_local ! Local right-hand - ! side arrays. allocated to have size (nrhs*ldr,0:total_threads) end subroutine factorize_posdef diff --git a/src/dum/hsl_ma86s.f90 b/src/dum/hsl_ma86s.f90 index 1d35157706..38c5408a55 100644 --- a/src/dum/hsl_ma86s.f90 +++ b/src/dum/hsl_ma86s.f90 @@ -151,24 +151,24 @@ module hsl_MA86_single end type node_type type thread_info - integer(ip_) :: num_delay = 0 ! number of delayed pivots - integer(long_) :: num_flops = 0 ! number of floating point operations + integer(ip_) :: num_delay = 0 ! number of delayed pivots + integer(long_) :: num_flops = 0 ! number of floating point operations integer(long_) :: num_factor = 0 ! number of entries in factors - integer(ip_) :: num_neg = 0 ! number of negative pivots in the real - ! or complex Hermitian case. + integer(ip_) :: num_neg = 0 ! number of negative pivots in the real + ! or complex Hermitian case. integer(ip_) :: num_nothresh = 0 ! number of pivots not satisfying ! pivot threshold test with control%u integer(ip_) :: num_perturbed = 0 ! number of perturbed pivots integer(ip_) :: num_two = 0 ! number of 2x2 pivots integer(ip_) :: num_zero_pivots = 0 ! number of zero pivots - real (sp_) :: usmall = -one ! Set to zero if num_perturbed > 0. + real (sp_) :: usmall = -one ! Set to zero if num_perturbed > 0. ! Otherwise, if q < p, it holds the value of cntl%umin that ! would have led to a greater value of q and if q = p, it holds ! the smallest relative pivot value of the chosen pivots. - real(sp_) :: detlog = zero ! logarithm of abs value of det A - integer(ip_) :: detsign = 1 ! in the real or complex Hermitian case, - ! holds sign of determinant or 0 if A is - ! singular + real(sp_) :: detlog = zero ! logarithm of abs value of det A + integer(ip_) :: detsign = 1 ! in the real or complex Hermitian case, + ! holds sign of determinant or 0 if A is + ! singular end type thread_info type lfactor @@ -572,20 +572,6 @@ subroutine factorize_posdef(a, order, keep, control, info, nrhs, ldr, rhs) integer(ip_), intent(in) :: nrhs ! number of right-hand sides (maybe = 0) integer(ip_), intent(in) :: ldr ! leading extent of rhs real(sp_), intent(inout) :: rhs(ldr*nrhs) ! On entry holds rhs data. - ! Overwritten by partial solution (forward substitution performed). - - ! local derived types - type(dagtask) :: task ! see description of derived type - type(taskstack) :: stack ! see description of derived type - - ! local arrays - real(sp_), dimension(:), allocatable :: detlog ! per thread sum of log pivot - integer(ip_), dimension(:), allocatable :: invp ! holds inverse ordering - integer(ip_), dimension(:), allocatable :: map ! allocated to have size n - ! used in copying entries of user's matrix a into factor storage - ! (keep%fact). - real(sp_), dimension(:,:), allocatable :: rhs_local ! Local right-hand - ! side arrays. allocated to have size (nrhs*ldr,0:total_threads) end subroutine factorize_posdef diff --git a/src/dum/mkl_pardiso.F90 b/src/dum/mkl_pardiso.F90 index 02b0795b09..5c6c09fc57 100644 --- a/src/dum/mkl_pardiso.F90 +++ b/src/dum/mkl_pardiso.F90 @@ -524,43 +524,53 @@ END SUBROUTINE PARDISO_HANDLE_DELETE_64 FUNCTION PARDISO_GETENV(PT, OptName, StrVal) USE MKL_PARDISO_PRIVATE USE GALAHAD_KINDS, ONLY: ip_ + USE GALAHAD_SYMBOLS INTEGER ( KIND = ip_ ) :: PARDISO_GETENV TYPE (MKL_PARDISO_HANDLE), INTENT(IN) :: PT(*) INTEGER ( KIND = ip_ ), INTENT(IN) :: OptName CHARACTER, INTENT(OUT) :: StrVal(*) + PARDISO_GETENV = GALAHAD_unavailable_option END FUNCTION PARDISO_GETENV FUNCTION PARDISO_GETENV_F(PT, OptName, StrVal) USE MKL_PARDISO_PRIVATE USE GALAHAD_KINDS, ONLY: ip_ + USE GALAHAD_SYMBOLS INTEGER ( KIND = ip_ ) :: PARDISO_GETENV_F TYPE (MKL_PARDISO_HANDLE), INTENT(IN) :: PT(*) INTEGER ( KIND = ip_ ), INTENT(IN) :: OptName CHARACTER (*), INTENT(OUT) :: StrVal + PARDISO_GETENV_F = GALAHAD_unavailable_option END FUNCTION PARDISO_GETENV_F FUNCTION PARDISO_SETENV(PT, OptName, StrVal) USE MKL_PARDISO_PRIVATE USE GALAHAD_KINDS, ONLY: ip_ + USE GALAHAD_SYMBOLS INTEGER ( KIND = ip_ ) :: PARDISO_SETENV TYPE (MKL_PARDISO_HANDLE), INTENT(INOUT) :: PT(*) INTEGER ( KIND = ip_ ), INTENT(IN) :: OptName INTEGER ( KIND = ip_ ), INTENT(IN) :: StrVal(*) + PARDISO_SETENV = GALAHAD_unavailable_option END FUNCTION PARDISO_SETENV FUNCTION PARDISO_SETENV_F(PT, OptName, StrVal) USE MKL_PARDISO_PRIVATE USE GALAHAD_KINDS, ONLY: ip_ + USE GALAHAD_SYMBOLS INTEGER ( KIND = ip_ ) :: PARDISO_SETENV_F TYPE (MKL_PARDISO_HANDLE), INTENT(INOUT) :: PT(*) INTEGER ( KIND = ip_ ), INTENT(IN) :: OptName CHARACTER (*), INTENT(IN) :: StrVal + PARDISO_SETENV_F = GALAHAD_unavailable_option END FUNCTION PARDISO_SETENV_F FUNCTION MKL_PARDISO_PIVOT( AII, BII, EPS) USE GALAHAD_KINDS, ONLY: ip_, dp_ + USE GALAHAD_SYMBOLS REAL ( KIND = dp_ ) :: AII, BII, EPS INTEGER ( KIND = ip_ ) :: MKL_PARDISO_PIVOT + MKL_PARDISO_PIVOT = GALAHAD_unavailable_option END ! SUBROUTINE PARDISOINIT(PT, MTYPE, IPARM) diff --git a/src/filtrane/filtrane.F90 b/src/filtrane/filtrane.F90 index 12e7fac9cd..7b7e537aa9 100644 --- a/src/filtrane/filtrane.F90 +++ b/src/filtrane/filtrane.F90 @@ -3617,8 +3617,7 @@ SUBROUTINE FILTRANE_solve( problem, control, inform, s ) ! Test for convergence. !------------------------------------------------------------------------------ - sqrtn = problem%n - sqrtn = SQRT( sqrtn ) + sqrtn = SQRT( REAL( problem%n, KIND = rp_ ) ) IF ( control%stop_on_prec_g ) THEN IF ( control%stop_on_g_max ) THEN IF ( s%g_norminf <= control%g_accuracy ) THEN @@ -3655,7 +3654,7 @@ SUBROUTINE FILTRANE_solve( problem, control, inform, s ) ! Ensure that the margin is small enough. - rp = s%p + rp = REAL( s%p, KIND = rp_ ) control%gamma_f = MIN( control%gamma_f, HALF / SQRT( rp ) ) ! Compute the norm of the current iterate. @@ -3804,8 +3803,7 @@ SUBROUTINE FILTRANE_solve( problem, control, inform, s ) ! Make sure the absolute requested precision on the subproblem is ! not much higher than the final precision required for the problem. - sqrtn = problem%n - sqrtn = SQRT( sqrtn ) + sqrtn = SQRT( REAL( problem%n, KIND = rp_ ) ) s%GLTR_control%stop_absolute = SQRT( EPSMACH ) IF ( control%stop_on_prec_g .OR. control%prec_used == NONE ) THEN IF ( control%stop_on_g_max ) THEN @@ -4555,7 +4553,7 @@ SUBROUTINE FILTRANE_solve( problem, control, inform, s ) IF ( s%vote( i ) == NEWTON ) n_Newton = n_Newton + 1 END DO IF ( n_votes >= control%model_inertia ) THEN - IF ( n_Newton > HALF * control%model_inertia ) THEN + IF ( n_Newton > control%model_inertia / 2 ) THEN IF ( s%level >= ACTION ) WRITE( s%out, 1140 ) n_Newton, n_votes s%model_used = NEWTON ELSE @@ -4911,8 +4909,7 @@ SUBROUTINE FILTRANE_solve( problem, control, inform, s ) ! ----------------------------------------------------------------------- - sqrtn = problem%n - sqrtn = SQRT( sqrtn ) + sqrtn = SQRT( REAL( problem%n, KIND = rp_ ) ) IF ( control%stop_on_prec_g ) THEN IF ( control%stop_on_g_max ) THEN IF ( s%g_norminf <= control%g_accuracy ) THEN @@ -7056,8 +7053,7 @@ LOGICAL FUNCTION FILTRANE_is_acceptable( f_plus ) s%r( 1:s%p ) = ABS( s%theta( 1:s%p ) ) IF ( control%margin_type /= FIXED ) THEN marginc = control%gamma_f * cnorm - sqrtp = s%p - sqrtp = SQRT( sqrtp ) + sqrtp = SQRT( REAL( s%p, KIND = rp_ ) ) END IF ! Select the active filter. diff --git a/src/fit/fit.F90 b/src/fit/fit.F90 index 1c4ea46bc6..8121ea7c06 100644 --- a/src/fit/fit.F90 +++ b/src/fit/fit.F90 @@ -406,7 +406,7 @@ SUBROUTINE FIT_hermite_interpolation( n, POINTS, F, COEF, data, control, & data%C = F DO kp1 = 1, nm1 - rkp1 = kp1 + rkp1 = REAL( kp1, KIND = rp_ ) c_last = data%C( kp1 ) DO jp1 = kp1 + 1, n IF ( POINTS( jp1 ) == POINTS( jp1 - kp1 ) ) THEN @@ -660,14 +660,14 @@ SUBROUTINE FIT_puiseux_interpolation( n, POINTS, F, COEF, data, control, & data%A( 0, k ) = data%B( 0, k ) DO j = 1, k - 1 data%A( j, k ) = two * data%B( j - 1 , k ) + & - ( two * j + one ) * data%B( j , k ) + ( two * REAL( j, KIND = rp_ ) + one ) * data%B( j , k ) END DO data%A( k, k ) = two * data%B( k - 1, k ) ELSE k = i / 2 + 1 DO j = 0, k - 2 data%B( j, k ) = two * ( data%A( j, k - 1 ) + & - ( j + one ) * data%A( j + 1, k - 1 ) ) + ( REAL( j, KIND = rp_ ) + one ) * data%A( j + 1, k - 1 ) ) END DO data%B( k - 1, k ) = two * data%A( k - 1, k - 1 ) END IF diff --git a/src/l2rt/l2rt.F90 b/src/l2rt/l2rt.F90 index c798214355..76089ccbb4 100644 --- a/src/l2rt/l2rt.F90 +++ b/src/l2rt/l2rt.F90 @@ -1,4 +1,4 @@ -! THIS VERSION: GALAHAD 4.1 - 2023-01-24 AT 09:30 GMT. +! THIS VERSION: GALAHAD 4.3 - 2023-01-27 AT 16:30 GMT. #include "galahad_modules.h" @@ -1082,17 +1082,17 @@ SUBROUTINE L2RT_solve( m, n, p, sigma, mu, X, U, V, data, control, inform) ! Record statistics about the number of inner iterations performed IF ( INFORM%biters > 0 ) THEN - rbiters = INFORM%biters + rbiters = REAL( inform%biters, KIND = rp_ ) inform%biters = inform%biters + 1 inform%biter_min = MIN( inform%biter_min, data%biter ) inform%biter_max = MAX( inform%biter_max, data%biter ) inform%biter_mean = ( rbiters / ( rbiters + one ) ) * & - ( inform%biter_mean + data%biter / rbiters ) + ( inform%biter_mean + REAL( data%biter, KIND = rp_ ) / rbiters ) ELSE inform%biters = 1 inform%biter_min = data%biter inform%biter_max = data%biter - inform%biter_mean = data%biter + inform%biter_mean = REAL( data%biter, KIND = rp_ ) END IF ! Compute the norms ||r_k|| and ||A^T r_k|| diff --git a/src/lapack/blas_interface.F90 b/src/lapack/blas_interface.F90 index 2baf61edad..6344d695b4 100644 --- a/src/lapack/blas_interface.F90 +++ b/src/lapack/blas_interface.F90 @@ -157,8 +157,9 @@ END FUNCTION LSAME INTERFACE XERBLA SUBROUTINE XERBLA( srname, info ) + USE GALAHAD_KINDS CHARACTER ( LEN = * ) :: srname - INTEGER :: info + INTEGER ( KIND = ip_ ) :: info END SUBROUTINE XERBLA END INTERFACE XERBLA diff --git a/src/lapack/lapack_interface.F90 b/src/lapack/lapack_interface.F90 index d4e456ac90..730e4b13a3 100644 --- a/src/lapack/lapack_interface.F90 +++ b/src/lapack/lapack_interface.F90 @@ -26,7 +26,7 @@ MODULE GALAHAD_LAPACK_interface ! parameter selection envionment - INTERFACE ILAENV + INTERFACE LAENV FUNCTION ILAENV( ispec, name, opts, n1, n2, n3, n4 ) USE GALAHAD_KINDS @@ -35,7 +35,7 @@ FUNCTION ILAENV( ispec, name, opts, n1, n2, n3, n4 ) CHARACTER ( LEN = * ) :: name, opts END FUNCTION ILAENV - END INTERFACE ILAENV + END INTERFACE LAENV ! LU factorization diff --git a/src/lapack/rebuild.F90 b/src/lapack/rebuild.F90 index ed9657cc5d..5290a06b3c 100644 --- a/src/lapack/rebuild.F90 +++ b/src/lapack/rebuild.F90 @@ -93,9 +93,11 @@ PROGRAM BUILD ! record procedure name ! IF ( new_line( l + 11 : i ) /= 'IEECHK' ) THEN - nfun = nfun + 1 - fun( nfun ) = ' ' - fun( nfun ) = new_line( l + 11 : i ) +! IF ( new_line( l + 11 : i ) /= 'XERBLA' .AND. & +! new_line( l + 11 : i ) /= 'LSAME' ) THEN + nfun = nfun + 1 + fun( nfun ) = ' ' + fun( nfun ) = new_line( l + 11 : i ) ! END IF END IF END IF diff --git a/src/lms/lms.F90 b/src/lms/lms.F90 index fa1b18e16f..9b90d256ff 100644 --- a/src/lms/lms.F90 +++ b/src/lms/lms.F90 @@ -29,8 +29,8 @@ MODULE GALAHAD_LMS_precision USE GALAHAD_SYMBOLS USE GALAHAD_SPACE_precision USE GALAHAD_SPECFILE_precision - USE GALAHAD_LAPACK_interface, ONLY : ILAENV, POTRF, POTRS, SYTRF, SYTRS - USE GALAHAD_BLAS_interface, ONLY : LSAME, XERBLA, SWAP, GEMV, TRSV, GER + USE GALAHAD_LAPACK_interface, ONLY : LAENV, POTRF, POTRS, SYTRF, SYTRS + USE GALAHAD_BLAS_interface, ONLY : SWAP, GEMV, TRSV, GER USE GALAHAD_LMT_precision, LMS_control_type => LMT_control_type, & LMS_time_type => LMT_time_type, & LMS_inform_type => LMT_inform_type, & @@ -293,8 +293,8 @@ SUBROUTINE LMS_setup( n, data, control, inform ) REAL ( KIND = rp_ ) :: clock_start, clock_now CHARACTER ( LEN = 6 ) :: method CHARACTER ( LEN = 80 ) :: array_name - INTEGER ( KIND = ip_ ) :: ILAENV - EXTERNAL :: ILAENV + INTEGER ( KIND = ip_ ) :: LAENV + EXTERNAL :: LAENV ! prefix for all output @@ -326,8 +326,8 @@ SUBROUTINE LMS_setup( n, data, control, inform ) SELECT CASE( control%method ) CASE ( 2 ) method = 'SR1 ' - nb = ILAENV( 1_ip_, 'DSYTRF', 'L', data%len_c, & - - 1_ip_, - 1_ip_, - 1_ip_ ) + nb = LAENV( 1_ip_, 'DSYTRF', 'L', data%len_c, & + - 1_ip_, - 1_ip_, - 1_ip_ ) data%lwork = data%len_c * nb len2_qp = 1 ; len2_qp_perm = 1 CASE ( 3 ) @@ -335,8 +335,8 @@ SUBROUTINE LMS_setup( n, data, control, inform ) CASE ( 4 ) method = 'ISBFGS' data%len_c = 2 * data%m ; len2_qp_perm = 1 - nb = ILAENV( 1_ip_, 'DSYTRF', 'L', data%len_c, & - - 1_ip_, - 1_ip_, - 1_ip_ ) + nb = LAENV( 1_ip_, 'DSYTRF', 'L', data%len_c, & + - 1_ip_, - 1_ip_, - 1_ip_ ) data%lwork = data%len_c * nb CASE DEFAULT method = 'BFGS ' @@ -347,8 +347,8 @@ SUBROUTINE LMS_setup( n, data, control, inform ) IF ( data%any_method ) THEN method = 'ANY ' data%len_c = 2 * data%m - nb = ILAENV( 1_ip_, 'DSYTRF', 'L', data%len_c, & - - 1_ip_, - 1_ip_, - 1_ip_ ) + nb = LAENV( 1_ip_, 'DSYTRF', 'L', data%len_c, & + - 1_ip_, - 1_ip_, - 1_ip_ ) data%lwork = MAX( data%len_c * nb, data%lwork ) END IF @@ -1852,14 +1852,9 @@ SUBROUTINE SYTRS_singular( uplo, n, nrhs, A, lda, IPIV, B, ldb, info ) LOGICAL :: upper INTEGER ( KIND = ip_ ) :: j, k, kp REAL ( KIND = rp_ ) :: ak, akm1, akm1k, bk, bkm1, denom - LOGICAL :: LSAME - EXTERNAL :: LSAME, XERBLA info = 0 - upper = LSAME( uplo, 'U' ) - IF ( .NOT. upper .AND. .NOT. LSAME( uplo, 'L' ) ) THEN - info = - 1 - ELSE IF ( n < 0 ) THEN + IF ( n < 0 ) THEN info = - 2 ELSE IF ( nrhs < 0 ) THEN info = - 3 @@ -1867,11 +1862,16 @@ SUBROUTINE SYTRS_singular( uplo, n, nrhs, A, lda, IPIV, B, ldb, info ) info = - 5 ELSE IF ( ldb < MAX( 1, n ) ) THEN info = - 8 + ELSE + IF ( uplo == 'U' .OR. uplo == 'u' ) THEN + upper = .TRUE. + ELSE IF ( uplo == 'L' .OR. uplo == 'l' ) THEN + upper = .FALSE. + ELSE + info = - 1 + END IF END IF - IF ( info /= 0 ) THEN - CALL XERBLA( 'DSYTRS', - info ) - RETURN - END IF + IF ( info /= 0 ) RETURN ! quick return if possible diff --git a/src/lpb/lpb.F90 b/src/lpb/lpb.F90 index c23e2e08e5..7d6aa3abca 100644 --- a/src/lpb/lpb.F90 +++ b/src/lpb/lpb.F90 @@ -1,4 +1,4 @@ -! THIS VERSION: GALAHAD 4.3 - 2024-01-17 AT 16:40 GMT. +! THIS VERSION: GALAHAD 4.3 - 2024-01-27 AT 16:40 GMT. #include "galahad_modules.h" @@ -2643,6 +2643,7 @@ SUBROUTINE LPB_solve_main( dims, n, m, A_val, A_col, A_ptr, & REAL ( KIND = rp_ ) :: one_plus_2_sigma_mu, two_sigma_mu2, two_sigma_mu REAL ( KIND = rp_ ) :: opt_alpha_guarantee, opt_merit_guarantee REAL ( KIND = rp_ ) :: stop_p, stop_d, stop_c, two_mu + REAL ( KIND = rp_ ) :: rnbnds, rnbnds_x, rnbnds_c LOGICAL :: set_printt, set_printi, set_printw, set_printd, set_printe LOGICAL :: printt, printi, printe, printd, printw, set_printp, printp LOGICAL :: maxpiv, stat_required, guarantee, unbounded @@ -3249,6 +3250,9 @@ SUBROUTINE LPB_solve_main( dims, n, m, A_val, A_col, A_ptr, & ! find the max-norm of the residual nbnds = nbnds_x + nbnds_c + rnbnds_x = REAL( nbnds_x, KIND = rp_ ) + rnbnds_c = REAL( nbnds_c, KIND = rp_ ) + rnbnds = REAL( nbnds, KIND = rp_ ) IF ( printi .AND. use_scale_c .AND. m > 0 .AND. & dims%c_l_start <= dims%c_u_end ) & WRITE( out, "( A, ' largest/smallest scale factor', 2ES11.4 )" ) & @@ -3324,13 +3328,13 @@ SUBROUTINE LPB_solve_main( dims, n, m, A_val, A_col, A_ptr, & ! record the slackness and the deviation from the central path IF ( nbnds_x > 0 ) THEN - slknes_x = slknes_x / nbnds_x + slknes_x = slknes_x / rnbnds_x ELSE slknes_x = zero END IF IF ( nbnds_c > 0 ) THEN - slknes_c = slknes_c / nbnds_c + slknes_c = slknes_c / rnbnds_c ELSE slknes_c = zero END IF @@ -3341,7 +3345,7 @@ SUBROUTINE LPB_solve_main( dims, n, m, A_val, A_col, A_ptr, & ELSE gamma_f = one END IF - slknes = slknes / nbnds + slknes = slknes / rnbnds gamma_c = control%gamma_c * slkmin / slknes ELSE gamma_f = zero ; slknes = zero ; gamma_c = zero @@ -3712,10 +3716,10 @@ SUBROUTINE LPB_solve_main( dims, n, m, A_val, A_col, A_ptr, & IF ( inform%feasible .AND. gradient_kind == 0 ) THEN IF ( inform%potential < control%potential_unbounded * & - ( ( dims%x_l_end - dims%x_free ) + & - ( n - dims%x_u_start + 1 ) + & - ( dims%c_l_end - dims%c_l_start + 1 ) + & - ( dims%c_u_end - dims%c_u_start + 1 ) ) ) THEN + REAL( ( dims%x_l_end - dims%x_free ) + & + ( n - dims%x_u_start + 1 ) + & + ( dims%c_l_end - dims%c_l_start + 1 ) + & + ( dims%c_u_end - dims%c_u_start + 1 ), KIND = rp_ ) ) THEN inform%status = GALAHAD_error_no_center ; GO TO 600 END IF @@ -5480,7 +5484,7 @@ SUBROUTINE LPB_solve_main( dims, n, m, A_val, A_col, A_ptr, & ! record the initial slope along the search arc - slope = - ( merit - mu * nbnds ) + slope = - ( merit - mu * rnbnds ) ! define an interval [alhpa_l,alpha_u] containing the required stepsize @@ -5575,11 +5579,11 @@ SUBROUTINE LPB_solve_main( dims, n, m, A_val, A_col, A_ptr, & ! record the initial slope along the search arc IF ( arc == 'ZP' ) THEN - slope = - two * ( merit - mu * nbnds ) + tau * res_primal_dual + slope = - two * ( merit - mu * rnbnds ) + tau * res_primal_dual ELSE IF ( puiseux ) THEN - slope = - two * ( merit - mu * nbnds ) + slope = - two * ( merit - mu * rnbnds ) ELSE - slope = - ( merit - mu * nbnds ) + slope = - ( merit - mu * rnbnds ) END IF IF ( printw ) WRITE( out, "( A, ' value and slope = ', 1P, 2D12.4)") & prefix, merit, slope @@ -5828,7 +5832,7 @@ SUBROUTINE LPB_solve_main( dims, n, m, A_val, A_col, A_ptr, & Y_u( dims%c_u_start : dims%c_u_end ) ) IF ( nbnds > 0 ) THEN - slknes = slknes / nbnds + slknes = slknes / rnbnds ELSE slknes = zero END IF @@ -6128,18 +6132,18 @@ SUBROUTINE LPB_solve_main( dims, n, m, A_val, A_col, A_ptr, & MAXVAL( - Y_u( dims%c_u_start : dims%c_u_end ) ) ) IF ( nbnds_x > 0 ) THEN - slknes_x = slknes_x / nbnds_x + slknes_x = slknes_x / rnbnds_x ELSE slknes_x = zero END IF IF ( nbnds_c > 0 ) THEN - slknes_c = slknes_c / nbnds_c + slknes_c = slknes_c / rnbnds_c ELSE slknes_c = zero END IF IF ( nbnds > 0 ) THEN - slknes = slknes / nbnds + slknes = slknes / rnbnds inform%complementary_slackness = slknes ELSE slknes = zero @@ -7707,7 +7711,7 @@ SUBROUTINE LPB_compute_stepsize( dims, n, m, nbnds, order, puiseux, & ! ... and both (x-x_l)_i(z_l)_i - (gamma_c / nbds) * comp >= 0 and ! (x-x_u)_i(z_u)_i - (gamma_c / nbds) * comp >= 0 - scomp = comp * gamma_c / nbnds + scomp = comp * gamma_c / REAL( nbnds, KIND = rp_ ) DO i = dims%x_free + 1, dims%x_u_start - 1 IF ( ( X( i ) - X_l( i ) ) * Z_l( i ) < scomp ) THEN @@ -7946,7 +7950,7 @@ SUBROUTINE LPB_compute_lmaxstep( dims, n, m, nbnds, X, X_l, X_u, DX, & ! Local variables - REAL ( KIND = rp_ ) :: compc, compl, compq, coef0, coef1, coef2 + REAL ( KIND = rp_ ) :: compc, compl, compq, coef0, coef1, coef2, rnbnds REAL ( KIND = rp_ ) :: coef0_f, coef1_f, coef2_f, root1, root2, tol REAL ( KIND = rp_ ) :: alpha_max_b, alpha_max_f, alpha, infeas_gamma_f @@ -7957,6 +7961,7 @@ SUBROUTINE LPB_compute_lmaxstep( dims, n, m, nbnds, X, X_l, X_u, DX, & RETURN END IF tol = epsmch ** 0.75 + rnbnds = REAL( nbnds, KIND = rp_ ) ! ================================================ ! part to compute alpha_max_b @@ -7993,8 +7998,9 @@ SUBROUTINE LPB_compute_lmaxstep( dims, n, m, nbnds, X, X_l, X_u, DX, & ! Scale these coefficients - compc = - gamma_c * coef0_f / nbnds ; compl = - gamma_c * coef1_f / nbnds - compq = - gamma_c * coef2_f / nbnds + compc = - gamma_c * coef0_f / rnbnds + compl = - gamma_c * coef1_f / rnbnds + compq = - gamma_c * coef2_f / rnbnds ! Compute the coefficients for the quadratic expression ! for the individual complementarity diff --git a/src/lsqp/lsqp.F90 b/src/lsqp/lsqp.F90 index 1c8250ee39..879d0cbbca 100644 --- a/src/lsqp/lsqp.F90 +++ b/src/lsqp/lsqp.F90 @@ -1,4 +1,4 @@ -! THIS VERSION: GALAHAD 4.3 - 2024-01-17 AT 16:10 GMT. +! THIS VERSION: GALAHAD 4.3 - 2024-01-27 AT 16:10 GMT. #include "galahad_modules.h" @@ -2968,7 +2968,7 @@ SUBROUTINE LSQP_solve_main( dims, n, m, A_val, A_col, A_ptr, & REAL ( KIND = rp_ ) :: slknes_x, slknes_c, slkmax_x, slkmax_c, slknes_req REAL ( KIND = rp_ ) :: slkmin_x, slkmin_c, merit_best, reduce_infeas REAL ( KIND = rp_ ) :: prfeas, dufeas, p_min, p_max, d_min, d_max - REAL ( KIND = rp_ ) :: step, one_minus_alpha + REAL ( KIND = rp_ ) :: step, one_minus_alpha, rnbnds, rnbnds_x, rnbnds_c REAL ( KIND = rp_ ) :: pmax_cor, pivot_tol, relative_pivot_tol, balance ! REAL ( KIND = rp_ ) :: errorc, errorg LOGICAL :: set_printt, set_printi, set_printw, set_printd, set_printe @@ -3455,6 +3455,9 @@ SUBROUTINE LSQP_solve_main( dims, n, m, A_val, A_col, A_ptr, & ! Find the max-norm of the residual nbnds = nbnds_x + nbnds_c + rnbnds_x = REAL( nbnds_x, KIND = rp_ ) + rnbnds_c = REAL( nbnds_c, KIND = rp_ ) + rnbnds = REAL( nbnds, KIND = rp_ ) IF ( printi .AND. m > 0 .AND. dims%c_l_start <= dims%c_u_end ) & WRITE( out, "( A, ' largest/smallest scale factor ', 2ES12.4 )" ) & prefix, MAXVAL( SCALE_C ), MINVAL( SCALE_C ) @@ -3557,19 +3560,19 @@ SUBROUTINE LSQP_solve_main( dims, n, m, A_val, A_col, A_ptr, & ! Record the slackness and the deviation from the central path IF ( nbnds_x > 0 ) THEN - slknes_x = slknes_x / nbnds_x + slknes_x = slknes_x / rnbnds_x ELSE slknes_x = zero END IF IF ( nbnds_c > 0 ) THEN - slknes_c = slknes_c / nbnds_c + slknes_c = slknes_c / rnbnds_c ELSE slknes_c = zero END IF IF ( nbnds > 0 ) THEN - gamma_f = gamma_f0 * slknes ; slknes = slknes / nbnds + gamma_f = gamma_f0 * slknes ; slknes = slknes / rnbnds gamma_b = gamma_b0 * slkmin / slknes ELSE gamma_f = zero ; slknes = zero ; gamma_b = zero @@ -3784,10 +3787,10 @@ SUBROUTINE LSQP_solve_main( dims, n, m, A_val, A_col, A_ptr, & IF ( inform%feasible .AND. Hessian_kind == 0 .AND. & gradient_kind == 0 ) THEN IF ( inform%potential < control%potential_unbounded * & - ( ( dims%x_l_end - dims%x_free ) + & - ( n - dims%x_u_start + 1 ) + & - ( dims%c_l_end - dims%c_l_start + 1 ) + & - ( dims%c_u_end - dims%c_u_start + 1 ) ) ) THEN + REAL( ( dims%x_l_end - dims%x_free ) + & + ( n - dims%x_u_start + 1 ) + & + ( dims%c_l_end - dims%c_l_start + 1 ) + & + ( dims%c_u_end - dims%c_u_start + 1 ), KIND = rp_ ) ) THEN inform%status = GALAHAD_error_no_center ; GO TO 600 END IF @@ -4653,7 +4656,7 @@ SUBROUTINE LSQP_solve_main( dims, n, m, A_val, A_col, A_ptr, & ! Record the slope along the search direction ! :::::::::::::::::::::::::::::::::::::::::::: - slope = - ( merit - mu * nbnds ) + slope = - ( merit - mu * rnbnds ) IF ( printt ) WRITE( out, "( A, ' Value and slope = ', 1P, 2D12.4)")& prefix, merit, slope @@ -4899,18 +4902,18 @@ SUBROUTINE LSQP_solve_main( dims, n, m, A_val, A_col, A_ptr, & MAXVAL( - Y_u( dims%c_u_start : dims%c_u_end ) ) ) IF ( nbnds_x > 0 ) THEN - slknes_x = slknes_x / nbnds_x + slknes_x = slknes_x / rnbnds_x ELSE slknes_x = zero END IF IF ( nbnds_c > 0 ) THEN - slknes_c = slknes_c / nbnds_c + slknes_c = slknes_c / rnbnds_c ELSE slknes_c = zero END IF IF ( nbnds > 0 ) THEN - slknes = slknes / nbnds + slknes = slknes / rnbnds slknes_req = slknes ELSE slknes = zero @@ -6201,13 +6204,14 @@ SUBROUTINE LSQP_compute_maxstep( dims, n, m, Z_l, Z_u, DZ_l, DZ_u, & ! Local variables REAL ( KIND = rp_ ) :: compc, compl, compq, coef0, coef1, coef2 - REAL ( KIND = rp_ ) :: coef0_f, coef1_f, coef2_f + REAL ( KIND = rp_ ) :: coef0_f, coef1_f, coef2_f, rnbnds REAL ( KIND = rp_ ) :: root1, root2, tol, alpha, alp, nu_gamma_f alpha_max_b = infinity ; alpha_max_f = infinity inform%status = GALAHAD_ok IF ( nbnds == 0 ) RETURN tol = epsmch ** 0.75 + rnbnds = REAL( nbnds, KIND = rp_ ) ! ================================================ ! part to compute alpha_max_b @@ -6250,8 +6254,9 @@ SUBROUTINE LSQP_compute_maxstep( dims, n, m, Z_l, Z_u, DZ_l, DZ_u, & ! Scale these coefficients - compc = - gamma_b * coef0_f / nbnds ; compl = - gamma_b * coef1_f / nbnds - compq = - gamma_b * coef2_f / nbnds + compc = - gamma_b * coef0_f / rnbnds + compl = - gamma_b * coef1_f / rnbnds + compq = - gamma_b * coef2_f / rnbnds ! write(6,"( ' gamma_b ', ES12.4, I6 )" ) gamma_b, nbnds ! write( 6, "( 3ES10.2 )" ) compq, compl, compc diff --git a/src/lsrt/lsrt.F90 b/src/lsrt/lsrt.F90 index 6fdfb53e40..1706eb3332 100644 --- a/src/lsrt/lsrt.F90 +++ b/src/lsrt/lsrt.F90 @@ -1,4 +1,4 @@ -! THIS VERSION: GALAHAD 4.1 - 2023-01-24 AT 09:30 GMT. +! THIS VERSION: GALAHAD 4.3 - 2023-01-27 AT 16:30 GMT. #include "galahad_modules.h" @@ -1059,17 +1059,17 @@ SUBROUTINE LSRT_solve( m, n, p, sigma, X, U, V, data, control, inform ) ! Record statistics about the number of inner iterations performed IF ( inform%biters > 0 ) THEN - rbiters = inform%biters + rbiters = REAL( inform%biters, KIND = rp_ ) inform%biters = inform%biters + 1 inform%biter_min = MIN( inform%biter_min, data%biter ) inform%biter_max = MAX( inform%biter_max, data%biter ) inform%biter_mean = ( rbiters / ( rbiters + one ) ) * & - ( inform%biter_mean + data%biter / rbiters ) + ( inform%biter_mean + REAL( data%biter, KIND = rp_ ) / rbiters ) ELSE inform%biters = 1 inform%biter_min = data%biter inform%biter_max = data%biter - inform%biter_mean = data%biter + inform%biter_mean = REAL( data%biter, KIND = rp_ ) END IF ! Compute the norms ||r_k|| and ||A^T r_k|| diff --git a/src/lstr/lstr.F90 b/src/lstr/lstr.F90 index b895716c87..c91a91d085 100644 --- a/src/lstr/lstr.F90 +++ b/src/lstr/lstr.F90 @@ -1,4 +1,4 @@ -! THIS VERSION: GALAHAD 4.1 - 2023-01-24 AT 09:30 GMT. +! THIS VERSION: GALAHAD 4.3 - 2023-01-27 AT 16:30 GMT. #include "galahad_modules.h" @@ -1200,17 +1200,17 @@ SUBROUTINE LSTR_solve( m, n, radius, X, U, V, data, control, inform ) ! Record statistics about the number of inner iterations performed IF ( INFORM%biters > 0 ) THEN - rbiters = INFORM%biters + rbiters = REAL( inform%biters, KIND = rp_ ) inform%biters = inform%biters + 1 inform%biter_min = MIN( inform%biter_min, data%biter ) inform%biter_max = MAX( inform%biter_max, data%biter ) inform%biter_mean = ( rbiters / ( rbiters + one ) ) * & - ( inform%biter_mean + data%biter / rbiters ) + ( inform%biter_mean + REAL( data%biter, KIND = rp_ ) / rbiters ) ELSE inform%biters = 1 inform%biter_min = data%biter inform%biter_max = data%biter - inform%biter_mean = data%biter + inform%biter_mean = REAL( data%biter, KIND = rp_ ) END IF ! Compute the norms ||r_k|| and ||A^T r_k|| diff --git a/src/miqr/miqr.F90 b/src/miqr/miqr.F90 index 27342a119c..be17c459d7 100644 --- a/src/miqr/miqr.F90 +++ b/src/miqr/miqr.F90 @@ -1,4 +1,4 @@ -! THIS VERSION: GALAHAD 4.1 - 2023-01-24 AT 09:30 GMT. +! THIS VERSION: GALAHAD 4.3 - 2024-01-27 AT 16:30 GMT. #include "galahad_modules.h" @@ -807,8 +807,9 @@ SUBROUTINE MIQR_form( A, data, control, inform ) ! exit if the number of newly-independent columns is small - IF ( data%level( level )%order <= & - data%control%tol_level * data%level( level )%n ) EXIT + IF ( REAL( data%level( level )%order, KIND = rp_ ) <= & + data%control%tol_level * & + REAL( data%level( level )%n, KIND = rp_ ) ) EXIT ! exit if the remaining number of unprocessed columns is small diff --git a/src/nls/nls.F90 b/src/nls/nls.F90 index 01d9089e7a..e4ad73c1f6 100644 --- a/src/nls/nls.F90 +++ b/src/nls/nls.F90 @@ -1,4 +1,4 @@ -! THIS VERSION: GALAHAD 4.1 - 2023-01-24 AT 09:30 GMT. +! THIS VERSION: GALAHAD 4.3 - 2024-01-27 AT 16:50 GMT. #include "galahad_modules.h" @@ -3927,7 +3927,8 @@ END SUBROUTINE eval_SCALE = data%total_facts + data%subproblem_data%total_facts inform%factorization_max = MAX( inform%factorization_max, & inform%subproblem_inform%RQS_inform%factorizations ) - inform%factorization_average = data%total_facts / inform%iter + inform%factorization_average = REAL( data%total_facts, KIND = rp_ ) & + / REAL( inform%iter, KIND = rp_ ) END IF ! ============================================================================ @@ -6720,7 +6721,8 @@ END SUBROUTINE eval_SCALE IF ( inform%RQS_inform%hard_case ) data%hard = 'h' facts_this_solve = inform%RQS_inform%factorizations - facts_this_solve inform%factorization_average = & - inform%RQS_inform%factorizations / inform%iter + REAL( inform%RQS_inform%factorizations, KIND = rp_ ) & + / REAL( inform%iter, KIND = rp_ ) inform%factorization_max = & MAX( inform%factorization_max, facts_this_solve ) inform%max_entries_factors = MAX( inform%max_entries_factors, & diff --git a/src/presolve/presolve.F90 b/src/presolve/presolve.F90 index 61bb35f11b..a49dd2ab0e 100644 --- a/src/presolve/presolve.F90 +++ b/src/presolve/presolve.F90 @@ -1,4 +1,4 @@ -! THIS VERSION: GALAHAD 4.1 - 2023-01-24 AT 09:30 GMT. +! THIS VERSION: GALAHAD 4.3 - 2024-01-27 AT 16:30 GMT. #include "galahad_modules.h" @@ -4409,7 +4409,7 @@ SUBROUTINE PRESOLVE_analyze END IF tmp = MAX( s%a_max, s%h_max, s%x_max, s%z_max, s%g_max, s%c_max, s%y_max ) s%max_growth = control%max_growth_factor * tmp - s%ACCURACY = tmp * itmp * EPSMACH + s%ACCURACY = tmp * REAL( itmp, KIND = rp_ ) * EPSMACH IF ( s%level >= DETAILS ) THEN WRITE( s%out, * ) ' setting problem dependent parameters' @@ -12382,7 +12382,8 @@ SUBROUTINE PRESOLVE_linear_doubleton( j, split_ok ) ELSE - IF ( s%A_row_s( io ) + nfills > s%max_fill_prop * ns ) THEN + IF ( REAL( s%A_row_s( io ) + nfills, KIND = rp_ ) > & + s%max_fill_prop * REAL( ns, KIND = rp_ ) ) THEN IF ( s%level >= DEBUG ) WRITE( s%out, * ) & ' too many fills in sparse A: skipping pivoting' EXIT @@ -20617,7 +20618,7 @@ SUBROUTINE PRESOLVE_revise_control( mode, prob, control, inform, s ) END IF END IF IF ( control%max_fill >= 0 ) THEN - s%max_fill_prop = HUNDRED + control%max_fill + s%max_fill_prop = HUNDRED + REAL( control%max_fill, KIND = rp_ ) s%max_fill_prop = s%max_fill_prop / HUNDRED ELSE s%max_fill_prop = s%INFINITY diff --git a/src/qpa/inqpa.F90 b/src/qpa/inqpa.F90 index 0ee762b50b..c670030639 100644 --- a/src/qpa/inqpa.F90 +++ b/src/qpa/inqpa.F90 @@ -358,7 +358,8 @@ PROGRAM RUNQPA_DATA_precision ! & ' maximum element of H = ', ES12.4 )" ) & ! MAXVAL( ABS( prob%A%val( : A_ne ) ) ), & ! MAXVAL( ABS( prob%H%val( : H_ne ) ) ) - prob%rho_g = 2 * m ; prob%rho_b = 2 * n + prob%rho_g = REAL( 2 * m, KIND = rp_ ) + prob%rho_b = REAL( 2 * n, KIND = rp_ ) ! ------------------- problem set-up complete ---------------------- @@ -426,8 +427,8 @@ PROGRAM RUNQPA_DATA_precision CALL SPECFILE_assign_string ( spec( 23 ), qfilename, errout ) CALL SPECFILE_assign_integer( spec( 24 ), qfiledevice, errout ) - IF ( prob%rho_g <= zero ) prob%rho_g = 2 * m - IF ( prob%rho_b <= zero ) prob%rho_b = 2 * n + IF ( prob%rho_g <= zero ) prob%rho_g = REAL( 2 * m, KIND = rp_ ) + IF ( prob%rho_b <= zero ) prob%rho_b = REAL( 2 * n, KIND = rp_ ) ! If required, print out the (raw) problem data diff --git a/src/qpb/qpb.F90 b/src/qpb/qpb.F90 index 426e1e111f..3530490728 100644 --- a/src/qpb/qpb.F90 +++ b/src/qpb/qpb.F90 @@ -1,4 +1,4 @@ -! THIS VERSION: GALAHAD 4.3 - 2024-01-17 AT 16:10 GMT. +! THIS VERSION: GALAHAD 4.3 - 2024-01-27 AT 16:10 GMT. #include "galahad_modules.h" @@ -4495,7 +4495,8 @@ SUBROUTINE QPB_solve_main( dims, n, m, & Y_u( dims%c_u_start : dims%c_u_end ) ) IF ( nbnds > 0 ) THEN - norm_c = ten ** ( 2 * ( NINT( LOG10( norm_c / nbnds ) ) / 2 ) ) + norm_c = ten ** ( 2 * ( NINT( LOG10( norm_c & + / REAL( nbnds, KIND = rp_ ) ) ) / 2 ) ) ELSE norm_c = zero END IF diff --git a/src/qpc/qpc.F90 b/src/qpc/qpc.F90 index d5c59b5951..9b7cd61826 100644 --- a/src/qpc/qpc.F90 +++ b/src/qpc/qpc.F90 @@ -1,4 +1,4 @@ -! THIS VERSION: GALAHAD 4.3 - 2024-01-17 AT 16:10 GMT. +! THIS VERSION: GALAHAD 4.3 - 2024-01-27 AT 16:10 GMT. #include "galahad_modules.h" @@ -4651,26 +4651,26 @@ SUBROUTINE QPC_solve( prob, C_stat, B_stat, data, control, inform, & IF ( control%qpb_or_qpa .OR. control%no_qpb ) THEN IF( control%rho_g <= zero ) THEN - prob%rho_g = 2 * prob%m + prob%rho_g = REAL( 2 * prob%m, KIND = rp_ ) ELSE prob%rho_g = control%rho_g END IF IF( control%rho_b <= zero ) THEN - prob%rho_b = 2 * prob%n + prob%rho_b = REAL( 2 * prob%n, KIND = rp_ ) ELSE prob%rho_b = control%rho_b END IF ELSE IF( control%rho_g <= zero ) THEN - prob%rho_g = prob%m + prob%rho_g = REAL( prob%m, KIND = rp_ ) prob%rho_g = two * MAX( prob%rho_g, MAXVAL( ABS( prob%Y ) ) ) ELSE prob%rho_g = control%rho_g END IF IF( control%rho_b <= zero ) THEN - prob%rho_b = prob%n + prob%rho_b = REAL( prob%n, KIND = rp_ ) prob%rho_b = two * MAX( prob%rho_b, MAXVAL( ABS( prob%Z ) ) ) ELSE prob%rho_b = control%rho_b diff --git a/src/roots/roots.F90 b/src/roots/roots.F90 index ff6e324d38..b68349aae7 100644 --- a/src/roots/roots.F90 +++ b/src/roots/roots.F90 @@ -1,4 +1,4 @@ -! THIS VERSION: GALAHAD 4.1 - 2023-01-24 AT 09:30 GMT. +! THIS VERSION: GALAHAD 4.1 - 2023-01-27 AT 16:30 GMT. #include "galahad_modules.h" @@ -1415,7 +1415,7 @@ SUBROUTINE ROOTS_polynomial_main( A, N, ROOT, D ) u = base ** i DO k = 0, nn - 1 D( k ) = D( k ) * u - A( k ) = D( k ) * ( nn - k ) + A( k ) = D( k ) * REAL( nn - k, KIND = rp_ ) END DO D( nn ) = D( nn ) * u @@ -1423,7 +1423,7 @@ SUBROUTINE ROOTS_polynomial_main( A, N, ROOT, D ) z0 = zero afz0 = ABS( D( nn ) ) - afzmin = afz0 * nn * 16.0_rp_ * epsmch + afzmin = afz0 * REAL( nn, KIND = rp_ ) * 16.0_rp_ * epsmch ! Test for roots at the origin @@ -1440,7 +1440,7 @@ SUBROUTINE ROOTS_polynomial_main( A, N, ROOT, D ) DO k = 0, nn - 1 u = ABS( D( K ) ) IF ( u == zero ) EXIT - u = LOG( afz0 / u ) / ( nn - k ) + u = LOG( afz0 / u ) / REAL( nn - k, KIND = rp_ ) r0 = MIN( u, r0 ) END DO r0 = EXP( r0 ) / 2 diff --git a/src/rqs/rqs.F90 b/src/rqs/rqs.F90 index 1e8742d3a7..cc2dcbf852 100644 --- a/src/rqs/rqs.F90 +++ b/src/rqs/rqs.F90 @@ -1,4 +1,4 @@ -! THIS VERSION: GALAHAD 4.3 - 2024-01-27 AT 07:30 GMT. +! THIS VERSION: GALAHAD 4.3 - 2024-01-27 AT 16:40 GMT. #include "galahad_modules.h" @@ -44,7 +44,7 @@ MODULE GALAHAD_RQS_precision USE GALAHAD_SLS_precision USE GALAHAD_IR_precision USE GALAHAD_MOP_precision, ONLY: mop_AX - USE GALAHAD_LAPACK_interface, ONLY : ILAENV, SYEV, SYGV + USE GALAHAD_LAPACK_interface, ONLY : LAENV, SYEV, SYGV IMPLICIT NONE @@ -831,8 +831,8 @@ SUBROUTINE RQS_solve( n, p, sigma, f, C, H, X, data, control, inform, & REAL ( KIND = rp_ ) :: clock_start, clock_now, clock_record LOGICAL :: new_q CHARACTER ( LEN = 80 ) :: array_name - INTEGER ( KIND = ip_ ) :: ILAENV - EXTERNAL :: ILAENV + INTEGER ( KIND = ip_ ) :: LAENV + EXTERNAL :: LAENV ! prefix for all output @@ -996,7 +996,7 @@ SUBROUTINE RQS_solve( n, p, sigma, f, C, H, X, data, control, inform, & ! allocate workspace - nb = ILAENV( 1, 'DSYTRD', 'L', n, - 1, - 1, - 1 ) + nb = LAENV( 1, 'DSYTRD', 'L', n, - 1, - 1, - 1 ) lwork = MAX( 1, 3 * n - 1, ( nb + 2 ) * n ) array_name = 'rqs: work' @@ -3642,7 +3642,8 @@ SUBROUTINE RQS_solve_main( n, p, sigma, f, C, H, X, data, control, & ELSE lambda = MIN( lambda_l + theta_g * width, & MAX( lambda_l, lambda_s_l + theta_ii * & - ( width_rel ** ( two * n_invit - gamma_eps ) ) ) ) + ( width_rel ** ( two * & + REAL( n_invit, KIND = rp_ ) - gamma_eps ) ) ) ) END IF ! end of potential hard case. If no inverse iteration was applied, diff --git a/src/sbls/sbls.F90 b/src/sbls/sbls.F90 index 45807e4a9b..c78db1cabe 100644 --- a/src/sbls/sbls.F90 +++ b/src/sbls/sbls.F90 @@ -49,7 +49,7 @@ MODULE GALAHAD_SBLS_precision USE GALAHAD_SPECFILE_precision USE GALAHAD_NORMS_precision, ONLY: TWO_norm USE GALAHAD_BLAS_interface, ONLY : GEMV - USE GALAHAD_LAPACK_interface, ONLY : ILAENV, POTRF, POTRS, SYTRF, SYTRS + USE GALAHAD_LAPACK_interface, ONLY : LAENV, POTRF, POTRS, SYTRF, SYTRS IMPLICIT NONE @@ -2104,8 +2104,8 @@ SUBROUTINE SBLS_form_n_factorize_explicit( n, m, H, A, C, efactors, & LOGICAL :: printi, resize, use_schur_complement LOGICAL :: fail_if_not_sc, numerical_pivoting CHARACTER ( LEN = 80 ) :: array_name - INTEGER ( KIND = ip_ ) :: ILAENV - EXTERNAL :: ILAENV + INTEGER ( KIND = ip_ ) :: LAENV + EXTERNAL :: LAENV ! REAL ( KIND = rp_ ) :: DD(2,A%m+A%n) @@ -4415,8 +4415,8 @@ SUBROUTINE SBLS_form_n_factorize_explicit( n, m, H, A, C, efactors, & ! set up space for the Bunch-Kaufman factorization of S np1 = H_lm%n_restriction + 1 ; npm = n + m - nb = ILAENV( 1_ip_, 'DSYTRF', 'L', efactors%len_s_max, & - - 1_ip_, - 1_ip_, - 1_ip_ ) + nb = LAENV( 1_ip_, 'DSYTRF', 'L', efactors%len_s_max, & + - 1_ip_, - 1_ip_, - 1_ip_ ) array_name = 'sbls: efactors%IPIV' CALL SPACE_resize_array( efactors%len_s_max, efactors%IPIV, & diff --git a/src/scale/scale.F90 b/src/scale/scale.F90 index 11b0527739..6f99121a07 100644 --- a/src/scale/scale.F90 +++ b/src/scale/scale.F90 @@ -1414,7 +1414,7 @@ SUBROUTINE SCALE_get_factors_from_K( n, m, H, A, trans, data, & ! compute the stopping tolerance - stop_tol = control%stop_tol * ne + stop_tol = control%stop_tol * REAL( ne, KIND = rp_ ) ! -------------- ! main iteration @@ -1908,7 +1908,7 @@ SUBROUTINE SCALE_get_factors_from_A( n, m, A, trans, data, & ! set the stopping tolerance - stop_tol = a_ne * control%stop_tol + stop_tol = REAL( a_ne, KIND = rp_ ) * control%stop_tol ! set initial values diff --git a/src/sils/sils.F90 b/src/sils/sils.F90 index 9f8ef8fee1..e43236c9d4 100644 --- a/src/sils/sils.F90 +++ b/src/sils/sils.F90 @@ -475,7 +475,8 @@ SUBROUTINE SILS_initialize( FACTORS, CONTROL ) CONTROL%maxla = HUGE( 0 ) CONTROL%maxliw = HUGE( 0 ) CONTROL%pivoting = 1 - CONTROL%thresh = 50 ; CONTROL%CNTL( 2 ) = CONTROL%thresh / 100.0_rp_ + CONTROL%thresh = 50 + CONTROL%CNTL( 2 ) = REAL( CONTROL%thresh, KIND = rp_ ) / 100.0_rp_ CONTROL%ordering = 3 CONTROL%scaling = 0 END IF @@ -543,7 +544,7 @@ SUBROUTINE SILS_analyse( MATRIX, FACTORS, CONTROL, AINFO, PERM ) ! Transfer CONTROL parameters CNTL( 1 ) = CONTROL%u - CNTL( 2 ) = CONTROL%thresh / 100.0_rp_ + CNTL( 2 ) = REAL( CONTROL%thresh, KIND = rp_ ) / 100.0_rp_ CNTL( 3 ) = CONTROL%tolerance CNTL( 4 : 5 ) = CONTROL%CNTL( 4 : 5 ) ICNTL( 1 ) = CONTROL%lp @@ -767,7 +768,7 @@ SUBROUTINE SILS_factorize( MATRIX, FACTORS, CONTROL, FINFO ) CASE ( 2 ) ; CNTL( 1 ) = - CONTROL%u CASE ( 3 ) ; CNTL( 1 ) = 0.0_rp_ END SELECT - CNTL( 2 ) = CONTROL%thresh / 100.0_rp_ + CNTL( 2 ) = REAL( CONTROL%thresh, KIND = rp_ ) / 100.0_rp_ CNTL( 3 ) = CONTROL%tolerance CNTL( 4 : 5 ) = CONTROL%CNTL( 4 : 5 ) ICNTL( 1 ) = CONTROL%lp diff --git a/src/sls/sls.F90 b/src/sls/sls.F90 index 084ea75686..5612956ee1 100644 --- a/src/sls/sls.F90 +++ b/src/sls/sls.F90 @@ -55,7 +55,7 @@ MODULE GALAHAD_SLS_precision USE GALAHAD_SMT_precision USE GALAHAD_SILS_precision USE GALAHAD_BLAS_interface, ONLY : TRSV, TBSV, GEMV, GER, SWAP, SCAL - USE GALAHAD_LAPACK_interface, ONLY : ILAENV, POTRF, POTRS, SYTRF, SYTRS, & + USE GALAHAD_LAPACK_interface, ONLY : LAENV, POTRF, POTRS, SYTRF, SYTRS, & PBTRF, PBTRS ! , SYEV USE HSL_ZD11_precision USE HSL_MA57_precision @@ -2694,8 +2694,8 @@ SUBROUTINE SLS_analyse( matrix, data, control, inform, PERM ) LOGICAL :: mc6168_ordering CHARACTER ( LEN = 400 ), DIMENSION( 1 ) :: path CHARACTER ( LEN = 400 ), DIMENSION( 4 ) :: filename - INTEGER ( KIND = ip_ ) :: ILAENV - EXTERNAL :: ILAENV + INTEGER ( KIND = ip_ ) :: LAENV + EXTERNAL :: LAENV !$ INTEGER ( KIND = ip_ ) :: OMP_GET_NUM_THREADS CHARACTER ( LEN = LEN( TRIM( control%prefix ) ) - 2 ) :: prefix @@ -4171,8 +4171,8 @@ SUBROUTINE SLS_analyse( matrix, data, control, inform, PERM ) inform%status, inform%alloc_status ) IF ( inform%status /= GALAHAD_ok ) GO TO 900 data%sytr_lwork = & - data%n * ILAENV( 1_ip_, 'DSYTRF', 'L', data%n, & - - 1_ip_, - 1_ip_, - 1_ip_ ) + data%n * LAENV( 1_ip_, 'DSYTRF', 'L', data%n, & + - 1_ip_, - 1_ip_, - 1_ip_ ) CALL SPACE_resize_array( data%sytr_lwork, data%WORK, & inform%status, inform%alloc_status ) IF ( inform%status /= GALAHAD_ok ) GO TO 900 diff --git a/src/space/space.F90 b/src/space/space.F90 index 60afe0f7d7..39ef46721a 100644 --- a/src/space/space.F90 +++ b/src/space/space.F90 @@ -2944,100 +2944,100 @@ SUBROUTINE SPACE_resize_integer_carray( len, array, status, alloc_status, & END SUBROUTINE SPACE_resize_integer_carray -! - S P A C E _ R E S I Z E _ L O G I C A L _ C A R R A Y S U B R O U T I N E - - SUBROUTINE SPACE_resize_logical_carray( len, array, status, alloc_status, & - deallocate_error_fatal, array_name, exact_size, bad_alloc, out ) - -! Ensure that the logical allocatable c-style array "array" is of length at -! least len. - -! If exact_size is prsent and true, array is reallocated to be of size len. -! Otherwise array is only reallocated if its length is currently smaller -! than len - -! Dummy arguments - - INTEGER ( KIND = ip_ ), INTENT( IN ) :: len - INTEGER ( KIND = ip_ ), INTENT( OUT ) :: status, alloc_status - LOGICAL ( KIND = lp_ ), ALLOCATABLE, DIMENSION( : ) :: array - INTEGER ( KIND = ip_ ), OPTIONAL :: out - LOGICAL, OPTIONAL :: deallocate_error_fatal, exact_size - CHARACTER ( LEN = 80 ), OPTIONAL :: array_name - CHARACTER ( LEN = 80 ), OPTIONAL :: bad_alloc - -! Local variable - - LOGICAL :: reallocate - -! Check to see if a reallocation (or initial allocation) is needed - - status = GALAHAD_ok ; alloc_status = 0 ; reallocate = .TRUE. - IF ( PRESENT( bad_alloc ) ) bad_alloc = '' - IF ( ALLOCATED( array ) ) THEN - IF ( PRESENT( exact_size ) ) THEN - IF ( exact_size ) THEN - IF ( LBOUND( array, 1 ) /= 0 .OR. & - UBOUND( array, 1 ) /= len - 1 ) THEN - CALL SPACE_dealloc_array( array, status, alloc_status, & - array_name, bad_alloc, out ) - ELSE ; reallocate = .FALSE. - END IF - ELSE - IF ( LBOUND( array, 1 ) /= 0 .OR. & - UBOUND( array, 1 ) < len - 1 ) THEN - CALL SPACE_dealloc_array( array, status, alloc_status, & - array_name, bad_alloc, out ) - ELSE ; reallocate = .FALSE. - END IF - END IF - ELSE - IF ( LBOUND( array, 1 ) /= 0 .OR. & - UBOUND( array, 1 ) < len - 1 ) THEN - CALL SPACE_dealloc_array( array, status, alloc_status, & - array_name, bad_alloc, out ) - ELSE ; reallocate = .FALSE. - END IF - END IF - END IF - -! If a deallocation error occured, return if desired - - IF ( PRESENT( deallocate_error_fatal ) ) THEN - IF ( deallocate_error_fatal .AND. alloc_status /= 0 ) THEN - status = GALAHAD_error_deallocate ; RETURN - END IF - ELSE - IF ( alloc_status /= 0 ) THEN - status = GALAHAD_error_deallocate ; RETURN - END IF - END IF - -! Reallocate array to be of length len, checking for error returns - - IF ( reallocate ) ALLOCATE( array( 0 : len - 1 ), STAT = alloc_status ) - IF ( alloc_status /= 0 ) THEN - status = GALAHAD_error_allocate - IF ( PRESENT( bad_alloc ) .AND. PRESENT( array_name ) ) & - bad_alloc = array_name - IF ( PRESENT( out ) ) THEN - IF ( PRESENT( array_name ) ) THEN - IF ( out > 0 ) WRITE( out, 2900 ) TRIM( array_name ), alloc_status - ELSE - IF ( out > 0 ) WRITE( out, 2910 ) alloc_status - END IF - END IF - END IF - RETURN - -! Non-executable statements - -2900 FORMAT( ' ** Allocation error for ', A, /, ' status = ', I6 ) -2910 FORMAT( ' ** Allocation error status = ', I6 ) - -! End of SPACE_resize_logical_carray - - END SUBROUTINE SPACE_resize_logical_carray +!!$! -S P A C E _ R E S I Z E _ L O G I C A L _ C A R R A Y S U B R O U T I N E +!!$ +!!$ SUBROUTINE SPACE_resize_logical_carray( len, array, status, alloc_status,& +!!$ deallocate_error_fatal, array_name, exact_size, bad_alloc, out ) +!!$ +!!$! Ensure that the logical allocatable c-style array "array" is of length at +!!$! least len. +!!$ +!!$! If exact_size is prsent and true, array is reallocated to be of size len. +!!$! Otherwise array is only reallocated if its length is currently smaller +!!$! than len +!!$ +!!$! Dummy arguments +!!$ +!!$ INTEGER ( KIND = ip_ ), INTENT( IN ) :: len +!!$ INTEGER ( KIND = ip_ ), INTENT( OUT ) :: status, alloc_status +!!$ LOGICAL ( KIND = lp_ ), ALLOCATABLE, DIMENSION( : ) :: array +!!$ INTEGER ( KIND = ip_ ), OPTIONAL :: out +!!$ LOGICAL, OPTIONAL :: deallocate_error_fatal, exact_size +!!$ CHARACTER ( LEN = 80 ), OPTIONAL :: array_name +!!$ CHARACTER ( LEN = 80 ), OPTIONAL :: bad_alloc +!!$ +!!$! Local variable +!!$ +!!$ LOGICAL :: reallocate +!!$ +!!$! Check to see if a reallocation (or initial allocation) is needed +!!$ +!!$ status = GALAHAD_ok ; alloc_status = 0 ; reallocate = .TRUE. +!!$ IF ( PRESENT( bad_alloc ) ) bad_alloc = '' +!!$ IF ( ALLOCATED( array ) ) THEN +!!$ IF ( PRESENT( exact_size ) ) THEN +!!$ IF ( exact_size ) THEN +!!$ IF ( LBOUND( array, 1 ) /= 0 .OR. & +!!$ UBOUND( array, 1 ) /= len - 1 ) THEN +!!$ CALL SPACE_dealloc_array( array, status, alloc_status, & +!!$ array_name, bad_alloc, out ) +!!$ ELSE ; reallocate = .FALSE. +!!$ END IF +!!$ ELSE +!!$ IF ( LBOUND( array, 1 ) /= 0 .OR. & +!!$ UBOUND( array, 1 ) < len - 1 ) THEN +!!$ CALL SPACE_dealloc_array( array, status, alloc_status, & +!!$ array_name, bad_alloc, out ) +!!$ ELSE ; reallocate = .FALSE. +!!$ END IF +!!$ END IF +!!$ ELSE +!!$ IF ( LBOUND( array, 1 ) /= 0 .OR. & +!!$ UBOUND( array, 1 ) < len - 1 ) THEN +!!$ CALL SPACE_dealloc_array( array, status, alloc_status, & +!!$ array_name, bad_alloc, out ) +!!$ ELSE ; reallocate = .FALSE. +!!$ END IF +!!$ END IF +!!$ END IF +!!$ +!!$! If a deallocation error occured, return if desired +!!$ +!!$ IF ( PRESENT( deallocate_error_fatal ) ) THEN +!!$ IF ( deallocate_error_fatal .AND. alloc_status /= 0 ) THEN +!!$ status = GALAHAD_error_deallocate ; RETURN +!!$ END IF +!!$ ELSE +!!$ IF ( alloc_status /= 0 ) THEN +!!$ status = GALAHAD_error_deallocate ; RETURN +!!$ END IF +!!$ END IF +!!$ +!!$! Reallocate array to be of length len, checking for error returns +!!$ +!!$ IF ( reallocate ) ALLOCATE( array( 0 : len - 1 ), STAT = alloc_status ) +!!$ IF ( alloc_status /= 0 ) THEN +!!$ status = GALAHAD_error_allocate +!!$ IF ( PRESENT( bad_alloc ) .AND. PRESENT( array_name ) ) & +!!$ bad_alloc = array_name +!!$ IF ( PRESENT( out ) ) THEN +!!$ IF ( PRESENT( array_name ) ) THEN +!!$ IF ( out > 0 ) WRITE( out, 2900 ) TRIM( array_name ), alloc_status +!!$ ELSE +!!$ IF ( out > 0 ) WRITE( out, 2910 ) alloc_status +!!$ END IF +!!$ END IF +!!$ END IF +!!$ RETURN +!!$ +!!$! Non-executable statements +!!$ +!!$2900 FORMAT( ' ** Allocation error for ', A, /, ' status = ', I6 ) +!!$2910 FORMAT( ' ** Allocation error status = ', I6 ) +!!$ +!!$! End of SPACE_resize_logical_carray +!!$ +!!$ END SUBROUTINE SPACE_resize_logical_carray !- S P A C E _ e x t e n d _ a r r a y _ i n t e g e r S U B R O U T I N E - diff --git a/src/spral/matrix_util.F90 b/src/spral/matrix_util.F90 index b4f94dce50..ecd8972a2c 100644 --- a/src/spral/matrix_util.F90 +++ b/src/spral/matrix_util.F90 @@ -676,12 +676,7 @@ subroutine clean_cscl_oop_main_ptr32(context, multiplier, matrix_type, m, n, & ! Local variables integer(ip_) :: col ! current column - integer(ip_) :: i - integer(ip_) :: idiag - integer(ip_) :: idup - integer(ip_) :: ioor - integer(ip_) :: j - integer(ip_) :: k + integer(ip_) :: i, idiag, idup, ioor, j, k integer(ip_) :: nout ! output unit (set to -1 if nout not present) integer(ip_) :: st ! stat parameter integer(ip_) :: minidx @@ -741,7 +736,7 @@ subroutine clean_cscl_oop_main_ptr32(context, multiplier, matrix_type, m, n, & allocate(map(2*ptr_in(n+1)-2),stat=st) k = 1 ! insert location do col = 1, n - ptr_out(col) = k + ptr_out(col) = INT( k, KIND = i4_ ) if(ptr_in(col+1).lt.ptr_in(col)) then flag = ERROR_PTR_MONO call print_matrix_flag(context,nout,flag) @@ -760,7 +755,7 @@ subroutine clean_cscl_oop_main_ptr32(context, multiplier, matrix_type, m, n, & cycle endif row_out(k) = row_in(i) - map(k) = multiplier*i + map(k) = INT( multiplier * i, KIND = i4_ ) k = k + 1 end do ! Sort entries into order @@ -794,7 +789,7 @@ subroutine clean_cscl_oop_main_ptr32(context, multiplier, matrix_type, m, n, & dup%next => duphead duphead => dup dup%src = map(i) - dup%dest = k-1 + dup%dest = INT( k - 1, KIND = i4_ ) cycle endif if(row_out(i).eq.col) idiag = idiag + 1 @@ -809,14 +804,14 @@ subroutine clean_cscl_oop_main_ptr32(context, multiplier, matrix_type, m, n, & return endif end do - ptr_out(n+1) = k - lmap = k-1 + ptr_out(n+1) = INT( k, KIND = i4_ ) + lmap = INT( k - 1, KIND = i4_ ) elseif(present(val_out)) then allocate(val_out(ptr_in(n+1)-1),stat=st) if(st.ne.0) goto 100 k = 1 ! insert location do col = 1, n - ptr_out(col) = k + ptr_out(col) = INT( k, KIND = i4_ ) if(ptr_in(col+1).lt.ptr_in(col)) then flag = ERROR_PTR_MONO call print_matrix_flag(context,nout,flag) @@ -836,7 +831,7 @@ subroutine clean_cscl_oop_main_ptr32(context, multiplier, matrix_type, m, n, & cycle endif row_out(k) = row_in(i) - val_out(k) = multiplier*val_in(i) + val_out(k) = REAL( multiplier, KIND = rp_ ) * val_in(i) k = k + 1 end do case default @@ -891,11 +886,11 @@ subroutine clean_cscl_oop_main_ptr32(context, multiplier, matrix_type, m, n, & return endif end do - ptr_out(n+1) = k + ptr_out(n+1) = INT( k, KIND = i4_ ) else ! pattern only k = 1 ! insert location do col = 1, n - ptr_out(col) = k + ptr_out(col) = INT( k, KIND = i4_ ) if(ptr_in(col+1).lt.ptr_in(col)) then flag = ERROR_PTR_MONO call print_matrix_flag(context,nout,flag) @@ -951,7 +946,7 @@ subroutine clean_cscl_oop_main_ptr32(context, multiplier, matrix_type, m, n, & return end if end do - ptr_out(n+1) = k + ptr_out(n+1) = INT( k, KIND = i4_ ) endif if(present(map)) then @@ -1220,7 +1215,7 @@ subroutine clean_cscl_oop_main(context, multiplier, matrix_type, m, n, & cycle endif row_out(kk) = row_in(ii) - val_out(kk) = multiplier*val_in(ii) + val_out(kk) = REAL( multiplier, KIND = rp_ ) * val_in(ii) kk = kk + 1 end do case default @@ -1441,12 +1436,7 @@ subroutine convert_coord_to_cscl_ptr32_precision(matrix_type, m, n, ne, row, & ! Local variables character(50) :: context ! Procedure name (used when printing). - integer(ip_) :: i - integer(ip_) :: idiag - integer(ip_) :: idup - integer(ip_) :: ioor - integer(ip_) :: j - integer(ip_) :: l + integer(ip_) :: i, idiag, idup, ioor, j, l integer(i4_) :: k, l1, l2 integer(i4_) :: ne_new integer(ip_) :: nout ! output unit (set to -1 if lp not present) @@ -1585,12 +1575,12 @@ subroutine convert_coord_to_cscl_ptr32_precision(matrix_type, m, n, ne, row, & k=ptr_out(j) ptr_out(j) = k+1 row_out(k) = i - map(k) = l + map(k) = INT( l, KIND = i4_ ) else k=ptr_out(i) ptr_out(i) = k+1 row_out(k) = j - map(k) = -l + map(k) = INT( -l, KIND = i4_ ) end if end do @@ -1603,12 +1593,12 @@ subroutine convert_coord_to_cscl_ptr32_precision(matrix_type, m, n, ne, row, & k=ptr_out(j) ptr_out(j) = k+1 row_out(k) = i - map(k) = l + map(k) = INT( l, KIND = i4_ ) else k=ptr_out(i) ptr_out(i) = k+1 row_out(k) = j - map(k) = l + map(k) = INT( l, KIND = i4_ ) end if end do case default @@ -1619,7 +1609,7 @@ subroutine convert_coord_to_cscl_ptr32_precision(matrix_type, m, n, ne, row, & k=ptr_out(j) ptr_out(j) = k+1 row_out(k) = i - map(k) = l + map(k) = INT( l, KIND = i4_ ) end do end select elseif(present(val_out)) then @@ -2684,8 +2674,8 @@ subroutine sort32( array, n, map, val ) real(rp_), dimension(n), optional, intent(inout) :: val ! Apply same ! permutation to val - integer(ip_) :: i - integer(ip_) :: temp + integer(ip_) :: i, temp + integer(i4_) :: temp4 real(rp_) :: vtemp integer(ip_) :: root @@ -2718,9 +2708,9 @@ subroutine sort32( array, n, map, val ) val(i) = vtemp endif if(present(map)) then - temp = map(1) + temp4 = map(1) map(1) = map(i) - map(i) = temp + map(i) = temp4 endif call pushdown32(1_ip_,i-1_ip_, array, val=val, map=map) end do @@ -3101,7 +3091,7 @@ subroutine half_to_full_int32(n,row,ptr,iw,a,cbase) end do end do - newtau = 2*oldtau - ndiag + newtau = 2*oldtau - INT( ndiag, KIND = i4_ ) ! ipkp1 points to position after end of column being currently processed ipkp1 = oldtau + 1 ! ckp1 points to position after end of same column in expanded structure @@ -3136,7 +3126,7 @@ subroutine half_to_full_int32(n,row,ptr,iw,a,cbase) ! column j in expanded form ptr(j) = jstart - rebase ! set ckp1 for next column - ckp1 = ckp1 - iw(j) + ckp1 = ckp1 - INT( iw(j), KIND = i4_ ) ! reset iw(j) to number of entries in lower triangle of column. iw(j) = lenk end do @@ -3146,7 +3136,7 @@ subroutine half_to_full_int32(n,row,ptr,iw,a,cbase) ! elements a(j,i) are put in position. do j = n,1,-1 i1 = ptr(j) + rebase - i2 = ptr(j) + iw(j) - 1 + rebase + i2 = ptr(j) + INT( iw(j), KIND = i4_ ) - 1 + rebase ! run down column in order ! note that i is always greater than or equal to j if (present(a)) then diff --git a/src/spral/random.F90 b/src/spral/random.F90 index cd0174bdea..b8ef64795a 100644 --- a/src/spral/random.F90 +++ b/src/spral/random.F90 @@ -42,7 +42,7 @@ module spral_random_precision ! ! Get random seed ! - integer function random_get_seed(state) + integer(ip_) function random_get_seed(state) implicit none type(random_state), intent(in) :: state @@ -96,7 +96,7 @@ integer(long_) function random_integer64(state, n) type(random_state), intent(inout) :: state integer(i8_), intent(in) :: n - if (n .le. 0_i8_) then + if (n <= 0_i8_) then random_integer64 = n return end if @@ -105,7 +105,8 @@ integer(long_) function random_integer64(state, n) state%x = int(mod(a*state%x+c, m)) ! Take modulo n for return value - random_integer64 = int(state%x * (real(n,rp_)/real(m,rp_)), long_) + 1 + random_integer64 = int( state%x * & + int( real(n,rp_) / real(m,rp_), ip_ ), long_ ) + 1 end function random_integer64 ! diff --git a/src/spral/rutherford_boeing.F90 b/src/spral/rutherford_boeing.F90 index 1f5053ff1e..7cff73b9ea 100644 --- a/src/spral/rutherford_boeing.F90 +++ b/src/spral/rutherford_boeing.F90 @@ -502,7 +502,7 @@ subroutine rb_read_precision_int64(filename, m, n, ptr, row, val, & r = rcptr(j) if ((abs(options%values) .eq. 3) .and. symmetric) then nzrow(r) = nzrow(r) + 1 - if (r .eq. c) val(j) = max(100, 10*(k+nzrow(r)-1)) + if (r .eq. c) val(j) = real(max(100, 10*(k+nzrow(r)-1)),rp_) end if end do else @@ -511,7 +511,7 @@ subroutine rb_read_precision_int64(filename, m, n, ptr, row, val, & r = rcptr(j) if ((abs(options%values) .eq. 3) .and. symmetric) then nzrow(r) = nzrow(r) + 1 - if (r .eq. c) val(j) = max(100, 10*(k+nzrow(r)-1)) + if (r .eq. c) val(j) = real(max(100, 10*(k+nzrow(r)-1)),rp_) end if end do end if diff --git a/src/ssids/cpu_iface.F90 b/src/ssids/cpu_iface.F90 index c8372a5d61..a4a8b15d09 100644 --- a/src/ssids/cpu_iface.F90 +++ b/src/ssids/cpu_iface.F90 @@ -6,13 +6,6 @@ #define spral_ssids_cpu_iface_precision spral_ssids_cpu_iface_single_64 #define spral_ssids_inform_precision spral_ssids_inform_single_64 #define spral_ssids_types_precision spral_ssids_types_single_64 -#define spral_c_gemv spral_c_sgemv_64 -#define spral_c_trsv spral_c_strsv_64 -#define spral_c_syrk spral_c_ssyrk_64 -#define spral_c_trsm spral_c_strsm_64 -#define spral_c_sytrf spral_c_ssytrf_64 -#define spral_c_potrf spral_c_spotrf_64 -#define spral_c_gemm spral_c_sgemm_64 #define gemv sgemv_64 #define trsv strsv_64 #define syrk ssyrk_64 @@ -25,13 +18,6 @@ #define spral_ssids_cpu_iface_precision spral_ssids_cpu_iface_single #define spral_ssids_inform_precision spral_ssids_inform_single #define spral_ssids_types_precision spral_ssids_types_single -#define spral_c_gemv spral_c_sgemv -#define spral_c_trsv spral_c_strsv -#define spral_c_syrk spral_c_ssyrk -#define spral_c_trsm spral_c_strsm -#define spral_c_sytrf spral_c_ssytrf -#define spral_c_potrf spral_c_spotrf -#define spral_c_gemm spral_c_sgemm #define gemv sgemv #define trsv strsv #define syrk ssyrk @@ -40,19 +26,19 @@ #define potrf spotrf #define gemm sgemm #endif +#define spral_c_gemv spral_c_sgemv +#define spral_c_trsv spral_c_strsv +#define spral_c_syrk spral_c_ssyrk +#define spral_c_trsm spral_c_strsm +#define spral_c_sytrf spral_c_ssytrf +#define spral_c_potrf spral_c_spotrf +#define spral_c_gemm spral_c_sgemm #else #ifdef SPRAL_64BIT_INTEGER #define spral_kinds_precision spral_kinds_double_64 #define spral_ssids_cpu_iface_precision spral_ssids_cpu_iface_double_64 #define spral_ssids_inform_precision spral_ssids_inform_double_64 #define spral_ssids_types_precision spral_ssids_types_double_64 -#define spral_c_gemv spral_c_dgemv_64 -#define spral_c_trsv spral_c_dtrsv_64 -#define spral_c_syrk spral_c_dsyrk_64 -#define spral_c_trsm spral_c_dtrsm_64 -#define spral_c_sytrf spral_c_dsytrf_64 -#define spral_c_potrf spral_c_dpotrf_64 -#define spral_c_gemm spral_c_dgemm_64 #define gemv dgemv_64 #define trsv dtrsv_64 #define syrk dsyrk_64 @@ -65,13 +51,6 @@ #define spral_ssids_cpu_iface_precision spral_ssids_cpu_iface_double #define spral_ssids_inform_precision spral_ssids_inform_double #define spral_ssids_types_precision spral_ssids_types_double -#define spral_c_gemv spral_c_dgemv -#define spral_c_trsv spral_c_dtrsv -#define spral_c_syrk spral_c_dsyrk -#define spral_c_trsm spral_c_dtrsm -#define spral_c_sytrf spral_c_dsytrf -#define spral_c_potrf spral_c_dpotrf -#define spral_c_gemm spral_c_dgemm #define gemv dgemv #define trsv dtrsv #define syrk dsyrk @@ -80,6 +59,13 @@ #define potrf dpotrf #define gemm dgemm #endif +#define spral_c_gemv spral_c_dgemv +#define spral_c_trsv spral_c_dtrsv +#define spral_c_syrk spral_c_dsyrk +#define spral_c_trsm spral_c_dtrsm +#define spral_c_sytrf spral_c_dsytrf +#define spral_c_potrf spral_c_dpotrf +#define spral_c_gemm spral_c_dgemm #endif !> \file diff --git a/src/trs/trs.F90 b/src/trs/trs.F90 index 9310a7b262..ee555a9925 100644 --- a/src/trs/trs.F90 +++ b/src/trs/trs.F90 @@ -44,7 +44,7 @@ MODULE GALAHAD_TRS_precision USE GALAHAD_SLS_precision USE GALAHAD_IR_precision USE GALAHAD_MOP_precision, ONLY: mop_AX - USE GALAHAD_LAPACK_interface, ONLY : ILAENV, SYEV, SYGV + USE GALAHAD_LAPACK_interface, ONLY : LAENV, SYEV, SYGV IMPLICIT NONE @@ -861,8 +861,8 @@ SUBROUTINE TRS_solve( n, radius, f, C, H, X, data, control, inform, & REAL ( KIND = rp_ ) :: clock_start, clock_now, clock_record LOGICAL :: new_q CHARACTER ( LEN = 80 ) :: array_name - INTEGER ( KIND = ip_ ) :: ILAENV - EXTERNAL :: ILAENV + INTEGER ( KIND = ip_ ) :: LAENV + EXTERNAL :: LAENV ! prefix for all output @@ -1018,7 +1018,7 @@ SUBROUTINE TRS_solve( n, radius, f, C, H, X, data, control, inform, & ! allocate workspace - nb = ILAENV( 1_ip_, 'DSYTRD', 'L', n, - 1_ip_, - 1_ip_, - 1_ip_ ) + nb = LAENV( 1_ip_, 'DSYTRD', 'L', n, - 1_ip_, - 1_ip_, - 1_ip_ ) lwork = MAX( 1, 3 * n - 1, ( nb + 2 ) * n ) array_name = 'trs: work' @@ -3136,7 +3136,8 @@ SUBROUTINE TRS_solve_main( n, radius, f, C, H, X, data, control, inform, & ELSE lambda = MIN( lambda_l + theta_g * width, & MAX( lambda_l, lambda_s_l + theta_ii * & - ( width_rel ** ( two * n_invit - gamma_eps ) ) ) ) + ( width_rel ** ( two * & + REAL( n_invit, KIND = rp_ ) - gamma_eps ) ) ) ) END IF ! end of potential hard case. If no inverse iteration was applied, diff --git a/src/wcp/wcp.F90 b/src/wcp/wcp.F90 index e1b4376a9a..394ff68a24 100644 --- a/src/wcp/wcp.F90 +++ b/src/wcp/wcp.F90 @@ -1,4 +1,4 @@ -! THIS VERSION: GALAHAD 4.3 - 2024-01-19 AT 16:15 GMT. +! THIS VERSION: GALAHAD 4.3 - 2024-01-27 AT 16:50 GMT. #include "galahad_modules.h" @@ -1119,7 +1119,7 @@ SUBROUTINE WCP_solve( prob, data, control, inform ) INTEGER ( KIND = ip_ ) :: dz_l_lower, dz_l_upper, dz_u_lower, dz_u_upper REAL :: time_start, time_record, time_now REAL ( KIND = rp_ ) :: clock_start, clock_record, clock_now - REAL ( KIND = rp_ ) :: fixed_sum, av_bnd + REAL ( KIND = rp_ ) :: av_bnd, fixed_sum LOGICAL :: printi, remap_freed, reset_bnd, implicit CHARACTER ( LEN = 80 ) :: array_name @@ -2692,6 +2692,7 @@ SUBROUTINE WCP_solve_main( dims, n, m, A_val, A_col, A_ptr, & REAL ( KIND = rp_ ) :: bound_average, bound_length, perturb_max, alpha_est REAL ( KIND = rp_ ) :: perturb_x, perturb_c, perturb_y, perturb_z, max_r REAL ( KIND = rp_ ) :: mu_l, mu_u, max_xr, max_cr, perturbation_small + REAL ( KIND = rp_ ) :: rnbnds, rnbnds_x, rnbnds_c ! REAL ( KIND = rp_ ) :: old_merit, min_mu, nu LOGICAL :: set_printt, set_printi, set_printw, set_printd, set_printe LOGICAL :: set_printp, printt, printi, printp, printe, printd, printw @@ -3857,6 +3858,9 @@ SUBROUTINE WCP_solve_main( dims, n, m, A_val, A_col, A_ptr, & ! Find the max-norm of the residual nbnds = nbnds_x + nbnds_c + rnbnds_x = REAL( nbnds_x, KIND = rp_ ) + rnbnds_c = REAL( nbnds_c, KIND = rp_ ) + rnbnds = REAL( nbnds, KIND = rp_ ) IF ( printi .AND. m > 0 .AND. dims%c_l_start <= dims%c_u_end ) & WRITE( out, "( A, ' largest/smallest scale factor ', 2ES12.4 )" ) & prefix, MAXVAL( SCALE_C ), MINVAL( SCALE_C ) @@ -3941,19 +3945,19 @@ SUBROUTINE WCP_solve_main( dims, n, m, A_val, A_col, A_ptr, & ! Record the slackness and the deviation from the central path IF ( nbnds_x > 0 ) THEN - slknes_x = slknes_x / nbnds_x + slknes_x = slknes_x / rnbnds_x ELSE slknes_x = zero END IF IF ( nbnds_c > 0 ) THEN - slknes_c = slknes_c / nbnds_c + slknes_c = slknes_c / rnbnds_c ELSE slknes_c = zero END IF IF ( nbnds > 0 ) THEN - slknes = slknes / nbnds + slknes = slknes / rnbnds ELSE slknes = zero END IF @@ -5288,19 +5292,19 @@ SUBROUTINE WCP_solve_main( dims, n, m, A_val, A_col, A_ptr, & MAXVAL( DIST_Y_u( dims%c_u_start : dims%c_u_end ) ) ) IF ( nbnds_x > 0 ) THEN - slknes_x = slknes_x / nbnds_x + slknes_x = slknes_x / rnbnds_x ELSE slknes_x = zero END IF IF ( nbnds_c > 0 ) THEN - slknes_c = slknes_c / nbnds_c + slknes_c = slknes_c / rnbnds_c ELSE slknes_c = zero END IF IF ( nbnds > 0 ) THEN - slknes = slknes / nbnds + slknes = slknes / rnbnds ELSE slknes = zero END IF