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

@@ -28,6 +28,23 @@ struct MovableScalar : public Base {
template <>
struct NumTraits<MovableScalar<float>> : GenericNumTraits<float> {};
namespace internal {
template <typename T>
struct random_impl<MovableScalar<T>> {
using MoveableT = MovableScalar<T>;
using Impl = random_impl<T>;
static EIGEN_DEVICE_FUNC inline MoveableT run(const MoveableT& x, const MoveableT& y) {
T result = Impl::run(x, y);
return MoveableT(result);
}
static EIGEN_DEVICE_FUNC inline MoveableT run() {
T result = Impl::run();
return MoveableT(result);
}
};
} // namespace internal
} // namespace Eigen
#endif