multi-variate distribution
Paolo Carlini
paolo.carlini@oracle.com
Wed Sep 5 14:45:00 GMT 2012
Hi,
On 09/05/2012 02:50 PM, Ulrich Drepper wrote:
> One minor detail
> would be that in the past, with Gaby too, we agreed that code in ext should
> stil use "uglified" names, in principle. Thus, eg, __beta_distribution. Do
> you see a problem with that?
> No technical problem. This seems to be a rather fragmented policy.
> Most extension seem not to have the uglification.
Well, there are some sorts of explanations for the non-uglified. For
example we have stuff which used to be in <algorithm> and other standard
headers, part of the HP/SGI code which we inherited and moved to ext
headers as-is. Actually, it is causing us problems, because of that
backward compatibility requirement, we should have a Bugzilla PR still
open because of that. The allocators should be all fine, with the
exception of new_allocator, but when we realized we missed the
underscores it was too late, because some symbols were already exported
unuglified. vstring.h is fine. pb_ds we figured out the code had no
uglification when it was too late, because the original contributor
disappeared and we are too lazy to adjust so much code ;) (at some point
I really asked help about that, I seem to remember).
(Actually, there - mostly orthogonal - subtleties with __gnu_cxx itself:
we are using it both for implementation details and for self-contained
extensions. In some cases that is sort-of intended, because the
allocator stuff can be both used as-is and, depending on configure-time
switches, to implement std::allocator. If you are interested in these
boring issues, that still open PR should have details)
> I would agree with
> this for common names which are not used anywhere else in the library
> (for namespace reasons). Also for code that will not have any chance
> to make it into the standard I'd agree it's the right thing to do.
> The sfmt engine is far superior in performance to any other with
> similar quality, the beta distribution is reasonably important and
> really not that difficult to implement. The multi-variate normal
> distribution is probably the most important distribution. Pretty much
> every non-trivial MCMC simulation has to use it or implement it
> something on its own. Uglifying the names in ext/ unconditionally
> means that if the code is promoted code actually has to be changed
> (more). The name already has a leading __ in the namespace and the
> unique identifiers used are sufficiently special and long to not cause
> any conflicts.
I hear you, but the problem is that given the way these things are
specified in the Standard users today can still use macros with those
names, which, until we have the new facilities in a Standard are not
special at all. Agreed, those would cause a problem only if an ext
header is included, but - also given the current confusion I mentioned
above between impl details and extensions - it seems safer to just
uglify anything non-standard, go with __beta_distribution, etc, and
avoid problems. Besides the testcases, I think we are talking only about
a few lines of code so far, the names of the distributions and the name
of the alternate mersenne twister.
Paolo.
More information about the Libstdc++
mailing list