mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
improve random
This commit is contained in:
@@ -26,3 +26,21 @@ class SafeScalar {
|
||||
T val_;
|
||||
bool initialized_;
|
||||
};
|
||||
|
||||
namespace Eigen {
|
||||
namespace internal {
|
||||
template <typename T>
|
||||
struct random_impl<SafeScalar<T>> {
|
||||
using SafeT = SafeScalar<T>;
|
||||
using Impl = random_impl<T>;
|
||||
static EIGEN_DEVICE_FUNC inline SafeT run(const SafeT& x, const SafeT& y) {
|
||||
T result = Impl::run(x, y);
|
||||
return SafeT(result);
|
||||
}
|
||||
static EIGEN_DEVICE_FUNC inline SafeT run() {
|
||||
T result = Impl::run();
|
||||
return SafeT(result);
|
||||
}
|
||||
};
|
||||
} // namespace internal
|
||||
} // namespace Eigen
|
||||
|
||||
Reference in New Issue
Block a user