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

added OneMatrix for matrix expressions with only ones #16676

Merged
merged 2 commits into from Apr 18, 2019

Conversation

Upabjojr
Copy link
Contributor

References to other Issues or PRs

Brief description of what is fixed or changed

Other comments

Release Notes

  • matrices
    • Introduction of OneMatrix, a matrix symbol representing matrices of only 1 entries.

@sympy-bot
Copy link

sympy-bot commented Apr 17, 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
    • Introduction of OneMatrix, a matrix symbol representing matrices of only 1 entries. (#16676 by @Upabjojr)

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. -->

#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234". See
https://github.com/blog/1506-closing-issues-via-pull-requests . Please also
write a comment on that issue linking back to this pull request once it is
open. -->


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


#### Other comments


#### 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
  * Introduction of `OneMatrix`, a matrix symbol representing matrices of only 1 entries.
<!-- END RELEASE NOTES -->

Update

The release notes on the wiki have been updated.

Copy link
Member

@sylee957 sylee957 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.
But I think you may need to add to __init__.py, so that it can be loaded under sympy main module.


assert isinstance(A + U, Add)
# assert a*OneMatrix(n, 1) == a
# assert OneMatrix(n, 1)*a == a
Copy link
Member

@sylee957 sylee957 Apr 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would these commented-out tests be made more meaningful?

And I don't think that the matrix multiplication can be defined here, unless n is 1.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are wrong. I shall remove them.

U ** 2

U = OneMatrix(n, n)
assert U[1, 2] == 1
Copy link
Member

@sylee957 sylee957 Apr 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure that matrices with symbolic dimensions can have its elements defined in explicit coordinates

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ZeroMatrix behaves like this (always returns zero). There should be a bounds check, but I don't think this is important. If you access a matrix containing only one element, you're pretty sure you get that element.

@codecov
Copy link

codecov bot commented Apr 18, 2019

Codecov Report

Merging #16676 into master will increase coverage by 0.015%.
The diff coverage is 100%.

@@              Coverage Diff              @@
##            master    #16676       +/-   ##
=============================================
+ Coverage   73.825%   73.841%   +0.015%     
=============================================
  Files          619       619               
  Lines       159286    159311       +25     
  Branches     37386     37388        +2     
=============================================
+ Hits        117594    117637       +43     
+ Misses       36260     36239       -21     
- Partials      5432      5435        +3

@Upabjojr Upabjojr merged commit ce0fb63 into sympy:master Apr 18, 2019
@Upabjojr Upabjojr deleted the add_support_for_onematrix branch April 20, 2019 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants