Defactoring algorithms: Difference between revisions
Cmloegcmluin (talk | contribs) finding the greatest factor |
Cmloegcmluin (talk | contribs) avoid using the term "normalize" where "put into normal form" can be used instead, to avoid conflict with other notions of normalization |
||
| Line 130: | Line 130: | ||
Almost done! Except Gene not only defactors, he also calls for HNF, as we would, to achieve canonical (unique ID) form. | Almost done! Except Gene not only defactors, he also calls for HNF, as we would, to achieve canonical (unique ID) form. | ||
<nowiki> | <nowiki>normalForm[m_] := Last[HermiteDecomposition[m]]</nowiki> | ||
Similar to the Smith Normal Form, we do a decomposition, which gives you the normal form plus some other bonus results. In this case we actually want the normal form itself, and it happens to be the last element in the result list. So putting it all together, we defactor and then | Similar to the Smith Normal Form, we do a decomposition, which gives you the normal form plus some other bonus results. In this case we actually want the normal form itself, and it happens to be the last element in the result list. So putting it all together, we defactor and then put into normal form: | ||
<nowiki>rightReducingMatrix[m_] := Last[SmithDecomposition[m]]; | <nowiki>rightReducingMatrix[m_] := Last[SmithDecomposition[m]]; | ||
smithDefactor[m_] := Take[Inverse[rightReducingMatrix[m]], MatrixRank[m]]; | smithDefactor[m_] := Take[Inverse[rightReducingMatrix[m]], MatrixRank[m]]; | ||
normalForm[m_] := Last[HermiteDecomposition[m]]; | |||
m = {{12,19,28,34},{26,41,60,72}}; | m = {{12,19,28,34},{26,41,60,72}}; | ||
normalForm[smithDefactor[m]]</nowiki> | |||
<nowiki>→ {{1,0,-4,-13},{0,1,4,10}}</nowiki> | <nowiki>→ {{1,0,-4,-13},{0,1,4,10}}</nowiki> | ||
And that result matches what Gene finds in that xen wiki article. Defactoring and | And that result matches what Gene finds in that xen wiki article. Defactoring and putting into normal form is equivalent to canonicalization. | ||
== Precedent: Pernet-Stein defactoring == | == Precedent: Pernet-Stein defactoring == | ||