Skip to content

Commit

Permalink
remove explicit kinds from geneeric function calls
Browse files Browse the repository at this point in the history
try to make lapack line lengths <80 chars after preprocessing
  • Loading branch information
dalekopera committed Jan 29, 2024
1 parent e7f092a commit 4e9fa08
Show file tree
Hide file tree
Showing 14 changed files with 287 additions and 267 deletions.
1 change: 0 additions & 1 deletion src/general/makemaster
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,6 @@ create_lapack:
$(MV) galahad_lapack.h $(GALAHAD)/include/
$(RM) ./build_lapack


# book keeping

clean:
Expand Down
2 changes: 1 addition & 1 deletion src/lapack/blas.f90
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
! THIS VERSION: GALAHAD 4.3 - 2024-01-28 AT 10:43 GMT
! THIS VERSION: GALAHAD 4.3 - 2024-01-29 AT 09:08 GMT

#include "galahad_blas.h"

Expand Down
138 changes: 69 additions & 69 deletions src/lapack/lapack.f90

Large diffs are not rendered by default.

44 changes: 35 additions & 9 deletions src/lapack/rebuild.F90
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
! THIS VERSION: GALAHAD 4.3 - 2024-01-20 AT 10:00 GMT.
! THIS VERSION: GALAHAD 4.3 - 2024-01-29 AT 09:45 GMT.

! read a file containg a subset of the reference blas, lapack, etc
! written in fortran 77, and output a multi-precision version capable
Expand Down Expand Up @@ -215,13 +215,29 @@ PROGRAM BUILD
! transform the line to accommodate multi-precision symbols, and
! to replace archaic fortran 77 functions

! TODO: replace
! '= dum(1)' '=INT(dum(1),KIND=ip_)'
! '= isgn' '= REAL(isgn,KIND=KIND(sgn)_)'
! '= iws' '= REAL(iws,KIND=KIND(work(1)))
! '= lwkopt' '= REAL(lwkopt,KIND=KIND(work(1)))
! '= maxwrk' '= REAL(maxwrk,KIND=KIND(work(1)))
! '= ws' '= REAL(ws,KIND=KIND(work(1)))
! 'lwkopt = work(1)' 'lwkopt = INT(work(1),KIND=ip_)'
!
! and modify
! IF (tol>=zero .AND. n*tol*(sminl/smax)<=MAX(eps,hndrth*tol)) THEN
! thresh = MAX(ABS(tol)*smax, maxitr*(n*(n*unfl)))
! thresh = MAX(tol*sminoa, maxitr*(n*(n*unfl)))
! wsize = MAX(wsize, 2*mn+work(2*mn+1))
! wsize = mn + work(mn+1)
! z(2*n+5) = hundrd*nfail/REAL(iter)

line = REPEAT( ' ', max_line )
k = 1 ; l_next = 0
DO l = 1, l_end
IF ( in_line( l : l ) /= ' ' .AND. nz < 0 ) nz = l
IF ( l < l_next ) CYCLE
IF ( in_line( l : l + 7 ) == 'EXTERNAL' ) external_line = .TRUE.

IF ( in_line( l : l + 12 ) == 'MAX(0, ILAENV' ) THEN
line( k : k + 9 ) = 'MAX(0_ip_, '
l_next = l + 6 ; k = k + 10
Expand Down Expand Up @@ -552,7 +568,6 @@ PROGRAM BUILD

