I am getting two vastly different answers with regards to simple matrix norms when comparing the MATLAB and Python functions.
Let
R =
0.9940 0.0773 -0.0773
-0.0713 0.9945 0.0769
0.0828 -0.0709 0.9940
Then in MATLAB:
>> norm(R)
ans =
1
But in Python
from scipy.linalg import norm
import numpy as np
print norm(R),np.linalg.norm(R)
1.73205080757 1.73205080757
where
print scipy.__version__,np.__version__
0.14.0 1.9.0
How did I manage to so comprehensively screw that up?
Python is returning the Frobenius norm. You can do this in MATLAB with:
>> norm(R,'fro')
ans =
1.73203140271763
By default, norm gives the 2-norm (norm(R,2)).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With