Yes, that looks like a bug. By the way, ones((0, 1)) is deprecated. Just use ones(0, 1).
Aaron Meurer On Sun, Nov 10, 2013 at 12:36 PM, someone <[email protected]> wrote: > Hi, > > I found a corner case where matrix addition does NOT > preserve matrix shape. Example: > > In [13]: A = ones((0,1)) > > In [14]: B = ones((0,1)) > > In [15]: A > Out[15]: Matrix(0, 1, []) > > In [16]: B > Out[16]: Matrix(0, 1, []) > > In [17]: A+B > Out[17]: Matrix(0, 0, []) > > While the other way round it works: > > In [18]: At = ones((1,0)) > > In [19]: Bt = ones((1,0)) > > In [20]: At > Out[20]: Matrix(1, 0, []) > > In [21]: Bt > Out[21]: Matrix(1, 0, []) > > In [22]: At + Bt > Out[22]: Matrix(1, 0, []) > > It might seem that matrices with 0 rows or columns are > some strange things. But they are not and often occur > as corner cases in more general algorithms. Hence correct > handling is indeed important. > > > -- Raoul > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/sympy. > For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sympy. For more options, visit https://groups.google.com/groups/opt_out.