IF ( external_line ) THEN
line_max = max_chars - nz - 16
IF ( line( l_end : l_end ) /= '&' ) external_line = .FALSE.
ELSE
line_max = max_chars - nz
END IF
Expand All @@ -572,13 +587,23 @@ PROGRAM BUILD
IF ( ( line( k : k ) == ' ' .AND. line( k-1 : k-1 ) /= "'" ) .OR. &
line( k : k ) == ',' ) THEN
IF ( line( k : k ) == ',' ) THEN
WRITE( out, "( A, A, A, '&' )" ) &
REPEAT( ' ', nz ), TRIM( line( 1 : k ) ), &
REPEAT( ' ', max_chars + 2 - nz - k )
IF ( external_line ) THEN
WRITE( out, "( A, A, '& ' )" ) &
REPEAT( ' ', nz ), TRIM( line( 1 : k ) )
ELSE
WRITE( out, "( A, A, A, '&' )" ) &
REPEAT( ' ', nz ), TRIM( line( 1 : k ) ), &
REPEAT( ' ', max_chars + 2 - nz - k )
END IF
ELSE
WRITE( out, "( A, A, A, '&' )" ) &
REPEAT( ' ', nz ), TRIM( line( 1 : k ) ), &
REPEAT( ' ', max_chars + 2 - nz - k )
IF ( external_line ) THEN
WRITE( out, "( A, A, ' &' )" ) &
REPEAT( ' ', nz ), TRIM( line( 1 : k ) )
ELSE
WRITE( out, "( A, A, A, '&' )" ) &
REPEAT( ' ', nz ), TRIM( line( 1 : k ) ), &
REPEAT( ' ', max_chars + 2 - nz - k )
END IF
END IF
nz = MIN( nz + 2, nz2 )
EXIT
Expand All @@ -589,6 +614,7 @@ PROGRAM BUILD
l_end = LEN_TRIM( line )
END IF
END DO
external_line = .FALSE.

! if a procedure line ends in a closing bracket, add a USE statement

Expand Down
3 changes: 1 addition & 2 deletions src/lms/lms.F90
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
! THIS VERSION: GALAHAD 4.3 - 2024-01-27 AT 07:00 GMT.
! THIS VERSION: GALAHAD 4.3 - 2024-01-29 AT 08:40 GMT.

#include "galahad_modules.h"

Expand Down Expand Up @@ -293,7 +293,6 @@ 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_ ) :: LAENV

! prefix for all output

Expand Down
44 changes: 25 additions & 19 deletions src/oblivion/trimsqp/trimsqp.F90
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
! THIS VERSION: GALAHAD 4.3 - 2024-01-04 AT 09:00 GMT.
! THIS VERSION: GALAHAD 4.3 - 2024-01-29 AT 09:00 GMT.

#include "galahad_modules.h"

Expand Down Expand Up @@ -2728,8 +2728,8 @@ END SUBROUTINE eval_HL

! the Cauchy step s_c.

data%alpha_c = min( one, data%alpha_c ) ! DPR: this should always be true.
data%s_c = data%alpha_c * data%s_p
data%alpha_c = min( one, data%alpha_c ) ! DPR: this should always be true.
data%s_c = data%alpha_c * data%s_p
data%inf_norm_s_c = data%alpha_c * data%inf_norm_s_p

if ( data%control%print_level >= GALAHAD_DEBUG ) then
Expand Down Expand Up @@ -2852,7 +2852,8 @@ END SUBROUTINE eval_HL
go to 999
end if

data%iterates_sqp = inform%QPseqp_inform%cg_iter ! Are these really iterations? ???? DPR
data%iterates_sqp = inform%QPseqp_inform%cg_iter
! Are these really iterations? ???? DPR

! The FULL length seqp step and multipliers.

Expand Down Expand Up @@ -3239,7 +3240,8 @@ END SUBROUTINE eval_HL
if ( data%NM%active ) then
if ( data%NM%num_fail == 0 ) then
data%NM%decreaseH = data%decreaseH_full
data%NM%merit_best = data%merit ! this may be different than data%revert%merit_revert. B/c penalt changes?
data%NM%merit_best = data%merit
! this may be different than data%revert%merit_revert. B/c penalty changes?
end if
data%ratio = data%NM%merit_best - data%merit_new
data%ratio = data%ratio / data%NM%decreaseH
Expand Down Expand Up @@ -3733,9 +3735,9 @@ END SUBROUTINE eval_HL
! ' sigma nv TR y_model gmts', &
! ' merit imp' )

