normal_mv_distribution maintains the variance-covariance matrix param in Cholesky-decomposed form. Existing param_type constructors, when taking a full or lower-triangle varcov matrix, perform Cholesky decomposition to convert it to the internal representation. This internal representation is visible both in the varcov() result, and in the streamed-out representation of a normal_mv_distribution object. The problem is that when that representation is streamed back in, the read-back decomposed varcov matrix is used as a lower-triangle non-decomposed varcov matrix, and it undergoes Cholesky decomposition again. So, each cycle of stream-out/stream-in changes the varcov matrix to its "square root", instead of restoring the original params. This patch includes Corentin's changes that introduce verification in testsuite/ext/random/normal_mv_distribution/operators/serialize.cc and other similar tests that the object read back in compares equal to the written-out object: the modified tests pass only if (u == v). This patch also fixes the error exposed by his change, introducing an alternate private constructor for param_type, used only by operator>>. for libstdc++-v3/ChangeLog * include/ext/random (normal_mv_distribution::param_type::param_type): New private ctor taking a decomposed varcov matrix, for use by... (operator>>): ... this, befriended. * include/ext/random.tcc (operator>>): Use it. (normal_mv_distribution::param_type::_M_init_lower): Adjust member function name in exception message. for libstdc++-v3/ChangeLog from Corentin Gay <gay@adacore.com> * testsuite/ext/random/beta_distribution/operators/serialize.cc, testsuite/ext/random/hypergeometric_distribution/operators/serialize.cc, testsuite/ext/random/normal_mv_distribution/operators/serialize.cc, testsuite/ext/random/triangular_distribution/operators/serialize.cc, testsuite/ext/random/von_mises_distribution/operators/serialize.cc: Add call to `VERIFY`. From-SVN: r274233
Name |
Last commit
|
Last update |
---|---|---|
.. | ||
pb_ds | Loading commit data... | |
algorithm | Loading commit data... | |
aligned_buffer.h | Loading commit data... | |
alloc_traits.h | Loading commit data... | |
atomicity.h | Loading commit data... | |
bitmap_allocator.h | Loading commit data... | |
cast.h | Loading commit data... | |
cmath | Loading commit data... | |
codecvt_specializations.h | Loading commit data... | |
concurrence.h | Loading commit data... | |
debug_allocator.h | Loading commit data... | |
enc_filebuf.h | Loading commit data... | |
extptr_allocator.h | Loading commit data... | |
functional | Loading commit data... | |
iterator | Loading commit data... | |
malloc_allocator.h | Loading commit data... | |
memory | Loading commit data... | |
mt_allocator.h | Loading commit data... | |
new_allocator.h | Loading commit data... | |
numeric | Loading commit data... | |
numeric_traits.h | Loading commit data... | |
pod_char_traits.h | Loading commit data... | |
pointer.h | Loading commit data... | |
pool_allocator.h | Loading commit data... | |
random | Loading commit data... | |
random.tcc | Loading commit data... | |
rb_tree | Loading commit data... | |
rc_string_base.h | Loading commit data... | |
rope | Loading commit data... | |
ropeimpl.h | Loading commit data... | |
slist | Loading commit data... | |
sso_string_base.h | Loading commit data... | |
stdio_filebuf.h | Loading commit data... | |
stdio_sync_filebuf.h | Loading commit data... | |
string_conversions.h | Loading commit data... | |
throw_allocator.h | Loading commit data... | |
type_traits.h | Loading commit data... | |
typelist.h | Loading commit data... | |
vstring.h | Loading commit data... | |
vstring.tcc | Loading commit data... | |
vstring_fwd.h | Loading commit data... | |
vstring_util.h | Loading commit data... |