Replies: 3 comments 2 replies
-
Hi @ah2048, Thank you for your interest in MathPHP. I see you closed this issue before I had a chance to respond. Did you find an answer or did you want to make a feature request? Let me know. Thanks. Mark |
Beta Was this translation helpful? Give feedback.
-
sorry for closing it without details. When I went through NumPy package, I found that "numpy.linalg.cond" is using svd, however we cannot do that by math-php svd function because it will be very slow for large matrices due to unnecessary calculations , I got help from my friend wrote me this $Mᵀ = $M->transpose();
$MMᵀ = $M->multiply($Mᵀ);
$eigenvalue = Eigenvalue::jacobiMethod($MMᵀ);
$max = max($eigenvalue);
$min = min($eigenvalue);
$conditionNumber = sqrt($max) / sqrt($min); But we found that Eigenvalue::jacobiMethod is slow (1 second) for large matrices (30x30) also, so we still struggling. I cannot open a feature request as I really have very little knowledge experience with this stuff. but it would be very nice to see cond function exists and working well at markrogoyski/math-php. |
Beta Was this translation helpful? Give feedback.
-
According to stackoverflow (https://stackoverflow.com/questions/29426357/is-numpy-linalg-cond-returning-the-ratio-of-the-biggest-and-smallest-eigenvalue) the ratio of singular values is not the same as a the ratio of eigenvalues unless you have a normal matrix. Are you sure the function your friend provided is correct? |
Beta Was this translation helpful? Give feedback.
-
Hello,
How to calculate condition number of a matrix?
I have so little experience with math, I just want to get an equivalent code to this function https://numpy.org/doc/stable/reference/generated/numpy.linalg.cond.html#numpy-linalg-cond
Beta Was this translation helpful? Give feedback.
All reactions