Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Convert matrix expressions to Indexed #17299

Open
wants to merge 7 commits into
base: master
from

Conversation

@anpandey
Copy link
Contributor

commented Jul 30, 2019

Brief description of what is fixed or changed

Adds an as_indexed method that converts a matrix expression to its corresponding contraction using represented by Indexed objects, functioning as an inverse of from_index_summation.

>>> n, m = symbols('n m', integer=True)
>>> A = MatrixSymbol('A', n, m)
>>> B = MatrixSymbol('B', m, n)
>>> e = A*B
>>> e.as_indexed()
A[i, j]*B[j, k]

Release Notes

  • matrices
    • add as_indexed to convert matrix expressions to Indexed
@sympy-bot

This comment has been minimized.

Copy link

commented Jul 30, 2019

Hi, I am the SymPy bot (v147). I'm here to help you write a release notes entry. Please read the guide on how to write release notes.

Your release notes are in good order.

Here is what the release notes will look like:

  • matrices
    • add as_indexed to convert matrix expressions to Indexed (#17299 by @anpandey)

This will be added to https://github.com/sympy/sympy/wiki/Release-Notes-for-1.5.

Note: This comment will be updated with the latest check if you edit the pull request. You need to reload the page to see it.

Click here to see the pull request description that was parsed.

<!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->

#### Brief description of what is fixed or changed

Adds an `as_indexed` method that converts a matrix expression to its corresponding contraction using represented by `Indexed` objects, functioning as an inverse of `from_index_summation`.

```python
>>> n, m = symbols('n m', integer=True)
>>> A = MatrixSymbol('A', n, m)
>>> B = MatrixSymbol('B', m, n)
>>> e = A*B
>>> e.as_indexed()
A[i, j]*B[j, k]
```

#### Release Notes

<!-- Write the release notes for this release below. See
https://github.com/sympy/sympy/wiki/Writing-Release-Notes for more information
on how to write release notes. The bot will check your release notes
automatically to see if they are formatted correctly. -->

<!-- BEGIN RELEASE NOTES -->
* matrices
  * add `as_indexed` to convert matrix expressions to `Indexed`
<!-- END RELEASE NOTES -->

sympy/matrices/expressions/matexpr.py Outdated Show resolved Hide resolved
sympy/matrices/expressions/matexpr.py Outdated Show resolved Hide resolved
sympy/matrices/expressions/matexpr.py Outdated Show resolved Hide resolved
@codecov

This comment has been minimized.

Copy link

commented Aug 2, 2019

Codecov Report

Merging #17299 into master will increase coverage by 8.008%.
The diff coverage is 81.666%.

@@              Coverage Diff              @@
##            master    #17299       +/-   ##
=============================================
+ Coverage   66.629%   74.638%   +8.008%     
=============================================
  Files          626       628        +2     
  Lines       162402    162971      +569     
  Branches     38099     38245      +146     
=============================================
+ Hits        108208    121639    +13431     
+ Misses       48853     35945    -12908     
- Partials      5341      5387       +46

anpandey added some commits Aug 6, 2019

Change helper to return row and column Idx
This is needed because the helper might not return an `Indexed`
expression, which would make the indices would not be accessible.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants
You can’t perform that action at this time.