/usr/include/gretl/gretl_utils.h is in libgretl1-dev 2016a-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 | /*
* gretl -- Gnu Regression, Econometrics and Time-series Library
* Copyright (C) 2001 Allin Cottrell and Riccardo "Jack" Lucchetti
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef GRETL_UTILS_H
#define GRETL_UTILS_H
#include "libgretl.h"
#include <float.h>
#include <limits.h>
#define floateq(x, y) (fabs((x) - (y)) < DBL_EPSILON)
#define floatneq(x, y) (fabs((x) - (y)) > DBL_EPSILON)
#define floatgt(x, y) ((x) - (y) > DBL_EPSILON)
#define floatlt(x, y) ((y) - (x) > DBL_EPSILON)
#define ok_int(x) (x <= (double) INT_MAX && x >= (double) INT_MIN)
enum {
SESSION_CLEAR_ALL,
SESSION_CLEAR_DATASET
};
void libgretl_init (void);
#ifdef HAVE_MPI
int libgretl_mpi_init (int self, int np, int dcmt);
#else
/* dummy function */
int gretl_mpi_initialized (void);
#endif
void libgretl_session_cleanup (int mode);
void libgretl_cleanup (void);
double date_as_double (int t, int pd, double sd0);
/* checks on variables */
int gretl_isdummy (int t1, int t2, const double *x);
int gretl_iszero (int t1, int t2, const double *x);
int gretl_isconst (int t1, int t2, const double *x);
int gretl_isunits (int t1, int t2, const double *x);
int gretl_isint (int t1, int t2, const double *x);
int gretl_iscount (int t1, int t2, const double *x);
int gretl_isdiscrete (int t1, int t2, const double *x);
int gretl_ispositive (int t1, int t2, const double *x, int strict);
int gretl_is_oprobit_ok (int t1, int t2, const double *x);
int true_const (int v, const DATASET *dset);
/* setting observations */
char *format_obs (char *obs, int maj, int min, int pd);
int set_obs (const char *parm1, const char *parm2,
DATASET *dset, gretlopt opt);
int simple_set_obs (DATASET *dset, int pd, const char *stobs,
gretlopt opt);
/* sorting and comparison */
int gretl_compare_doubles (const void *a, const void *b);
int gretl_inverse_compare_doubles (const void *a, const void *b);
int count_distinct_values (const double *x, int n);
int count_distinct_int_values (const int *x, int n);
int rearrange_id_array (double *x, int m, int n);
int gretl_compare_ints (const void *a, const void *b);
/* miscellaneous */
int gretl_version_number (const char *version);
char *gretl_version_string (char *targ, int vnum);
void printlist (const int *list, const char *msg);
double gretl_double_from_string (const char *s, int *err);
int gretl_int_from_string (const char *s, int *err);
int positive_int_from_string (const char *s);
int varnum_from_string (const char *str, DATASET *dset);
int gretl_int_from_double (double x, int *err);
GretlType gretl_type_from_name (const char *s, const DATASET *dset);
double *copyvec (const double *src, int n);
void doubles_array_free (double **X, int m);
double **doubles_array_new (int m, int n);
double **doubles_array_new0 (int m, int n);
int doubles_array_adjust_length (double **X, int m, int new_n);
double **data_array_from_model (const MODEL *pmod, double **Z,
int missv);
int ijton (int i, int j, int nrows);
int transcribe_array (double *targ, const double *src,
const DATASET *dset);
int gretl_copy_file (const char *src, const char *dest);
int gretl_delete_var_by_name (const char *s, PRN *prn);
#ifndef WIN32
int gretl_spawn (char *cmdline);
#endif
/* model selection criteria */
int gretl_calculate_criteria (double ess, int n, int k,
double *ll, double *aic, double *bic,
double *hqc);
int ls_criteria (MODEL *pmod);
/* hypothesis tests mechanism */
int get_last_test_type (void);
void record_test_result (double teststat, double pval, char *blurb);
void record_matrix_test_result (gretl_matrix *tests,
gretl_matrix *pvals);
void record_LR_test_result (double teststat, double pval, double lnl,
char *blurb);
void record_QLR_test_result (double teststat, double pval, double brk);
double get_last_test_statistic (char *blurb);
double get_last_pvalue (char *blurb);
double get_last_lnl (char *blurb);
double get_last_break (char *blurb);
gretl_matrix *get_last_test_matrix (int *err);
gretl_matrix *get_last_pvals_matrix (int *err);
/* timer */
double gretl_stopwatch (void);
/* aligned allocation */
void *gretl_aligned_malloc (size_t size, size_t alignment);
void gretl_aligned_free (void *mem);
/* search in path, etc. */
int check_for_program (const char *prog);
const char *blas_variant_string (void);
int get_openblas_details (char **s1, char **s2);
gint64 gretl_monotonic_time (void);
#endif /* GRETL_UTILS_H */
|