Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Cannot mulyiply polynomial by matrix when ordering is explicitly specified

Consider the following code:

sage: F = GF(17)
sage: R.<x, y> = PolynomialRing(F)
sage: MS = MatrixSpace(F, 5, 5)
sage: x, y = R.gens()
sage: MS.random_element() * x  # Good.
[   0   -x -8*x  3*x  6*x]
[ 5*x  4*x -5*x  7*x  2*x]
[ 7*x -3*x    0  7*x -7*x]
[-2*x  2*x  7*x  4*x -2*x]
[-4*x  4*x    x  4*x    x]
sage: MS.random_element() * y  # Good.
[ 8*y -3*y  5*y  7*y  8*y]
[ 3*y  4*y -3*y -7*y  3*y]
[-3*y   -y  4*y  4*y -7*y]
[ 5*y -6*y -4*y -8*y -7*y]
[ 2*y  5*y -4*y -3*y -4*y]
# So far, so good.  Now watch.
sage: R.<x, y> = PolynomialRing(F, order='lex')
sage: x, y = R.gens()
sage: MS.random_element() * x
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-12-928a7b216caf> in <module>()
----> 1 MS.random_element() * x

sage/structure/element.pyx in sage.structure.element.Matrix.__mul__ (/build/sagemath/src/sage-6.9/src/build/cythonized/sage/structure/element.c:23250)()

sage/structure/coerce.pyx in sage.structure.coerce.CoercionModel_cache_maps.bin_op (/build/sagemath/src/sage-6.9/src/build/cythonized/sage/structure/coerce.c:9739)()

TypeError: unsupported operand parent(s) for '*': 'Full MatrixSpace of 5 by 4 dense matrices over Finite Field of size 17' and 'Multivariate Polynomial Ring in x, y over Finite Field of size 17'

Does anybody know if this is intentional? In my opinion it shouldn't happen because lex ordering is already the implicit default. The bug does not seem to occur with degrevlex ordering, which is also weird.

Cannot mulyiply polynomial by matrix when ordering is explicitly specified

Consider the following code:

sage: F = GF(17)
sage: R.<x, y> = PolynomialRing(F)
sage: MS = MatrixSpace(F, 5, 5)
4)
sage: x, y = R.gens()
sage: MS.random_element() * x  # Good.
[   0   -x -8*x  3*x  6*x]
[ 5*x  4*x -5*x  7*x  2*x]
[ 7*x -3*x    0  7*x -7*x]
[-2*x  2*x  7*x  4*x -2*x]
[-4*x  4*x    x  4*x    x]
sage: MS.random_element() * y  # Good.
[ 8*y -3*y  5*y  7*y  8*y]
[ 3*y  4*y -3*y -7*y  3*y]
[-3*y   -y  4*y  4*y -7*y]
[ 5*y -6*y -4*y -8*y -7*y]
[ 2*y  5*y -4*y -3*y -4*y]
# So far, so good.  Now watch.
sage: R.<x, y> = PolynomialRing(F, order='lex')
sage: x, y = R.gens()
sage: MS.random_element() * x
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-12-928a7b216caf> in <module>()
----> 1 MS.random_element() * x

sage/structure/element.pyx in sage.structure.element.Matrix.__mul__ (/build/sagemath/src/sage-6.9/src/build/cythonized/sage/structure/element.c:23250)()

sage/structure/coerce.pyx in sage.structure.coerce.CoercionModel_cache_maps.bin_op (/build/sagemath/src/sage-6.9/src/build/cythonized/sage/structure/coerce.c:9739)()

TypeError: unsupported operand parent(s) for '*': 'Full MatrixSpace of 5 by 4 dense matrices over Finite Field of size 17' and 'Multivariate Polynomial Ring in x, y over Finite Field of size 17'

Does anybody know if this is intentional? In my opinion it shouldn't happen because lex ordering is already the implicit default. The bug does not seem to occur with degrevlex ordering, which is also weird.

Cannot mulyiply polynomial by matrix when ordering is explicitly specified

Consider the following code:

sage: F = GF(17)
sage: R.<x, y> = PolynomialRing(F)
sage: MS = MatrixSpace(F, 5, 4)
sage: x, y = R.gens()
sage: MS.random_element() * x  # Good.
sage: MS.random_element() * y  # Good.
# So far, so good.  Now watch.
sage: R.<x, y> = PolynomialRing(F, order='lex')
sage: x, y = R.gens()
sage: MS.random_element() * x
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-12-928a7b216caf> in <module>()
----> 1 MS.random_element() * x

sage/structure/element.pyx in sage.structure.element.Matrix.__mul__ (/build/sagemath/src/sage-6.9/src/build/cythonized/sage/structure/element.c:23250)()

sage/structure/coerce.pyx in sage.structure.coerce.CoercionModel_cache_maps.bin_op (/build/sagemath/src/sage-6.9/src/build/cythonized/sage/structure/coerce.c:9739)()

TypeError: unsupported operand parent(s) for '*': 'Full MatrixSpace of 5 by 4 dense matrices over Finite Field of size 17' and 'Multivariate Polynomial Ring in x, y over Finite Field of size 17'

Does anybody know if this is intentional? In my opinion it shouldn't happen because lex ordering is already the implicit default. The bug does not seem to occur with degrevlex ordering, which is also weird.weird. The bug also does not occur with square matrices, which is even weirder.

SageMath Version 6.9, Release Date: 2015-10-10

Cannot mulyiply polynomial by matrix when ordering is explicitly specified

Consider the following code:

sage: F = GF(17)
sage: R.<x, y> = PolynomialRing(F)
sage: MS = MatrixSpace(F, 5, 4)
sage: x, y = R.gens()
sage: MS.random_element() * x  # Good.
sage: MS.random_element() * y  # Good.
# So far, so good.  Now watch.
sage: R.<x, y> = PolynomialRing(F, order='lex')
sage: x, y = R.gens()
sage: MS.random_element() * x
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-12-928a7b216caf> in <module>()
----> 1 MS.random_element() * x

sage/structure/element.pyx in sage.structure.element.Matrix.__mul__ (/build/sagemath/src/sage-6.9/src/build/cythonized/sage/structure/element.c:23250)()

sage/structure/coerce.pyx in sage.structure.coerce.CoercionModel_cache_maps.bin_op (/build/sagemath/src/sage-6.9/src/build/cythonized/sage/structure/coerce.c:9739)()

TypeError: unsupported operand parent(s) for '*': 'Full MatrixSpace of 5 by 4 dense matrices over Finite Field of size 17' and 'Multivariate Polynomial Ring in x, y over Finite Field of size 17'

Does anybody know if this is intentional? In my opinion it shouldn't happen because lex ordering is already the implicit default. The bug does not seem to occur with degrevlex ordering, which is also weird. The bug also does not occur with square matrices, which is even weirder.

SageMath Version 6.9, Release Date: 2015-10-10