matrix_sample_code.cpp v3.0