DeRhamComputation/sage/as_covers/as_auxilliary.sage

20 lines
731 B
Python

def magmathis(A, B, text = False):
"""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()
n = A.dimensions()[0]
A = str(list(A))
B = str(list(B))
A = A.replace("(", "")
A = A.replace(")", "")
B = B.replace("(", "")
B = B.replace(")", "")
result = "A := MatrixAlgebra<GF("+str(q) + "),"+ str(n) + "|"
result += A + "," + B
result += ">;"
result += "M := RModule(RSpace(GF("+str(q)+")," + str(n) + "), A);"
result += "IndecomposableSummands(M);"
if text:
return result
print(magma_free(result))