The problem is that you test for equivalence of floating point values. This is bound to cause errors, as has been discussed hundreds of times on this forum:
The issue is related to floating point error of the results. Even though the product pinv(A)*A may not be exactly symmetric, but it is within the roundoff error of being symmetric.
As a test, try:
X = pinv(A);
S = A*X;
e = norm(S-S')/norm(S)
The relative error e should be roughly of size eps(X).
If it is important that S be exactly symmetric, it is recommended that you compute:
Best Answer