2023-02-13 13:05:48 +01:00
|
|
|
def magmathis(A, B, text = False, prefix="", sufix=""):
|
2022-11-18 15:00:34 +01:00
|
|
|
"""Find decomposition of Z/p^2-module given by matrices A, B into indecomposables using magma.
|
|
|
|
If text = True, print the command for Magma. Else - return the output of Magma free."""
|
|
|
|
q = parent(A).base_ring().order()
|
2023-02-13 13:05:48 +01:00
|
|
|
p = q.factor()[0][0]
|
2022-11-18 15:00:34 +01:00
|
|
|
n = A.dimensions()[0]
|
|
|
|
A = str(list(A))
|
|
|
|
B = str(list(B))
|
|
|
|
A = A.replace("(", "")
|
|
|
|
A = A.replace(")", "")
|
|
|
|
B = B.replace("(", "")
|
|
|
|
B = B.replace(")", "")
|
2023-02-13 13:05:48 +01:00
|
|
|
result = prefix
|
|
|
|
if q != p:
|
|
|
|
result += "F<a> := GF(" + str(q) + ");"
|
|
|
|
result += "A := MatrixAlgebra<GF("+str(q) + "),"+ str(n) + "|"
|
2022-11-18 15:00:34 +01:00
|
|
|
result += A + "," + B
|
|
|
|
result += ">;"
|
|
|
|
result += "M := RModule(RSpace(GF("+str(q)+")," + str(n) + "), A);"
|
2023-02-13 13:05:48 +01:00
|
|
|
result += "L := IndecomposableSummands(M); L;"
|
|
|
|
result += "for i in [1 .. #L] do print(Generators(Action(L[i]))); end for;"
|
|
|
|
result += sufix
|
2022-11-18 15:00:34 +01:00
|
|
|
if text:
|
|
|
|
return result
|
2023-02-13 13:05:48 +01:00
|
|
|
return(magma_free(result))
|