ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 17 Jul 2019 17:49:28 +0200Matrix multiplication of sparse matrix with matrix over polynomial ringhttps://ask.sagemath.org/question/47196/matrix-multiplication-of-sparse-matrix-with-matrix-over-polynomial-ring/ Hi all,
I would like to know how to multiply the following matrices I have constructed in Sage. Here is my code for a toy example:
from scipy.sparse import csr_matrix
row = [0,0,1]
col = [0,1,1]
data = [1,-1,1]
A = csr_matrix((data,(row,col)),shape=(4,4))
R.<x,y> = PolynomialRing(QQ,2)
B = matrix(R,2,2,[1,x,1,y])
When I try to multiply the matrices using A.dot(B), I end up with the error: "No supported conversion for types: (dtype('int64'), dtype('O'))"
Is there a way I can multiply these matrices and yield an output that is a csr_matrix? (I suspect I would want to convert the entries of my A matrix to be the same data type, but I am unaware of how to do this)
Thank you for your time!
BarkWed, 17 Jul 2019 17:49:28 +0200https://ask.sagemath.org/question/47196/