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 module~odrpack odrpack module~odrpack_capi->module~odrpack module~odrpack_core odrpack_core module~odrpack_capi->module~odrpack_core iso_fortran_env iso_fortran_env module~odrpack->iso_fortran_env module~odrpack_kinds odrpack_kinds module~odrpack->module~odrpack_kinds module~odrpack_core->module~odrpack_kinds module~odrpack_kinds->iso_fortran_env

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)


Abstract Interfaces

abstract interface

  • public subroutine fcn_tc(n, m, np, nq, ldn, ldm, ldnp, beta, xplusd, ifixb, ifixx, ldifx, ideval, f, fjacb, fjacd, istop) bind(C)

    User-supplied subroutine for evaluating the model.

    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) :: np

    Number of function parameters.

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

    Number of responses per observation.

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

    Leading dimension declarator equal or exceeding n.

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

    Leading dimension declarator equal or exceeding m.

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

    Leading dimension declarator equal or exceeding np.

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

    Current values of parameters.

    real(kind=c_double), intent(in) :: xplusd(ldn,m)

    Current value of explanatory variable, i.e., x + delta.

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

    Indicators for "fixing" parameters (beta).

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

    Indicators for "fixing" explanatory variable (x).

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

    Leading dimension of array ifixx.

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

    Indicator for selecting computation to be performed.

    real(kind=c_double), intent(out) :: f(ldn,nq)

    Predicted function values.

    real(kind=c_double), intent(out) :: fjacb(ldn,ldnp,nq)

    Jacobian with respect to beta.

    real(kind=c_double), intent(out) :: fjacd(ldn,ldm,nq)

    Jacobian with respect to errors delta.

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

    Stopping condition.


Derived Types

type, public, bind(C) ::  workidx_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 :: xplus
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 :: wssde
integer(kind=c_int), public :: wssep
integer(kind=c_int), public :: rcond
integer(kind=c_int), public :: eta
integer(kind=c_int), public :: olmav
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 :: rnors
integer(kind=c_int), public :: prers
integer(kind=c_int), public :: partl
integer(kind=c_int), public :: sstol
integer(kind=c_int), public :: taufc
integer(kind=c_int), public :: epsma
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 :: delts
integer(kind=c_int), public :: deltn
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 :: lwkmn

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 :: iprin
integer(kind=c_int), public :: luner
integer(kind=c_int), public :: lunrp
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 :: liwkmn

Subroutines

public subroutine odr_short_c(fcn, n, m, np, nq, 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_tc) :: fcn

User-supplied subroutine for evaluating the model.

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) :: np

Number of function parameters.

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

Number of responses per observation.

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

Function parameters.

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

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_medium_c(fcn, n, m, np, nq, beta, y, x, we, ldwe, ld2we, wd, ldwd, ld2wd, ifixb, ifixx, ldifx, delta, lower, upper, job, iprint, lunerr, lunrpt, info) bind(C)

"Medium-call" wrapper for the odr routine including most commonly used optional arguments.

Arguments

Type IntentOptional Attributes Name
procedure(fcn_tc) :: fcn

User-supplied subroutine for evaluating the model.

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) :: np

Number of function parameters.

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

Number of responses per observation.

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

Function parameters.

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

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) :: we(ldwe,ld2we,nq)

epsilon weights.

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, n}.

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

delta weights.

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) :: ifixb(np)

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

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

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

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

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

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.

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. Available options are: 0 => no output. 6 => output to standard error. other => output to logical unit number lunerr.

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

Logical unit number for computation reports. Available options are: 0 => no output. 6 => output to standard error. other => output to logical unit number lunrpt.

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

Logical unit number for computation reports.

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

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

Arguments

Type IntentOptional Attributes Name
procedure(fcn_tc) :: fcn

User-supplied subroutine for evaluating the model.

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) :: np

Number of function parameters.

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

Number of responses per observation.

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

Function parameters.

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

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) :: we(ldwe,ld2we,nq)

epsilon weights.

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, n}.

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

delta weights.

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) :: ifixb(np)

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

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

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

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

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

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

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

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

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

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

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

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

Scaling values for beta.

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

Scaling values for delta.

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

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

real(kind=c_double), intent(inout) :: work(lwork)

Real work space.

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

Length of array work.

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

Integer work space.

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

Length of array iwork.

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.

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. Available options are: 0 => no output. 6 => output to standard error. other => output to logical unit number lunerr.

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

Logical unit number for computation reports. Available options are: 0 => no output. 6 => output to standard error. other => output to logical unit number lunrpt.

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

Variable designating why the computations were stopped.

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

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

Arguments

Type IntentOptional Attributes 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.

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

C-string containing the file name.

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 diwinf_c(m, np, nq, iworkidx) bind(C)

Get storage locations within integer work space.

Arguments

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

The number of columns of data in the independent variable.

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

The number of function parameters.

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

The number of responses per observation.

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

0-based indexes of integer work array.

public pure subroutine dwinf_c(n, m, np, nq, ldwe, ld2we, isodr, workidx) 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) :: np

Number of function parameters.

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

Number of responses per observation.

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 (isodr = .true.) or by OLS (isodr = .false.).

type(workidx_t), intent(out) :: workidx

0-based indexes of real work array.

public pure subroutine workspace_dimensions_c(n, m, np, nq, isodr, lwork, 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) :: np

Number of function parameters.

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

Number of responses per observation.

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

The variable designating whether the solution is by ODR (isodr = .true.) or by OLS (isodr = .false.).

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

Length of real work array.

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

Length of integer iwork array.