Explicit ODR job, with user-supplied analytic derivatives and nondefault ifixx
.
Type | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|
integer | :: | i | ||||
integer | :: | iprint | ||||
integer | :: | j | ||||
integer | :: | job | ||||
integer | :: | lundata | ||||
integer | :: | lunrpt | ||||
integer | :: | m | ||||
integer | :: | n | ||||
integer | :: | np | ||||
integer | :: | q | ||||
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, iprint, j, job, lundata, lunrpt, m, n, np, q integer, allocatable :: ifixx(:, :) real(kind=wp), allocatable :: beta(:), x(:, :), y(:, :) ! Set up report files open (newunit=lunrpt, file='./example/report1.dat') ! Read problem dimensions open (newunit=lundata, file='./example/data1.dat') read (lundata, *) n, m, np, q ! Allocate arrays allocate (beta(np), x(n, m), y(n, q), ifixx(n, m)) ! Read problem data and set nondefault value for argument 'ifixx' read (lundata, *) (beta(i), i=1, np) do i = 1, n read (lundata, *) (x(i, j), j=1, m), (y(i, j), j=1, q) if (x(i, 1) == 0.0E0_wp .or. x(i, 1) == 100.0E0_wp) then ifixx(i, 1) = 0 else ifixx(i, 1) = 1 end if end do close (lundata) ! 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, n, m, q, np, beta, y, x, & ifixx=ifixx, & job=job, iprint=iprint, lunerr=lunrpt, lunrpt=lunrpt) close (lunrpt) end program example1