borglab / borglab/SwiftFusion

Ideal manifold definition experience

Open
#45 4 comments 2 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
118
Forks
14
PR merge metrics
No merged PRs in 30d

Description

In parallel with the discussion on https://github.com/borglab/SwiftFusion/pull/37, I'm curious what everyone thinks the ideal pie-in-the-sky experience for defining a manifold looks like.

https://github.com/borglab/SwiftFusion/pull/37 is constrained by today's Swift AD API, but it would be very realistic to soon make improvements to the AD API that allow something better.

Here's my initial idea:
* You define a single struct (no wrappers needed)
* You specify the `TangentVector` type
* You specify `retract` and `localCoordinates` methods

So for example `Rot2` would be:

```swift
struct Rot2: Manifold {
var c, s: Double

typealias TangentVector = Vector1

@differentiable
func retract(_ v: Vector1) -> Rot2 {
return self * Rot2(v)
}

@differentiable
func localCoordinates(_ other: Rot2) -> TangentVector {
return (self.inverse() * other).theta
}

@differentiable
static func * (_ lhs: Rot2, _ rhs: Rot2) -> Rot2 { ... }

@differentiable
func inverse() -> Rot2 { ... }

@differentiable
var theta: Double { ... }
}
```

What do you think of that?

Do you have suggestions about ways it could be even better?

I'm interested in hearing anything even if it seems completely unrealistic.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.