MAINT: speed up expm for special cases