2000 format(1x, '** ERROR : allocation error in subroutine TRIMSQP_solve.', &
2000 format(1x, '** ERROR : allocation error in subroutine TRIMSQP_solve.', &
' error= ', I0, ' status= ', I0, '.')
2001 format(1x, '** ERROR : de-allocation error in subroutine TRIMSQP_solve.', &
2001 format(1x, '** ERROR : de-allocation error in subroutine TRIMSQP_solve.', &
' error= ', I0, ' status= ', I0, '.')
!3000 format(1x, (65('*')), / )
!3001 format(1x, (65('*')), /, &
Expand Down Expand Up @@ -3782,7 +3784,7 @@ END SUBROUTINE eval_HL
!!$3014 format( /, 2x, ' QPsiqp%m = ', I5, ' QPsiqp%n = ', I5, ' QPsiqp%f = ', ES16.9 )
!3015 format( 1x, 'Merit function is first-order optimal', &
! ' - turning non-monotone off.', /)
3016 format( 1x, ' NM%active = T : saving model decrease for possible revert', / )
3016 format( 1x, ' NM%active = T : saving model decrease for possible revert',/)
!3015 format( /, '---------------------------------------------------------------',/,&
! 1x,'BFGS is being used, the following data has been computed',/ &
! 10x, 'd', 15x, 'Bs', 11x, 'gradLxnew', 10x, 'gradLx', / &
Expand Down Expand Up @@ -4613,7 +4615,8 @@ SUBROUTINE build_QPpred( nlp, QPpred, inform, data )
! L o c a l V a r i a b l e s
!-----------------------------------------------

integer ( kind = ip_ ) :: len, Ane, tally, i, j, out, error, m, n, m_a, L!, Hne, Bne
integer ( kind = ip_ ) :: len, Ane, tally, i, j, out, error
integer ( kind = ip_ ) :: m, n, m_a, L !, Hne, Bne
integer ( kind = ip_ ) :: B_type, Bind, Aind, I_Bind, I_Aind, Ltn, np2m
character, allocatable, dimension( : ) :: store_type

Expand Down Expand Up @@ -5103,7 +5106,8 @@ SUBROUTINE build_QPsiqp( nlp, QPsiqp, inform, data )
elseif ( nlp%m_a > 0 ) then
call SMT_put( store_type, SMT_get( nlp%A%type ), inform%status )
else
call SMT_put( store_type, 'COORDINATE', inform%status ) ! dummy value DPR: maybe dense for descent constraint.
call SMT_put( store_type, 'COORDINATE', inform%status )
! dummy value DPR: maybe dense for descent constraint.
end if

SELECT CASE ( SMT_get( store_type ) )
Expand Down Expand Up @@ -6027,7 +6031,8 @@ SUBROUTINE fill_QPsteer( nlp, QPsteer, inform, control, data )
CASE ('DENSE')

do i = 1, nlp%m_a
QPsteer%A%val( 1+(i-1)*nlp%n : i*nlp%n ) = nlp%A%val( 1+(i-1)*nlp%n : i*nlp%n )
QPsteer%A%val( 1+(i-1)*nlp%n : i*nlp%n ) &
= nlp%A%val( 1+(i-1)*nlp%n : i*nlp%n )
QPsteer%A%row( 1+(i-1)*nlp%n : i*nlp%n ) = i
do j = 1, nlp%n
QPsteer%A%col( (i-1)*nlp%n + j ) = j
Expand Down Expand Up @@ -6684,7 +6689,8 @@ SUBROUTINE fill_QPpred( nlp, QPpred, inform, data )
if ( data%control%print_level >= GALAHAD_DEBUG ) then
write( out, 1017 )
write( out, '(4(2x, ES15.8))') &
( data%BFGS%d(i), data%BFGS%BS(i), data%BFGS%gradLx(i), data%BFGS%gradLx_new(i), i = 1, n )
( data%BFGS%d(i), data%BFGS%BS(i), data%BFGS%gradLx(i), &
data%BFGS%gradLx_new(i), i = 1, n )
write( out, 1016 ) data%BFGS%std, stBs
end if

Expand Down Expand Up @@ -6803,8 +6809,8 @@ SUBROUTINE fill_QPsiqp( nlp, QPsiqp, inform, data )
! Fill constants.
!****************

! F
QPsiqp%f = zero !Irrelavant, but actually f_k + g_k^T s_c + half s_c ^T H_k s_c
! F - irrelavant, but actually f_k + g_k^T s_c + half s_c ^T H_k s_c
QPsiqp%f = zero

! Fill vectors.
!****************
Expand Down Expand Up @@ -7217,8 +7223,8 @@ SUBROUTINE fill_QPsiqp( nlp, QPsiqp, inform, data )

! Format statements

1000 FORMAT(1X, '** ERROR : unrecognized storage type in subroutine fill_QPsiqp.')

1000 FORMAT(1X, '** ERROR : unrecognized storage type in subroutine', &
' fill_QPsiqp.')

END SUBROUTINE fill_QPsiqp

Expand Down Expand Up @@ -9354,15 +9360,15 @@ SUBROUTINE get_cauchy_step( m, C_type, f, g_s, s_hs, s_norm, rho_g, &
! of accuracy, so the line derivative should be recomputed.

IF ( ABS( slope ) < - epsqrt * slope_old ) THEN
IF ( print_debug ) &
IF ( print_debug ) &
WRITE( out, "( ' recompute line derivative ... ' )" )
CALL cauchy_get_val_and_slope( m, C_type, f, g_s, s_hs, rho_g, &
RES_l, RES_u, A_s, t_break, &
t_pert, too_small, &
val, slope, exact )

gradient = slope + t_break * curv
IF ( print_debug ) &
IF ( print_debug ) &
WRITE( out, "( ' val, slope ', 2ES22.14 )" ) val, slope
ENDIF

Expand Down Expand Up @@ -9533,7 +9539,7 @@ SUBROUTINE get_cauchy_step( m, C_type, f, g_s, s_hs, s_norm, rho_g, &
"( 3X, I7, ES12.4, A14, 3ES12.4 )" ) &
iter, t_min, ' - -', fun, zero, curv
IF ( print_debug ) THEN
exact_val = cauchy_get_val( m, C_type, f, g_s, s_hs, rho_g, &
exact_val = cauchy_get_val( m, C_type, f, g_s, s_hs, rho_g, &
RES_l, RES_u, A_s, t_min, too_small )

WRITE( out, 2010 ) ' val', fun, exact_val
Expand Down
3 changes: 2 additions & 1 deletion src/qpp/qpps.f90
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ PROGRAM GALAHAD_QPP_EXAMPLE
' <u'
END DO
DO i = d%x_u_end + 1, p%n ! non-positivities
WRITE( 6, 10 ) i, p%X( i ), p%X_l( i ), p%X_u( i ), p%Z( i ), p%G( i ), & ' <0'
WRITE( 6, 10 ) i, p%X( i ), p%X_l( i ), p%X_u( i ), p%Z( i ), p%G( i ), &
' <0'
END DO
! re-ordered constraints
WRITE( 6, "( /, 5X,'i', 5x, 'A*v', 10X, 'l', 11X, 'u', 11X, 'y', &
Expand Down
4 changes: 2 additions & 2 deletions src/rqs/rqs.F90
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
! THIS VERSION: GALAHAD 4.3 - 2024-01-27 AT 16:40 GMT.
! THIS VERSION: GALAHAD 4.3 - 2024-01-29 AT 08:40 GMT.

#include "galahad_modules.h"

Expand Down Expand Up @@ -831,7 +831,7 @@ 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_ ) :: LAENV
! INTEGER ( KIND = ip_ ) :: LAENV

! prefix for all output

Expand Down
Loading

0 comments on commit 4e9fa08

Please sign in to comment.