1 /* 2 * R : A Computer Language for Statistical Data Analysis 3 * Copyright (C) 2005-2016 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 General Public License as published by 7 * the Free Software Foundation; either version 2 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 General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, a copy is available at 17 * https://www.R-project.org/Licenses/ 18 */ 19 20 #ifndef PORT_PORT_H 21 #define PORT_PORT_H 22 23 /* Header file for the C utilities to accompany the Fortran 24 * optimization routines for the port library. 25 * 26 * Copyright (C) 2005-5 the R Core Team 27 * Licensed under the GNU General Public License, version 2 or later. 28 */ 29 30 #include <math.h> 31 #include <string.h> // for memmove, memcpy, strcmp 32 #include <Rinternals.h> 33 #include <R_ext/RS.h> 34 35 #ifdef ENABLE_NLS 36 #include <libintl.h> 37 #define _(String) dgettext ("stats", String) 38 #else 39 #define _(String) (String) 40 #endif 41 42 /* PORT interface functions - reverse communication */ 43 44 /* DRMNF(D, FX, IV, LIV, LV, N, V, X) */ 45 extern void F77_NAME(drmnf)(double[], double*, 46 int[], int*, int*, int*, double[], double[]); 47 48 /* DRMNG(D, FX, G, IV, LIV, LV, N, V, X) */ 49 extern void F77_NAME(drmng)(double[], double*, double[], 50 int[], int*, int*, int*, double[], double[]); 51 52 /* DRMNH(D, FX, G, H, IV, LH, LIV, LV, N, V, X) */ 53 extern void F77_NAME(drmnh)(double[], double*, double[], double[], 54 int[], int*, int*, int*, int*, double[], double[]); 55 56 /* DRMNFB(B, D, FX, IV, LIV, LV, N, V, X) */ 57 extern void F77_NAME(drmnfb)(double[], double[], double*, 58 int[], int*, int*, int*, double[], double[]); 59 60 /* DRMNGB(B, D, FX, G, IV, LIV, LV, N, V, X) */ 61 extern void F77_NAME(drmngb)(double[], double[], double*, double[], 62 int[], int*, int*, int*, double[], double[]); 63 64 /* DRMNH(B, D, FX, G, H, IV, LH, LIV, LV, N, V, X) */ 65 extern void F77_NAME(drmnhb)(double[], double[], double*, double[], double[], 66 int[], int*, int*, int*, int*, double[], double[]); 67 68 /* DRN2GB(B, D, DR, IV, LIV, LV, N, ND, N1, N2, P, R, RD, V, X) */ 69 extern void F77_NAME(drn2gb)(double[], double[], double[], 70 int[], int*, int*, int*, int*, int*, int*, int*, 71 double[], double[], double[], double[]); 72 /* DRN2G(D, DR, IV, LIV, LV, N, ND, N1, N2, P, R, RD, V, X) */ 73 extern void F77_NAME(drn2g)(double[], double[], 74 int[], int*, int*, int*, int*, int*, int*, int*, 75 double[], double[], double[], double[]); 76 /* DRNSGB(A, ALF, B, C, DA, IN, IV, L, L1, LA, LIV, LV, N, NDA, P, V, Y) */ 77 extern void F77_NAME(drnsgb)(double[], double[], double[], double[], double[], 78 int[], int[], int*, int*, int*, int*, 79 int*, int*, int*, int*, int*, 80 double[], double[]); 81 /* DRNSG(A, ALF, C, DA, IN, IV, L, L1, LA, LIV, LV, N, NDA, P, V, Y) */ 82 extern void F77_NAME(drnsg)(double[], double[], double[], double[], 83 int[], int[], int*, int*, int*, int*, 84 int*, int*, int*, int*, int*, 85 double[], double[]); 86 87 SEXP port_ivset(SEXP kind, SEXP iv, SEXP v); 88 89 SEXP port_nlminb(SEXP fn, SEXP gr, SEXP hs, SEXP rho, 90 SEXP lowerb, SEXP upperb, SEXP d, SEXP iv, SEXP v); 91 92 SEXP port_nlsb(SEXP m, SEXP d, SEXP gg, SEXP iv, SEXP v, 93 SEXP lowerb, SEXP upperb); 94 95 void Rf_divset(int alg, int iv[], int liv, int lv, double v[]); 96 97 void 98 nlminb_iterate(double b[], double d[], double fx, double g[], double h[], 99 int iv[], int liv, int lv, int n, double v[], double x[]); 100 101 void 102 nlsb_iterate(double b[], double d[], double dr[], int iv[], int liv, 103 int lv, int n, int nd, int p, double r[], double rd[], 104 double v[], double x[]); 105 106 #endif 107