deed936ca0bfa5998af0225fab99c47bd2bc4b6d,mathics/builtin/linalg.py,Eigenvalues,apply,#Eigenvalues#Any#Any#,715

Before Change


                                 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


        eigenvalues = list(matrix.eigenvals().items())

        // Sort the eigenvalues in the Mathematica convention
        if all(v.is_complex for (v, _) in eigenvalues):
            eigenvalues.sort(key=lambda v: (abs(v[0]), - re(v[0]), - im(v[0])),
                             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)]

        return Expression("List", *eigenvalues)


class Eigensystem(Builtin):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

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: DistrictDataLabs/yellowbrick
Commit Name: ca14cf72e3e4bd3a6136cafad8701ac41f48f09b
Time: 2018-08-25
Author: davidwaterman@gmail.com
File Name: yellowbrick/cluster/elbow.py
Class Name: KElbowVisualizer
Method Name: __init__


Project Name: quiltdata/quilt
Commit Name: 7d9a7fead18653a43645c3d673499cf639337406
Time: 2020-06-03
Author: akarve@users.noreply.github.com
File Name: lambdas/es/indexer/index.py
Class Name:
Method Name: handler