CXXR (C++ R)
stats_package.h
1 /*CXXR $Id: stats_package.h 1348 2013-02-25 17:49:03Z arr $
2  *CXXR
3  *CXXR This file is part of CXXR, a project to refactor the R interpreter
4  *CXXR into C++. It may consist in whole or in part of program code and
5  *CXXR documentation taken from the R project itself, incorporated into
6  *CXXR CXXR (and possibly MODIFIED) under the terms of the GNU General Public
7  *CXXR Licence.
8  *CXXR
9  *CXXR CXXR is Copyright (C) 2008-13 Andrew R. Runnalls, subject to such other
10  *CXXR copyrights and copyright restrictions as may be stated below.
11  *CXXR
12  *CXXR CXXR is not part of the R project, and bugs and other issues should
13  *CXXR not be reported via r-bugs or other R project channels; instead refer
14  *CXXR to the CXXR website.
15  *CXXR */
16 
17 /*
18  * R : A Computer Language for Statistical Data Analysis
19  * Copyright (C) 2007 The R Core Team.
20  *
21  * This program is free software; you can redistribute it and/or modify
22  * it under the terms of the GNU Lesser General Public License as published by
23  * the Free Software Foundation; either version 2.1 of the License, or
24  * (at your option) any later version.
25  *
26  * This program is distributed in the hope that it will be useful,
27  * but WITHOUT ANY WARRANTY; without even the implied warranty of
28  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29  * GNU Lesser General Public License for more details.
30  *
31  * You should have received a copy of the GNU Lesser General Public License
32  * along with this program; if not, a copy is available at
33  * http://www.r-project.org/Licenses/
34  */
35 
36 #ifndef R_STATS_PACKAGE_H
37 #define R_STATS_PACKAGE_H
38 #include <Rconfig.h>
39 
40 #ifdef HAVE_VISIBILITY_ATTRIBUTE
41 # define attribute_hidden __attribute__ ((visibility ("hidden")))
42 #else
43 # define attribute_hidden
44 #endif
45 
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49 
50 enum AlgType {NREG = 1, OPT = 2};
51  /* 0-based indices into v */
52 enum VPos {F = 9, F0 = 12, FDIF = 10, G = 27, HC = 70};
53  /* 0-based indices into iv */
54 enum IVPos {AI = 90, AM = 94, ALGSAV = 50, COVMAT = 25,
55  COVPRT = 13, COVREQ = 14, DRADPR = 100,
56  DTYPE = 15, IERR = 74, INITH = 24, INITS = 24,
57  IPIVOT = 75, IVNEED = 2, LASTIV = 42, LASTV = 44,
58  LMAT = 41, MXFCAL = 16, MXITER = 17, NEXTV = 46,
59  NFCALL = 5, NFCOV = 51, NFGCAL = 6, NGCOV = 52,
60  NITER = 30, NVDFLT = 49, NVSAVE = 8, OUTLEV = 18,
61  PARPRT = 19, PARSAV = 48, PERM = 57, PRUNIT = 20,
62  QRTYP = 79, RDREQ = 56, RMAT = 77, SOLPRT = 21,
63  STATPR = 22, TOOBIG = 1, VNEED = 3, VSAVE = 59,
64  X0PRT = 23};
65 
66 void attribute_hidden
67 S_Rf_divset(int alg, int iv[], int liv, int lv, double v[]);
68 
69 void attribute_hidden
70 S_nlsb_iterate(double b[], double d[], double dr[], int iv[],
71  int liv, int lv, int n, int nd, int p,
72  double r[], double rd[], double v[], double x[]);
73 
74 void attribute_hidden
75 S_nlminb_iterate(double b[], double d[], double fx, double g[],
76  double h[], int iv[], int liv, int lv, int n,
77  double v[], double x[]);
78 
79 static R_INLINE int S_v_length(int alg, int n)
80 {
81  return (alg - 1) ? (105 + (n * (2 * n + 20))) :
82  (130 + (n * (n + 27))/2);
83 }
84 
85 static R_INLINE int S_iv_length(int alg, int n)
86 {
87  return (alg - 1) ? (82 + 4 * n) : (78 + 3 * n);
88 }
89 
90 #ifdef __cplusplus
91 }
92 #endif
93 
94 #endif /* R_STATS_PACKAGE_H */
95 
96