[1/4] gid32: Add matrix helper functions.