deed936ca0bfa5998af0225fab99c47bd2bc4b6d,mathics/builtin/linalg.py,Eigenvalues,apply,#Eigenvalues#Any#Any#,715
Before Change
if matrix.cols != matrix.rows or matrix.cols == 0:
return evaluation.message("Eigenvalues", "matsq", m)
eigenvalues = matrix.eigenvals().items()
try:
eigenvalues = sorted(eigenvalues,
key=lambda v_c: (abs(v_c[0]), -v_c[0]),
reverse=True)
// Try to sort the results as complex numbers
except TypeError:
try:
eigenvalues = sorted(eigenvalues,
key=lambda v_c: -abs(v_c[0]))
// Don"t sort the results at all
except TypeError:
pass
return from_sympy([v for (v, c) in eigenvalues for _ in range(c)])
class Eigensystem(Builtin):
After Change
reverse=True)
eigenvalues = [from_sympy(v) for (v, c) in eigenvalues
for _ in range(c)]
// Sort the eigenvalues in an arbitrary yet deterministic order
else:
eigenvalues = [(from_sympy(v), c) for (v, c) in eigenvalues]
eigenvalues.sort(key=lambda v: v[0].get_sort_key())
eigenvalues = [v for (v, c) in eigenvalues for _ in range(c)]
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 15
Instances Project Name: mathics/Mathics
Commit Name: deed936ca0bfa5998af0225fab99c47bd2bc4b6d
Time: 2020-09-06
Author: pablo-escobar@riseup.net
File Name: mathics/builtin/linalg.py
Class Name: Eigenvalues
Method Name: apply
Project Name: mathics/Mathics
Commit Name: 214c09c0f018013be994d4c1220bfb5f5264c724
Time: 2020-09-05
Author: pablo-escobar@riseup.net
File Name: mathics/builtin/linalg.py
Class Name: Eigenvalues
Method Name: apply
Project Name: mathics/Mathics
Commit Name: deed936ca0bfa5998af0225fab99c47bd2bc4b6d
Time: 2020-09-06
Author: pablo-escobar@riseup.net
File Name: mathics/builtin/linalg.py
Class Name: Eigenvalues
Method Name: apply
Project Name: mathics/Mathics
Commit Name: af4b29bd5694e2eec570d67602c4a81b5364b34d
Time: 2020-09-05
Author: pablo-escobar@riseup.net
File Name: mathics/builtin/linalg.py
Class Name: Eigenvalues
Method Name: apply