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

Expanded coefficients and Added broadcasting for * and / #17

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Vizia128
Copy link

Added broadcasting to allow for inertial maps in PGA physics.

Base.broadcasted(::typeof(*), a::MultiVector, b::MultiVector)::MultiVector
Base.broadcasted(::typeof(/), a::MultiVector, b::MultiVector)::MultiVector

Added the ability to grab a tuple or vector of coefficients from a MultiVector. This allows for grabbing the coefficients of a sub algebra.

coefficients(mv::MultiVector, idxs::Union{NTuple, AbstractVector})

Fixed a bug where isapprox(0alg.e1, 0alg.e1) returns false.

@ATell-SoundTheory
Copy link
Owner

Thank you very much for your contribution. I've done a quick code review and I have a few minor issues:

  • Documentation string says the function name is coefficient, but the code says coefficients.
  • You do not specify the value type for the vector or tuple handed into 'coefficients', but you're then assuming it's an index type and not a symbol. Since the coefficient function you're generalizing handles both, you should, too. You are also relying on more internals than you have to. You should probably just forward the array/tuple to the already defined coefficient functions with a map.
  • I like the way you've constructed the submitted unit tests. However, the broadcast test is rather hard to maintain and quite elaborate. Since you want to replicate component-wise operations, why do you not construct the expected outcome from known component-wise operations in Julia instead of spelling them out with numeric literals?

If you address these issues there shouldn't be anything in the way of merging your changes.

@ATell-SoundTheory ATell-SoundTheory self-assigned this Jul 24, 2023
@Vizia128 Vizia128 force-pushed the master branch 3 times, most recently from c14caf6 to ee19ae0 Compare July 25, 2023 03:32
@Vizia128
Copy link
Author

Thank you for the feedback. I think I have addressed the issues.

  • Fixed docstring of coefficients to be plural
  • I added support for inputting vectors or ntuples of symbols into coefficients
  • Simplified the unit tests and separated the .* and ./ tests
  • Added an assertion for mv1 ./ mv2 to ensure that mv1's base indices are a subset of mv2's

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants