odrpack_capi Module

C-bindings for 'odrpack'.


Uses

  • module~~odrpack_capi~~UsesGraph module~odrpack_capi odrpack_capi iso_c_binding iso_c_binding module~odrpack_capi->iso_c_binding

Interfaces

interface

  • public function strlen(string) bind(C)

    Length of a C-string.

    Arguments

    Type IntentOptional Attributes Name
    type(c_ptr), intent(in), value :: string

    Return Value integer(kind=c_int)


Derived Types

type, public, bind(C) ::  rworkidx_t

0-based indices of the variables stored in the real work array.

Components

Type Visibility Attributes Name Initial
integer(kind=c_int), public :: delta
integer(kind=c_int), public :: eps
integer(kind=c_int), public :: xplusd
integer(kind=c_int), public :: fn
integer(kind=c_int), public :: sd
integer(kind=c_int), public :: vcv
integer(kind=c_int), public :: rvar
integer(kind=c_int), public :: wss
integer(kind=c_int), public :: wssdel
integer(kind=c_int), public :: wsseps
integer(kind=c_int), public :: rcond
integer(kind=c_int), public :: eta
integer(kind=c_int), public :: olmavg
integer(kind=c_int), public :: tau
integer(kind=c_int), public :: alpha
integer(kind=c_int), public :: actrs
integer(kind=c_int), public :: pnorm
integer(kind=c_int), public :: rnorms
integer(kind=c_int), public :: prers
integer(kind=c_int), public :: partol
integer(kind=c_int), public :: sstol
integer(kind=c_int), public :: taufac
integer(kind=c_int), public :: epsmac
integer(kind=c_int), public :: beta0
integer(kind=c_int), public :: betac
integer(kind=c_int), public :: betas
integer(kind=c_int), public :: betan
integer(kind=c_int), public :: s
integer(kind=c_int), public :: ss
integer(kind=c_int), public :: ssf
integer(kind=c_int), public :: qraux
integer(kind=c_int), public :: u
integer(kind=c_int), public :: fs
integer(kind=c_int), public :: fjacb
integer(kind=c_int), public :: we1
integer(kind=c_int), public :: diff
integer(kind=c_int), public :: deltas
integer(kind=c_int), public :: deltan
integer(kind=c_int), public :: t
integer(kind=c_int), public :: tt
integer(kind=c_int), public :: omega
integer(kind=c_int), public :: fjacd
integer(kind=c_int), public :: wrk1
integer(kind=c_int), public :: wrk2
integer(kind=c_int), public :: wrk3
integer(kind=c_int), public :: wrk4
integer(kind=c_int), public :: wrk5
integer(kind=c_int), public :: wrk6
integer(kind=c_int), public :: wrk7
integer(kind=c_int), public :: lower
integer(kind=c_int), public :: upper
integer(kind=c_int), public :: lrwkmin

type, public, bind(C) ::  iworkidx_t

0-based indices of the variables stored in the integer work array.

Components

Type Visibility Attributes Name Initial
integer(kind=c_int), public :: msgb
integer(kind=c_int), public :: msgd
integer(kind=c_int), public :: ifix2
integer(kind=c_int), public :: istop
integer(kind=c_int), public :: nnzw
integer(kind=c_int), public :: npp
integer(kind=c_int), public :: idf
integer(kind=c_int), public :: job
integer(kind=c_int), public :: iprint
integer(kind=c_int), public :: lunerr
integer(kind=c_int), public :: lunrpt
integer(kind=c_int), public :: nrow
integer(kind=c_int), public :: ntol
integer(kind=c_int), public :: neta
integer(kind=c_int), public :: maxit
integer(kind=c_int), public :: niter
integer(kind=c_int), public :: nfev
integer(kind=c_int), public :: njev
integer(kind=c_int), public :: int2
integer(kind=c_int), public :: irank
integer(kind=c_int), public :: ldtt
integer(kind=c_int), public :: bound
integer(kind=c_int), public :: liwkmin

Subroutines

public subroutine odr_short_c(fcn, data, n, m, q, np, beta, y, x, delta, lower, upper, job) bind(C)

"Short-call" wrapper for the odr routine including very few optional arguments.

Arguments

Type IntentOptional Attributes Name
procedure(fcn_t) :: fcn

User-supplied subroutine for evaluating the model.

type(c_ptr), intent(in), value :: data

User-defined data passed to the function.

integer(kind=c_int), intent(in) :: n

Number of observations.

integer(kind=c_int), intent(in) :: m

Number of columns of data in the independent variable.

