Re: [sage-devel] inplace transpose

2017-05-22 Thread Erik Bray
On Mon, May 22, 2017 at 4:01 PM, Jori Mäntysalo  wrote:
> On Mon, 22 May 2017, Vincent Delecroix wrote:
>
>> 1) add an option inplace=True/False. There is at least one such method in
>> Sage: the relabel method for graphs. The behavior is as follows:
>
>
> inplace is mentioned at
> http://doc.sagemath.org/html/en/developer/coding_basics.html#miscellanous-minor-things
>
> So yes, I think "inplace=True" should be preferred over "return_copy=False"
> or similar.
>
>> 2) Make a private inplace method mat._transpose_inplace()
>>
>> 3) Make a public inplace method mat.transpose_inplace()
>>
>> Any preference between 1), 2), 3) or a suggestion for something else is
>> welcome!
>
>
> I think 1 would be most natural.

Though I'd also add that something like 2) makes perfect sense as an
*implementation* detail.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] inplace transpose

2017-05-22 Thread Jori Mäntysalo

On Mon, 22 May 2017, Vincent Delecroix wrote:

1) add an option inplace=True/False. There is at least one such method in 
Sage: the relabel method for graphs. The behavior is as follows:


inplace is mentioned at 
http://doc.sagemath.org/html/en/developer/coding_basics.html#miscellanous-minor-things


So yes, I think "inplace=True" should be preferred over 
"return_copy=False" or similar.



2) Make a private inplace method mat._transpose_inplace()

3) Make a public inplace method mat.transpose_inplace()

Any preference between 1), 2), 3) or a suggestion for something else is 
welcome!


I think 1 would be most natural.

--
Jori Mäntysalo

Re: [sage-devel] inplace transpose

2017-05-22 Thread Thierry
Hi,

On Mon, May 22, 2017 at 02:35:43PM +0200, Vincent Delecroix wrote:
> Dear all,
> 
> I would like to have inplace version of transpose for matrices. For the
> echelon form we have methods mat.echelonize vs mat.echelon_form. However I
> do not see how to deal with transpose in the same way. I see three
> reasonable possibilities
> 
>  1) add an option inplace=True/False. There is at least one such method in
> Sage: the relabel method for graphs. The behavior is as follows:
> 
>   if inplace=True: returns a new graph
>   if inplace=False: modifies the graph inplace and does not return anything

Do you mean the converse ?

Ciao,
Thierry
 
> One can do the same with .transpose for matrices. However, this would be the
> first time in matrix code.
> 
> 2) Make a private inplace method mat._transpose_inplace()
> 
> 3) Make a public inplace method mat.transpose_inplace()
> 
> Any preference between 1), 2), 3) or a suggestion for something else is
> welcome!
> 
> Vincent
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sage-devel+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-devel@googlegroups.com.
> Visit this group at https://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] inplace transpose

2017-05-22 Thread Vincent Delecroix



On 22/05/2017 14:43, Erik Bray wrote:

On Mon, May 22, 2017 at 2:35 PM, Vincent Delecroix
<20100.delecr...@gmail.com> wrote:

Dear all,

I would like to have inplace version of transpose for matrices. For the
echelon form we have methods mat.echelonize vs mat.echelon_form. However I
do not see how to deal with transpose in the same way. I see three
reasonable possibilities

  1) add an option inplace=True/False. There is at least one such method in
Sage: the relabel method for graphs. The behavior is as follows:

   if inplace=True: returns a new graph
   if inplace=False: modifies the graph inplace and does not return anything


I like this, and there is some precedent for it elsewhere too.  But I
assume you meant this the other way around?


Indeed!


One can do the same with .transpose for matrices. However, this would be the
first time in matrix code.

2) Make a private inplace method mat._transpose_inplace()

3) Make a public inplace method mat.transpose_inplace()

Any preference between 1), 2), 3) or a suggestion for something else is
welcome!

Vincent

--
You received this message because you are subscribed to the Google Groups
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.




--
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] inplace transpose

2017-05-22 Thread Erik Bray
On Mon, May 22, 2017 at 2:35 PM, Vincent Delecroix
<20100.delecr...@gmail.com> wrote:
> Dear all,
>
> I would like to have inplace version of transpose for matrices. For the
> echelon form we have methods mat.echelonize vs mat.echelon_form. However I
> do not see how to deal with transpose in the same way. I see three
> reasonable possibilities
>
>  1) add an option inplace=True/False. There is at least one such method in
> Sage: the relabel method for graphs. The behavior is as follows:
>
>   if inplace=True: returns a new graph
>   if inplace=False: modifies the graph inplace and does not return anything

I like this, and there is some precedent for it elsewhere too.  But I
assume you meant this the other way around?

> One can do the same with .transpose for matrices. However, this would be the
> first time in matrix code.
>
> 2) Make a private inplace method mat._transpose_inplace()
>
> 3) Make a public inplace method mat.transpose_inplace()
>
> Any preference between 1), 2), 3) or a suggestion for something else is
> welcome!
>
> Vincent
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-devel+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-devel@googlegroups.com.
> Visit this group at https://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.