The code can be compiled correctly. But running the executable will cause a segment fault. If line 15 of the code is removed, the executable works fine. What may be the problem. Thanks
ublas::matrix<double> & n = m.back();
m.push_back(ublas::matrix<double>());
// the reference 'n' is no longer a valid reference
// (the sequence might have been relocated in memory)