21 #define _GNU_SOURCE //for asprintf
27 #include <gsl/gsl_rng.h>
28 #include <gsl/gsl_matrix.h>
39 #define apop_varad_head(type, name) type variadic_##name(variadic_type_##name varad_in)
41 #define apop_varad_declare(type, name, ...) \
44 } variadic_type_##name; \
45 apop_varad_head(type, name);
47 #define apop_varad_var(name, value) name = varad_in.name ? varad_in.name : (value);
48 #define apop_varad_link(name,...) variadic_##name((variadic_type_##name) {__VA_ARGS__})
64 int colct, rowct, textct;
92 unsigned long name_hash;
141 char output_delimiter[100];
143 char input_delimiters[100];
144 char db_name_column[300];
152 #if __STDC_VERSION__ > 201100L && !defined(__STDC_NO_ATOMICS__)
153 _Atomic(
int) rng_seed;
166 #ifdef APOP_NO_VARIADIC
169 void apop_name_stack_base(
apop_name * n1,
apop_name *nadd,
char type1,
char typeadd) ;
171 #define apop_name_stack(...) apop_varad_link(apop_name_stack, __VA_ARGS__)
177 void apop_data_add_names_base(
apop_data *d,
const char type,
char const ** names);
200 #define apop_data_add_names(dataset, type, ...) apop_data_add_names_base((dataset), (type), (char const*[]) {__VA_ARGS__, NULL})
216 #define apop_data_free(freeme) (apop_data_free_base(freeme) ? 0 : ((freeme)= NULL))
221 #ifdef APOP_NO_VARIADIC
224 apop_data * apop_data_alloc_base(
const size_t size1,
const size_t size2,
const int size3) ;
226 #define apop_data_alloc(...) apop_varad_link(apop_data_alloc, __VA_ARGS__)
229 #ifdef APOP_NO_VARIADIC
232 apop_data * apop_data_calloc_base(
const size_t size1,
const size_t size2,
const int size3) ;
234 #define apop_data_calloc(...) apop_varad_link(apop_data_calloc, __VA_ARGS__)
237 #ifdef APOP_NO_VARIADIC
242 #define apop_data_stack(...) apop_varad_link(apop_data_stack, __VA_ARGS__)
249 #ifdef APOP_NO_VARIADIC
250 double *
apop_data_ptr(
apop_data *data,
int row,
int col,
const char *rowname,
const char *colname,
const char *page) ;
252 double * apop_data_ptr_base(
apop_data *data,
int row,
int col,
const char *rowname,
const char *colname,
const char *page) ;
253 apop_varad_declare(
double *,
apop_data_ptr,
apop_data *data;
int row;
int col;
const char *rowname;
const char *colname;
const char *page);
254 #define apop_data_ptr(...) apop_varad_link(apop_data_ptr, __VA_ARGS__)
257 #ifdef APOP_NO_VARIADIC
258 double apop_data_get(
const apop_data *data,
size_t row,
int col,
const char *rowname,
const char *colname,
const char *page) ;
260 double apop_data_get_base(
const apop_data *data,
size_t row,
int col,
const char *rowname,
const char *colname,
const char *page) ;
261 apop_varad_declare(
double,
apop_data_get,
const apop_data *data;
size_t row;
int col;
const char *rowname;
const char *colname;
const char *page);
262 #define apop_data_get(...) apop_varad_link(apop_data_get, __VA_ARGS__)
265 #ifdef APOP_NO_VARIADIC
266 int apop_data_set(
apop_data *data,
size_t row,
int col,
const double val,
const char *rowname,
const char * colname,
const char *page) ;
268 int apop_data_set_base(
apop_data *data,
size_t row,
int col,
const double val,
const char *rowname,
const char * colname,
const char *page) ;
269 apop_varad_declare(
int,
apop_data_set,
apop_data *data;
size_t row;
int col;
const double val;
const char *rowname;
const char * colname;
const char *page);
270 #define apop_data_set(...) apop_varad_link(apop_data_set, __VA_ARGS__)
277 #ifdef APOP_NO_VARIADIC
280 apop_data * apop_data_transpose_base(
apop_data *in,
char transpose_text,
char inplace) ;
282 #define apop_data_transpose(...) apop_varad_link(apop_data_transpose, __VA_ARGS__)
288 #define apop_data_prune_columns(in, ...) apop_data_prune_columns_base((in), (char *[]) {__VA_ARGS__, NULL})
291 #ifdef APOP_NO_VARIADIC
294 apop_data * apop_data_get_page_base(
const apop_data * data,
const char * title,
const char match) ;
296 #define apop_data_get_page(...) apop_varad_link(apop_data_get_page, __VA_ARGS__)
300 #ifdef APOP_NO_VARIADIC
303 apop_data* apop_data_rm_page_base(
apop_data * data,
const char *title,
const char free_p) ;
305 #define apop_data_rm_page(...) apop_varad_link(apop_data_rm_page, __VA_ARGS__)
308 #ifdef APOP_NO_VARIADIC
313 #define apop_data_rm_rows(...) apop_varad_link(apop_data_rm_rows, __VA_ARGS__)
318 #ifdef APOP_NO_VARIADIC
323 #define apop_model_draws(...) apop_varad_link(apop_model_draws, __VA_ARGS__)
333 #ifdef APOP_NO_VARIADIC
336 gsl_matrix * apop_vector_to_matrix_base(
const gsl_vector *in,
char row_col) ;
338 #define apop_vector_to_matrix(...) apop_varad_link(apop_vector_to_matrix, __VA_ARGS__)
347 #ifdef APOP_NO_VARIADIC
350 gsl_vector * apop_array_to_vector_base(
double *in,
int size) ;
352 #define apop_array_to_vector(...) apop_varad_link(apop_array_to_vector, __VA_ARGS__)
355 #define apop_line_to_vector apop_array_to_vector
358 #ifdef APOP_NO_VARIADIC
359 apop_data *
apop_text_to_data(
char const *text_file,
int has_row_names,
int has_col_names,
int const *field_ends,
char const *delimiters) ;
361 apop_data * apop_text_to_data_base(
char const *text_file,
int has_row_names,
int has_col_names,
int const *field_ends,
char const *delimiters) ;
362 apop_varad_declare(
apop_data *,
apop_text_to_data,
char const *text_file;
int has_row_names;
int has_col_names;
int const *field_ends;
char const *delimiters);
363 #define apop_text_to_data(...) apop_varad_link(apop_text_to_data, __VA_ARGS__)
366 #ifdef APOP_NO_VARIADIC
367 int apop_text_to_db(
char const *text_file,
char *tabname,
int has_row_names,
int has_col_names,
char **field_names,
int const *field_ends,
apop_data *field_params,
char *table_params,
char const *delimiters,
char if_table_exists) ;
369 int apop_text_to_db_base(
char const *text_file,
char *tabname,
int has_row_names,
int has_col_names,
char **field_names,
int const *field_ends,
apop_data *field_params,
char *table_params,
char const *delimiters,
char if_table_exists) ;
370 apop_varad_declare(
int,
apop_text_to_db,
char const *text_file;
char *tabname;
int has_row_names;
int has_col_names;
char **field_names;
int const *field_ends;
apop_data *field_params;
char *table_params;
char const *delimiters;
char if_table_exists);
371 #define apop_text_to_db(...) apop_varad_link(apop_text_to_db, __VA_ARGS__)
381 char *col_col_name,
char *data_col_name);
384 #ifdef APOP_NO_VARIADIC
387 gsl_vector * apop_data_pack_base(
const apop_data *in, gsl_vector *out,
char all_pages,
char use_info_pages) ;
388 apop_varad_declare(gsl_vector *,
apop_data_pack,
const apop_data *in; gsl_vector *out;
char all_pages;
char use_info_pages);
389 #define apop_data_pack(...) apop_varad_link(apop_data_pack, __VA_ARGS__)
392 #ifdef APOP_NO_VARIADIC
395 void apop_data_unpack_base(
const gsl_vector *in,
apop_data *d,
char use_info_pages) ;
397 #define apop_data_unpack(...) apop_varad_link(apop_data_unpack, __VA_ARGS__)
401 #define apop_vector_fill(avfin, ...) apop_vector_fill_base((avfin), (double []) {__VA_ARGS__})
402 #define apop_data_fill(adfin, ...) apop_data_fill_base((adfin), (double []) {__VA_ARGS__})
403 #define apop_text_fill(dataset, ...) apop_text_fill_base((dataset), (char* []) {__VA_ARGS__, NULL})
405 #define apop_data_falloc(sizes, ...) apop_data_fill(apop_data_alloc sizes, __VA_ARGS__)
408 gsl_vector *apop_vector_fill_base(gsl_vector *in,
double []);
452 #define apop_gaussian apop_normal
453 #define apop_OLS apop_ols
454 #define apop_PMF apop_pmf
455 #define apop_F_distribution apop_f_distribution
456 #define apop_WLS apop_wls
457 #define apop_IV apop_iv
478 #define apop_model_set_parameters(in, ...) apop_model_set_parameters_base((in), (double []) {__VA_ARGS__})
485 #define apop_model_mixture(...) apop_model_mixture_base((apop_model *[]){__VA_ARGS__, NULL})
490 #define apop_model_stack(...) apop_model_stack_base((apop_model *[]){__VA_ARGS__, NULL})
494 #ifdef APOP_NO_VARIADIC
496 double (*fn_r)(
apop_data *),
double (*fn_dp)(
double,
void *),
double (*fn_vp)(gsl_vector*,
void *),
497 double (*fn_rp)(
apop_data *,
void *),
double (*fn_dpi)(
double,
void *,
int),
498 double (*fn_vpi)(gsl_vector*,
void *,
int),
double (*fn_rpi)(
apop_data*,
void *,
int),
499 double (*fn_di)(
double,
int),
double (*fn_vi)(gsl_vector*,
int),
double (*fn_ri)(
apop_data*,
int),
500 void *param,
int inplace,
char part,
int all_pages) ;
502 apop_data * apop_map_base(
apop_data *in,
double (*fn_d)(
double),
double (*fn_v)(gsl_vector*),
503 double (*fn_r)(
apop_data *),
double (*fn_dp)(
double,
void *),
double (*fn_vp)(gsl_vector*,
void *),
504 double (*fn_rp)(
apop_data *,
void *),
double (*fn_dpi)(
double,
void *,
int),
505 double (*fn_vpi)(gsl_vector*,
void *,
int),
double (*fn_rpi)(
apop_data*,
void *,
int),
506 double (*fn_di)(
double,
int),
double (*fn_vi)(gsl_vector*,
int),
double (*fn_ri)(
apop_data*,
int),
507 void *param,
int inplace,
char part,
int all_pages) ;
509 double (*fn_r)(
apop_data *); double (*fn_dp)(double,
void *); double (*fn_vp)(gsl_vector*,
void *);
510 double (*fn_rp)(
apop_data *,
void *); double (*fn_dpi)(double,
void *, int);
511 double (*fn_vpi)(gsl_vector*,
void *, int); double (*fn_rpi)(apop_data*,
void *, int);
512 double (*fn_di)(double, int); double (*fn_vi)(gsl_vector*, int); double (*fn_ri)(apop_data*, int);
513 void *param;
int inplace;
char part;
int all_pages);
514 #define apop_map(...) apop_varad_link(apop_map, __VA_ARGS__)
517 #ifdef APOP_NO_VARIADIC
518 double apop_map_sum(apop_data *in,
double (*fn_d)(
double),
double (*fn_v)(gsl_vector*),
519 double (*fn_r)(apop_data *),
double (*fn_dp)(
double,
void *),
double (*fn_vp)(gsl_vector*,
void *),
520 double (*fn_rp)(apop_data *,
void *),
double (*fn_dpi)(
double,
void *,
int),
521 double (*fn_vpi)(gsl_vector*,
void *,
int),
double (*fn_rpi)(apop_data*,
void *,
int),
522 double (*fn_di)(
double,
int),
double (*fn_vi)(gsl_vector*,
int),
double (*fn_ri)(apop_data*,
int),
523 void *param,
char part,
int all_pages) ;
525 double apop_map_sum_base(apop_data *in,
double (*fn_d)(
double),
double (*fn_v)(gsl_vector*),
526 double (*fn_r)(apop_data *),
double (*fn_dp)(
double,
void *),
double (*fn_vp)(gsl_vector*,
void *),
527 double (*fn_rp)(apop_data *,
void *),
double (*fn_dpi)(
double,
void *,
int),
528 double (*fn_vpi)(gsl_vector*,
void *,
int),
double (*fn_rpi)(apop_data*,
void *,
int),
529 double (*fn_di)(
double,
int),
double (*fn_vi)(gsl_vector*,
int),
double (*fn_ri)(apop_data*,
int),
530 void *param,
char part,
int all_pages) ;
531 apop_varad_declare(
double,
apop_map_sum, apop_data *in; double (*fn_d)(double); double (*fn_v)(gsl_vector*);
532 double (*fn_r)(apop_data *); double (*fn_dp)(double,
void *); double (*fn_vp)(gsl_vector*,
void *);
533 double (*fn_rp)(apop_data *,
void *); double (*fn_dpi)(double,
void *, int);
534 double (*fn_vpi)(gsl_vector*,
void *, int); double (*fn_rpi)(apop_data*,
void *, int);
535 double (*fn_di)(double, int); double (*fn_vi)(gsl_vector*, int); double (*fn_ri)(apop_data*, int);
536 void *param;
char part;
int all_pages);
537 #define apop_map_sum(...) apop_varad_link(apop_map_sum, __VA_ARGS__)
542 gsl_vector *
apop_matrix_map(
const gsl_matrix *m,
double (*fn)(gsl_vector*));
543 gsl_vector *
apop_vector_map(
const gsl_vector *v,
double (*fn)(
double));
556 #ifdef APOP_NO_VARIADIC
557 void apop_plot_histogram(gsl_vector *data,
size_t bin_count,
char *with,
char const *output_name, FILE *output_pipe,
char output_type,
char output_append) ;
559 void apop_plot_histogram_base(gsl_vector *data,
size_t bin_count,
char *with,
char const *output_name, FILE *output_pipe,
char output_type,
char output_append) ;
560 apop_varad_declare(
void, apop_plot_histogram, gsl_vector *data;
size_t bin_count;
char *with;
char const *output_name; FILE *output_pipe;
char output_type;
char output_append);
561 #define apop_plot_histogram(...) apop_varad_link(apop_plot_histogram, __VA_ARGS__)
565 #ifdef APOP_NO_VARIADIC
566 void apop_matrix_print(
const gsl_matrix *data,
char const *output_name, FILE *output_pipe,
char output_type,
char output_append) ;
568 void apop_matrix_print_base(
const gsl_matrix *data,
char const *output_name, FILE *output_pipe,
char output_type,
char output_append) ;
569 apop_varad_declare(
void,
apop_matrix_print,
const gsl_matrix *data;
char const *output_name; FILE *output_pipe;
char output_type;
char output_append);
570 #define apop_matrix_print(...) apop_varad_link(apop_matrix_print, __VA_ARGS__)
573 #ifdef APOP_NO_VARIADIC
574 void apop_vector_print(gsl_vector *data,
char const *output_name, FILE *output_pipe,
char output_type,
char output_append) ;
576 void apop_vector_print_base(gsl_vector *data,
char const *output_name, FILE *output_pipe,
char output_type,
char output_append) ;
577 apop_varad_declare(
void,
apop_vector_print, gsl_vector *data;
char const *output_name; FILE *output_pipe;
char output_type;
char output_append);
578 #define apop_vector_print(...) apop_varad_link(apop_vector_print, __VA_ARGS__)
581 #ifdef APOP_NO_VARIADIC
582 void apop_data_print(
const apop_data *data,
char const *output_name, FILE *output_pipe,
char output_type,
char output_append) ;
584 void apop_data_print_base(
const apop_data *data,
char const *output_name, FILE *output_pipe,
char output_type,
char output_append) ;
585 apop_varad_declare(
void,
apop_data_print,
const apop_data *data;
char const *output_name; FILE *output_pipe;
char output_type;
char output_append);
586 #define apop_data_print(...) apop_varad_link(apop_data_print, __VA_ARGS__)
596 #ifdef APOP_NO_VARIADIC
599 double apop_vector_mean_base(gsl_vector
const *v, gsl_vector
const *weights);
600 apop_varad_declare(
double,
apop_vector_mean, gsl_vector
const *v; gsl_vector
const *weights);
601 #define apop_vector_mean(...) apop_varad_link(apop_vector_mean, __VA_ARGS__)
604 #ifdef APOP_NO_VARIADIC
605 double apop_vector_var(gsl_vector
const *v, gsl_vector
const *weights);
607 double apop_vector_var_base(gsl_vector
const *v, gsl_vector
const *weights);
608 apop_varad_declare(
double,
apop_vector_var, gsl_vector
const *v; gsl_vector
const *weights);
609 #define apop_vector_var(...) apop_varad_link(apop_vector_var, __VA_ARGS__)
612 #ifdef APOP_NO_VARIADIC
615 double apop_vector_skew_pop_base(gsl_vector
const *v, gsl_vector
const *weights);
616 apop_varad_declare(
double,
apop_vector_skew_pop, gsl_vector
const *v; gsl_vector
const *weights);
617 #define apop_vector_skew_pop(...) apop_varad_link(apop_vector_skew_pop, __VA_ARGS__)
620 #ifdef APOP_NO_VARIADIC
623 double apop_vector_kurtosis_pop_base(gsl_vector
const *v, gsl_vector
const *weights);
625 #define apop_vector_kurtosis_pop(...) apop_varad_link(apop_vector_kurtosis_pop, __VA_ARGS__)
628 #ifdef APOP_NO_VARIADIC
630 gsl_vector
const *weights);
632 double apop_vector_cov_base(gsl_vector
const *v1, gsl_vector
const *v2,
633 gsl_vector
const *weights);
634 apop_varad_declare(
double,
apop_vector_cov, gsl_vector
const *v1; gsl_vector
const *v2;
635 gsl_vector
const *weights);
636 #define apop_vector_cov(...) apop_varad_link(apop_vector_cov, __VA_ARGS__)
640 #ifdef APOP_NO_VARIADIC
641 double apop_vector_distance(
const gsl_vector *ina,
const gsl_vector *inb,
const char metric,
const double norm) ;
643 double apop_vector_distance_base(
const gsl_vector *ina,
const gsl_vector *inb,
const char metric,
const double norm) ;
644 apop_varad_declare(
double,
apop_vector_distance,
const gsl_vector *ina;
const gsl_vector *inb;
const char metric;
const double norm);
645 #define apop_vector_distance(...) apop_varad_link(apop_vector_distance, __VA_ARGS__)
649 #ifdef APOP_NO_VARIADIC
652 void apop_vector_normalize_base(gsl_vector *in, gsl_vector **out,
const char normalization_type) ;
653 apop_varad_declare(
void,
apop_vector_normalize, gsl_vector *in; gsl_vector **out;
const char normalization_type);
654 #define apop_vector_normalize(...) apop_varad_link(apop_vector_normalize, __VA_ARGS__)
669 #ifdef APOP_NO_VARIADIC
672 int apop_matrix_is_positive_semidefinite_base(gsl_matrix *m,
char semi) ;
674 #define apop_matrix_is_positive_semidefinite(...) apop_varad_link(apop_matrix_is_positive_semidefinite, __VA_ARGS__)
682 apop_data *
apop_t_test(gsl_vector *a, gsl_vector *b);
684 #ifdef APOP_NO_VARIADIC
685 apop_data*
apop_anova(
char *table,
char *data,
char *grouping1,
char *grouping2) ;
687 apop_data* apop_anova_base(
char *table,
char *data,
char *grouping1,
char *grouping2) ;
688 apop_varad_declare(apop_data*,
apop_anova,
char *table;
char *data;
char *grouping1;
char *grouping2);
689 #define apop_anova(...) apop_varad_link(apop_anova, __VA_ARGS__)
692 #define apop_ANOVA apop_anova
693 #ifdef APOP_NO_VARIADIC
696 apop_data * apop_f_test_base(
apop_model *est, apop_data *contrast) ;
698 #define apop_f_test(...) apop_varad_link(apop_f_test, __VA_ARGS__)
701 #define apop_F_test apop_f_test
704 #define apop_estimate_r_squared(in) apop_estimate_coefficient_of_determination(in)
708 #ifdef APOP_NO_VARIADIC
711 apop_data * apop_data_to_factors_base(apop_data *data,
char intype,
int incol,
int outcol) ;
712 apop_varad_declare(apop_data *,
apop_data_to_factors, apop_data *data;
char intype;
int incol;
int outcol);
713 #define apop_data_to_factors(...) apop_varad_link(apop_data_to_factors, __VA_ARGS__)
716 #ifdef APOP_NO_VARIADIC
719 apop_data * apop_data_get_factor_names_base(apop_data *data,
int col,
char type) ;
721 #define apop_data_get_factor_names(...) apop_varad_link(apop_data_get_factor_names, __VA_ARGS__)
725 #ifdef APOP_NO_VARIADIC
726 apop_data *
apop_data_to_dummies(apop_data *d,
int col,
char type,
int keep_first,
char append,
char remove) ;
728 apop_data * apop_data_to_dummies_base(apop_data *d,
int col,
char type,
int keep_first,
char append,
char remove) ;
729 apop_varad_declare(apop_data *,
apop_data_to_dummies, apop_data *d;
int col;
char type;
int keep_first;
char append;
char remove);
730 #define apop_data_to_dummies(...) apop_varad_link(apop_data_to_dummies, __VA_ARGS__)
734 #ifdef APOP_NO_VARIADIC
739 #define apop_kl_divergence(...) apop_varad_link(apop_kl_divergence, __VA_ARGS__)
749 #ifdef APOP_NO_VARIADIC
752 apop_data * apop_bootstrap_cov_base(apop_data *data,
apop_model *model, gsl_rng* rng,
int iterations,
char keep_boots,
char ignore_nans) ;
753 apop_varad_declare(apop_data *,
apop_bootstrap_cov, apop_data *data;
apop_model *model; gsl_rng* rng;
int iterations;
char keep_boots;
char ignore_nans);
754 #define apop_bootstrap_cov(...) apop_varad_link(apop_bootstrap_cov, __VA_ARGS__)
760 #define apop_rng_get_thread(thread_in) apop_rng_get_thread_base(#thread_in[0]=='\0' ? -1: (thread_in+0))
761 gsl_rng *apop_rng_get_thread_base(
int thread);
768 #ifdef APOP_NO_VARIADIC
771 gsl_vector * apop_numerical_gradient_base(apop_data * data,
apop_model* model,
double delta) ;
773 #define apop_numerical_gradient(...) apop_varad_link(apop_numerical_gradient, __VA_ARGS__)
776 #ifdef APOP_NO_VARIADIC
779 apop_data * apop_model_hessian_base(apop_data * data,
apop_model *model,
double delta) ;
781 #define apop_model_hessian(...) apop_varad_link(apop_model_hessian, __VA_ARGS__)
784 #ifdef APOP_NO_VARIADIC
787 apop_data * apop_model_numerical_covariance_base(apop_data * data,
apop_model *model,
double delta) ;
789 #define apop_model_numerical_covariance(...) apop_varad_link(apop_model_numerical_covariance, __VA_ARGS__)
795 #ifdef APOP_NO_VARIADIC
800 #define apop_estimate_restart(...) apop_varad_link(apop_estimate_restart, __VA_ARGS__)
805 #ifdef APOP_NO_VARIADIC
808 long double apop_linear_constraint_base(gsl_vector *beta, apop_data * constraint,
double margin) ;
809 apop_varad_declare(
long double,
apop_linear_constraint, gsl_vector *beta; apop_data * constraint;
double margin);
810 #define apop_linear_constraint(...) apop_varad_link(apop_linear_constraint, __VA_ARGS__)
848 int apop_vtable_add(
char const *tabname,
void *fn_in,
unsigned long hash);
849 void *apop_vtable_get(
char const *tabname,
unsigned long hash);
850 int apop_vtable_drop(
char const *tabname,
unsigned long hash);
853 #define apop_update_hash(m1, m2) ( \
854 ((m1)->log_likelihood ? (size_t)(m1)->log_likelihood : \
855 (m1)->p ? (size_t)(m1)->p*33 : \
856 (m1)->draw ? (size_t)(m1)->draw*33*27 \
858 +((m2)->log_likelihood ? (size_t)(m2)->log_likelihood : \
859 (m2)->p ? (size_t)(m2)->p*33 : \
860 (m2)->draw ? (size_t)(m2)->draw*33*27 \
863 #ifdef Declare_type_checking_fns
864 void apop_update_type_check(apop_update_type in){ };
866 void apop_update_type_check(apop_update_type in);
868 #define apop_update_vtable_add(fn, ...) apop_update_type_check(fn), apop_vtable_add("apop_update", fn, apop_update_hash(__VA_ARGS__))
869 #define apop_update_vtable_get(...) apop_vtable_get("apop_update", apop_update_hash(__VA_ARGS__))
870 #define apop_update_vtable_drop(...) apop_vtable_drop("apop_update", apop_update_hash(__VA_ARGS__))
872 typedef void (*apop_score_type)(apop_data *d, gsl_vector *gradient, apop_model *params);
873 #define apop_score_hash(m1) ((size_t)((m1)->log_likelihood ? (m1)->log_likelihood : (m1)->p))
874 #ifdef Declare_type_checking_fns
875 void apop_score_type_check(apop_score_type in){ };
877 void apop_score_type_check(apop_score_type in);
879 #define apop_score_vtable_add(fn, ...) apop_score_type_check(fn), apop_vtable_add("apop_score", fn, apop_score_hash(__VA_ARGS__))
880 #define apop_score_vtable_get(...) apop_vtable_get("apop_score", apop_score_hash(__VA_ARGS__))
881 #define apop_score_vtable_drop(...) apop_vtable_drop("apop_score", apop_score_hash(__VA_ARGS__))
883 typedef apop_model* (*apop_parameter_model_type)(apop_data *, apop_model *);
884 #define apop_parameter_model_hash(m1) ((size_t)((m1)->log_likelihood ? (m1)->log_likelihood : (m1)->p)*33 + (m1)->estimate ? (size_t)(m1)->estimate: 27)
885 #ifdef Declare_type_checking_fns
886 void apop_parameter_model_type_check(apop_parameter_model_type in){ };
888 void apop_parameter_model_type_check(apop_parameter_model_type in);
890 #define apop_parameter_model_vtable_add(fn, ...) apop_parameter_model_type_check(fn), apop_vtable_add("apop_parameter_model", fn, apop_parameter_model_hash(__VA_ARGS__))
891 #define apop_parameter_model_vtable_get(...) apop_vtable_get("apop_parameter_model", apop_parameter_model_hash(__VA_ARGS__))
892 #define apop_parameter_model_vtable_drop(...) apop_vtable_drop("apop_parameter_model", apop_parameter_model_hash(__VA_ARGS__))
894 typedef apop_data * (*apop_predict_type)(apop_data *d, apop_model *params);
895 #define apop_predict_hash(m1) ((size_t)((m1)->log_likelihood ? (m1)->log_likelihood : (m1)->p)*33 + (m1)->estimate ? (size_t)(m1)->estimate: 27)
896 #ifdef Declare_type_checking_fns
897 void apop_predict_type_check(apop_predict_type in){ };
899 void apop_predict_type_check(apop_predict_type in);
901 #define apop_predict_vtable_add(fn, ...) apop_predict_type_check(fn), apop_vtable_add("apop_predict", fn, apop_predict_hash(__VA_ARGS__))
902 #define apop_predict_vtable_get(...) apop_vtable_get("apop_predict", apop_predict_hash(__VA_ARGS__))
903 #define apop_predict_vtable_drop(...) apop_vtable_drop("apop_predict", apop_predict_hash(__VA_ARGS__))
905 typedef void (*apop_model_print_type)(apop_model *params, FILE *out);
906 #define apop_model_print_hash(m1) ((m1)->log_likelihood ? (size_t)(m1)->log_likelihood : \
907 (m1)->p ? (size_t)(m1)->p*33 : \
908 (m1)->estimate ? (size_t)(m1)->estimate*33*33 : \
909 (m1)->draw ? (size_t)(m1)->draw*33*27 : \
910 (m1)->cdf ? (size_t)(m1)->cdf*27*27 \
912 #ifdef Declare_type_checking_fns
913 void apop_model_print_type_check(apop_model_print_type in){ };
915 void apop_model_print_type_check(apop_model_print_type in);
917 #define apop_model_print_vtable_add(fn, ...) apop_model_print_type_check(fn), apop_vtable_add("apop_model_print", fn, apop_model_print_hash(__VA_ARGS__))
918 #define apop_model_print_vtable_get(...) apop_vtable_get("apop_model_print", apop_model_print_hash(__VA_ARGS__))
919 #define apop_model_print_vtable_drop(...) apop_vtable_drop("apop_model_print", apop_model_print_hash(__VA_ARGS__))
931 #define apop_test_ANOVA_independence(d) apop_test_anova_independence(d)
933 #ifdef APOP_NO_VARIADIC
934 int apop_regex(
const char *
string,
const char* regex, apop_data **substrings,
const char use_case) ;
936 int apop_regex_base(
const char *
string,
const char* regex, apop_data **substrings,
const char use_case) ;
937 apop_varad_declare(
int,
apop_regex,
const char *
string;
const char* regex; apop_data **substrings;
const char use_case);
938 #define apop_regex(...) apop_varad_link(apop_regex, __VA_ARGS__)
942 int apop_system(
const char *fmt, ...) __attribute__ ((format (printf,1,2)));
949 #ifdef APOP_NO_VARIADIC
950 apop_data *
apop_data_to_bins(apop_data *indata, apop_data *binspec,
int bin_count,
char close_top_bin) ;
952 apop_data * apop_data_to_bins_base(apop_data *indata, apop_data *binspec,
int bin_count,
char close_top_bin) ;
953 apop_varad_declare(apop_data *,
apop_data_to_bins, apop_data *indata; apop_data *binspec;
int bin_count;
char close_top_bin);
954 #define apop_data_to_bins(...) apop_varad_link(apop_data_to_bins, __VA_ARGS__)
957 #ifdef APOP_NO_VARIADIC
958 apop_model *
apop_model_to_pmf(apop_model *model, apop_data *binspec,
long int draws,
int bin_count, gsl_rng *rng) ;
960 apop_model * apop_model_to_pmf_base(apop_model *model, apop_data *binspec,
long int draws,
int bin_count, gsl_rng *rng) ;
961 apop_varad_declare(apop_model *,
apop_model_to_pmf, apop_model *model; apop_data *binspec;
long int draws;
int bin_count; gsl_rng *rng);
962 #define apop_model_to_pmf(...) apop_varad_link(apop_model_to_pmf, __VA_ARGS__)
967 #ifdef APOP_NO_VARIADIC
968 char*
apop_text_paste(apop_data
const*strings,
char *between,
char *before,
char *after,
char *between_cols,
int (*prune)(apop_data* ,
int ,
int ,
void*),
void* prune_parameter) ;
970 char* apop_text_paste_base(apop_data
const*strings,
char *between,
char *before,
char *after,
char *between_cols,
int (*prune)(apop_data* ,
int ,
int ,
void*),
void* prune_parameter) ;
971 apop_varad_declare(
char*,
apop_text_paste, apop_data
const*strings;
char *between;
char *before;
char *after;
char *between_cols; int (*prune)(apop_data* , int , int ,
void*);
void* prune_parameter);
972 #define apop_text_paste(...) apop_varad_link(apop_text_paste, __VA_ARGS__)
980 #define Apop_notify(verbosity, ...) {\
981 if (apop_opts.verbose != -1 && apop_opts.verbose >= verbosity) { \
982 if (!apop_opts.log_file) apop_opts.log_file = stderr; \
983 fprintf(apop_opts.log_file, "%s: ", __func__); fprintf(apop_opts.log_file, __VA_ARGS__); fprintf(apop_opts.log_file, "\n"); \
984 fflush(apop_opts.log_file); \
987 #define Apop_maybe_abort(level) \
988 {if ((level == -5 && apop_opts.stop_on_warning!='n') \
989 || (apop_opts.verbose >= level && apop_opts.stop_on_warning == 'v') \
990 || (apop_opts.stop_on_warning=='w') ) \
1004 #define Apop_stopif(test, onfail, level, ...) do {\
1006 Apop_notify(level, __VA_ARGS__); \
1007 Apop_maybe_abort(level) \
1011 #define apop_errorlevel -5
1014 #define apop_return_data_error(E) {apop_data *out=apop_data_alloc(); out->error='E'; return out;}
1019 #define Apop_assert_c(test, returnval, level, ...) \
1020 Apop_stopif(!(test), return returnval, level, __VA_ARGS__)
1022 #define Apop_assert(test, ...) Apop_assert_c((test), 0, apop_errorlevel, __VA_ARGS__)
1025 #define Apop_assert_n(test, ...) Apop_assert_c((test), , apop_errorlevel, __VA_ARGS__)
1026 #define Apop_assert_nan(test, ...) Apop_assert_c((test), GSL_NAN, apop_errorlevel, __VA_ARGS__)
1027 #define Apop_assert_negone(test, ...) Apop_assert_c((test), -1, apop_errorlevel, __VA_ARGS__)
1030 #ifdef APOP_NO_VARIADIC
1033 apop_data * apop_data_listwise_delete_base(apop_data *d,
char inplace) ;
1035 #define apop_data_listwise_delete(...) apop_varad_link(apop_data_listwise_delete, __VA_ARGS__)
1039 #define apop_ml_imputation(d, m) apop_ml_impute(d, m)
1041 #ifdef APOP_NO_VARIADIC
1044 apop_model * apop_model_metropolis_base(apop_data *d, gsl_rng* rng, apop_model *m);
1046 #define apop_model_metropolis(...) apop_varad_link(apop_model_metropolis, __VA_ARGS__)
1049 #ifdef APOP_NO_VARIADIC
1050 apop_model *
apop_update(apop_data *data, apop_model *prior, apop_model *likelihood, gsl_rng *rng) ;
1052 apop_model * apop_update_base(apop_data *data, apop_model *prior, apop_model *likelihood, gsl_rng *rng) ;
1053 apop_varad_declare(apop_model *,
apop_update, apop_data *data; apop_model *prior; apop_model *likelihood; gsl_rng *rng);
1054 #define apop_update(...) apop_varad_link(apop_update, __VA_ARGS__)
1058 #ifdef APOP_NO_VARIADIC
1059 double apop_test(
double statistic,
char *distribution,
double p1,
double p2,
char tail) ;
1061 double apop_test_base(
double statistic,
char *distribution,
double p1,
double p2,
char tail) ;
1062 apop_varad_declare(
double,
apop_test,
double statistic;
char *distribution;
double p1;
double p2;
char tail);
1063 #define apop_test(...) apop_varad_link(apop_test, __VA_ARGS__)
1068 #ifdef APOP_NO_VARIADIC
1071 double * apop_vector_percentiles_base(gsl_vector *data,
char rounding) ;
1073 #define apop_vector_percentiles(...) apop_varad_link(apop_vector_percentiles, __VA_ARGS__)
1078 #ifdef APOP_NO_VARIADIC
1079 apop_data *
apop_data_sort(apop_data *data, apop_data *sort_order,
char asc,
char inplace,
double *col_order);
1081 apop_data * apop_data_sort_base(apop_data *data, apop_data *sort_order,
char asc,
char inplace,
double *col_order);
1082 apop_varad_declare(apop_data *,
apop_data_sort, apop_data *data; apop_data *sort_order;
char asc;
char inplace;
double *col_order);
1083 #define apop_data_sort(...) apop_varad_link(apop_data_sort, __VA_ARGS__)
1088 #ifdef APOP_NO_VARIADIC
1089 apop_data *
apop_rake(
char const *margin_table,
char *
const*var_list,
1090 int var_ct,
char const *all_vars,
char *
const *contrasts,
int contrast_ct,
1091 char const *structural_zeros,
int max_iterations,
double tolerance,
1092 char const *count_col,
int run_number,
char const *init_table,
1093 char const *init_count_col,
double nudge,
char const* table_name) ;
1095 apop_data * apop_rake_base(
char const *margin_table,
char *
const*var_list,
1096 int var_ct,
char const *all_vars,
char *
const *contrasts,
int contrast_ct,
1097 char const *structural_zeros,
int max_iterations,
double tolerance,
1098 char const *count_col,
int run_number,
char const *init_table,
1099 char const *init_count_col,
double nudge,
char const* table_name) ;
1100 apop_varad_declare(apop_data *,
apop_rake,
char const *margin_table;
char *
const*var_list;
1101 int var_ct;
char const *all_vars;
char *
const *contrasts;
int contrast_ct;
1102 char const *structural_zeros;
int max_iterations;
double tolerance;
1103 char const *count_col;
int run_number;
char const *init_table;
1104 char const *init_count_col;
double nudge;
char const* table_name);
1105 #define apop_rake(...) apop_varad_link(apop_rake, __VA_ARGS__)
1110 #include <gsl/gsl_cdf.h>
1111 #include <gsl/gsl_blas.h>
1112 #include <gsl/gsl_sf_log.h>
1113 #include <gsl/gsl_sf_exp.h>
1114 #include <gsl/gsl_linalg.h>
1115 #include <gsl/gsl_sf_gamma.h>
1116 #include <gsl/gsl_sf_psi.h>
1117 #include <gsl/gsl_randist.h>
1118 #include <gsl/gsl_histogram.h>
1119 #include <gsl/gsl_statistics_double.h>
1124 double apop_det_and_inv(
const gsl_matrix *in, gsl_matrix **out,
int calc_det,
int calc_inv);
1125 #ifdef APOP_NO_VARIADIC
1126 apop_data *
apop_dot(
const apop_data *d1,
const apop_data *d2,
char form1,
char form2) ;
1128 apop_data * apop_dot_base(
const apop_data *d1,
const apop_data *d2,
char form1,
char form2) ;
1129 apop_varad_declare(apop_data *,
apop_dot,
const apop_data *d1;
const apop_data *d2;
char form1;
char form2);
1130 #define apop_dot(...) apop_varad_link(apop_dot, __VA_ARGS__)
1133 #ifdef APOP_NO_VARIADIC
1136 int apop_vector_bounded_base(
const gsl_vector *in,
long double max) ;
1138 #define apop_vector_bounded(...) apop_varad_link(apop_vector_bounded, __VA_ARGS__)
1144 #ifdef APOP_NO_VARIADIC
1145 apop_data *
apop_matrix_pca(gsl_matrix *data,
int const dimensions_we_want) ;
1147 apop_data * apop_matrix_pca_base(gsl_matrix *data,
int const dimensions_we_want) ;
1148 apop_varad_declare(apop_data *,
apop_matrix_pca, gsl_matrix *data;
int const dimensions_we_want);
1149 #define apop_matrix_pca(...) apop_varad_link(apop_matrix_pca, __VA_ARGS__)
1152 #ifdef APOP_NO_VARIADIC
1155 gsl_vector * apop_vector_stack_base(gsl_vector *v1, gsl_vector * v2,
char inplace) ;
1156 apop_varad_declare(gsl_vector *,
apop_vector_stack, gsl_vector *v1; gsl_vector * v2;
char inplace);
1157 #define apop_vector_stack(...) apop_varad_link(apop_vector_stack, __VA_ARGS__)
1160 #ifdef APOP_NO_VARIADIC
1161 gsl_matrix *
apop_matrix_stack(gsl_matrix *m1, gsl_matrix * m2,
char posn,
char inplace) ;
1163 gsl_matrix * apop_matrix_stack_base(gsl_matrix *m1, gsl_matrix * m2,
char posn,
char inplace) ;
1164 apop_varad_declare(gsl_matrix *,
apop_matrix_stack, gsl_matrix *m1; gsl_matrix * m2;
char posn;
char inplace);
1165 #define apop_matrix_stack(...) apop_varad_link(apop_matrix_stack, __VA_ARGS__)
1175 #define APOP_SUBMATRIX(m, srow, scol, nrows, ncols, o) gsl_matrix apop_mm_##o = gsl_matrix_submatrix((m), (srow), (scol), (nrows),(ncols)).matrix;\
1176 gsl_matrix * o = &( apop_mm_##o );
1179 #define Apop_row_v(m, row, v) Apop_matrix_row((m)->matrix, row, v)
1182 #define Apop_col_v(m, col, v) gsl_vector apop_vv_##v = ((col) == -1) ? (gsl_vector){} : gsl_matrix_column((m)->matrix, (col)).vector;\
1183 gsl_vector * v = ((col)==-1) ? (m)->vector : &( apop_vv_##v );
1186 #define Apop_rows(d, rownum, len, outd) apop_data *outd = Apop_rs(d, rownum, len)
1189 #define Apop_row(d, row, outd) Apop_rows(d, row, 1, outd)
1192 #define Apop_cols(d, colnum, len, outd) apop_data *outd = Apop_cs(d, colnum, len);
1194 #define Apop_row_tv(m, row, v) gsl_vector apop_vv_##v = gsl_matrix_row((m)->matrix, apop_name_find((m)->names, row, 'r')).vector;\
1195 gsl_vector * v = &( apop_vv_##v );
1197 #define Apop_col_tv(m, col, v) gsl_vector apop_vv_##v = gsl_matrix_column((m)->matrix, apop_name_find((m)->names, col, 'c')).vector;\
1198 gsl_vector * v = &( apop_vv_##v );
1200 #define Apop_row_t(d, rowname, outd) int apop_row_##outd = apop_name_find((d)->names, rowname, 'r'); Apop_rows(d, apop_row_##outd, 1, outd)
1202 #define Apop_col_t(d, colname, outd) int apop_col_##outd = apop_name_find((d)->names, colname, 'c'); Apop_cols(d, apop_col_##outd, 1, outd)
1207 #define Apop_subm(data_to_view, srow, scol, nrows, ncols)( \
1209 || (data_to_view)->size1 < (srow)+(nrows) || (srow) < 0 \
1210 || (data_to_view)->size2 < (scol)+(ncols) || (scol) < 0) ? NULL \
1211 : &(gsl_matrix){.size1=(nrows), .size2=(ncols), \
1212 .tda=(data_to_view)->tda, \
1213 .data=gsl_matrix_ptr((data_to_view), (srow), (scol))} \
1216 #define Apop_rv(data_to_view, row) ( \
1217 ((data_to_view) == NULL || (data_to_view)->matrix == NULL \
1218 || (data_to_view)->matrix->size1 <= (row) || (row) < 0) ? NULL \
1219 : &(gsl_vector){.size=(data_to_view)->matrix->size2, \
1220 .stride=1, .data=gsl_matrix_ptr((data_to_view)->matrix, (row), 0)} \
1223 #define Apop_cv(data_to_view, col) ( \
1224 !(data_to_view) ? NULL \
1225 : (col)==-1 ? (data_to_view)->vector \
1226 : (!(data_to_view)->matrix \
1227 || (data_to_view)->matrix->size2 <= (col) || ((int)(col)) < -1) ? NULL \
1228 : &(gsl_vector){.size=(data_to_view)->matrix->size1, \
1229 .stride=(data_to_view)->matrix->tda, .data=gsl_matrix_ptr((data_to_view)->matrix, 0, (col))} \
1233 #define apop_subvector(v, start, len) ( \
1234 ((v) == NULL || (v)->size < ((start)+(len)) || (start) < 0) ? NULL \
1235 : &(gsl_vector){.size=(len), .stride=(v)->stride, .data=(v)->data+(start*(v)->stride)})
1238 #define apop_mrow(m, row) ( \
1239 ((m) == NULL || (m)->size1 <= (row) || (row) < 0) ? NULL \
1240 : &(gsl_matrix){.size1=1, .size2=(m)->size2, \
1241 .tda=(m)->tda, .data=gsl_matrix_ptr((m), (row), 0)} \
1244 #define Apop_rs(d, rownum, len)( \
1245 (!(d) || (rownum) < 0) ? NULL \
1247 .names= ( !((d)->names) ? NULL : \
1249 .title = (d)->names->title, \
1250 .vector = (d)->names->vector, \
1251 .col = (d)->names->col, \
1252 .row = ((d)->names->row && (d)->names->rowct > (rownum)) ? &((d)->names->row[rownum]) : NULL, \
1253 .text = (d)->names->text, \
1254 .colct = (d)->names->colct, \
1255 .rowct = (d)->names->row ? (GSL_MIN(1, GSL_MAX((d)->names->rowct - (int)(rownum), 0))) \
1257 .textct = (d)->names->textct }), \
1258 .vector= apop_subvector((d->vector), (rownum), (len)), \
1259 .matrix = Apop_subm(((d)->matrix), (rownum), 0, (len), (d)->matrix?(d)->matrix->size2:0), \
1260 .weights = apop_subvector(((d)->weights), (rownum), (len)), \
1261 .textsize[0]=(d)->textsize[0]> (rownum)+(len)-1 ? (len) : 0, \
1262 .textsize[1]=(d)->textsize[1], \
1263 .text = (d)->text ? &((d)->text[rownum]) : NULL, \
1266 #define Apop_cs(d, colnum, len) ( \
1267 (!(d)||!(d)->matrix || (d)->matrix->size2 <= (colnum)+(len)-1 \
1271 .weights= (d)->weights, \
1272 .matrix = Apop_subm((d)->matrix, 0, colnum, (d)->matrix->size1, (len)),\
1276 .names= (d)->names ? &(apop_name){ \
1277 .title = (d)->names->title, \
1279 .row = (d)->names->row, \
1280 .col = ((d)->names->col && (d)->names->colct > colnum) ? &((d)->names->col[colnum]) : NULL, \
1282 .rowct = (d)->names->rowct, \
1283 .colct = (d)->names->col ? (GSL_MIN(len, GSL_MAX((d)->names->colct - colnum, 0))) \
1285 .textct = (d)->names->textct } : NULL \
1288 #define Apop_r(d, rownum) Apop_rs(d, rownum, 1)
1289 #define Apop_c(d, col) Apop_cs(d, col, 1)
1291 #define APOP_COL Apop_col
1292 #define apop_col Apop_col
1293 #define APOP_COLS Apop_cols
1294 #define apop_cols Apop_cols
1295 #define APOP_COL_T Apop_col_t
1296 #define apop_col_t Apop_col_t
1297 #define APOP_COL_TV Apop_col_tv
1298 #define apop_col_tv Apop_col_tv
1299 #define APOP_COL_V Apop_col_v
1300 #define apop_col_v Apop_col_v
1302 #define APOP_ROW Apop_row
1303 #define apop_row Apop_row
1304 #define Apop_data_row Apop_row #deprecated
1305 #define APOP_ROWS Apop_rows
1306 #define apop_rows Apop_rows
1307 #define APOP_ROW_T Apop_row_t
1308 #define apop_row_t Apop_row_t
1309 #define APOP_ROW_TV Apop_row_tv
1310 #define apop_row_tv Apop_row_tv
1311 #define APOP_ROW_V Apop_row_v
1312 #define apop_row_v Apop_row_v
1331 #define Apop_matrix_row(m, row, v) gsl_vector apop_vv_##v = gsl_matrix_row((m), (row)).vector;\
1332 gsl_vector * v = &( apop_vv_##v );
1351 #define Apop_matrix_col(m, col, v) gsl_vector apop_vv_##v = gsl_matrix_column((m), (col)).vector;\
1352 gsl_vector * v = &( apop_vv_##v );
1354 #define Apop_submatrix APOP_SUBMATRIX
1355 #define APOP_MATRIX_ROW Apop_matrix_row
1356 #define apop_matrix_row Apop_matrix_row
1357 #define APOP_MATRIX_COL Apop_matrix_col
1358 #define apop_matrix_col Apop_matrix_col
1367 #define apop_sum(in) apop_vector_sum(in)
1368 #define apop_var(in) apop_vector_var(in)
1369 #define apop_mean(in) apop_vector_mean(in)
1486 #ifdef APOP_NO_VARIADIC
1489 int apop_table_exists_base(
char const *name,
char remove) ;
1491 #define apop_table_exists(...) apop_varad_link(apop_table_exists, __VA_ARGS__)
1496 #ifdef APOP_NO_VARIADIC
1499 int apop_db_close_base(
char vacuum) ;
1501 #define apop_db_close(...) apop_varad_link(apop_db_close, __VA_ARGS__)
1505 int apop_query(
const char *q, ...) __attribute__ ((format (printf,1,2)));
1506 gsl_matrix *
apop_query_to_matrix(const
char * fmt, ...) __attribute__ ((format (printf,1,2)));
1507 apop_data *
apop_query_to_text(const
char * fmt, ...) __attribute__ ((format (printf,1,2)));
1508 apop_data *
apop_query_to_data(const
char * fmt, ...) __attribute__ ((format (printf,1,2)));
1509 apop_data *
apop_query_to_mixed_data(const
char *typelist, const
char * fmt, ...) __attribute__ ((format (printf,2,3)));
1510 gsl_vector *
apop_query_to_vector(const
char * fmt, ...) __attribute__ ((format (printf,1,2)));
1520 void * apop_settings_get_grp(apop_model *m,
char *type,
char fail);
1521 void apop_settings_remove_group(apop_model *m,
char *delme);
1523 void *apop_settings_group_alloc(apop_model *model,
char *type,
void *free_fn,
void *copy_fn,
void *the_group);
1524 apop_model *apop_settings_group_alloc_wm(apop_model *model,
char *type,
void *free_fn,
void *copy_fn,
void *the_group);
1535 #define Apop_settings_get_group(m, type) apop_settings_get_grp(m, #type, 'c')
1542 #define Apop_settings_rm_group(m, type) apop_settings_remove_group(m, #type)
1556 #define Apop_settings_add_group(model, type, ...) \
1557 apop_settings_group_alloc(model, #type, type ## _settings_free, type ## _settings_copy, type ##_settings_init ((type ## _settings) {__VA_ARGS__}))
1564 #define apop_model_copy_set(model, type, ...) \
1565 apop_settings_group_alloc_wm(apop_model_copy(model), #type, type ## _settings_free, type ## _settings_copy, type ##_settings_init ((type ## _settings) {__VA_ARGS__}))
1570 #define Apop_settings_get(model, type, setting) \
1571 (((type ## _settings *) apop_settings_get_grp(model, #type, 'f'))->setting)
1579 #define Apop_settings_set(model, type, setting, data) \
1581 if (!(model)) continue; \
1582 type ## _settings *apop_tmp_settings = apop_settings_get_grp(model, #type, 'c'); \
1583 Apop_stopif(!apop_tmp_settings, (model)->error='s', 0, "You're trying to modify a setting in " \
1584 #model "'s setting group of type " #type " but that model doesn't have such a group."); \
1585 apop_tmp_settings->setting = (data); \
1589 #define Apop_settings_add Apop_settings_set
1590 #define APOP_SETTINGS_ADD Apop_settings_set
1591 #define apop_settings_set Apop_settings_set
1592 #define APOP_SETTINGS_GET Apop_settings_get
1593 #define apop_settings_get Apop_settings_get
1594 #define APOP_SETTINGS_ADD_GROUP Apop_settings_add_group
1595 #define apop_settings_add_group Apop_settings_add_group
1596 #define APOP_SETTINGS_GET_GROUP Apop_settings_get_group
1597 #define apop_settings_get_group Apop_settings_get_group
1598 #define APOP_SETTINGS_RM_GROUP Apop_settings_rm_group
1599 #define apop_settings_rm_group Apop_settings_rm_group
1600 #define Apop_model_copy_set apop_model_copy_set
1603 #define Apop_model_add_group Apop_settings_add_group
1607 #define Apop_settings_declarations(ysg) \
1608 ysg##_settings * ysg##_settings_init(ysg##_settings); \
1609 void * ysg##_settings_copy(ysg##_settings *); \
1610 void ysg##_settings_free(ysg##_settings *);
1626 #define Apop_settings_init(name, ...) \
1627 name##_settings *name##_settings_init(name##_settings in) { \
1628 name##_settings *out = malloc(sizeof(name##_settings)); \
1634 #define Apop_varad_set(var, value) (out)->var = (in).var ? (in).var : (value);
1655 #define Apop_settings_copy(name, ...) \
1656 void * name##_settings_copy(name##_settings *in) {\
1657 name##_settings *out = malloc(sizeof(name##_settings)); \
1680 #define Apop_settings_free(name, ...) \
1681 void name##_settings_free(name##_settings *in) {\
1733 int n_tries, iters_fixed_T;
1734 double k, t_initial, mu_t, t_min ;
1833 void (*set_fn)(apop_data*, apop_model*);
1937 long drop_square[8];
1948 long *parameter, *a;
1949 double *xi, *vert, *vval;
1952 double *fitted_values;
1953 double *fitted_residuals;
1955 double one_delta, two_delta;
1956 double *pseudovalues;
2075 typedef struct point {
2080 struct point *pl,*pr;
2118 apop_data *(*base_to_transformed)(apop_data*);
2119 apop_data *(*transformed_to_base)(apop_data*);
2120 double (*jacobian_to_base)(apop_data*);
2121 apop_model *base_model;
2128 double (*constraint)(apop_data *, apop_model *);
2129 double (*scaling)(apop_model *);
2136 apop_model *generator_m;
2156 #define apop_model_coordinate_transform(...) Apop_model_copy_set(apop_coordinate_transform, apop_ct, __VA_ARGS__)
2157 #define apop_model_dcompose(...) Apop_model_copy_set(apop_composition, apop_composition, __VA_ARGS__)
2158 #define apop_model_dconstrain(...) Apop_model_copy_set(apop_dconstrain, apop_dconstrain, __VA_ARGS__)
2163 Apop_settings_declarations(apop_ct)
2164 Apop_settings_declarations(apop_lm)
2165 Apop_settings_declarations(apop_pm)
2166 Apop_settings_declarations(apop_pmf)
2167 Apop_settings_declarations(apop_mle)
2168 Apop_settings_declarations(
apop_cdf)
2169 Apop_settings_declarations(apop_arms)
2170 Apop_settings_declarations(apop_mcmc)
2171 Apop_settings_declarations(apop_loess)
2172 Apop_settings_declarations(apop_stack)
2173 Apop_settings_declarations(apop_mixture)
2174 Apop_settings_declarations(apop_dconstrain)
2175 Apop_settings_declarations(apop_composition)
2176 Apop_settings_declarations(apop_parts_wanted)
2177 Apop_settings_declarations(apop_kernel_density)
2187 #include <gsl/gsl_sort.h>
2188 #include <gsl/gsl_eigen.h>
2189 #include <gsl/gsl_sort_vector.h>
2190 #include <gsl/gsl_permutation.h>
2191 #include <gsl/gsl_integration.h>
apop_data * instruments
Definition: apop.h:1754
apop_data * apop_paired_t_test(gsl_vector *a, gsl_vector *b)
Definition: apop_tests.c:82
double apop_matrix_map_all_sum(const gsl_matrix *in, double(*fn)(double))
Definition: apop_mapply.c:445
void apop_settings_copy_group(apop_model *outm, apop_model *inm, char *copyme)
Definition: apop_settings.c:90
apop_data * apop_t_test(gsl_vector *a, gsl_vector *b)
Definition: apop_tests.c:47
void(* base_step_fn)(double const *, struct apop_mcmc_proposal_s *, struct apop_mcmc_settings *)
Definition: apop.h:1920
double target_accept_rate
Definition: apop.h:1898
struct apop_data apop_data
apop_model * apop_model_clear(apop_data *data, apop_model *model)
Definition: apop_model.c:24
apop_model * apop_model_metropolis(apop_data *d, gsl_rng *rng, apop_model *m)
Definition: apop_mcmc.c:291
gsl_vector * weights
Definition: apop.h:2146
double * xinit
Definition: apop.h:2097
void apop_data_unpack(const gsl_vector *in, apop_data *d, char use_info_pages)
Definition: apop_conversions.c:705
apop_data * apop_data_rm_page(apop_data *data, const char *title, const char free_p)
Definition: apop_data.c:1545
long double apop_linear_constraint(gsl_vector *beta, apop_data *constraint, double margin)
Definition: apop_linear_constraint.c:125
apop_data * apop_data_to_dummies(apop_data *d, int col, char type, int keep_first, char append, char remove)
Definition: apop_regression.c:287
apop_data * apop_query_to_text(const char *fmt,...)
Definition: apop_db.c:271
void apop_model_print(apop_model *print_me, FILE *out)
Definition: apop_model.c:122
int own_kernel
Definition: apop.h:1835
gsl_matrix * draws_made
Definition: apop.h:1799
long double apop_matrix_sum(const gsl_matrix *m)
Definition: apop_stats.c:394
double apop_vector_map_sum(const gsl_vector *in, double(*fn)(double))
Definition: apop_mapply.c:433
void apop_data_add_named_elmt(apop_data *d, char *name, double val)
Definition: apop_data.c:1107
apop_dconstrain
Definition: model_doc.h:896
void apop_name_print(apop_name *n)
Definition: apop_name.c:74
apop_data * apop_bootstrap_cov(apop_data *data, apop_model *model, gsl_rng *rng, int iterations, char keep_boots, char ignore_nans)
Definition: apop_bootstrap.c:121
char apop_data_free_base(apop_data *freeme)
Definition: apop_data.c:209
apop_binomial
Definition: model_doc.h:1752
int thread_count
Definition: apop.h:151
int want_predict_ci
Definition: apop.h:2067
char * apop_text_paste(apop_data const *strings, char *between, char *before, char *after, char *between_cols, int(*prune)(apop_data *, int, int, void *), void *prune_parameter)
Definition: apop_asst.c:68
apop_model * kernel
Definition: apop.h:1831
void apop_matrix_print(const gsl_matrix *data, Output_declares)
Definition: apop_output.c:359
apop_data * apop_f_test(apop_model *est, apop_data *contrast)
Definition: apop_tests.c:116
int apop_draw(double *out, gsl_rng *r, apop_model *m)
Definition: apop_model.c:412
apop_data * apop_data_summarize(apop_data *data)
Definition: apop_stats.c:465
gsl_matrix * apop_matrix_rm_columns(gsl_matrix *in, int *drop)
Definition: apop_linear_algebra.c:351
size_t * block_starts
Definition: apop.h:1912
gsl_matrix * apop_vector_to_matrix(const gsl_vector *in, char row_col)
Definition: apop_conversions.c:73
gsl_vector * apop_query_to_vector(const char *fmt,...)
Definition: apop_db.c:405
void apop_score(apop_data *d, gsl_vector *out, apop_model *m)
Definition: apop_model.c:289
apop_data * apop_data_to_bins(apop_data *indata, apop_data *binspec, int bin_count, char close_top_bin)
Definition: apop_hist.c:324
apop_beta
Definition: model_doc.h:196
apop_data * apop_query_to_data(const char *fmt,...)
Definition: apop_db.c:333
apop_data * apop_data_sort(apop_data *data, apop_data *sort_order, char asc, char inplace, double *col_order)
Definition: apop_sort.c:145
apop_data * apop_model_draws(apop_model *model, int count, apop_data *draws)
Definition: apop_asst.c:418
void apop_data_memcpy(apop_data *out, const apop_data *in)
Definition: apop_data.c:260
apop_data * apop_text_alloc(apop_data *in, const size_t row, const size_t col)
Definition: apop_data.c:1186
void apop_vector_apply(gsl_vector *v, void(*fn)(double *))
Definition: apop_mapply.c:385
apop_data * info
Definition: apop.h:111
apop_mixture
Definition: model_doc.h:1007
gsl_matrix * apop_matrix_stack(gsl_matrix *m1, gsl_matrix *m2, char posn, char inplace)
Definition: apop_linear_algebra.c:275
apop_data * apop_rake(char const *margin_table, char *const *var_list, int var_ct, char const *all_vars, char *const *contrasts, int contrast_ct, char const *structural_zeros, int max_iterations, double tolerance, char const *count_col, int run_number, char const *init_table, char const *init_count_col, double nudge, char const *table_name)
Definition: apop_rake.c:539
apop_data * apop_data_stack(apop_data *m1, apop_data *m2, char posn, char inplace)
Definition: apop_data.c:400
double * apop_data_ptr(apop_data *data, int row, int col, const char *rowname, const char *colname, const char *page)
Definition: apop_data.c:846
apop_model * apop_model_to_pmf(apop_model *model, apop_data *binspec, long int draws, int bin_count, gsl_rng *rng)
Definition: apop_hist.c:35
apop_loess
Definition: model_doc.h:362
struct apop_mcmc_settings apop_mcmc_settings
gsl_vector * apop_matrix_map(const gsl_matrix *m, double(*fn)(gsl_vector *))
Definition: apop_mapply.c:341
double apop_data_get(const apop_data *data, size_t row, int col, const char *rowname, const char *colname, const char *page)
Definition: apop_data.c:898
void apop_matrix_normalize(gsl_matrix *data, const char row_or_col, const char normalization)
Definition: apop_stats.c:376
struct apop_mcmc_proposal_s apop_mcmc_proposal_s
apop_model * apop_ml_impute(apop_data *d, apop_model *meanvar)
Definition: apop_missing_data.c:134
double apop_vector_kurtosis(const gsl_vector *in)
Definition: apop_stats.c:80
long double(* cdf)(apop_data *d, apop_model *params)
Definition: apop.h:121
int draws
Definition: apop.h:1796
gsl_rng * apop_rng_alloc(int seed)
Definition: apop_bootstrap.c:21
apop_data * apop_test_fisher_exact(apop_data *intab)
Definition: apop_fexact.c:1893
double xr
Definition: apop.h:2099
void apop_data_print(const apop_data *data, Output_declares)
Definition: apop_output.c:327
long double apop_vector_sum(const gsl_vector *in)
Definition: apop_stats.c:38
int histosegments
Definition: apop.h:1887
apop_data * apop_model_hessian(apop_data *data, apop_model *model, double delta)
Definition: apop_mle.c:195
void apop_vector_print(gsl_vector *data, Output_declares)
Definition: apop_output.c:210
double xl
Definition: apop.h:2098
char * method
Definition: apop.h:1695
apop_model * apop_estimate(apop_data *d, apop_model *m)
Definition: apop_model.c:223
gsl_vector * apop_vector_unique_elements(const gsl_vector *v)
Definition: apop_regression.c:75
void apop_crosstab_to_db(apop_data *in, char *tabname, char *row_col_name, char *col_col_name, char *data_col_name)
Definition: apop_conversions.c:205
double apop_det_and_inv(const gsl_matrix *in, gsl_matrix **out, int calc_det, int calc_inv)
Definition: apop_linear_algebra.c:54
apop_logit
Definition: model_doc.h:1959
gsl_vector * apop_vector_realloc(gsl_vector *v, size_t newheight)
Definition: apop_data.c:1431
int apop_query(const char *fmt,...)
Definition: apop_db.c:228
apop_stack
Definition: model_doc.h:1211
double * starting_pt
Definition: apop.h:1692
apop_data * apop_test_kolmogorov(apop_model *m1, apop_model *m2)
Definition: apop_hist.c:258
size_t more_size
Definition: apop.h:131
char want_cov
Definition: apop.h:1755
int proposal_count
Definition: apop.h:1897
void apop_vector_normalize(gsl_vector *in, gsl_vector **out, const char normalization_type)
Definition: apop_stats.c:324
apop_data * apop_data_get_factor_names(apop_data *data, int col, char type)
Definition: apop_regression.c:434
double apop_test(double statistic, char *distribution, double p1, double p2, char tail)
Definition: apop_tests.c:422
apop_data * apop_matrix_to_data(gsl_matrix *m)
Definition: apop_data.c:153
apop_data * apop_matrix_pca(gsl_matrix *data, int const dimensions_we_want)
Definition: apop_linear_algebra.c:119
char do_metro
Definition: apop.h:2103
void apop_matrix_show(const gsl_matrix *data)
Definition: apop_output.c:386
char want_expected_value
Definition: apop.h:1756
apop_coordinate_transform
Definition: model_doc.h:1451
apop_data * apop_predict(apop_data *d, apop_model *m)
Definition: apop_model.c:478
long double(* p)(apop_data *d, apop_model *params)
Definition: apop.h:117
void apop_matrix_mean_and_var(const gsl_matrix *data, double *mean, double *var)
Definition: apop_stats.c:436
apop_opts_type apop_opts
Definition: apop_db.c:10
gsl_vector * apop_vector_map(const gsl_vector *v, double(*fn)(double))
Definition: apop_mapply.c:370
apop_data * apop_data_covariance(const apop_data *in)
Definition: apop_stats.c:636
int ninit
Definition: apop.h:2101
apop_data ** apop_data_split(apop_data *in, int splitpoint, char r_or_c)
Definition: apop_data.c:508
void apop_model_free(apop_model *free_me)
Definition: apop_model.c:58
double apop_vector_skew_pop(gsl_vector const *v, gsl_vector const *weights)
Definition: apop_stats.c:118
apop_data * apop_histograms_test_goodness_of_fit(apop_model *h0, apop_model *h1)
Definition: apop_hist.c:76
int max_iterations
Definition: apop.h:1721
long double(* log_likelihood)(apop_data *d, apop_model *params)
Definition: apop.h:119
apop_data * data
Definition: apop.h:109
void apop_matrix_apply(gsl_matrix *m, void(*fn)(gsl_vector *))
Definition: apop_mapply.c:355
apop_bernoulli
Definition: model_doc.h:7
apop_data * parameters
Definition: apop.h:110
apop_t_distribution
Definition: model_doc.h:587
double apop_p(apop_data *d, apop_model *m)
Definition: apop_model.c:238
gsl_rng * rng
Definition: apop.h:2130
void apop_matrix_apply_all(gsl_matrix *in, void(*fn)(double *))
Definition: apop_mapply.c:421
apop_model * apop_update(apop_data *data, apop_model *prior, apop_model *likelihood, gsl_rng *rng)
Definition: apop_update.c:177
long double apop_multivariate_lngamma(double a, int p)
Definition: apop_stats.c:808
void apop_name_stack(apop_name *n1, apop_name *nadd, char type1, char typeadd)
Definition: apop_name.c:128
int apop_text_to_db(char const *text_file, char *tabname, int has_row_names, int has_col_names, char **field_names, int const *field_ends, apop_data *field_params, char *table_params, char const *delimiters, char if_table_exists)
Definition: apop_conversions.c:1162
double apop_kl_divergence(apop_model *from, apop_model *to, int draw_ct, gsl_rng *rng)
Definition: apop_stats.c:699
apop_probit
Definition: model_doc.h:1321
gsl_matrix * apop_matrix_copy(const gsl_matrix *in)
Definition: apop_conversions.c:343
apop_model * base_pmf
Definition: apop.h:1829
int(* base_adapt_fn)(struct apop_mcmc_proposal_s *ps, struct apop_mcmc_settings *ms)
Definition: apop.h:1921
int npoint
Definition: apop.h:2102
apop_model * base_model
Definition: apop.h:1891
int(* adapt_fn)(struct apop_mcmc_proposal_s *ps, struct apop_mcmc_settings *ms)
Definition: apop.h:1871
double tolerance
Definition: apop.h:1718
double apop_map_sum(apop_data *in, apop_fn_d *fn_d, apop_fn_v *fn_v, apop_fn_r *fn_r, apop_fn_dp *fn_dp, apop_fn_vp *fn_vp, apop_fn_rp *fn_rp, apop_fn_dpi *fn_dpi, apop_fn_vpi *fn_vpi, apop_fn_rpi *fn_rpi, apop_fn_di *fn_di, apop_fn_vi *fn_vi, apop_fn_ri *fn_ri, void *param, char part, int all_pages)
Definition: apop_mapply.c:475
apop_data * apop_data_get_page(const apop_data *data, const char *title, const char match)
Definition: apop_data.c:1460
double apop_vector_correlation(const gsl_vector *ina, const gsl_vector *inb)
Definition: apop_stats.c:191
apop_data * apop_estimate_coefficient_of_determination(apop_model *)
Definition: apop_regression.c:522
void apop_estimate_parameter_tests(apop_model *est)
Definition: apop_regression.c:22
int apop_data_set_row(apop_data *row, apop_data *d, int row_number)
Definition: apop_data.c:1043
gsl_vector * apop_vector_copy(const gsl_vector *in)
Definition: apop_conversions.c:324
apop_data * apop_data_alloc(const size_t size1, const size_t size2, const int size3)
Definition: apop_data.c:35
apop_data * apop_data_add_page(apop_data *dataset, apop_data *newpage, const char *title)
Definition: apop_data.c:1511
apop_data * apop_map(apop_data *in, apop_fn_d *fn_d, apop_fn_v *fn_v, apop_fn_r *fn_r, apop_fn_dp *fn_dp, apop_fn_vp *fn_vp, apop_fn_rp *fn_rp, apop_fn_dpi *fn_dpi, apop_fn_vpi *fn_vpi, apop_fn_rpi *fn_rpi, apop_fn_di *fn_di, apop_fn_vi *fn_vi, apop_fn_ri *fn_ri, void *param, int inplace, char part, int all_pages)
Definition: apop_mapply.c:115
int destroy_data
Definition: apop.h:1753
double apop_matrix_determinant(const gsl_matrix *in)
Definition: apop_linear_algebra.c:100
double apop_vector_var_m(const gsl_vector *in, const double mean)
Definition: apop_stats.c:184
apop_model * proposal
Definition: apop.h:1856
apop_data * apop_text_to_data(char const *text_file, int has_row_names, int has_col_names, int const *field_ends, char const *delimiters)
Definition: apop_conversions.c:608
int * draws_refcount
Definition: apop.h:1800
gsl_vector * apop_vector_stack(gsl_vector *v1, gsl_vector *v2, char inplace)
Definition: apop_linear_algebra.c:210
void apop_vector_exp(gsl_vector *v)
Definition: apop_linear_algebra.c:191
apop_data * apop_data_to_factors(apop_data *data, char intype, int incol, int outcol)
Definition: apop_regression.c:387
double xprev
Definition: apop.h:2104
apop_improper_uniform
Definition: model_doc.h:1269
apop_data * apop_vector_to_data(gsl_vector *v)
Definition: apop_data.c:162
gsl_vector * apop_array_to_vector(double *in, int size)
Definition: apop_conversions.c:42
int apop_table_exists(char const *name, char remove)
Definition: apop_db.c:126
int apop_db_open(char const *filename)
Definition: apop_db.c:79
double apop_vector_var(gsl_vector const *v, gsl_vector const *weights)
Definition: apop_stats.c:559
int apop_db_close(char vacuum)
Definition: apop_db.c:175
int apop_system(const char *fmt,...)
Definition: apop_asst.c:164
int apop_name_add(apop_name *n, char const *add_me, char type)
Definition: apop_name.c:32
apop_name * apop_name_alloc(void)
Definition: apop_name.c:13
apop_mcmc_proposal_s * proposals
Definition: apop.h:1894
apop_model * apop_estimate_restart(apop_model *e, apop_model *copy, char *starting_pt, double boundary)
Definition: apop_mle.c:716
apop_data * apop_jackknife_cov(apop_data *data, apop_model *model)
Definition: apop_bootstrap.c:53
double burnin
Definition: apop.h:1885
apop_data * base_data
Definition: apop.h:1828
apop_data * apop_data_correlation(const apop_data *in)
Definition: apop_stats.c:660
void apop_data_rm_columns(apop_data *d, int *drop)
Definition: apop_data.c:704
void apop_prep(apop_data *d, apop_model *m)
Definition: apop_model.c:441
apop_kernel_density
Definition: model_doc.h:1838
apop_multivariate_normal
Definition: model_doc.h:244
gsl_rng * rng
Definition: apop.h:1797
int dsize
Definition: apop.h:104
int verbose
Definition: apop.h:1723
apop_data * apop_db_to_crosstab(char *tabname, char *r1, char *r2, char *datacol)
Definition: apop_conversions.c:136
apop_data * apop_test_anova_independence(apop_data *d)
Definition: apop_tests.c:217
long double total_weight
Definition: apop.h:1819
apop_exponential
Definition: model_doc.h:1392
int reject_count
Definition: apop.h:1875
apop_model * apop_beta_from_mean_var(double m, double v)
Definition: apop_asst.c:342
apop_model * apop_parameter_model(apop_data *d, apop_model *m)
Definition: apop_model.c:353
void apop_text_free(char ***freeme, int rows, int cols)
Definition: apop_data.c:185
apop_model * cmf
Definition: apop.h:2150
int apop_name_find(const apop_name *n, const char *findme, const char type)
Definition: apop_name.c:188
double apop_matrix_mean(const gsl_matrix *data)
Definition: apop_stats.c:409
apop_model * model1
Definition: apop.h:2113
double apop_vector_mean(gsl_vector const *v, gsl_vector const *weights)
Definition: apop_stats.c:520
apop_normal
Definition: model_doc.h:646
int * cmf_refct
Definition: apop.h:2151
apop_dirichlet
Definition: model_doc.h:704
int apop_vector_bounded(const gsl_vector *in, long double max)
Definition: apop_linear_algebra.c:386
apop_wls
Definition: model_doc.h:447
FILE * log_file
Definition: apop.h:149
double apop_vector_distance(const gsl_vector *ina, const gsl_vector *inb, const char metric, const double norm)
Definition: apop_stats.c:224
apop_data * apop_text_unique_elements(const apop_data *d, size_t col)
Definition: apop_regression.c:103
gsl_matrix * apop_matrix_map_all(const gsl_matrix *in, double(*fn)(double))
Definition: apop_mapply.c:402
char * splitpage
Definition: apop.h:2112
int apop_regex(const char *string, const char *regex, apop_data **substrings, const char use_case)
Definition: apop_asst.c:262
int apop_data_set(apop_data *data, size_t row, int col, const double val, const char *rowname, const char *colname, const char *page)
Definition: apop_data.c:980
apop_data * apop_data_pmf_compress(apop_data *in)
Definition: apop_pmf.c:337
apop_model * pmf
Definition: apop.h:1889
int accept_count
Definition: apop.h:1899
apop_zipf
Definition: model_doc.h:68
double apop_matrix_to_positive_semidefinite(gsl_matrix *m)
Definition: apop_stats.c:887
double apop_vector_skew(const gsl_vector *in)
Definition: apop_stats.c:71
void(* step_fn)(double const *, struct apop_mcmc_proposal_s *, struct apop_mcmc_settings *)
Definition: apop.h:1863
int draw_ct
Definition: apop.h:2132
apop_uniform
Definition: model_doc.h:1502
gsl_matrix * apop_query_to_matrix(const char *fmt,...)
Definition: apop_db.c:376
int(* draw)(double *out, gsl_rng *r, apop_model *params)
Definition: apop.h:124
gsl_matrix * apop_matrix_realloc(gsl_matrix *m, size_t newheight, size_t newwidth)
Definition: apop_data.c:1378
long double apop_multivariate_gamma(double a, int p)
Definition: apop_stats.c:796
gsl_matrix * apop_matrix_inverse(const gsl_matrix *in)
Definition: apop_linear_algebra.c:85
apop_lognormal
Definition: model_doc.h:537
apop_model * model
Definition: apop.h:2107
apop_model ** model_list
Definition: apop.h:2147
double apop_generalized_harmonic(int N, double s) __attribute__((__pure__))
Definition: apop_asst.c:114
apop_model * cdf_model
Definition: apop.h:1798
char start_at
Definition: apop.h:1915
void apop_vector_log10(gsl_vector *v)
Definition: apop_linear_algebra.c:165
apop_data * apop_data_rank_expand(apop_data *in)
Definition: apop_conversions.c:291
apop_model * model2
Definition: apop.h:2114
apop_data * apop_data_prune_columns_base(apop_data *d, char **colnames)
Definition: apop_data.c:746
int * param_sizes
Definition: apop.h:2149
apop_data * apop_data_listwise_delete(apop_data *d, char inplace)
Definition: apop_missing_data.c:29
apop_data * apop_data_copy(const apop_data *in)
Definition: apop_data.c:331
int apop_text_add(apop_data *in, const size_t row, const size_t col, const char *fmt,...)
Definition: apop_data.c:1159
apop_model * base_model
Definition: apop.h:2127
int gsl_vector * apop_vector_moving_average(gsl_vector *, size_t)
Definition: apop_smoothing.c:11
double apop_log_likelihood(apop_data *d, apop_model *m)
Definition: apop_model.c:255
double convex
Definition: apop.h:2100
double apop_query_to_float(const char *fmt,...)
Definition: apop_db.c:445
void apop_vector_show(const gsl_vector *data)
Definition: apop_output.c:230
apop_model * apop_model_fix_params_get_base(apop_model *model_in)
Definition: apop_fix_params.c:273
double apop_vector_cov(gsl_vector const *v1, gsl_vector const *v2, gsl_vector const *weights)
Definition: apop_stats.c:593
apop_pmf
Definition: model_doc.h:797
int apop_matrix_is_positive_semidefinite(gsl_matrix *m, char semi)
Definition: apop_stats.c:852
apop_yule
Definition: model_doc.h:1902
apop_iv
Definition: model_doc.h:1698
apop_name * apop_name_copy(apop_name *in)
Definition: apop_name.c:168
apop_data * apop_query_to_mixed_data(const char *typelist, const char *fmt,...)
Definition: apop_db.c:489
int reject_count
Definition: apop.h:1900
void apop_data_show(const apop_data *data)
Definition: apop_output.c:103
void apop_vector_log(gsl_vector *v)
Definition: apop_linear_algebra.c:178
double apop_cdf(apop_data *d, apop_model *m)
Definition: apop_model.c:519
gsl_vector * apop_numerical_gradient(apop_data *data, apop_model *model, double delta)
Definition: apop_mle.c:131
apop_data * apop_data_rm_rows(apop_data *in, int *drop, int(*do_drop)(apop_data *, void *), void *drop_parameter)
Definition: apop_data.c:1595
int neval
Definition: apop.h:2105
apop_gamma
Definition: model_doc.h:1632
apop_poisson
Definition: model_doc.h:2036
apop_multinomial
Definition: model_doc.h:1550
int gsl_matrix apop_data apop_data apop_data gsl_vector double int apop_data_to_db(const apop_data *set, const char *tabname, char)
Definition: apop_db.c:610
double apop_rng_GHgB3(gsl_rng *r, double *a)
Definition: apop_asst.c:319
double ci_level
Definition: apop.h:2069
void apop_name_free(apop_name *free_me)
Definition: apop_name.c:106
double apop_matrix_map_sum(const gsl_matrix *in, double(*fn)(gsl_vector *))
Definition: apop_mapply.c:457
void * more
Definition: apop.h:128
double apop_vector_kurtosis_pop(gsl_vector const *v, gsl_vector const *weights)
Definition: apop_stats.c:154
gsl_vector * apop_data_pack(const apop_data *in, gsl_vector *out, char all_pages, char use_info_pages)
Definition: apop_conversions.c:783
apop_data * apop_data_calloc(const size_t size1, const size_t size2, const int size3)
Definition: apop_data.c:88
apop_data ** path
Definition: apop.h:1736
apop_data * apop_data_rank_compress(apop_data *in)
Definition: apop_conversions.c:270
apop_model * apop_model_fix_params(apop_model *model_in)
Definition: apop_fix_params.c:230
apop_model * apop_model_copy(apop_model *in)
Definition: apop_model.c:152
void apop_maximum_likelihood(apop_data *data, apop_model *dist)
Definition: apop_mle.c:646
apop_ols
Definition: model_doc.h:1078
char db_engine
Definition: apop.h:146
double last_ll
Definition: apop.h:1888
void(* estimate)(apop_data *data, apop_model *params)
Definition: apop.h:115
char * nan_string
Definition: apop.h:145
apop_model * input_distribution
Definition: apop.h:1757
int apop_arms_draw(double *out, gsl_rng *r, apop_model *m)
Adaptive rejection metropolis sampling.
Definition: apop_arms.c:93
apop_data * apop_model_numerical_covariance(apop_data *data, apop_model *model, double delta)
Definition: apop_mle.c:253
char draw_index
Definition: apop.h:1817
double * apop_vector_percentiles(gsl_vector *data, char rounding)
Definition: apop_asst.c:184
apop_data * apop_anova(char *table, char *data, char *grouping1, char *grouping2)
Definition: apop_tests.c:291
apop_data * apop_dot(const apop_data *d1, const apop_data *d2, char form1, char form2)
Definition: apop_linear_algebra.c:474
int verbose
Definition: apop.h:139
apop_data * apop_data_transpose(apop_data *in, char transpose_text, char inplace)
Definition: apop_data.c:1274
char stop_on_warning
Definition: apop.h:140
char gibbs_chunks
Definition: apop.h:1901
int proposal_is_cp
Definition: apop.h:1913
gsl_vector * cmf
Definition: apop.h:1816
int * cmf_refct
Definition: apop.h:1820
long int periods
Definition: apop.h:1884
double dim_cycle_tolerance
Definition: apop.h:1725