rafaelrojasmiliani / manifolds

Riemmanian Manifold representation library with automatic first order differentiation
1 stars 0 forks source link

Introduce Faithfull manifolds: Manifolds that are equivalent to its representation #6

Closed rafaelrojasmiliani closed 1 year ago

rafaelrojasmiliani commented 2 years ago

Some manifolds can be exactly equivalent to their representation chosen by the user of this API. Some examples are the manifold of matrices, or vector spaces (tuple of real numbers).

This comes with the following drawback: It would be awkward to use a Manifold instance instead of the representation that is diffeomorphic to the manifold that we desire to describe. This is the case of Charts and parametrizations. The map from /to the manifold to/from Rn. The user might like to have Eigen::Vector as input/output of this maps.

We introduce Faithfull manifolds as those which are diffeomorphic to their representation type. They are introduces as a new template paramenter and use SNIFAE to defind cast and assigment operator as follows

  template <bool F = Faithfull>
  operator const std::enable_if_t<F, R> &() const & {
    return representation_;
  }

  template <bool F = Faithfull> operator std::enable_if_t<F, R>() & {
    return representation_;
  }

  template <bool F = Faithfull> operator std::enable_if_t<F, R> &&() && {
    return std::move(representation_);
  }