(从性能的角度来看)有没有比简单的方法更快的方法
std::vector<double> y;
y.reserve(x.size());
for(size_t i = 0; i < x.size(); ++i)
y.push_back(std::exp(x[i]));
最佳答案
如果您需要最大精度到最接近的ULP,这可能与您将获得的速度一样快。
如果您可以接受一些近似误差,则可以使用much faster methods that use SIMD。
关于c++ - C++-将std::exp应用于std::vector,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60732589/