Constrained tuning: Difference between revisions
m FloraC moved page CTE tuning to Constrained tuning: I've reworked it to focus on the technique than CTE itself |
Update the code and +some actually useful properties to TOCTE |
||
| Line 23: | Line 23: | ||
== Computation == | == Computation == | ||
As a standard optimization problem, numerous algorithms exist to solve it, such as [[Wikipedia: Sequential quadratic programming|sequential quadratic programming]], to name one. [[Flora Canou]]'s [https://github.com/FloraCanou/temperament_evaluator/blob/ | As a standard optimization problem, numerous algorithms exist to solve it, such as [[Wikipedia: Sequential quadratic programming|sequential quadratic programming]], to name one. [[Flora Canou]]'s [https://github.com/FloraCanou/temperament_evaluator/blob/bbe4d6b86f099117263824574ef408ffe3c92e95/te_optimizer_legacy.py tuning optimizer] is such an implementation in [https://www.python.org Python]. Note: it depends on [https://scipy.org/ Scipy]. | ||
{{Databox| Code | | {{Databox| Code | | ||
<syntaxhighlight lang="python"> | <syntaxhighlight lang="python"> | ||
# © 2020-2022 Flora Canou | Version 0.21. | # © 2020-2022 Flora Canou | Version 0.21.3 | ||
# This work is licensed under the GNU General Public License version 3. | # This work is licensed under the GNU General Public License version 3. | ||
| Line 71: | Line 71: | ||
def weightskewed (main, subgroup, wtype = "tenney", skew = 0, order = 2): | def weightskewed (main, subgroup, wtype = "tenney", skew = 0, order = 2): | ||
return main @ get_weight (subgroup, wtype) @ get_skew (subgroup, skew, order) | return main @ get_weight (subgroup, wtype) @ get_skew (subgroup, skew, order) | ||
def error (gen, map, jip, order): | def error (gen, map, jip, order): | ||
| Line 82: | Line 80: | ||
jip = np.log2 (subgroup)*SCALAR | jip = np.log2 (subgroup)*SCALAR | ||
map_wx = | map_wx = weightskewed (map, subgroup, wtype, skew, order) | ||
jip_wx = | jip_wx = weightskewed (jip, subgroup, wtype, skew, order) | ||
if order == 2 and cons_monzo_list is None: #te with no constraints, simply use lstsq for better performance | if order == 2 and cons_monzo_list is None: #te with no constraints, simply use lstsq for better performance | ||
res = linalg.lstsq (map_w.T, jip_wx) | res = linalg.lstsq (map_w.T, jip_wx) | ||
| Line 179: | Line 177: | ||
== Special constraint == | == Special constraint == | ||
The special eigenmonzo WXj | The special eigenmonzo WXj, where j is the all-ones monzo, has the effect of removing the weight-skewed tuning bias. This eigenmonzo is actually proportional to the monzo of the extra dimension introduced by the skew. In other words, it forces the extra dimension to be pure, and therefore, the skew will have no effect with this constrained tuning. | ||
It can be regarded as a distinct optimum, the '''TOCTE tuning''' ('''Tenney ones constrained Tenney-Euclidean tuning'''). | It can be regarded as a distinct optimum. In the case of Tenney weighting, it is the '''TOCTE tuning''' ('''Tenney ones constrained Tenney-Euclidean tuning'''). | ||
=== For equal temperaments === | === For equal temperaments === | ||