Wedgie: Difference between revisions

No edit summary
 
Line 70: Line 70:
== Derivation from mapping matrices ==
== Derivation from mapping matrices ==
{{Todo|inline=1| expand }}
{{Todo|inline=1| expand }}
Below is a script that finds the wedgie from a mapping matrix in [https://www.python.org/ Python], using [https://scipy.org/ Scipy].
<syntaxhighlight lang="python">
import itertools
import numpy as np
from scipy import linalg
def wedgie (breeds):
    combinations = itertools.combinations (range (breeds.shape[1]), breeds.shape[0])
    wedgie = np.array ([linalg.det (breeds[:, entry]) for entry in combinations])
    if wedgie[0] < 0:
        wedgie *= -1
    # convert to integer type if possible
    wedgie_rd = np.rint (wedgie)
    if np.allclose (wedgie, wedgie_rd, rtol = 0, atol = 1e-6):
        wedgie = wedgie_rd.astype (int)
       
    return wedgie
</syntaxhighlight>


== Derivation from edo joins ==
== Derivation from edo joins ==