Added matrix_init() function