Skip to content

Using the Matrix/Vector Constructor does not work as expected with Polynomial Rings #6643

Open

Description

@GalaxyCo

This issue might be more of a design decision than a bug report, however in my opinion it should work to be able to create a Matrix/Vector with a Polynomial Ring as the Ring from a list/Matrix/Vector. This is the issue I ran into and discussed with @ThomasBreuer

gap> r := PolynomialRing(GF(4), 1);
GF(2^2)[x_1]
gap> Matrix(IsPlistMatrixRep, r, [[Z(4)]]);
Error, the elements in <list> must lie in <basedomain>
Stack trace:
*[1] Error( "the elements in <list> must lie in <basedomain>" );
   @ /home/peter/gap/gap/lib/matobjplist.gi:78
 [2] MakeIsPlistVectorRep( basedomain, PlainListCopy( list ), true )
   @ /home/peter/gap/gap/lib/matobjplist.gi:166
 [3] method( req1, req2, req3 )
   @ /home/peter/gap/gap/lib/methsel.g:231
 [4] NewVector( filterVectors, basedomain, list[i] )
   @ /home/peter/gap/gap/lib/matobjplist.gi:201
 [5] method( req1, req2, req3, req4 )
   @ /home/peter/gap/gap/lib/methsel.g:254
...  at *stdin*:29
you can enter 'quit;' to quit to outer loop, or
you can enter 'return;' to continue

and

gap> Vector(r, [Z(4)]);
Error, the elements in <list> must lie in <basedomain>
Stack trace:
*[1] Error( "the elements in <list> must lie in <basedomain>" );
   @ /home/peter/gap/gap/lib/matobjplist.gi:78
 [2] MakeIsPlistVectorRep( basedomain, PlainListCopy( list ), true )
   @ /home/peter/gap/gap/lib/matobjplist.gi:166
 [3] method( req1, req2, req3 )
   @ /home/peter/gap/gap/lib/methsel.g:231
 [4] NewVector( DefaultVectorRepForBaseDomain( R ), R, l )
   @ /home/peter/gap/gap/lib/matobj.gi:209
<function "Vector method">( <arguments> )
 called from read-eval loop at *stdin*:36
you can enter 'quit;' to quit to outer loop, or
you can enter 'return;' to continue

This issue is probably caused by the following.

gap> Z(4) in r;
false

I would argue that using the constructors Matrix/Vector as above should be allowed, as the following also works:

gap> One(r);
Z(2)^0
gap> One(r) * Z(4);
Z(2^2)
gap> One(r) * Z(4) in r;
true
gap> One(r) * Z(4) = Z(4);
false

Hence it also works to multiply Matrices consisting of lists within lists with elements from the polynomial ring and so forth.

gap> a := [[Z(4)]]*One(r);
[ [ Z(2^2) ] ]
gap> Matrix(IsPlistMatrixRep, r, a);
<1x1-matrix over PolynomialRing( GF(2^2), ["x_1"] )>

Creating the matrix object like this feels like a hack, I think using the constructor should be the inteded solution.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions