1 Star 0 Fork 16

一张弓/NumCpp

forked from Gitee 极速下载/NumCpp 
加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
performance02.cpp 725 Bytes
一键复制 编辑 原始数据 按行查看 历史
Tobias Knopp 提交于 2013-10-09 13:55 +08:00 . more template instantiations
#include <numcpp.h>
using namespace numcpp;
int main()
{
auto N = 100000;
auto M = 1000;
{
auto t = tic();
EnableCaching();
Array<cdouble> x = zeros(N);
for(auto i=0; i<M; i++)
{
Array<cdouble> y = eval(linspace(0,1,N));//fft(eval(linspace(0,1,N)*i));
x += i*exp(2*pi*I*i*y);
}
DisableCaching();
toc(t);
}
//std::cout << MemoryBlock::numAllocations << std::endl;
{
auto t = tic();
Array<cdouble> x = zeros(N);
for(auto i=0; i<M; i++)
{
Array<cdouble> y = eval(linspace(0,1,N));//fft(eval(linspace(0,1,N)*i));
x += i*exp(2*pi*I*i*y);
}
toc(t);
}
//std::cout << MemoryBlock::numAllocations << std::endl;
return 0;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/a-bow/numcpp.git
git@gitee.com:a-bow/numcpp.git
a-bow
numcpp
NumCpp
master

搜索帮助