Skip to content

Instantly share code, notes, and snippets.

@mateuszbaran
Last active June 5, 2019 17:46
Show Gist options
  • Save mateuszbaran/6ac0115866562d09ea5e856216568a73 to your computer and use it in GitHub Desktop.
Save mateuszbaran/6ac0115866562d09ea5e856216568a73 to your computer and use it in GitHub Desktop.
abstract type Manifold
end
# Retraction type should be a part of the type of manifold,
# either by different concrete types or a single type with a type parameter
# that selects the retraction type.
retr(M::Manifold, v, x, t=1) = error("Not implemented")
retr!(M::Manifold, y, v, x, t=1) = error("Not implemented")
# just a reasonable default
distance(M::Manifold, x, y) = norm(log(M, x, y))
# inner product of ξ and ν that are tangent vectors at x
# Manopt.jl and ManifoldProjections.jl calls this dot, Manopt and OptimKit use inner, FunManifolds uses innerproduct
dot(M::Manifold, x, ξ, ν) = error("Not implemented")
norm(M::Manifold, x, v) = sqrt(inner(M, x, v, v))
# Proper exponential map
# mutating version saves the result to y
exp(M::Manifold, x, ξ, t=1) = error("Not implemented")
exp!(M::Manifold, y, x, ξ, t=1) = error("Not implemented")
# Proper logarithmic map
log(M::Manifold, x, y) = error("Not implemented")
log!(M::Manifold, v, x, y) = error("Not implemented")
# dimension of given manifold
manifold_dimension(M::Manifold) = error("Not implemented")
# type of vector transport (isometric, some approximation or something else)
# should be a part of the type of manifold,
# either by different concrete types or a single type with a type parameter
# that selects the retraction type.
vector_transport(M::Manifold, xfrom, xat, v) = error("Not implemented")
vector_transport!(M::Manifold, vto, xfrom, xat, v) = error("Not implemented")
random_point(M::Manifold, options...) = error("Not implemented")
random_tvector(M::Manifold, x, options...) = error("Not implemented")
typical_distance(M::Manifold) = error("Not implemented")
zero_tvector(M::Manifold, x) = log(M, x, x)
zero_tvector!(M::Manifold, v, x) = log!(M, v, x, x)
geodesic(M::Manifold, x, y, t) = exp(M, x, log(M, x, y), t)
@kellertuer
Copy link

Then its underscores for functions.

For Manopt.jl my idea was to do both (but I think I wrote that) project(M,N,x) and embed(N,M,y) but only really of both are known. Whether that can be included in our common interface, I am not sure.

Wy remove retract? I favour or retr? I'd be fine with that.

@mateuszbaran
Copy link
Author

For Manopt.jl my idea was to do both (but I think I wrote that) project(M,N,x) and embed(N,M,y) but only really of both are known. Whether that can be included in our common interface, I am not sure.

I think the safe choice would be to wait with project and embed until there is a clear use case. We can always add new functions.

Wy remove retract? I favour or retr? I'd be fine with that.

Yes, I think retr should be sufficient.

@kellertuer
Copy link

retr is sufficient.

Yes, I'll work on that as one of my next features, so I'll provide an update, when I have more details on that and for now we should omit those two.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment