Skip to content

Commit

Permalink
Improved performance of power manifold creation and more (#197)
Browse files Browse the repository at this point in the history
* Improved performance of power manifold creation and some cases of `get_component` on product manifold

* add fallback for older Julia versions, add date to news
  • Loading branch information
mateuszbaran authored Aug 3, 2024
1 parent 2ac6a52 commit 99ff139
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
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

2 comments on commit 99ff139

@mateuszbaran
Copy link
Member Author

Choose a reason for hiding this comment

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

@JuliaRegistrator register

Release notes:

Changed

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

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Error while trying to register: Version 0.15.11 already exists

Please sign in to comment.