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

Documentation and Convenience wrappers #5

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@ A Julia library to handle projections on manifolds. This is useful for minimizin

Currently, the sphere `{x ∈ K^n, ||x|| = r}` and the Stiefel manifold `{X ∈ K^{n × m}, X'*X = I}` as well as independent copies of these manifolds are supported.

The projections implemented are `retract` and `project_tangent`.

```
retract(M::Manifold, x) = retract!(M, copy(x))
Copy link
Collaborator

Choose a reason for hiding this comment

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

No need to say how retract is implemented to the user. Maybe just say (after the "example" section) how to define a new manifold, which would function as an API documentation? Taking for instance the example of the "partial sphere" you had.

```
retracts the given point `x` back onto the Manifold `M`.
```
project_tangent(M::Manifold, g, x) = project_tangent!(M, copy(g), x)
```
Projects the given vector `g` into the tangent space on the Manifold `M` around the point `x`.
`x` is assumed to lie on the manifold. This is not checked!

Example usage:

```julia
Expand Down
9 changes: 6 additions & 3 deletions src/ManifoldProjections.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@ end

# fallback for out-of-place ops
retract(M::Manifold, x) = retract!(M, copy(x))

"""
project_tangent(M::Manifold, g, x)
Return the projection of the given vector `g` into the tangent space on the Manifold `M` around the point `x` (assumed to lie on `M`).
"""
project_tangent(M::Manifold, g, x) = project_tangent!(M, copy(g), x)
function project_tangent!(M::Manifold, g, x) end

# Fake objective function implementing a retraction
mutable struct ManifoldObjective{T<:NLSolversBase.AbstractObjective} <: NLSolversBase.AbstractObjective
Expand Down Expand Up @@ -108,11 +114,8 @@ Multiple copies of the same manifold. Points are stored as inner_dims x outer_di
e.g. the product of 2x2 Stiefel manifolds of dimension N x n would be a N x n x 2 x 2 matrix.
"""
struct PowerManifold<:Manifold
"Type of embedded manifold"
inner_manifold::Manifold
"Dimension of the embedded manifolds"
inner_dims::Tuple
"Number of embedded manifolds"
outer_dims::Tuple
end
function retract!(m::PowerManifold, x)
Expand Down