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

Avoid using `dot_mode` to determine which dot product to call #61

Merged
merged 1 commit into from Nov 21, 2019

Conversation

@eric-wieser
Copy link
Contributor

eric-wieser commented Nov 21, 2019

This change leaves the behavior of Ga.dot_mode and Ga.dot alone, but replaces all the internal uses of these variables with new left_contract, right_contract, and hestenes_dot methods.

Passing the mode as an argument instead means that this code becomes (more) threadsafe.

r"""
Let :math:`A = a + A'` and :math:`B = b + B'` where :math:`a` and
:math:`b` are the scalar parts of :math:`A` and :math:`B`, and
:math:`A'` and :math:`B'` are the remaining parts of :math:`A` and
:math:`B`. Then we have:
.. math::
(a+A') \rfloor (b+B') &= a(b+B') + A' \rfloor B' \\
(a+A') \lfloor (b+B') &= b(a+A') + A' \lfloor B'
We use these relations to reduce :math:`A \rfloor B` (``A<B``) and
:math:`A \lfloor B` (``A>B``).
"""
Comment on lines +1289 to +1303

This comment has been minimized.

Copy link
@eric-wieser

eric-wieser Nov 21, 2019

Author Contributor

This isn't a real docstring anyway it seems - it describes implementation details, which don't need to appear on readthedocs

This comment has been minimized.

Copy link
@utensil
@eric-wieser eric-wieser force-pushed the eric-wieser:avoid-dot_mode branch from 4b6d314 to a893b52 Nov 21, 2019
galgebra/ga.py Outdated Show resolved Hide resolved
@eric-wieser eric-wieser force-pushed the eric-wieser:avoid-dot_mode branch from a893b52 to 59cd256 Nov 21, 2019
def hestenes_dot(self, A, B):
r""" compute the hestenes dot product, :math:`A \bullet B` """
return self._dot(A, B, mode='|')

def left_contract(self, A, B):
r""" compute the left contraction, :math:`A \rfloor B` """
return self._dot(A, B, mode='<')

def right_contract(self, A, B):
r""" compute the right contraction, :math:`A \lfloor B` """
return self._dot(A, B, mode='>')
Comment on lines +1320 to +1331

This comment has been minimized.

Copy link
@eric-wieser

eric-wieser Nov 21, 2019

Author Contributor

Names are up for debate here, although it probably doesn't matter since any actual user would use operator overloads on Mv

This comment has been minimized.

Copy link
@utensil

utensil Nov 21, 2019

Member

Shouldn't they be private then if they're not part of the API?

This comment has been minimized.

Copy link
@eric-wieser

eric-wieser Nov 21, 2019

Author Contributor

They're part of the public API of Ga just like dot is, but chances are no one is using that API, and people are using the Mv API

This change leaves the behavior of `Ga.dot_mode` and `Ga.dot` alone, but replaces all the internal uses of these variables with new `left_contract`, `right_contract`, and `hestenes_dot` methods.

Passing the mode as an argument instead means that this code becomes (more) threadsafe.
@codecov

This comment has been minimized.

Copy link

codecov bot commented Nov 21, 2019

Codecov Report

Merging #61 into master will increase coverage by 0.06%.
The diff coverage is 78.12%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master     #61      +/-   ##
=========================================
+ Coverage   66.63%   66.7%   +0.06%     
=========================================
  Files           8       8              
  Lines        4892    4890       -2     
=========================================
+ Hits         3260    3262       +2     
+ Misses       1632    1628       -4
Impacted Files Coverage Δ
galgebra/mv.py 61.7% <0%> (-0.07%) ⬇️
galgebra/lt.py 43% <100%> (-0.1%) ⬇️
galgebra/ga.py 74.73% <80%> (+0.4%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6bbfd33...e51b819. Read the comment docs.

@eric-wieser eric-wieser force-pushed the eric-wieser:avoid-dot_mode branch from 59cd256 to e51b819 Nov 21, 2019
@utensil utensil merged commit a2a34f5 into pygae:master Nov 21, 2019
5 checks passed
5 checks passed
Travis CI - Pull Request Build Passed
Details
codebeat 6 issues resolved and 5 introduced
Details
codecov/patch 78.12% of diff hit (target 66.63%)
Details
codecov/project 66.7% (+0.06%) compared to 6bbfd33
Details
continuous-documentation/read-the-docs Read the Docs build succeeded!
Details
@eric-wieser eric-wieser deleted the eric-wieser:avoid-dot_mode branch Nov 26, 2019
@utensil utensil added this to the 0.4.5 milestone Nov 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.