alpaqa 1.0.0a9
Nonconvex constrained optimization
Loading...
Searching...
No Matches
lbfgsb_c.f90
Go to the documentation of this file.
1module lbfgsb_c
2 use iso_c_binding
3
4#ifdef __flang__
5 implicit none (type)
6#else
7 implicit none (type,external)
8#endif
9
10 interface
11 !> Main function from the original L-BFGS-B Fortran API.
12 subroutine setulb(n, m, x, l, u, nbd, f, g, factr, pgtol, &
13 wa, iwa, task, iprint, csave, lsave, isave, dsave)
14 character(60) task, csave
15 logical lsave(4)
16 integer n, m, iprint, nbd(n), iwa(3*n), isave(44)
17 double precision f, factr, pgtol, x(n), l(n), u(n), g(n), &
18 wa(2*m*n + 5*n + 11*m*m + 8*m), dsave(29)
19 end subroutine
20 end interface
21
22contains
23
24 !> C interface to @ref setulb.
25 subroutine alpaqa_setulb_c(n, m, x, l, u, nbd, f, g, factr, pgtol, &
26 wa, iwa, task, iprint, csave, lsave, isave, dsave) bind(C, name="alpaqa_setulb_c")
27 integer(c_int), intent(in), value :: n, m
28 real(c_double), intent(inout) :: x(n)
29 real(c_double), intent(in) :: l(n), u(n)
30 integer(c_int), intent(in) :: nbd(n)
31 real(c_double), intent(inout) :: f
32 real(c_double), intent(inout) :: g(n)
33 real(c_double), intent(in), value :: factr
34 real(c_double), intent(in), value :: pgtol
35 real(c_double), intent(out) :: wa(2*m*n + 5*n + 11*m*m + 8*m)
36 integer(c_int), intent(out) :: iwa(3*n)
37 character(c_char), intent(inout) :: task(60)
38 integer(c_int), intent(in), value :: iprint
39 character(c_char), intent(inout) :: csave(60)
40 logical(c_bool), intent(inout) :: lsave(4)
41 integer(c_int), intent(inout) :: isave(44)
42 real(c_double), intent(inout) :: dsave(29)
43
44 character(60) :: task_f, csave_f
45 logical :: lsave_f(4)
46 integer :: i
47 do i=1, 60
48 task_f(i:i) = task(i)
49 csave_f(i:i) = csave(i)
50 end do
51 do i=1, 4
52 lsave_f(i) = lsave(i)
53 end do
54 call setulb(n, m, x, l, u, nbd, f, g, factr, pgtol, &
55 wa, iwa, task_f, iprint, csave_f, lsave_f, isave, dsave)
56 do i=1, 4
57 lsave(i) = lsave_f(i)
58 end do
59 do i = 1, 60
60 csave(i) = csave_f(i:i)
61 task(i) = task_f(i:i)
62 end do
63 end
64
65end module lbfgsb_c
Main function from the original L-BFGS-B Fortran API.
Definition: lbfgsb_c.f90:12
void alpaqa_setulb_c(int n, int m, double *x, const double *l, const double *u, const int *nbd, double &f, double *g, double factr, double pgtol, double *wa, int *iwa, char *task, int iprint, char *csave, bool *lsave, int *isave, double *dsave)