Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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).

## [2.5.0] unreleased

## Added

* a `ZeroVector` type, to avoid allocating unnecessary zeros similar to the [`Identity`](https://juliamanifolds.github.io/LieGroups.jl/stable/interface/operations/#LieGroups.Identity) on [`LieGroups.jl`](https://github.com/JuliaManifolds/LieGroups.jl).
Comment thread
kellertuer marked this conversation as resolved.
Outdated

## [2.4.0] 03/06/2026

### Added
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "ManifoldsBase"
uuid = "3362f125-f0bb-47a3-aa74-596ffd7ef2fb"
version = "2.4.0"
version = "2.5.0"
authors = ["Seth Axen <seth.axen@gmail.com>", "Mateusz Baran <mateuszbaran89@gmail.com>", "Ronny Bergmann <manopt@ronnybergmann.net>", "Antoine Levitt <antoine.levitt@gmail.com>"]

[workspace]
Expand Down
4 changes: 2 additions & 2 deletions docs/src/manifolds.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ helpers to build or create manifolds based on existing manifolds

## A default manifold

[`DefaultManifold`](@ref ManifoldsBase.DefaultManifold) is a simplified version of [`Euclidean`](https://juliamanifolds.github.io/Manifolds.jl/latest/manifolds/euclidean.html) and demonstrates a basic interface implementation.
[`DefaultManifold`](@ref ManifoldsBase.DefaultManifold) is a simplified version of [`Euclidean`](@extref `Manifolds.Euclidean`) and demonstrates a basic interface implementation.
It can be used to perform simple tests.
Since when using `Manifolds.jl` the [`Euclidean`](https://juliamanifolds.github.io/Manifolds.jl/latest/manifolds/euclidean.html) is available, the `DefaultManifold` itself is not exported.
Since when using `Manifolds.jl` the [`Euclidean`](@extref `Manifolds.Euclidean`) is available, the [`DefaultManifold`](@ref ManifoldsBase.DefaultManifold) itself is not exported.

```@docs
ManifoldsBase.DefaultManifold
Expand Down
48 changes: 15 additions & 33 deletions src/ManifoldsBase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,9 @@
module ManifoldsBase

import Base:
isapprox,
exp,
log,
convert,
copy,
copyto!,
angle,
eltype,
fill,
fill!,
isempty,
length,
similar,
show,
+,
-,
*,
==
isapprox, exp, log,
convert, copy, copyto!, angle, eltype, fill, fill!, isempty, length, similar, show,
+, -, *, ==
import LinearAlgebra: ×, dot, norm, det, cross, I, UniformScaling, Diagonal
import Random: rand, rand!

Expand Down Expand Up @@ -1229,6 +1214,7 @@ function zero_vector(M::AbstractManifold, p)
return X
end


#
#
# Internal function to set plotting backend
Expand Down Expand Up @@ -1266,6 +1252,7 @@ end
include("errors.jl")
include("parallel_transport.jl")
include("vector_transport.jl")

include("shooting.jl")
include("vector_spaces.jl")
include("point_vector_fallbacks.jl")
Expand Down Expand Up @@ -1332,13 +1319,10 @@ end
# Export
# ------
#
# (a) Manifolds and general types
# Manifolds and general types
export AbstractManifold,
AbstractManifoldPoint,
AbstractTangentVector,
AbstractCotangentVector,
TFVector,
CoTFVector
AbstractManifoldPoint, AbstractTangentVector, AbstractCotangentVector,
TFVector, CoTFVector, ZeroVector
export AbstractAffineConnection, ConnectionManifold, LeviCivitaConnection
export AbstractMetric, MetricManifold
export VectorSpaceFiber
Expand All @@ -1355,8 +1339,7 @@ export AbstractPowerRepresentation,
NestedPowerRepresentation, NestedReplacingPowerRepresentation
export ProductManifold

# (b) Generic Estimation Types

# Generic Estimation Types
export GeodesicInterpolationWithinRadius,
CyclicProximalPointEstimation,
ExtrinsicEstimation,
Expand All @@ -1365,8 +1348,7 @@ export GeodesicInterpolationWithinRadius,
AbstractApproximationMethod,
GeodesicInterpolation


# (b) Retraction Types
# Retraction Types
export AbstractRetractionMethod,
ApproximateRetraction,
ApproximateExponentialRetraction,
Expand All @@ -1385,7 +1367,7 @@ export AbstractRetractionMethod,
SoftmaxRetraction,
StabilizedRetraction

# (c) Inverse Retraction Types
# Inverse Retraction Types
export AbstractInverseRetractionMethod,
ApproximateInverseRetraction,
ApproximateLogarithmicInverseRetraction,
Expand All @@ -1402,7 +1384,7 @@ export AbstractInverseRetractionMethod,
SoftmaxInverseRetraction,
StabilizedInverseRetraction

# (d) Vector Transport Types
# Vector Transport Types
export AbstractVectorTransportMethod,
DifferentiatedRetractionVectorTransport,
EmbeddedVectorTransport,
Expand All @@ -1416,7 +1398,7 @@ export AbstractVectorTransportMethod,
VectorTransportTo,
VectorTransportWithKeywords

# (e) Basis Types
# Basis Types
export CachedBasis,
DefaultBasis,
DefaultOrthogonalBasis,
Expand All @@ -1427,12 +1409,12 @@ export CachedBasis,
ProjectedOrthonormalBasis,
VeeOrthogonalBasis

# (f) Error Messages
# Error Messages
export OutOfInjectivityRadiusError, ManifoldDomainError
export ApproximatelyError
export CompositeManifoldError, ComponentManifoldError, ManifoldDomainError

# (g) Functions on Manifolds
# Functions on Manifolds
export ×,
ℝ,
ℂ,
Expand Down
77 changes: 16 additions & 61 deletions src/bases.jl
Original file line number Diff line number Diff line change
Expand Up @@ -298,20 +298,14 @@ function allocate_coordinates(M::AbstractManifold, p::Int, T, n::Int)
return (representation_size(M) == () && n == 0) ? zero(T) : zeros(T, n)
end
function allocate_result(
M::AbstractManifold,
f::typeof(get_coordinates),
p,
X,
basis::AbstractBasis{𝔽},
M::AbstractManifold, f::typeof(get_coordinates), p, X, basis::AbstractBasis{𝔽},
) where {𝔽}
T = coordinate_eltype(M, p, 𝔽)
return allocate_coordinates(M, p, T, number_of_coordinates(M, basis))
end

@inline function allocate_result_type(
M::AbstractManifold,
f::typeof(get_vector),
args::Tuple{Any, Vararg{Any}},
M::AbstractManifold, f::typeof(get_vector), args::Tuple{Any, Vararg{Any}},
)
apf = allocation_promotion_function(M, f, args)
return apf(
Expand Down Expand Up @@ -369,12 +363,7 @@ function change_basis(M::AbstractManifold, p, c, B_in::AbstractBasis, B_out::Abs
end

function change_basis!(
M::AbstractManifold,
c_out,
p,
c,
B_in::AbstractBasis,
B_out::AbstractBasis,
M::AbstractManifold, c_out, p, c, B_in::AbstractBasis, B_out::AbstractBasis,
)
return get_coordinates!(M, c_out, p, get_vector(M, p, c, B_in), B_out)
end
Expand Down Expand Up @@ -561,10 +550,7 @@ requires either a dual basis or the cached basis to be selfdual, for example ort
See also: [`get_vector`](@ref), [`get_basis`](@ref)
"""
function get_coordinates(
M::AbstractManifold,
p,
X,
B::AbstractBasis = default_basis(M, typeof(p)),
M::AbstractManifold, p, X, B::AbstractBasis = default_basis(M, typeof(p)),
)
return _get_coordinates(M, p, X, B)
end
Expand Down Expand Up @@ -681,25 +667,13 @@ function _get_coordinates!(M::AbstractManifold, Y, p, X, B::CachedBasis)
return get_coordinates_cached!(M, number_system(M), Y, p, X, B, number_system(B))
end
function get_coordinates_cached!(
M::AbstractManifold,
::ComplexNumbers,
Y,
p,
X,
B::CachedBasis,
::ComplexNumbers,
M::AbstractManifold, ::ComplexNumbers, Y, p, X, B::CachedBasis, ::ComplexNumbers,
)
map!(vb -> conj(inner(M, p, X, vb)), Y, get_vectors(M, p, B))
return Y
end
function get_coordinates_cached!(
M::AbstractManifold,
::𝔽,
Y,
p,
X,
C::CachedBasis,
::RealNumbers,
M::AbstractManifold, ::𝔽, Y, p, X, C::CachedBasis, ::RealNumbers,
) where {𝔽}
map!(vb -> real(inner(M, p, X, vb)), Y, get_vectors(M, p, C))
return Y
Expand All @@ -721,10 +695,7 @@ requires either a dual basis or the cached basis to be selfdual, for example ort
See also: [`get_coordinates`](@ref), [`get_basis`](@ref), [`default_basis`](@ref)
"""
@inline function get_vector(
M::AbstractManifold,
p,
c,
B::AbstractBasis = default_basis(M, typeof(p)),
M::AbstractManifold, p, c, B::AbstractBasis = default_basis(M, typeof(p)),
)
return _get_vector(M, p, c, B)
end
Expand Down Expand Up @@ -830,11 +801,7 @@ end
function get_vector_orthonormal! end

@inline function _get_vector!(
M::AbstractManifold,
Y,
p,
c,
B::DiagonalizingOrthonormalBasis,
M::AbstractManifold, Y, p, c, B::DiagonalizingOrthonormalBasis,
)
return get_vector_diagonalizing!(M, Y, p, c, B)
end
Expand Down Expand Up @@ -917,33 +884,21 @@ When a set of vectors is orthonormalized a set of vectors is returned.
When an [`AbstractBasis`](@ref) is orthonormalized, a [`CachedBasis`](@ref) is returned.
"""
function gram_schmidt(
M::AbstractManifold{𝔽},
p,
B::AbstractBasis{𝔽};
warn_linearly_dependent = false,
return_incomplete_set = false,
skip_linearly_dependent = false,
M::AbstractManifold{𝔽}, p, B::AbstractBasis{𝔽};
warn_linearly_dependent = false, return_incomplete_set = false, skip_linearly_dependent = false,
kwargs...,
) where {𝔽}
V = gram_schmidt(
M,
p,
get_vectors(M, p, B);
warn_linearly_dependent = warn_linearly_dependent,
skip_linearly_dependent = skip_linearly_dependent,
return_incomplete_set = return_incomplete_set,
kwargs...,
M, p, get_vectors(M, p, B);
warn_linearly_dependent = warn_linearly_dependent, skip_linearly_dependent = skip_linearly_dependent,
return_incomplete_set = return_incomplete_set, kwargs...,
)
return CachedBasis(GramSchmidtOrthonormalBasis(𝔽), V)
end
function gram_schmidt(
M::AbstractManifold,
p,
V::AbstractVector;
atol = eps(number_eltype(first(V))),
warn_linearly_dependent = false,
return_incomplete_set = false,
skip_linearly_dependent = false,
M::AbstractManifold, p, V::AbstractVector;
atol = eps(number_eltype(first(V))), warn_linearly_dependent = false,
return_incomplete_set = false, skip_linearly_dependent = false,
kwargs...,
)
N = length(V)
Expand Down
2 changes: 1 addition & 1 deletion src/exp_log_geo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function exp(M::AbstractManifold, p, X)
end

@doc raw"""
exp_fused(M::AbstractManifold, p, X, t::Number = 1)
exp_fused(M::AbstractManifold, p, X, t::Number)

Compute the exponential map of tangent vector `X` scaled by `t` at point `p`.
Compared to [`exp`](@ref), this method provides the opportunity to
Expand Down
Loading
Loading