diff --git a/src/vendor/cigraph/vendor/plfit/gss.h b/src/vendor/cigraph/vendor/plfit/gss.h index e4745c8090..45276fda07 100644 --- a/src/vendor/cigraph/vendor/plfit/gss.h +++ b/src/vendor/cigraph/vendor/plfit/gss.h @@ -20,15 +20,7 @@ #ifndef __GSS_H__ #define __GSS_H__ -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif +#include "plfit_decls.h" __BEGIN_DECLS diff --git a/src/vendor/cigraph/vendor/plfit/hzeta.c b/src/vendor/cigraph/vendor/plfit/hzeta.c index ea7b9d3bcc..e6564b247a 100644 --- a/src/vendor/cigraph/vendor/plfit/hzeta.c +++ b/src/vendor/cigraph/vendor/plfit/hzeta.c @@ -53,7 +53,7 @@ /* Work around bug in some Windows SDK / MSVC versions where NAN is not a * constant expression, triggering an error in the definition of - * hsl_sf_hzeta_eulermaclaurin_series_coeffs[] and + * hsl_sf_hzeta_eulermaclaurin_series_coeffs[] and * hsl_sf_hzeta_eulermaclaurin_series_majorantratios[] below. * We re-define NAN to the value it had in earlier MSVC versions. * See https://github.com/igraph/igraph/issues/2701 diff --git a/src/vendor/cigraph/vendor/plfit/hzeta.h b/src/vendor/cigraph/vendor/plfit/hzeta.h index 31d646e05f..39a7e01a7c 100644 --- a/src/vendor/cigraph/vendor/plfit/hzeta.h +++ b/src/vendor/cigraph/vendor/plfit/hzeta.h @@ -32,15 +32,7 @@ #ifndef __HZETA_H__ #define __HZETA_H__ -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif +#include "plfit_decls.h" __BEGIN_DECLS diff --git a/src/vendor/cigraph/vendor/plfit/kolmogorov.h b/src/vendor/cigraph/vendor/plfit/kolmogorov.h index 358e69753d..9615bcb74b 100644 --- a/src/vendor/cigraph/vendor/plfit/kolmogorov.h +++ b/src/vendor/cigraph/vendor/plfit/kolmogorov.h @@ -20,17 +20,8 @@ #ifndef __KOLMOGOROV_H__ #define __KOLMOGOROV_H__ -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - #include +#include "plfit_decls.h" __BEGIN_DECLS diff --git a/src/vendor/cigraph/vendor/plfit/lbfgs.h b/src/vendor/cigraph/vendor/plfit/lbfgs.h index c36a0b1f83..f67277e080 100644 --- a/src/vendor/cigraph/vendor/plfit/lbfgs.h +++ b/src/vendor/cigraph/vendor/plfit/lbfgs.h @@ -29,9 +29,9 @@ #ifndef __LBFGS_H__ #define __LBFGS_H__ -#ifdef __cplusplus -extern "C" { -#endif/*__cplusplus*/ +#include "plfit_decls.h" + +__BEGIN_DECLS /* * The default precision of floating point values is 64bit (double). @@ -517,9 +517,7 @@ void lbfgs_free(lbfgsfloatval_t *x); /** @} */ -#ifdef __cplusplus -} -#endif/*__cplusplus*/ +__END_DECLS diff --git a/src/vendor/cigraph/vendor/plfit/plfit.c b/src/vendor/cigraph/vendor/plfit/plfit.c index 27e788d360..bfc8eeb5ba 100644 --- a/src/vendor/cigraph/vendor/plfit/plfit.c +++ b/src/vendor/cigraph/vendor/plfit/plfit.c @@ -24,12 +24,10 @@ #include #include #include -#include "plfit_error.h" #include "gss.h" #include "lbfgs.h" #include "plfit.h" #include "kolmogorov.h" -#include "plfit_sampling.h" #include "hzeta.h" /* #define PLFIT_DEBUG */ diff --git a/src/vendor/cigraph/vendor/plfit/plfit.h b/src/vendor/cigraph/vendor/plfit/plfit.h index 52b5545442..a312790f22 100644 --- a/src/vendor/cigraph/vendor/plfit/plfit.h +++ b/src/vendor/cigraph/vendor/plfit/plfit.h @@ -18,23 +18,16 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __PLFIT_H__ -#define __PLFIT_H__ +#ifndef PLFIT_H +#define PLFIT_H #include +#include "plfit_decls.h" +#include "plfit_error.h" #include "plfit_mt.h" +#include "plfit_sampling.h" #include "plfit_version.h" -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - __BEGIN_DECLS typedef unsigned short int plfit_bool_t; @@ -91,50 +84,50 @@ typedef struct _plfit_discrete_options_t { plfit_mt_rng_t* rng; } plfit_discrete_options_t; -int plfit_continuous_options_init(plfit_continuous_options_t* options); -int plfit_discrete_options_init(plfit_discrete_options_t* options); +PLFIT_EXPORT int plfit_continuous_options_init(plfit_continuous_options_t* options); +PLFIT_EXPORT int plfit_discrete_options_init(plfit_discrete_options_t* options); -extern const plfit_continuous_options_t plfit_continuous_default_options; -extern const plfit_discrete_options_t plfit_discrete_default_options; +PLFIT_EXPORT extern const plfit_continuous_options_t plfit_continuous_default_options; +PLFIT_EXPORT extern const plfit_discrete_options_t plfit_discrete_default_options; /********** continuous power law distribution fitting **********/ -int plfit_log_likelihood_continuous(const double* xs, size_t n, double alpha, +PLFIT_EXPORT int plfit_log_likelihood_continuous(const double* xs, size_t n, double alpha, double xmin, double* l); -int plfit_estimate_alpha_continuous(const double* xs, size_t n, double xmin, +PLFIT_EXPORT int plfit_estimate_alpha_continuous(const double* xs, size_t n, double xmin, const plfit_continuous_options_t* options, plfit_result_t* result); -int plfit_continuous(const double* xs, size_t n, +PLFIT_EXPORT int plfit_continuous(const double* xs, size_t n, const plfit_continuous_options_t* options, plfit_result_t* result); /*********** discrete power law distribution fitting ***********/ -int plfit_estimate_alpha_discrete(const double* xs, size_t n, double xmin, +PLFIT_EXPORT int plfit_estimate_alpha_discrete(const double* xs, size_t n, double xmin, const plfit_discrete_options_t* options, plfit_result_t *result); -int plfit_log_likelihood_discrete(const double* xs, size_t n, double alpha, double xmin, double* l); -int plfit_discrete(const double* xs, size_t n, const plfit_discrete_options_t* options, +PLFIT_EXPORT int plfit_log_likelihood_discrete(const double* xs, size_t n, double alpha, double xmin, double* l); +PLFIT_EXPORT int plfit_discrete(const double* xs, size_t n, const plfit_discrete_options_t* options, plfit_result_t* result); /***** resampling routines to generate synthetic replicates ****/ -int plfit_resample_continuous(const double* xs, size_t n, double alpha, double xmin, +PLFIT_EXPORT int plfit_resample_continuous(const double* xs, size_t n, double alpha, double xmin, size_t num_samples, plfit_mt_rng_t* rng, double* result); -int plfit_resample_discrete(const double* xs, size_t n, double alpha, double xmin, +PLFIT_EXPORT int plfit_resample_discrete(const double* xs, size_t n, double alpha, double xmin, size_t num_samples, plfit_mt_rng_t* rng, double* result); /******** calculating the p-value of a fitted model only *******/ -int plfit_calculate_p_value_continuous(const double* xs, size_t n, +PLFIT_EXPORT int plfit_calculate_p_value_continuous(const double* xs, size_t n, const plfit_continuous_options_t* options, plfit_bool_t xmin_fixed, plfit_result_t *result); -int plfit_calculate_p_value_discrete(const double* xs, size_t n, +PLFIT_EXPORT int plfit_calculate_p_value_discrete(const double* xs, size_t n, const plfit_discrete_options_t* options, plfit_bool_t xmin_fixed, plfit_result_t *result); /************* calculating descriptive statistics **************/ -int plfit_moments(const double* data, size_t n, double* mean, double* variance, +PLFIT_EXPORT int plfit_moments(const double* data, size_t n, double* mean, double* variance, double* skewness, double* kurtosis); __END_DECLS -#endif /* __PLFIT_H__ */ +#endif /* PLFIT_H */ diff --git a/src/vendor/cigraph/vendor/plfit/plfit_decls.h b/src/vendor/cigraph/vendor/plfit/plfit_decls.h new file mode 100644 index 0000000000..ee45c3bed3 --- /dev/null +++ b/src/vendor/cigraph/vendor/plfit/plfit_decls.h @@ -0,0 +1,35 @@ +/* plfit_decls.h + * + * Copyright (C) 2024 Tamas Nepusz + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef PLFIT_DECLS_H +#define PLFIT_DECLS_H + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus + #define __BEGIN_DECLS extern "C" { + #define __END_DECLS } +#else + #define __BEGIN_DECLS /* empty */ + #define __END_DECLS /* empty */ +#endif + +#define PLFIT_EXPORT /* empty */ + +#endif /* PLFIT_DECLS_H */ diff --git a/src/vendor/cigraph/vendor/plfit/plfit_error.h b/src/vendor/cigraph/vendor/plfit/plfit_error.h index b9170b380a..c6c5dff325 100644 --- a/src/vendor/cigraph/vendor/plfit/plfit_error.h +++ b/src/vendor/cigraph/vendor/plfit/plfit_error.h @@ -17,18 +17,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __ERROR_H__ -#define __ERROR_H__ +#ifndef PLFIT_ERROR_H +#define PLFIT_ERROR_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif +#include "plfit_decls.h" __BEGIN_DECLS @@ -66,22 +58,15 @@ enum { typedef void plfit_error_handler_t(const char*, const char*, int, int); -extern plfit_error_handler_t plfit_error_handler_abort; -extern plfit_error_handler_t plfit_error_handler_ignore; -extern plfit_error_handler_t plfit_error_handler_printignore; - -plfit_error_handler_t* plfit_set_error_handler(plfit_error_handler_t* new_handler); +PLFIT_EXPORT extern plfit_error_handler_t plfit_error_handler_abort; +PLFIT_EXPORT extern plfit_error_handler_t plfit_error_handler_ignore; +PLFIT_EXPORT extern plfit_error_handler_t plfit_error_handler_printignore; -void plfit_error(const char *reason, const char *file, int line, int plfit_errno); -const char* plfit_strerror(const int plfit_errno); +PLFIT_EXPORT plfit_error_handler_t* plfit_set_error_handler(plfit_error_handler_t* new_handler); -void plfit_error_handler_abort(const char *reason, const char *file, int line, - int plfit_errno); -void plfit_error_handler_ignore(const char *reason, const char *file, int line, - int plfit_errno); -void plfit_error_handler_printignore(const char *reason, const char *file, int line, - int plfit_errno); +PLFIT_EXPORT void plfit_error(const char *reason, const char *file, int line, int plfit_errno); +PLFIT_EXPORT const char* plfit_strerror(const int plfit_errno); __END_DECLS -#endif /* __ERROR_H__ */ +#endif /* PLFIT_ERROR_H */ diff --git a/src/vendor/cigraph/vendor/plfit/plfit_mt.h b/src/vendor/cigraph/vendor/plfit/plfit_mt.h index b30cdaf504..99c5f96b1f 100644 --- a/src/vendor/cigraph/vendor/plfit/plfit_mt.h +++ b/src/vendor/cigraph/vendor/plfit/plfit_mt.h @@ -11,20 +11,11 @@ * This file has been placed in the public domain. */ -#ifndef __PLFIT_MT_H__ -#define __PLFIT_MT_H__ +#ifndef PLFIT_MT_H +#define PLFIT_MT_H #include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif +#include "plfit_decls.h" __BEGIN_DECLS @@ -55,7 +46,7 @@ typedef struct { * * \param rng the random number generator to initialize */ -void plfit_mt_init(plfit_mt_rng_t* rng); +PLFIT_EXPORT void plfit_mt_init(plfit_mt_rng_t* rng); /** * \brief Initializes a Mersenne Twister random number generator, seeding it @@ -70,7 +61,7 @@ void plfit_mt_init(plfit_mt_rng_t* rng); * be initialized from the built-in RNG as if \ref plfit_mt_init() * was called. */ -void plfit_mt_init_from_rng(plfit_mt_rng_t* rng, plfit_mt_rng_t* seeder); +PLFIT_EXPORT void plfit_mt_init_from_rng(plfit_mt_rng_t* rng, plfit_mt_rng_t* seeder); /** * \brief Returns the next 32-bit random number from the given Mersenne Twister @@ -79,7 +70,7 @@ void plfit_mt_init_from_rng(plfit_mt_rng_t* rng, plfit_mt_rng_t* seeder); * \param rng the random number generator to use * \return the next 32-bit random number from the generator */ -uint32_t plfit_mt_random(plfit_mt_rng_t* rng); +PLFIT_EXPORT uint32_t plfit_mt_random(plfit_mt_rng_t* rng); /** * \brief Returns a uniformly distributed double from the interval [0;1) @@ -89,8 +80,8 @@ uint32_t plfit_mt_random(plfit_mt_rng_t* rng); * \param rng the random number generator to use * \return a uniformly distributed random number from the interval [0;1) */ -double plfit_mt_uniform_01(plfit_mt_rng_t* rng); +PLFIT_EXPORT double plfit_mt_uniform_01(plfit_mt_rng_t* rng); __END_DECLS -#endif +#endif /* PLFIT_MT_H */ diff --git a/src/vendor/cigraph/vendor/plfit/plfit_sampling.h b/src/vendor/cigraph/vendor/plfit/plfit_sampling.h index f63407c2b8..ed89c2cd05 100644 --- a/src/vendor/cigraph/vendor/plfit/plfit_sampling.h +++ b/src/vendor/cigraph/vendor/plfit/plfit_sampling.h @@ -17,22 +17,13 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __SAMPLING_H__ -#define __SAMPLING_H__ +#ifndef PLFIT_SAMPLING_H +#define PLFIT_SAMPLING_H #include +#include "plfit_decls.h" #include "plfit_mt.h" -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - __BEGIN_DECLS /** @@ -49,7 +40,7 @@ __BEGIN_DECLS * \param rng the Mersenne Twister random number generator to use * \return the value drawn from the given binomial distribution. */ -double plfit_rbinom(double n, double p, plfit_mt_rng_t* rng); +PLFIT_EXPORT double plfit_rbinom(double n, double p, plfit_mt_rng_t* rng); /** * Draws a sample from a Pareto distribution with the given minimum value and @@ -61,7 +52,7 @@ double plfit_rbinom(double n, double p, plfit_mt_rng_t* rng); * * \return the sample or NaN if one of the parameters is invalid */ -extern double plfit_rpareto(double xmin, double alpha, plfit_mt_rng_t* rng); +PLFIT_EXPORT extern double plfit_rpareto(double xmin, double alpha, plfit_mt_rng_t* rng); /** * Draws a given number of samples from a Pareto distribution with the given @@ -76,7 +67,7 @@ extern double plfit_rpareto(double xmin, double alpha, plfit_mt_rng_t* rng); * * \return \c PLFIT_EINVAL if one of the parameters is invalid, zero otherwise */ -int plfit_rpareto_array(double xmin, double alpha, size_t n, plfit_mt_rng_t* rng, +PLFIT_EXPORT int plfit_rpareto_array(double xmin, double alpha, size_t n, plfit_mt_rng_t* rng, double* result); /** @@ -89,7 +80,7 @@ int plfit_rpareto_array(double xmin, double alpha, size_t n, plfit_mt_rng_t* rng * * \return the sample or NaN if one of the parameters is invalid */ -extern double plfit_rzeta(long int xmin, double alpha, plfit_mt_rng_t* rng); +PLFIT_EXPORT extern double plfit_rzeta(long int xmin, double alpha, plfit_mt_rng_t* rng); /** * Draws a given number of samples from a zeta distribution with the given @@ -104,7 +95,7 @@ extern double plfit_rzeta(long int xmin, double alpha, plfit_mt_rng_t* rng); * * \return \c PLFIT_EINVAL if one of the parameters is invalid, zero otherwise */ -int plfit_rzeta_array(long int xmin, double alpha, size_t n, plfit_mt_rng_t* rng, +PLFIT_EXPORT int plfit_rzeta_array(long int xmin, double alpha, size_t n, plfit_mt_rng_t* rng, double* result); /** @@ -118,7 +109,7 @@ int plfit_rzeta_array(long int xmin, double alpha, size_t n, plfit_mt_rng_t* rng * \param rng the Mersenne Twister random number generator to use * \return the value drawn from the given uniform distribution. */ -extern double plfit_runif(double lo, double hi, plfit_mt_rng_t* rng); +PLFIT_EXPORT extern double plfit_runif(double lo, double hi, plfit_mt_rng_t* rng); /** * Draws a sample from a uniform distribution over the [0; 1) interval. @@ -128,7 +119,7 @@ extern double plfit_runif(double lo, double hi, plfit_mt_rng_t* rng); * \param rng the Mersenne Twister random number generator to use * \return the value drawn from the given uniform distribution. */ -extern double plfit_runif_01(plfit_mt_rng_t* rng); +PLFIT_EXPORT extern double plfit_runif_01(plfit_mt_rng_t* rng); /** * Random sampler using Walker's alias method. @@ -148,7 +139,7 @@ typedef struct { * \param n the number of items in the array * \return error code */ -int plfit_walker_alias_sampler_init(plfit_walker_alias_sampler_t* sampler, +PLFIT_EXPORT int plfit_walker_alias_sampler_init(plfit_walker_alias_sampler_t* sampler, double* ps, size_t n); /** @@ -156,7 +147,7 @@ int plfit_walker_alias_sampler_init(plfit_walker_alias_sampler_t* sampler, * * \param sampler the sampler to destroy */ -void plfit_walker_alias_sampler_destroy(plfit_walker_alias_sampler_t* sampler); +PLFIT_EXPORT void plfit_walker_alias_sampler_destroy(plfit_walker_alias_sampler_t* sampler); /** * \brief Draws a given number of samples from the sampler and writes them @@ -169,9 +160,9 @@ void plfit_walker_alias_sampler_destroy(plfit_walker_alias_sampler_t* sampler); * \param rng the Mersenne Twister random number generator to use * \return error code */ -int plfit_walker_alias_sampler_sample(const plfit_walker_alias_sampler_t* sampler, +PLFIT_EXPORT int plfit_walker_alias_sampler_sample(const plfit_walker_alias_sampler_t* sampler, long int* xs, size_t n, plfit_mt_rng_t* rng); __END_DECLS -#endif +#endif /* PLFIT_SAMPLING_H */ diff --git a/src/vendor/igraph_version.h b/src/vendor/igraph_version.h index 13123b4249..8e6df48830 100644 --- a/src/vendor/igraph_version.h +++ b/src/vendor/igraph_version.h @@ -28,11 +28,11 @@ __BEGIN_DECLS -#define IGRAPH_VERSION "0.10.15-27-g3ac79b81b" +#define IGRAPH_VERSION "0.10.15-28-g8d242741a" #define IGRAPH_VERSION_MAJOR 0 #define IGRAPH_VERSION_MINOR 10 #define IGRAPH_VERSION_PATCH 15 -#define IGRAPH_VERSION_PRERELEASE "27-g3ac79b81b" +#define IGRAPH_VERSION_PRERELEASE "28-g8d242741a" IGRAPH_EXPORT void igraph_version(const char **version_string, int *major,