From 83a564895f8ce2d0a0464b3e1b9f52512c8a9d97 Mon Sep 17 00:00:00 2001 From: Mateusz Baran Date: Fri, 2 Aug 2024 21:21:40 +0200 Subject: [PATCH] Improved performance of power manifold creation and some cases of `get_component` on product manifold --- NEWS.md | 6 ++++++ .../ProductManifoldRecursiveArrayToolsExt.jl | 2 +- src/PowerManifold.jl | 6 +++--- src/ProductManifold.jl | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/NEWS.md b/NEWS.md index f303ecfc..965c7348 100644 --- a/NEWS.md +++ b/NEWS.md @@ -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] unreleased + +### Changed + +* Improved performance of power manifold creation and some cases of `get_component` on product manifold. + ## [0.15.11] 28/07/2024 ### Added diff --git a/ext/ManifoldsBaseRecursiveArrayToolsExt/ProductManifoldRecursiveArrayToolsExt.jl b/ext/ManifoldsBaseRecursiveArrayToolsExt/ProductManifoldRecursiveArrayToolsExt.jl index 86ba2956..4ee61b84 100644 --- a/ext/ManifoldsBaseRecursiveArrayToolsExt/ProductManifoldRecursiveArrayToolsExt.jl +++ b/ext/ManifoldsBaseRecursiveArrayToolsExt/ProductManifoldRecursiveArrayToolsExt.jl @@ -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}, diff --git a/src/PowerManifold.jl b/src/PowerManifold.jl index 037b9032..e8b1028f 100644 --- a/src/PowerManifold.jl +++ b/src/PowerManifold.jl @@ -100,7 +100,7 @@ function _parameter_symbol( return :type end -function PowerManifold( +Base.@constprop :aggressive function PowerManifold( M::AbstractManifold{𝔽}, ::TPR, size::Integer...; @@ -109,7 +109,7 @@ function PowerManifold( size_w = wrap_type_parameter(parameter, size) return PowerManifold{𝔽,typeof(M),typeof(size_w),TPR}(M, size_w) end -function PowerManifold( +Base.@constprop :aggressive function PowerManifold( M::PowerManifold{𝔽,TM,TSize,TPR}, size::Integer...; parameter::Symbol = _parameter_symbol(M), @@ -117,7 +117,7 @@ function PowerManifold( 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( +Base.@constprop :aggressive function PowerManifold( M::PowerManifold{𝔽,TM}, ::TPR, size::Integer...; diff --git a/src/ProductManifold.jl b/src/ProductManifold.jl index 3a4d42bd..8e3b3c39 100644 --- a/src/ProductManifold.jl +++ b/src/ProductManifold.jl @@ -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