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] Power manifold #40

Merged
merged 27 commits into from
Nov 16, 2019
Merged

[WIP] Power manifold #40

merged 27 commits into from
Nov 16, 2019

Conversation

mateuszbaran
Copy link
Member

I've made an initial part of the power manifold. I've written HybridArrays.jl to make them faster but the current version is not benchmarked enough to be sure how much it helps but I'm optimistic about it.

@sethaxen
Copy link
Member

Awesome!! I'm excited to look at this further. Should be able to review near the end of this week.

@sethaxen sethaxen self-requested a review October 15, 2019 05:03
@codecov
Copy link

codecov bot commented Oct 18, 2019

Codecov Report

Merging #40 into master will increase coverage by 3.81%.
The diff coverage is 88.59%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #40      +/-   ##
==========================================
+ Coverage   78.45%   82.26%   +3.81%     
==========================================
  Files          14       16       +2     
  Lines         882      987     +105     
==========================================
+ Hits          692      812     +120     
+ Misses        190      175      -15
Impacted Files Coverage Δ
src/utils.jl 74.19% <ø> (+22.08%) ⬆️
src/Manifolds.jl 72% <ø> (ø) ⬆️
src/Rotations.jl 91.54% <100%> (+0.04%) ⬆️
src/ProjectedDistribution.jl 93.33% <100%> (+28.62%) ⬆️
src/SizedAbstractArray.jl 78.57% <78.57%> (ø)
src/PowerManifold.jl 92.3% <92.3%> (ø)
src/ProductManifold.jl 75.67% <0%> (+1.35%) ⬆️

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 0ac1284...de6d7f3. Read the comment docs.

Copy link
Member

@sethaxen sethaxen left a comment

Choose a reason for hiding this comment

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

So far it looks great, and I love that you can basically make and work with array of points on Manifolds and still leverage all of the speed-ups. I'm wondering if any of that logic can also be applied to ProductManifold.

Would like to see cross overloaded so that if all of the manifolds being multiplied are of the same type, it produces a PowerManifold instead of a ProductManifold. And also the cases of pow by pow, pow by manifold, and manifold by pow.

src/PowerManifold.jl Outdated Show resolved Hide resolved
return PowerManifold{typeof(manifold), Tuple{size...}}(manifold)
end

function power_mapreduce(f, op, M::PowerManifold, kwargs::NamedTuple, init, x...)
Copy link
Member

Choose a reason for hiding this comment

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

Is there really no way that we can just specialize mapreduce and map for any function whose first argument is PowerManifold? This really requires writing custom code for power manifolds.

This also seems like something that would be useful for product manifolds in general and just specialized for power manifolds.

Or maybe we should package our own functions for

Copy link
Member Author

Choose a reason for hiding this comment

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

power_map and power_mapreduce have quite a bit of logic in them that is specific to the power manifold. Product manifolds don't need that since the logic there is much more simple. On the other hand, power_map and power_mapreduce still don't handle all cases and I don't really like that splatting of kwargs. On top of that is the problem of allocation of views on the heap. I don't think there is much reason to additionally restrict ourselves to adding new methods to map and mapreduce.


generates the power manifold $M^{N_1 \times N_2 \times \dots \times N_n}$.
"""
struct PowerManifold{TM<:Manifold, TSize} <: Manifold
Copy link
Member

Choose a reason for hiding this comment

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

Should PowerManifold and ProductManifold share a base abstract class? I suspect there will be some shared functionality that can be abstracted out.

Copy link
Member Author

Choose a reason for hiding this comment

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

What shared functionality are you thinking about? I don't really see any right now.

By the way, thank you for the review 🙂 .

Copy link
Member

Choose a reason for hiding this comment

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

I am not sure, whether a common base class is useful. They share that they build a manifold from another one/others, so I also don't see exactly what a common base class might bring as an advantage.

@mateuszbaran
Copy link
Member Author

The PR is almost ready, there is just one minor change that needs to be done once HybridArrays 0.3.0 is tagged. The code assumes that the power manifold is represented by one big array (any kind should do but HybridArray is quite fast).

Do you think I should make any changes here @sethaxen @kellertuer ?

Copy link
Member

@kellertuer kellertuer left a comment

Choose a reason for hiding this comment

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

Yes, you are right, it's nearly done and I think it is a quite nice way to do product manifolds.

benchmark/benchmarks.jl Outdated Show resolved Hide resolved

generates the power manifold $M^{N_1 \times N_2 \times \dots \times N_n}$.
"""
struct PowerManifold{TM<:Manifold, TSize} <: Manifold
Copy link
Member

Choose a reason for hiding this comment

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

I am not sure, whether a common base class is useful. They share that they build a manifold from another one/others, so I also don't see exactly what a common base class might bring as an advantage.

src/PowerManifold.jl Show resolved Hide resolved
src/PowerManifold.jl Show resolved Hide resolved
@mateuszbaran
Copy link
Member Author

I'll merge it soon if there are no significant issues.

@mateuszbaran mateuszbaran merged commit 76e6282 into master Nov 16, 2019
@mateuszbaran mateuszbaran deleted the mbaran/power-manifold branch January 20, 2020 22:18
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.

3 participants