if A is a nxn matrix, then in octave, pinv(A) represent inverse of A. pinv(A)*A should then yield Identity matrix I(n). But the following code is not working.
A=[ 1 2 3,
4 5 6,
7 8 9];
pinv(A)*A
0.83333 0.33333 -0.16667
0.33333 0.33333 0.33333
-0.16667 0.33333 0.83333
The diagonal elements , (pinv(A)*(A))[i,i] for i=1,2,3 are not even near to one.What went wrong?
Try use inv(A) function and you will get very useful information:
>> inv(A)
warning: matrix singular to machine precision, rcond = 1.54198e-018
Matrix A is not invertible! It is singular. Try change matrix A:
>> A=[ 10 2 3; 4 5 6; 7 8 9]
A =
10 2 3
4 5 6
7 8 9
>> inv(A)*A
ans =
1.00000 0.00000 0.00000
-0.00000 1.00000 0.00000
0.00000 0.00000 1.00000
>> pinv(A)*A
ans =
1.0000e+000 -2.2204e-016 -4.4409e-016
-1.7764e-015 1.0000e+000 -3.5527e-015
5.3291e-015 5.3291e-015 1.0000e+000