integer(kind=c_int), intent(in) :: q

Number of responses per observation.

integer(kind=c_int), intent(in) :: np

Number of function parameters.

real(kind=c_double), intent(inout) :: beta(np)

Function parameters.

real(kind=c_double), intent(in) :: y(n,q)

Dependent variable. Unused when the model is implicit.

real(kind=c_double), intent(in) :: x(n,m)

Explanatory variable.

real(kind=c_double), intent(inout), optional :: delta(n,m)

Error in the x data. Initial guess on input and estimated value on output.

real(kind=c_double), intent(in), optional :: lower(np)

Lower bound on beta.

real(kind=c_double), intent(in), optional :: upper(np)

Upper bound on beta.

integer(kind=c_int), intent(in), optional :: job

Variable controlling initialization and computational method.

public subroutine odr_long_c(fcn, data, n, m, q, np, ldwe, ld2we, ldwd, ld2wd, ldifx, ldstpd, ldscld, lrwork, liwork, beta, y, x, we, wd, ifixb, ifixx, stpb, stpd, sclb, scld, delta, lower, upper, rwork, iwork, job, ndigit, taufac, sstol, partol, maxit, iprint, lunerr, lunrpt, info, thunk) bind(C)

"Long-call" wrapper for the odr routine including all optional arguments and thunk.

Arguments

Type IntentOptional Attributes Name
procedure(fcn_t) :: fcn

User-supplied subroutine for evaluating the model.

type(c_ptr), intent(in), value :: data

User-defined data passed to the function.

integer(kind=c_int), intent(in) :: n

Number of observations.

integer(kind=c_int), intent(in) :: m

Number of columns of data in the independent variable.

integer(kind=c_int), intent(in) :: q

Number of responses per observation.

integer(kind=c_int), intent(in) :: np

Number of function parameters.

integer(kind=c_int), intent(in) :: ldwe

Leading dimension of array we, ldwe ∈ {1, n}.

integer(kind=c_int), intent(in) :: ld2we

Second dimension of array we, ld2we ∈ {1, q}.

integer(kind=c_int), intent(in) :: ldwd

Leading dimension of array wd, ldwd ∈ {1, n}.

integer(kind=c_int), intent(in) :: ld2wd

Second dimension of array wd, ld2wd ∈ {1, m}.

integer(kind=c_int), intent(in) :: ldifx

Leading dimension of array ifixx, ldifx ∈ {1, n}.

integer(kind=c_int), intent(in) :: ldstpd

Leading dimension of array stpd, ldstpd ∈ {1, n}.

integer(kind=c_int), intent(in) :: ldscld

Leading dimension of array scld, ldscld ∈ {1, n}.

integer(kind=c_int), intent(in) :: lrwork

Length of array rwork.

integer(kind=c_int), intent(in) :: liwork

Length of array iwork.

real(kind=c_double), intent(inout) :: beta(np)

Function parameters.

real(kind=c_double), intent(in) :: y(n,q)

Dependent variable. Unused when the model is implicit.

real(kind=c_double), intent(in) :: x(n,m)

Explanatory variable.

real(kind=c_double), intent(in), optional :: we(ldwe,ld2we,q)

epsilon weights.

real(kind=c_double), intent(in), optional :: wd(ldwd,ld2wd,m)

delta weights.

integer(kind=c_int), intent(in), optional :: ifixb(np)

Values designating whether the elements of beta are fixed at their input values or not.

integer(kind=c_int), intent(in), optional :: ifixx(ldifx,m)

Values designating whether the elements of x are fixed at their input values or not.

real(kind=c_double), intent(in), optional :: stpb(np)

Relative step for computing finite difference derivatives with respect to beta.

real(kind=c_double), intent(in), optional :: stpd(ldstpd,m)

Relative step for computing finite difference derivatives with respect to delta.

real(kind=c_double), intent(in), optional :: sclb(np)

Scaling values for beta.

real(kind=c_double), intent(in), optional :: scld(ldscld,m)

Scaling values for delta.

real(kind=c_double), intent(inout), optional :: delta(n,m)

Error in the x data. Shape: (n, m). Initial guess on input and estimated value on output.

real(kind=c_double), intent(in), optional :: lower(np)

Lower bound on beta.

real(kind=c_double), intent(in), optional :: upper(np)

Upper bound on beta.

real(kind=c_double), intent(inout), optional :: rwork(lrwork)

Real work space.

integer(kind=c_int), intent(inout), optional :: iwork(liwork)

Integer work space.

integer(kind=c_int), intent(in), optional :: job

