why does matrix have copyin_matrix and copyin_list when one can do that with slices?

11 views
Skip to first unread message

krastano...@gmail.com

unread,
May 12, 2012, 7:41:50 AM5/12/12
to sy...@googlegroups.com
One can do this:

In [20]: a = Matrix([1,2,3])

In [21]: a[0:1,0]=[5]

In [22]: a
Out[22]:

⎡5⎤
⎢ ⎥
⎢2⎥
⎢ ⎥
⎣3⎦

In [23]: a[0:2,0]=[10,20]

In [24]: a
Out[24]:

⎡10⎤
⎢ ⎥
⎢20⎥
⎢ ⎥
⎣3 ⎦


And also this:
In [31]: a = eye(3)

In [32]: a[0:2,0:2] = 3*eye(2)

In [33]: a
Out[33]:

⎡3 0 0⎤
⎢ ⎥
⎢0 3 0⎥
⎢ ⎥
⎣0 0 1⎦


And the __setitem__ method is not using any code from copyin_*. Is
this duplication of code and generally duplication of functionality?

krastano...@gmail.com

unread,
May 12, 2012, 10:44:58 AM5/12/12
to sy...@googlegroups.com
Actually __setitem__ uses these. Does It make sense to make them start
with an "_"?

Matthew Rocklin

unread,
May 12, 2012, 10:55:56 AM5/12/12
to sy...@googlegroups.com
A quick grep shows that they're not used anywhere outside of matrices.py. 
Making them private sounds good to me. 

Is there any chance we're breaking someone's code downstream? Perhaps the old names should remain but be deprecated. 

On Sat, May 12, 2012 at 9:44 AM, krastano...@gmail.com <krastano...@gmail.com> wrote:
Actually __setitem__ uses these. Does It make sense to make them start
with an "_"?

--
You received this message because you are subscribed to the Google Groups "sympy" group.
To post to this group, send email to sy...@googlegroups.com.
To unsubscribe from this group, send email to sympy+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sympy?hl=en.


Vinzent Steinberg

unread,
May 16, 2012, 2:02:24 PM5/16/12
to sy...@googlegroups.com
Am Samstag, 12. Mai 2012 16:55:56 UTC+2 schrieb Matthew:
A quick grep shows that they're not used anywhere outside of matrices.py. 
Making them private sounds good to me. 

Is there any chance we're breaking someone's code downstream? Perhaps the old names should remain but be deprecated. 

On Sat, May 12, 2012 at 9:44 AM, Stefan wrote:
Actually __setitem__ uses these. Does It make sense to make them start
with an "_"?

I think these methods are just older than the slicing syntax. The matrix interface could indeed need some cleaning up.

Vinzent
 

Aaron Meurer

unread,
Jun 14, 2012, 7:40:53 PM6/14/12
to sy...@googlegroups.com
+1 for deprecating them. 

Aaron Meurer
--
You received this message because you are subscribed to the Google Groups "sympy" group.
To view this discussion on the web visit https://groups.google.com/d/msg/sympy/-/utgwPEfn8tcJ.

To post to this group, send email to sy...@googlegroups.com.
To unsubscribe from this group, send email to sympy+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sympy?hl=en.


--
Sent from my iPad.
Reply all
Reply to author
Forward
0 new messages