Here my fixes to make the code working.

Fix Mat2X to Mat and Mat3X to Mat.
Templates make that some wrong data are read if you send Mat2X and Mat3X data instead of Mat only T type.

I have added : 

How use AC ransac to estimate the P matrix. AC-Ransac found all the point as inliers.

I have show to you how use the openMVG KRt decomposition. (I saw that you have done one in your other test binary).

And show how you can compute residuals.

As an exercise you can refine the P matrix with BundleAdjustment by using the ceres solver or the Eigen based LM minimizer.