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

Documentation and Convenience wrappers #5

wants to merge 6 commits into from

Conversation

benneti
Copy link

@benneti benneti commented Dec 9, 2018

A few convenience wrappers for the product and power manifold contructors.
But primarily some documentation of the functions.
Is it OK to add empty functions on the abstract type, that contain the documentations, as all retract and project_tangent have the same basic functionality?
Also added a short description of most things in the readme.
If you have any feedback let me know

README.md Outdated
To combine Manifolds one can use `PowerManifold` and `ProductManifold`.
The constructor of `PowerManifold` takes the exponentiated manifold `M`, the dimensions of this manifold `inner_dims` and the exponents `outer_dims`.
The constructor of `ProductManifold` takes the two manifolds `m1` and `m2` and their respective dimensions `dims1` and `dims2` as arguments.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd rather not document those yet, as they have a pretty crappy interface. Let those who want it use it in wait of a better code.

@@ -2,6 +2,21 @@ 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 (both are also available inplace `!`).
```
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.

retract(M::Manifold, x) = retract!(M, copy(x))
"Retracts a given point `x` back onto the Manifold `M`"
function retract!(M::Manifold, x) end
Copy link
Collaborator

Choose a reason for hiding this comment

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

IMO this type of comment is just noise: it doesn't tell you anything that you wouldn't get by reading the function name. Adding more comments is great when a code is finalized and won't change for ten years. I doubt this is the case with this library, so any comment means giving a false sense of a mature library, and means having to maintain it when we change things around.

function retract!(M::Manifold, x) end
"""
Returns the projection of 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!
Copy link
Collaborator

Choose a reason for hiding this comment

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

"around the point x (assumed to lie on M)"

@@ -145,6 +160,9 @@ struct ProductManifold<:Manifold
dims1::Tuple
dims2::Tuple
end
ProductManifold(m1::Manifold, m2::Manifold, dim1::Int, dim2::Int) = ProductManifold(m1, m2, Tuple(dim1), Tuple(dim2))
ProductManifold(m1::Manifold, m2::Manifold, dim1::Tuple, dim2::Int) = ProductManifold(m1, m2, dim1, Tuple(dim2))
ProductManifold(m1::Manifold, m2::Manifold, dim1::Int, dim2::Tuple) = ProductManifold(m1, m2, Tuple(dim1), dim2)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd rather not have these for the same reason as above: this API is pretty bad anyway...

@antoine-levitt
Copy link
Collaborator

Thanks for the PR! See comments. Sorry to be so negative, but this library is a newborn (it's not even used by anybody yet), and adding convenience wrappers and comments, while great in theory, feels premature at this stage.

@benneti
Copy link
Author

benneti commented Dec 10, 2018

It is fine, its better to say clear what you envision

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants