int n;int d;//float * points = generate_random_matrix( n, d);float * points = read_file("data.in", n , d);std::cout << "done reading" << std::endl;flann::Matrix<float> POINTS(points, n, d);const flann::AutotunedIndexParams params(0.8);std::vector<flann::Index<flann::L2<float>> *> nn_data_structures;flann::Index<flann::L2<float>> * ds = new flann::Index<flann::L2<float>> (POINTS, params);nn_data_structures.push_back(ds);nn_data_structures[0]->buildIndex();auto p = nn_data_structures[0]->getPoint(0);std::cout << p[0] << std::endl;
However, calling getPoint leads to a segmentation fault.
More precisely I am getting:
Program received signal SIGSEGV, Segmentation fault. 0x000055555555f508 in flann::NNIndex<flann::L2<float> >::getPoint (id=2, this=0x5555557aa8b0) at /home/hussein/projects/flann/flann/src/cpp/flann/algorithms/nn_index.h:191 191 return points_[index];
I have the following code.
int n;
int d;
//float * points = generate_random_matrix( n, d);
float * points = read_file("data.in", n , d);
std::cout << "done reading" << std::endl;
flann::Matrix<float> POINTS(points, n, d);
const flann::AutotunedIndexParams params(0.8);
std::vector<flann::Index<flann::L2<float>> *> nn_data_structures;
flann::Index<flann::L2<float>> * ds = new flann::Index<flann::L2<float>> (POINTS, params);
nn_data_structures.push_back(ds);
nn_data_structures[0]->buildIndex();
auto p = nn_data_structures[0]->getPoint(0);
std::cout << p[0] << std::endl;
However, calling getPoint leads to a segmentation fault. More precisely I am getting:
Program received signal SIGSEGV, Segmentation fault. 0x000055555555f508 in flann::NNIndex<flann::L2<float> >::getPoint (id=2, this=0x5555557aa8b0) at /home/hussein/projects/flann/flann/src/cpp/flann/algorithms/nn_index.h:191 191 return points_[index];
Thank you in advance for your help.