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

Improved performance of power manifold creation and more #197

Merged
merged 2 commits into from
Aug 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.15.12] 03/08/2024

### Changed

* Improved performance of power manifold creation and some cases of `get_component` on product manifold.

## [0.15.11] 28/07/2024

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ Access the element(s) at index `i` of a point `p` on a [`ProductManifold`](@ref)
linear indexing.
See also [Array Indexing](https://docs.julialang.org/en/v1/manual/arrays/#man-array-indexing-1) in Julia.
"""
Base.@propagate_inbounds function Base.getindex(
@inline Base.@propagate_inbounds function Base.getindex(
p::ArrayPartition,
M::ProductManifold,
i::Union{Integer,Colon,AbstractVector,Val},
Expand Down
10 changes: 10 additions & 0 deletions src/ManifoldsBase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ include("exp_log_geo.jl")
include("projections.jl")
include("metric.jl")

if isdefined(Base, Symbol("@constprop"))
macro aggressive_constprop(ex)
return esc(:(Base.@constprop :aggressive $ex))
end
else
macro aggressive_constprop(ex)
return esc(ex)
end
end

"""
allocate(a)
allocate(a, dims::Integer...)
Expand Down
6 changes: 3 additions & 3 deletions src/PowerManifold.jl
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ function _parameter_symbol(
return :type
end

function PowerManifold(
@aggressive_constprop function PowerManifold(
M::AbstractManifold{𝔽},
::TPR,
size::Integer...;
Expand All @@ -109,15 +109,15 @@ function PowerManifold(
size_w = wrap_type_parameter(parameter, size)
return PowerManifold{𝔽,typeof(M),typeof(size_w),TPR}(M, size_w)
end
function PowerManifold(
@aggressive_constprop function PowerManifold(
M::PowerManifold{𝔽,TM,TSize,TPR},
size::Integer...;
parameter::Symbol = _parameter_symbol(M),
) where {𝔽,TM<:AbstractManifold{𝔽},TSize,TPR<:AbstractPowerRepresentation}
size_w = wrap_type_parameter(parameter, (get_parameter(M.size)..., size...))
return PowerManifold{𝔽,TM,typeof(size_w),TPR}(M.manifold, size_w)
end
function PowerManifold(
@aggressive_constprop function PowerManifold(
M::PowerManifold{𝔽,TM},
::TPR,
size::Integer...;
Expand Down
2 changes: 1 addition & 1 deletion src/ProductManifold.jl
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ end
Get the `i`th component of a point `p` on a [`ProductManifold`](@ref) `M`.
"""
function get_component(M::ProductManifold, p, i)
@inline function get_component(M::ProductManifold, p, i)
return submanifold_component(M, p, i)
end

Expand Down
Loading