sync with numpy's builtin: diag