//
// Created by 付聪 on 2017/6/21.
//
#include <efanna2e/index_nsg.h>
#include <efanna2e/util.h>
void load_data(char* filename, float*& data, unsigned& num,unsigned& dim){// load data with sift10K pattern
std::ifstream in(filename, std::ios::binary);
if(!in.is_open()){std::cout<<"open file error"<<std::endl;exit(-1);}
in.read((char*)&dim,4);
std::cout<<"data dimension: "<<dim<<std::endl;
in.seekg(0,std::ios::end);
std::ios::pos_type ss = in.tellg();
size_t fsize = (size_t)ss;
num = (unsigned)(fsize / (dim+1) / 4);
data = new float[num * dim * sizeof(float)];
in.see