我在blitz ++,armadillo,boost :: MultiArray之间用以下代码进行了比较(借用旧帖子)
#include <iostream>
using namespace std;
#include <windows.h>
#define _SCL_SECURE_NO_WARNINGS
#define BOOST_DISABLE_ASSERTS
#include <boost/multi_array.hpp>
#include <blitz/array.h>
#include <armadillo>
int main(int argc, char* argv[])
{
const int X_SIZE = 1000;
const int Y_SIZE = 1000;
const int ITERATIONS = 100;
unsigned int startTime = 0;
unsigned int endTime = 0;
// Create the boost array
//------------------Measure boost Loop------------------------------------------
{
typedef boost::multi_array<double, 2> ImageArrayType;
ImageArrayType boostMatrix(boost::extents[X_SIZE][Y_SIZE]);
startTime = ::GetTickCount();
for (int i = 0; i < ITERATIONS; …
Run Code Online (Sandbox Code Playgroud) c++ boost-multi-array multidimensional-array blitz++ armadillo
我试着boost::bind
用std::vector<>::resize
.
但是以下代码将无法编译:
#include <boost/bind.hpp>
#include <vector>
using namespace boost;
int main(){
typedef std::vector<double> type;
type a;
bind(&type::resize, _1, 2)(a);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
那么,我该怎么做呢?
谢谢!
提升版本1.53 gcc版本4.8或4.6
*编辑:*上面的代码适用于-std = c ++ 11.事实上,我原来的问题是:
#include <boost/bind.hpp>
#include <blitz/array.h>
#include <vector>
using namespace boost;
using namespace blitz;
int main(){
typedef Array<double, 1> type;
type a;
//a.resize(4) is ok;
bind(&type::resize, _1, 2)(a);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我的编译命令是:g ++ t.cpp -I path/include/-std = c ++ 11 -L path/lib/-l blitz