RAPI
|
00001 /* 00002 * R : A Computer Language for Statistical Data Analysis 00003 * Copyright (C) 1998-2015 The R Core Team 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU Lesser General Public License as published by 00007 * the Free Software Foundation; either version 2.1 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU Lesser General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Lesser General Public License 00016 * along with this program; if not, a copy is available at 00017 * https://www.R-project.org/Licenses/ 00018 * 00019 * 00020 * Application Routines, typically implemented in ../appl/ 00021 * ---------------------------------------------- ======== 00022 */ 00023 00024 /* This header file contains routines which are in the R API and ones which 00025 are not. 00026 00027 Those which are not can be used only at the user's risk and may change 00028 or disappear in a future release of R. 00029 */ 00030 00031 00032 #ifndef R_APPLIC_H_ 00033 #define R_APPLIC_H_ 00034 00035 #include <R_ext/Boolean.h> 00036 #include <R_ext/RS.h> /* F77_... */ 00037 #include <R_ext/BLAS.h> 00038 00039 #ifdef __cplusplus 00040 extern "C" { 00041 #endif 00042 00043 /* Entry points in the R API */ 00044 00045 /* ../../appl/integrate.c */ 00046 typedef void integr_fn(double *x, int n, void *ex); 00047 /* vectorizing function f(x[1:n], ...) -> x[] {overwriting x[]}. */ 00048 00049 void Rdqags(integr_fn f, void *ex, double *a, double *b, 00050 double *epsabs, double *epsrel, 00051 double *result, double *abserr, int *neval, int *ier, 00052 int *limit, int *lenw, int *last, int *iwork, double *work); 00053 00054 void Rdqagi(integr_fn f, void *ex, double *bound, int *inf, 00055 double *epsabs, double *epsrel, 00056 double *result, double *abserr, int *neval, int *ier, 00057 int *limit, int *lenw, int *last, 00058 int *iwork, double *work); 00059 00060 /* main/optim.c */ 00061 typedef double optimfn(int, double *, void *); 00062 typedef void optimgr(int, double *, double *, void *); 00063 00064 void vmmin(int n, double *b, double *Fmin, 00065 optimfn fn, optimgr gr, int maxit, int trace, 00066 int *mask, double abstol, double reltol, int nREPORT, 00067 void *ex, int *fncount, int *grcount, int *fail); 00068 void nmmin(int n, double *Bvec, double *X, double *Fmin, optimfn fn, 00069 int *fail, double abstol, double intol, void *ex, 00070 double alpha, double bet, double gamm, int trace, 00071 int *fncount, int maxit); 00072 void cgmin(int n, double *Bvec, double *X, double *Fmin, 00073 optimfn fn, optimgr gr, 00074 int *fail, double abstol, double intol, void *ex, 00075 int type, int trace, int *fncount, int *grcount, int maxit); 00076 void lbfgsb(int n, int m, double *x, double *l, double *u, int *nbd, 00077 double *Fmin, optimfn fn, optimgr gr, int *fail, void *ex, 00078 double factr, double pgtol, int *fncount, int *grcount, 00079 int maxit, char *msg, int trace, int nREPORT); 00080 void samin(int n, double *pb, double *yb, optimfn fn, int maxit, 00081 int tmax, double ti, int trace, void *ex); 00082 00083 /* appl/interv.c: Also in Utils.h, used in package eco */ 00084 int findInterval(double *xt, int n, double x, 00085 Rboolean rightmost_closed, Rboolean all_inside, int ilo, 00086 int *mflag); 00087 // findInterval2() is only in Utils.h (and hence Rinternals.h) 00088 00089 00090 /* ------------------ Entry points NOT in the R API --------------- */ 00091 00092 /* The following are registered for use in .C/.Fortran */ 00093 00094 /* appl/dqrutl.f: interfaces to dqrsl */ 00095 void F77_NAME(dqrqty)(double *x, int *n, int *k, double *qraux, 00096 double *y, int *ny, double *qty); 00097 void F77_NAME(dqrqy)(double *x, int *n, int *k, double *qraux, 00098 double *y, int *ny, double *qy); 00099 void F77_NAME(dqrcf)(double *x, int *n, int *k, double *qraux, 00100 double *y, int *ny, double *b, int *info); 00101 void F77_NAME(dqrrsd)(double *x, int *n, int *k, double *qraux, 00102 double *y, int *ny, double *rsd); 00103 void F77_NAME(dqrxb)(double *x, int *n, int *k, double *qraux, 00104 double *y, int *ny, double *xb); 00105 00106 /* end of registered */ 00107 00108 /* hidden, for use in R.bin/R.dll/libR.so */ 00109 00110 /* appl/pretty.c: for use in engine.c and util.c */ 00111 double R_pretty(double *lo, double *up, int *ndiv, int min_n, 00112 double shrink_sml, double high_u_fact[], 00113 int eps_correction, int return_bounds); 00114 00115 00116 /* For use in package stats */ 00117 00118 /* appl/uncmin.c : */ 00119 00120 /* type of pointer to the target and gradient functions */ 00121 typedef void (*fcn_p)(int, double *, double *, void *); 00122 00123 /* type of pointer to the hessian functions */ 00124 typedef void (*d2fcn_p)(int, int, double *, double *, void *); 00125 00126 void fdhess(int n, double *x, double fval, fcn_p fun, void *state, 00127 double *h, int nfd, double *step, double *f, int ndigit, 00128 double *typx); 00129 00130 /* Also used in packages nlme, pcaPP */ 00131 void optif9(int nr, int n, double *x, 00132 fcn_p fcn, fcn_p d1fcn, d2fcn_p d2fcn, 00133 void *state, double *typsiz, double fscale, int method, 00134 int iexp, int *msg, int ndigit, int itnlim, int iagflg, 00135 int iahflg, double dlt, double gradtl, double stepmx, 00136 double steptl, double *xpls, double *fpls, double *gpls, 00137 int *itrmcd, double *a, double *wrk, int *itncnt); 00138 00139 /* find qr decomposition, dqrdc2() is basis of R's qr(), 00140 also used by nlme and many other packages. */ 00141 void F77_NAME(dqrdc2)(double *x, int *ldx, int *n, int *p, 00142 double *tol, int *rank, 00143 double *qraux, int *pivot, double *work); 00144 void F77_NAME(dqrls)(double *x, int *n, int *p, double *y, int *ny, 00145 double *tol, double *b, double *rsd, 00146 double *qty, int *k, 00147 int *jpvt, double *qraux, double *work); 00148 00149 #ifdef __cplusplus 00150 } 00151 #endif 00152 00153 #endif /* R_APPLIC_H_ */