Explicit ODR job, with user-supplied analytic derivatives and nondefault ifixx
.
Type | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|
integer | :: | i | ||||
integer | :: | info | ||||
integer | :: | iprint | ||||
integer | :: | j | ||||
integer | :: | job | ||||
integer | :: | lunerr | ||||
integer | :: | lunrpt | ||||
integer | :: | m | ||||
integer | :: | n | ||||
integer | :: | np | ||||
integer | :: | nq | ||||
integer, | allocatable | :: | ifixx(:,:) | |||
real(kind=wp), | allocatable | :: | beta(:) | |||
real(kind=wp), | allocatable | :: | x(:,:) | |||
real(kind=wp), | allocatable | :: | y(:,:) |
program example1 !! Explicit ODR job, with user-supplied analytic derivatives and nondefault `ifixx`. use odrpack, only: odr use odrpack_kinds, only: wp use example1_model, only: fcn implicit none ! Variable declarations integer :: i, info, iprint, j, job, lunerr, lunrpt, m, n, np, nq integer, allocatable :: ifixx(:, :) real(kind=wp), allocatable :: beta(:), x(:, :), y(:, :) ! Set up report files open (newunit=lunrpt, file='./example/report1.dat') lunerr = lunrpt ! Read problem dimensions open (unit=5, file='./example/data1.dat') read (5, *) n, m, np, nq ! Allocate arrays allocate (beta(np), x(n, m), y(n, nq), ifixx(n, m)) ! Read problem data and set nondefault value for argument 'ifixx' read (5, *) (beta(i), i=1, np) do i = 1, n read (5, *) (x(i, j), j=1, m), (y(i, j), j=1, nq) if (x(i, 1) .eq. 0.0E0_wp .or. x(i, 1) .eq. 100.0E0_wp) then ifixx(i, 1) = 0 else ifixx(i, 1) = 1 end if end do close (5) ! Specify task: Explicit orthogonal distance regression ! With user supplied derivatives (checked) ! Covariance matrix constructed with recomputed derivatives ! Delta initialized to zero ! Not a restart ! And indicate short initial report ! Short iteration reports every iteration, and ! Long final report job = 00020 iprint = 1112 ! Compute solution call odr(fcn=fcn, & n=n, m=m, np=np, nq=nq, & beta=beta, & y=y, x=x, & ifixx=ifixx, & job=job, & iprint=iprint, lunerr=lunerr, lunrpt=lunrpt, & info=info) end program example1