+2019-08-09 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`.
+
+2019-08-09 Alexandre Oliva <oliva@adacore.com>
+
+ * 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.
+
2019-08-08 Jonathan Wakely <jwakely@redhat.com>
P0325R4 to_array from LFTS with updates
_InputIterator2 __varbegin,
_InputIterator2 __varend);
+ // param_type constructors apply Cholesky decomposition to the
+ // varcov matrix in _M_init_full and _M_init_lower, but the
+ // varcov matrix output ot a stream is already decomposed, so
+ // we need means to restore it as-is when reading it back in.
+ template<size_t _Dimen1, typename _RealType1,
+ typename _CharT, typename _Traits>
+ friend std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ __gnu_cxx::normal_mv_distribution<_Dimen1, _RealType1>&
+ __x);
+ param_type(std::array<_RealType, _Dimen> const &__mean,
+ std::array<_RealType, _M_t_size> const &__varcov)
+ : _M_mean (__mean), _M_t (__varcov)
+ {}
+
std::array<_RealType, _Dimen> _M_mean;
std::array<_RealType, _M_t_size> _M_t;
};
__sum = *__varcovbegin++ - __sum;
if (__builtin_expect(__sum <= _RealType(0), 0))
std::__throw_runtime_error(__N("normal_mv_distribution::"
- "param_type::_M_init_full"));
+ "param_type::_M_init_lower"));
*__w++ = std::sqrt(__sum);
}
}
__is >> __x._M_nd;
+ // The param_type temporary is built with a private constructor,
+ // to skip the Cholesky decomposition that would be performed
+ // otherwise.
__x.param(typename normal_mv_distribution<_Dimen, _RealType>::
- param_type(__mean.begin(), __mean.end(),
- __varcov.begin(), __varcov.end()));
+ param_type(__mean, __varcov));
__is.flags(__flags);
return __is;
#include <ext/random>
#include <sstream>
+#include <testsuite_hooks.h>
void
test01()
str << u;
str >> v;
+ VERIFY( u == v );
}
int main()
str << u;
str >> v;
+ VERIFY( u == v );
}
int
#include <ext/random>
#include <sstream>
+#include <testsuite_hooks.h>
void
test01()
str << u;
str >> v;
+ VERIFY( u == v );
}
int main()
#include <ext/random>
#include <sstream>
+#include <testsuite_hooks.h>
void
test01()
str << u;
str >> v;
+ VERIFY( u == v );
}
int main()
#include <ext/random>
#include <sstream>
+#include <testsuite_hooks.h>
void
test01()
str << u;
str >> v;
+ VERIFY( u == v );
}
int main()