On Thu, Feb 4, 2016 at 3:47 PM, Francesco Bonazzi <[email protected]>
wrote:

>
>
> On Thursday, 4 February 2016 21:26:10 UTC+1, Aaron Meurer wrote:
>>
>>
>> The function approach sounds fine, but to me, it seems that you would
>> mainly want to override __mul__ and use that.
>>
>>
>
> Not sure about __mul__, when you apply __mul__ to two matrices you are
> performing a tensor product followed by a contraction of the central
> indices, that is
>
>    1. A[i, j], B[m, l] ===> A[i, j]*B[m, l]  (got a rank-4 array, matrix
>    is a rank-2 array)
>    2. A[i, j]*B[m, l] ===> Sum(A[i, k]*B[k, l], k)  (got back a rank-2
>    array by contracting indices *j* and *m*)
>
> I don't want to override __mul__ because the behavior with matrices is
> different.
>

It's worth pointing out that Python 3.5 has the new __matmul__ operator (A@B).
You're the best one to decide what these operators should do, and whether
not defining them is too much of an inconvenience. I would warn against
using non-standard operators (like the logic operators &, |, and ^) for
multiplication, since they have different precedence rules with other
operators (like +) than what you would generally expect.

Aaron Meurer


>
>
>>
>>> Can we solve this issue quickly before the release process for version
>>> 1.0 starts?
>>>
>>
>> Is this going to be an API change from what's in master. I plan to start
>> the release branch *very soon*.
>>
>>
>
> No API changes. Just a small bug fix in the PR (unrelated to new
> functionality).
>
>
>>
>>> *ISSUE 2:*
>>>
>>
>> Is this the same issue as https://github.com/sympy/sympy/issues/5858?
>>
>>
> Had a quick look at that matrix cookbook in the link. The examples I
> verified appear to be the same of my proposal, and to Wolfram Mathematica's
> API, but better doublecheck.
>
> Anyway, I would temporarily add it to the N-dim array only. Extending this
> functionality to matrices should be procrastinated.
>
> --
> 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 https://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/1e94aac1-6c07-4a24-9a3d-83e501bd4037%40googlegroups.com
> <https://groups.google.com/d/msgid/sympy/1e94aac1-6c07-4a24-9a3d-83e501bd4037%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 https://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAKgW%3D6JgXgvk60HCxerDt-hEv-be%3DcxcZRykbHjEywEfYXwbMg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to