Variable controlling initialization and computational method.

integer(kind=c_int), intent(in), optional :: ndigit

Number of accurate digits in the function results, as supplied by the user.

real(kind=c_double), intent(in), optional :: taufac

Factor used to compute the initial trust region diameter.

real(kind=c_double), intent(in), optional :: sstol

Sum-of-squares convergence stopping tolerance.

real(kind=c_double), intent(in), optional :: partol

Parameter convergence stopping tolerance.

integer(kind=c_int), intent(in), optional :: maxit

Maximum number of iterations allowed.

integer(kind=c_int), intent(in), optional :: iprint

Print control variable.

integer(kind=c_int), intent(in), optional :: lunerr

Logical unit number for error messages. 0: No output. 6: Output to standard output. k /= 0,6: Output to logical unit k.

integer(kind=c_int), intent(in), optional :: lunrpt

Logical unit number for computation reports. 0: No output. 6: Output to standard output. k /= 0,6: Output to logical unit k.

integer(kind=c_int), intent(out), optional :: info

Variable designating why the computations were stopped.

type(c_ptr), intent(in), value :: thunk

User-defined data passed to the function.

public subroutine open_file(filename_cptr, lun, ierr) bind(C)

Open a new file associated with a specified logical unit number.

Arguments

Type IntentOptional Attributes Name
type(c_ptr), intent(in), value :: filename_cptr

C-string containing the file name.

integer(kind=c_int), intent(inout) :: lun

Logical unit number. If lun > 0, the user-supplied logical unit number is used. Otherwise, a new logical unit number is assigned.

integer(kind=c_int), intent(out) :: ierr

Error code returned by iostat.

public subroutine close_file(lun, ierr) bind(C)

Close a file associated with a specified logical unit number.

Arguments

Type IntentOptional Attributes Name
integer(kind=c_int), intent(in) :: lun

Logical unit number.

integer(kind=c_int), intent(out) :: ierr

Error code returned by iostat.

public pure subroutine loc_iwork_c(m, q, np, iwi) bind(C)

Get storage locations within integer work space.

Arguments

Type IntentOptional Attributes Name
integer(kind=c_int), intent(in) :: m

Number of columns of data in the independent variable.

integer(kind=c_int), intent(in) :: q

Number of responses per observation.

integer(kind=c_int), intent(in) :: np

Number of function parameters.

type(iworkidx_t), intent(out) :: iwi

0-based indexes of integer work array.

public pure subroutine loc_rwork_c(n, m, q, np, ldwe, ld2we, isodr, rwi) bind(C)

Get storage locations within real work space.

Arguments

Type IntentOptional Attributes Name
integer(kind=c_int), intent(in) :: n

Number of observations.

integer(kind=c_int), intent(in) :: m

Number of columns of data in the explanatory variable.

integer(kind=c_int), intent(in) :: q

Number of responses per observation.

integer(kind=c_int), intent(in) :: np

Number of function parameters.

integer(kind=c_int), intent(in) :: ldwe

Leading dimension of array we.

integer(kind=c_int), intent(in) :: ld2we

Second dimension of array we.

logical(kind=c_bool), intent(in) :: isodr

Variable designating whether the solution is by ODR (.true.) or by OLS (.false.).

type(rworkidx_t), intent(out) :: rwi

0-based indexes of real work array.

public pure subroutine workspace_dimensions_c(n, m, q, np, isodr, lrwork, liwork) bind(C)

Calculate the dimensions of the workspace arrays.

Arguments

Type IntentOptional Attributes Name
integer(kind=c_int), intent(in) :: n

Number of observations.

integer(kind=c_int), intent(in) :: m

Number of columns of data in the independent variable.

integer(kind=c_int), intent(in) :: q

Number of responses per observation.

integer(kind=c_int), intent(in) :: np

Number of function parameters.

logical(kind=c_bool), intent(in) :: isodr

Variable designating whether the solution is by ODR (.true.) or by OLS (.false.).

integer(kind=c_int), intent(out) :: lrwork

Length of real rwork array.

integer(kind=c_int), intent(out) :: liwork

Length of integer iwork array.

public pure subroutine stop_message_c(info, message, message_size) bind(C)

Get a message corresponding to a given info code.

Arguments

Type IntentOptional Attributes Name
integer(kind=c_int), intent(in), value :: info

Variable designating why the computations were stopped.

character(kind=c_char, len=1), intent(out) :: message(message_size)

C-string containing a message corresponding to info.

integer(kind=c_size_t), intent(in), value :: message_size

Length of array message.