The code is lifted basically 1-to-1 from the C sample code on the wikipedia page (https://en.wikipedia.org/wiki/Alpha_beta_filter).It isn't clear how you calculated alpha and beta also I don't agree with your checks.
The checks are also lifted directly from that page.
I will take a look into making an alpha-beta-gamma filter based on your notes and the mathcad sample. it will take some effort on my part since it has been a long time since I dabbled with matrix equations.