Add function create_matrix and construct_matrix.