Statistics
| Revision:

root / tmp / org.txm.statsengine.r.core.win32 / res / win32 / include / R_ext / Applic.h @ 2486

History | View | Annotate | Download (5.4 kB)

1
/*
2
 *  R : A Computer Language for Statistical Data Analysis
3
 *  Copyright (C) 1998-2013   The R Core Team
4
 *
5
 *  This program is free software; you can redistribute it and/or modify
6
 *  it under the terms of the GNU Lesser General Public License as published by
7
 *  the Free Software Foundation; either version 2.1 of the License, or
8
 *  (at your option) any later version.
9
 *
10
 *  This program is distributed in the hope that it will be useful,
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 *  GNU Lesser General Public License for more details.
14
 *
15
 *  You should have received a copy of the GNU Lesser General Public License
16
 *  along with this program; if not, a copy is available at
17
 *  http://www.r-project.org/Licenses/
18
 *
19
 *
20
 * Application Routines, typically implemented in  ../appl/
21
 * ----------------------------------------------  ========
22
 */
23

    
24
/* This header file contains routines which are in the R API and ones which
25
   are not.
26

27
   Those which are not can be used only at the user's risk and may change
28
   or disappear in a future release of R.
29
*/
30

    
31

    
32
#ifndef R_APPLIC_H_
33
#define R_APPLIC_H_
34

    
35
#include <R_ext/Boolean.h>
36
#include <R_ext/RS.h>                /* F77_... */
37
#include <R_ext/BLAS.h>
38

    
39
#ifdef  __cplusplus
40
extern "C" {
41
#endif
42

    
43
/* Entry points in the R API */
44

    
45
/* appl/integrate.c */
46
typedef void integr_fn(double *x, int n, void *ex);
47
/* vectorizing function   f(x[1:n], ...) -> x[]  {overwriting x[]}. */
48

    
49
void Rdqags(integr_fn f, void *ex, double *a, double *b,
50
            double *epsabs, double *epsrel,
51
            double *result, double *abserr, int *neval, int *ier,
52
            int *limit, int *lenw, int *last, int *iwork, double *work);
53

    
54
void Rdqagi(integr_fn f, void *ex, double *bound, int *inf,
55
            double *epsabs, double *epsrel,
56
            double *result, double *abserr, int *neval, int *ier,
57
            int *limit, int *lenw, int *last,
58
            int *iwork, double *work);
59

    
60
/* main/optim.c */
61
typedef double optimfn(int, double *, void *);
62
typedef void optimgr(int, double *, double *, void *);
63

    
64
void vmmin(int n, double *b, double *Fmin,
65
           optimfn fn, optimgr gr, int maxit, int trace,
66
           int *mask, double abstol, double reltol, int nREPORT,
67
           void *ex, int *fncount, int *grcount, int *fail);
68
void nmmin(int n, double *Bvec, double *X, double *Fmin, optimfn fn,
69
           int *fail, double abstol, double intol, void *ex,
70
           double alpha, double bet, double gamm, int trace,
71
           int *fncount, int maxit);
72
void cgmin(int n, double *Bvec, double *X, double *Fmin,
73
           optimfn fn, optimgr gr,
74
           int *fail, double abstol, double intol, void *ex,
75
           int type, int trace, int *fncount, int *grcount, int maxit);
76
void lbfgsb(int n, int m, double *x, double *l, double *u, int *nbd,
77
            double *Fmin, optimfn fn, optimgr gr, int *fail, void *ex,
78
            double factr, double pgtol, int *fncount, int *grcount,
79
            int maxit, char *msg, int trace, int nREPORT);
80
void samin(int n, double *pb, double *yb, optimfn fn, int maxit,
81
           int tmax, double ti, int trace, void *ex);
82

    
83
/* appl/interv.c: Also in Utils.h, used in package eco */
84
int findInterval(double *xt, int n, double x,
85
                 Rboolean rightmost_closed,  Rboolean all_inside, int ilo,
86
                 int *mflag);
87

    
88
 
89
/* ------------------ Entry points NOT in the R API --------------- */
90

    
91
/* The following are registered for use in .C/.Fortran */
92

    
93
/* appl/dqrutl.f: interfaces to dqrsl */
94
void F77_NAME(dqrqty)(double *x, int *n, int *k, double *qraux,
95
                      double *y, int *ny, double *qty);
96
void F77_NAME(dqrqy)(double *x, int *n, int *k, double *qraux,
97
                     double *y, int *ny, double *qy);
98
void F77_NAME(dqrcf)(double *x, int *n, int *k, double *qraux,
99
                     double *y, int *ny, double *b, int *info);
100
void F77_NAME(dqrrsd)(double *x, int *n, int *k, double *qraux,
101
                     double *y, int *ny, double *rsd);
102
void F77_NAME(dqrxb)(double *x, int *n, int *k, double *qraux,
103
                     double *y, int *ny, double *xb);
104

    
105
/* end of registered */
106
 
107
/* hidden, for use in R.bin/R.dll/libR.so */
108

    
109
/* appl/pretty.c: for use in engine.c and util.c */
110
double R_pretty(double *lo, double *up, int *ndiv, int min_n,
111
                double shrink_sml, double high_u_fact[],
112
                int eps_correction, int return_bounds);
113

    
114
 
115
/* For use in package stats */
116

    
117
/* appl/uncmin.c : */
118

    
119
/* type of pointer to the target and gradient functions */
120
typedef void (*fcn_p)(int, double *, double *, void *);
121

    
122
/* type of pointer to the hessian functions */
123
typedef void (*d2fcn_p)(int, int, double *, double *, void *);
124

    
125
void fdhess(int n, double *x, double fval, fcn_p fun, void *state,
126
            double *h, int nfd, double *step, double *f, int ndigit,
127
            double *typx);
128

    
129
/* Also used in packages nlme, pcaPP */
130
void optif9(int nr, int n, double *x,
131
            fcn_p fcn, fcn_p d1fcn, d2fcn_p d2fcn,
132
            void *state, double *typsiz, double fscale, int method,
133
            int iexp, int *msg, int ndigit, int itnlim, int iagflg,
134
            int iahflg, double dlt, double gradtl, double stepmx,
135
            double steptl, double *xpls, double *fpls, double *gpls,
136
            int *itrmcd, double *a, double *wrk, int *itncnt);
137

    
138
/* find qr decomposition, dqrdc2() is basis of R's qr(), 
139
   also used by nlme and many other packages. */
140
void F77_NAME(dqrdc2)(double *x, int *ldx, int *n, int *p,
141
                      double *tol, int *rank,
142
                      double *qraux, int *pivot, double *work);
143
void F77_NAME(dqrls)(double *x, int *n, int *p, double *y, int *ny,
144
                     double *tol, double *b, double *rsd,
145
                     double *qty, int *k,
146
                     int *jpvt, double *qraux, double *work);
147

    
148
#ifdef  __cplusplus
149
}
150
#endif
151

    
152
#endif /* R_APPLIC_H_ */