Generator preimage: Difference between revisions

Cmloegcmluin (talk | contribs)
leaving original art by Gene alone, I've revised the material I've added in the past (a brief intro, explanations of algorithms, examples, implementations) to use nomenclature I feel ls less confusing and ambiguous
Cmloegcmluin (talk | contribs)
fix Wolfram method names
Line 192: Line 192:
=== Wolfram Language implementation ===
=== Wolfram Language implementation ===


{{Databox|jiT[]|
{{Databox|getGpt[]|
<syntaxhighlight lang="mathematica">
<syntaxhighlight lang="mathematica">
jiT[m_] := Module[{decomp, left, snf, right},
getGpt[m_] := Module[{decomp, left, snf, right},
   decomp = SmithDecomposition[m];
   decomp = SmithDecomposition[m];
   left = Part[decomp, 1];
   left = Part[decomp, 1];
Line 396: Line 396:
=== Wolfram Language implementation ===
=== Wolfram Language implementation ===


{{Databox|jiT[]|
{{Databox|getGpt[]|
<syntaxhighlight lang="mathematica">
<syntaxhighlight lang="mathematica">
jiTEntry[u_, v_, c_] := Module[{base},
getGptEntry[u_, v_, c_] := Module[{base},
   base = Transpose[columnHermiteDefactor[Join[{u}, Transpose[c]]]];
   base = Transpose[columnHermiteDefactor[Join[{u}, Transpose[c]]]];


Line 404: Line 404:
];
];


jiT[m_] := Module[{c},
getGptSmithMethod[m_] := Module[{c},
   c = nullSpaceBasis[m];
   c = nullSpaceBasis[m];
   Transpose[MapThread[jiTEntry[#1, #1, c]&, {Map[multByLcd,Transpose[PseudoInverse[m]]],m}]]
   Transpose[MapThread[getGptEntry[#1, #1, c]&, {Map[multByLcd,Transpose[PseudoInverse[m]]],m}]]
];
];


jiT[{{1,2,4},{0,-1,-4}}] (* {{1,2},{0,-1},{0,0}} = 2/1 and 4/3 as expected *)
getGptSmithMethod[{{1,2,4},{0,-1,-4}}] (* {{1,2},{0,-1},{0,0}} = 2/1 and 4/3 as expected *)
</syntaxhighlight>}}
</syntaxhighlight>}}