我试图将boost :: multi_array的性能与本机动态分配的数组进行比较,使用以下测试程序:
#include <windows.h>
#define _SCL_SECURE_NO_WARNINGS
#define BOOST_DISABLE_ASSERTS
#include <boost/multi_array.hpp>
int main(int argc, char* argv[])
{
const int X_SIZE = 200;
const int Y_SIZE = 200;
const int ITERATIONS = 500;
unsigned int startTime = 0;
unsigned int endTime = 0;
// Create the boost array
typedef boost::multi_array<double, 2> ImageArrayType;
ImageArrayType boostMatrix(boost::extents[X_SIZE][Y_SIZE]);
// Create the native array
double *nativeMatrix = new double [X_SIZE * Y_SIZE];
//------------------Measure boost----------------------------------------------
startTime = ::GetTickCount();
for (int i = 0; i < ITERATIONS; ++i) …Run Code Online (Sandbox Code Playgroud) 我正在用C++开始一个新的科学计算项目,并且由于包含了许多数字化的程序,我正在考虑使用Armadillo或Blitz ++来进行有效的数组/矩阵/张量处理.哪一个更好用?