improve random

This commit is contained in:
Charles Schlosser
2024-01-31 08:16:29 +00:00
parent a9ddab3e06
commit d626762e3f
9 changed files with 405 additions and 151 deletions

View File

@@ -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