4PROGRAM qpalm_fortran_example
10 INTEGER ( KIND = integer_kind ),
PARAMETER :: n = 2
11 INTEGER ( KIND = integer_kind ),
PARAMETER :: m = 3
12 INTEGER ( KIND = integer_kind ),
PARAMETER :: hne = 2
13 INTEGER ( KIND = integer_kind ),
PARAMETER :: ane = 4
17 INTEGER ( KIND = integer_kind ),
DIMENSION( hne ) :: hrow
18 INTEGER ( KIND = integer_kind ),
DIMENSION( n + 1 ) :: hptr
19 REAL ( KIND =
real_kind ),
DIMENSION( hne ) :: hval
20 REAL ( KIND =
real_kind ),
DIMENSION( n ) :: g
22 INTEGER ( KIND = integer_kind ),
DIMENSION( ane ) :: arow
23 INTEGER ( KIND = integer_kind ),
DIMENSION( n + 1 ) :: aptr
24 REAL ( KIND =
real_kind ),
DIMENSION( ane ) :: aval
25 REAL ( KIND =
real_kind ),
DIMENSION( m ) :: cl, cu
26 REAL ( KIND =
real_kind ),
DIMENSION( n ) :: x
27 REAL ( KIND =
real_kind ),
DIMENSION( m ) :: y
28 TYPE ( QPALM_settings ) :: settings
29 TYPE ( QPALM_info ) :: info
33 hptr = (/ 1, 2, 3 /) ; hrow = (/ 1, 2 /)
34 hval = (/ 1.0_real_kind, 1.5_real_kind /)
35 g = (/ 8.4018771715_real_kind, 3.9438292682_real_kind /) ; f = 0.0_real_kind
36 aptr = (/ 1, 3, 5 /) ; arow = (/ 1, 3, 2, 3 /)
37 aval = (/ 1.0_real_kind, 1.0_real_kind, 1.0_real_kind, 1.0_real_kind /)
38 cl = (/ - 2.0_real_kind, - 2.0_real_kind, - 2.0_real_kind /)
39 cu = (/ 2.0_real_kind, 2.0_real_kind, 2.0_real_kind /)
48 ane, aptr, arow, aval, cl, cu, settings, x, y, info )
52 IF ( info%status_val == 1 )
THEN
53 WRITE( 6,
"( ' problem solved in ', I0, ' iterations, objective value =', &
54 & ES18.10 )" ) info%iter, info%objective
55 WRITE( 6,
"( ' X =', ( 5ES13.5 ) )" ) x
57 WRITE( 6,
"( ' error return with status = ', I0 )" ) info%status_val
60END PROGRAM qpalm_fortran_example
Fortran interface to the C package QPALM, with the aim to minimize the objective function.
integer, parameter real_kind