Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

similar/zero can still generate matrices of the wrong type #1045

Closed
wbhart opened this issue Apr 19, 2021 · 5 comments
Closed

similar/zero can still generate matrices of the wrong type #1045

wbhart opened this issue Apr 19, 2021 · 5 comments

Comments

@wbhart
Copy link
Contributor

wbhart commented Apr 19, 2021

julia> using Nemo

julia> M = matrix(QQ, [1 2; 3 4])
[1   2]
[3   4]

julia> typeof(M)
fmpq_mat

julia> N = similar(M, ZZ)
[0 0]
[0 0]

julia> typeof(N)
AbstractAlgebra.Generic.MatSpaceElem{fmpz}

I think the Nemo version of similar has to do the coercion into the new ring itself, rather than rely on AbstractAlgebra to do it, as the latter will always generate a generic matrix.

@wbhart
Copy link
Contributor Author

wbhart commented Apr 19, 2021

Or better yet it should ignore the ring of the first argument and look at the type of the Ring argument instead.

@wbhart
Copy link
Contributor Author

wbhart commented Apr 19, 2021

You guys don't define custom polynomial types that don't use generic polynomials in Hecke do you?

@thofma
Copy link
Member

thofma commented Apr 21, 2021

No.

@thofma
Copy link
Member

thofma commented Apr 21, 2021

(And I agree with your conclusion.)

@wbhart
Copy link
Contributor Author

wbhart commented Apr 21, 2021

Apparently we decided in #651 that this was desired behaviour, so as to not break deepcopy and related things.

In fact, the regression test breaks if I make the change that I think makes sense. So I'm going to leave this one alone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants