sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.39k stars 472 forks source link

vectors and matrices should support the whole division operation `//` by a scalar when their base rings do #38637

Open maxale opened 1 month ago

maxale commented 1 month ago

Problem Description

sage: v = vector(ZZ,[1,2,3])
sage: v // 2
[...]
TypeError: unsupported operand parent(s) for //: 'Ambient free module of rank 3 over the principal ideal domain Integer Ring' and 'Integer Ring'

Proposed Solution

Vectors / matrices should rely on support of that operation in the base ring. That is, v // 2 should be equivalent to

sage: v.apply_map(lambda t: t // 2)
(0, 1, 1)

Alternatives Considered

N/A

Additional Information

No response

Is there an existing issue for this?

samkitshah1262 commented 3 weeks ago

@mkoeppe @maxale Is this issue up for the taking?

maxale commented 3 weeks ago

@samkitshah1262 yes, you are welcome to step in.

samkitshah1262 commented 2 weeks ago

@maxale @mkoeppe I have set up sage , but since this is my first time contributing , can you please guide me on how to tackle this issue , or what could be a good starting point? Thank you!

maxale commented 2 weeks ago

@samkitshah1262 Check out this FAQ: https://doc.sagemath.org/html/en/faq/faq-contribute.html