Ask Your Question

Revision history [back]

tensor_product of matrices over cyclotomic field

Beginner question: I have created some matrices over a cyclotomic field and attempted to compute some of their tensor products:

N = 3
k.<w> = CyclotomicField(N)
Z = diagonal_matrix(k,N,[w^j for j in range(0,N)])
X = matrix(k,N,N,[1 if (i%N - floor(i/N)) % N == N-1 else 0 for i in range(0,N*N)])
I = identity_matrix(k,N)
I.tensor_product(X)
X.tensor_product(I)
Z.tensor_product(I)
Z.tensor_product(X)

#I.tensor_product(Z)
#X.tensor_product(Z)

If I uncomment either of the last two lines I get

AttributeError: 'sage.matrix.matrix_generic_sparse.Matrix_generic_sparse' object has no attribute '_rational_matrix'

It seems my code is working when both matrices in the tensor product are rational or when self is non-rational, but not when self is rational and the argument is non-rational. Should I be somehow instructing sagemath to regard self as a matrix over the cyclotomic field?

tensor_product of matrices over cyclotomic field

Beginner question: I have created some matrices over a cyclotomic field and attempted to compute some of their tensor products:

N = 3
k.<w> = CyclotomicField(N)
Z = diagonal_matrix(k,N,[w^j for j in range(0,N)])
X = matrix(k,N,N,[1 if (i%N - floor(i/N)) % N == N-1 else 0 for i in range(0,N*N)])
I = identity_matrix(k,N)
I.tensor_product(X)
X.tensor_product(I)
Z.tensor_product(I)
Z.tensor_product(X)

#I.tensor_product(Z)
#X.tensor_product(Z)

If I uncomment either of the last two lines I get

AttributeError: 'sage.matrix.matrix_generic_sparse.Matrix_generic_sparse' object has no attribute '_rational_matrix'

It seems my code is working when both matrices in the tensor product are rational or when self is non-rational, but not when self is rational and the argument is non-rational. Should I be somehow instructing sagemath to regard self as a matrix over the cyclotomic field?