3

What is the equivalent of std::vector::push_back() , in matrix<float,0,1> I tried M(i) = xx,xx , but the program crash and i get "Segmentation fault (core dumped)"

TahaOUARRAK
  • 150
  • 3
  • 9

1 Answers1

2

Dlib's matrices have fixed size, they are not auto-extending like STL's vectors

So you can set matrix size and use is:

dlib::matrix<double,3,3> m(num_rows, num_cols); // at compile time
dlib::matrix<double> m(num_rows, num_cols); // at construction time
dlib::matrix<double> m; m.set_size(num_rows, num_cols) // at run time
m(1,2) = 1;

More information is in Dlib examples

And possible reason of segmentation fault is using matrix of unknown size

Evgeniy
  • 2,481
  • 14
  • 24