On Jun 4, 2009, at 8:53 PM, Jason Grout wrote:

> Robert Bradshaw wrote:
>> On Jun 4, 2009, at 5:48 PM, Craig Citro wrote:
>>
>>>>> Should this be changed so that m.change_ring(R) always returns a
>>>>> copy?
>>>> Yes, I think so.
>>>>
>>> +1
>>
>> I'd say No. I think change_ring should be fast when it's already the
>> right ring, it shouldn't be used for making copies (unless
>> necessary). Perhaps it could take an optional copy parameter.
>
> How do you generally use the matrix after you call change_ring()?  It
> seems like the normal thing to do would be to change the matrix in  
> some
> way.  In that case, it is a huge bonus to have consistency between
> returning the original object and returning a copy.

I usually use change_ring on polynomials, after which I extract  
coefficients/find roots/factor/etc. It's also nice to change the ring  
to be over a fraction field (i.e. M.change_ring(M.base_ring 
().fraction_field())) before taking the echelon form.

In general I view X.change_ring(R) as shorthand for X.parent 
().change_ring(R)(X), and given a parent R, R(x) generally returns x  
if x is already an element of R.

- Robert



--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to