Kalman filter Programming

I want to model the GPS using Kalman filter,But the kalman filter algorithm is not working,there is some singular matrix problem occur while compute inversion.if anyone having coding for KF please help me