From: Jonathan Zheng Date: Thu, 16 Jan 2020 14:49:43 +0000 (+0000) Subject: randomkit added X-Git-Tag: stable_release_2.44.0~12^2~13 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e08e5829c3abdb7bf32bbaa9b4e965026bca4bbb;p=graphviz randomkit added --- diff --git a/lib/neatogen/randomkit.c b/lib/neatogen/randomkit.c index ba143a34b..21dcda2ec 100644 --- a/lib/neatogen/randomkit.c +++ b/lib/neatogen/randomkit.c @@ -71,49 +71,50 @@ #include #include -#ifdef _WIN32 -/* - * Windows - * XXX: we have to use this ugly defined(__GNUC__) because it is not easy to - * detect the compiler used in distutils itself - */ -#if (defined(__GNUC__) && defined(NPY_NEEDS_MINGW_TIME_WORKAROUND)) - /* - * FIXME: ideally, we should set this to the real version of MSVCRT. We need - * something higher than 0x601 to enable _ftime64 and co - */ -#define __MSVCRT_VERSION__ 0x0700 -#include -#include - -/* - * mingw msvcr lib import wrongly export _ftime, which does not exist in the - * actual msvc runtime for version >= 8; we make it an alias to _ftime64, which - * is available in those versions of the runtime - */ -#define _FTIME(x) _ftime64((x)) -#else -#include -#include -#define _FTIME(x) _ftime((x)) -#endif - -#ifndef RK_NO_WINCRYPT -/* Windows crypto */ -#ifndef _WIN32_WINNT -#define _WIN32_WINNT 0x0400 -#endif -#include -#include -#endif +#ifdef _WIN32 -#else -/* Unix */ -#include -#include -#include -#endif +// * Windows +// * XXX: we have to use this ugly defined(__GNUC__) because it is not easy to +// * detect the compiler used in distutils itself +// */ +//#if (defined(__GNUC__) && defined(NPY_NEEDS_MINGW_TIME_WORKAROUND)) +// +///* +// * FIXME: ideally, we should set this to the real version of MSVCRT. We need +// * something higher than 0x601 to enable _ftime64 and co +// */ +//#define __MSVCRT_VERSION__ 0x0700 +//#include +//#include +// +///* +// * mingw msvcr lib import wrongly export _ftime, which does not exist in the +// * actual msvc runtime for version >= 8; we make it an alias to _ftime64, which +// * is available in those versions of the runtime +// */ +//#define _FTIME(x) _ftime64((x)) +//#else +//#include +//#include +//#define _FTIME(x) _ftime((x)) +//#endif +// +//#ifndef RK_NO_WINCRYPT +///* Windows crypto */ +//#ifndef _WIN32_WINNT +//#define _WIN32_WINNT 0x0400 +//#endif +//#include +//#include +//#endif +// +//#else +///* Unix */ +//#include +//#include +//#include +//#endif #include "randomkit.h" diff --git a/lib/neatogen/sgd.c b/lib/neatogen/sgd.c index f7a69be7d..21269b15f 100644 --- a/lib/neatogen/sgd.c +++ b/lib/neatogen/sgd.c @@ -24,13 +24,11 @@ float calculate_stress(term *terms, int n_terms) { } // it is much faster to shuffle term rather than pointers to term, even though the swap is more expensive static rk_state rstate; -void fisheryates_shuffle(term *terms, int n_terms) { +static void fisheryates_shuffle(term *terms, int n_terms) { int i; for (i=n_terms-1; i>=1; i--) { // srand48() is called in neatoinit.c, so no need to seed here //int j = (int)(drand48() * (i+1)); - // TODO: better RNG because shuffling is eating up at least 50% of computation - int j = rk_interval(i, &rstate); term temp = terms[i];