3 integer,
parameter :: rk = kind(1.0d0)
4 integer,
intent(in) :: n
5 real(kind=rk),
dimension(n),
intent(in) :: x
6 real(kind=rk),
dimension(n),
intent(out) :: g
8 real(kind=rk),
dimension(2) :: fullx
9 integer :: mpi_rank,mpi_err
11 integer :: status(mpi_status_size)
14 call mpi_comm_rank(mpi_comm_world,mpi_rank,mpi_err)
19 call mpi_send(fullx(1),1,mpi_double_precision,1,1,mpi_comm_world&
21 call mpi_recv(fullx(2),1,mpi_double_precision,1,1,mpi_comm_world&
23 g(1) = 200*(fullx(2) - fullx(1)**2)*(-2*fullx(1)) - 2*(1 - fullx(1))
26 call mpi_recv(fullx(1),1,mpi_double_precision,0,1,mpi_comm_world&
28 call mpi_send(fullx(2),1,mpi_double_precision,0,1,mpi_comm_world&
30 g(1) = 200*(fullx(2) - fullx(1)**2)
32 print*,
'too many processes launched for the model. Error'
subroutine objective_gradient(n, x, g)