Operators
In many cases, we wish to define operators on the manifold. Most notably, we are interested in being able to compute the exterior derivative (gradient), the divergence, and the Laplacian.
Coming soon...
We also need to add the ability to compute the curl on the manifold.
src.riemax.operators
src.riemax.operators.grad(fn: tp.Callable[[M[jax.Array]], jax.Array], metric: MetricFn) -> tp.Callable[[M[jax.Array]], jax.Array]
Compute gradient of scalar function on the manifold.
When an inner product \(\langle \cdot, \cdot \rangle\) is defined, the gradient \(\nabla f\) of a function \(f\) is defined as the unique vector \(V\) such that its inner product with any element of \(V\) is the directional derivative of \(f\) along the vector.12 Precisely
this yields
The 1-form \(df\) is a section of the cotangent bundle, giving a local linear approximation to \(f\) in the cotangent space at each point.
Example:
Given a scalar function \(f\), we can define the gradient as
# ...
def scalar_fn(p: jax.Array) -> jax.Array:
return jnp.sum(jnp.square(p))
fn_grad = riemax.manifold.operators.grad(scalar_fn, fn_metric)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fn |
typing.Callable[[src.riemax.manifold.types.M[jax.Array]], jax.Array]
|
scalar function to take derivative of |
required |
metric |
src.riemax.manifold.types.MetricFn
|
function defining the metric tensor on the manifold |
required |
Returns:
Name | Type | Description |
---|---|---|
transformed |
typing.Callable[[src.riemax.manifold.types.M[jax.Array]], jax.Array]
|
function which takes gradient of scalar function on the manifold |
Source code in src/riemax/manifold/operators.py
src.riemax.operators.div(fn: tp.Callable[[M[jax.Array]], jax.Array], metric: MetricFn) -> tp.Callable[[M[jax.Array]], jax.Array]
Compute divergence of vector-valued function on the manifold.
Given a vector field \(X \in TM\), we define the divergence as12
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fn |
typing.Callable[[src.riemax.manifold.types.M[jax.Array]], jax.Array]
|
vector function to compute divergence of |
required |
metric |
src.riemax.manifold.types.MetricFn
|
function defining the metric tensor on the manifold |
required |
Returns:
Name | Type | Description |
---|---|---|
transformed |
typing.Callable[[src.riemax.manifold.types.M[jax.Array]], jax.Array]
|
Function which computes divergence of vector-valued function on the manifold |
Source code in src/riemax/manifold/operators.py
src.riemax.operators.laplace_beltrami(fn: tp.Callable[[M[jax.Array]], jax.Array], metric: MetricFn) -> tp.Callable[[M[jax.Array]], jax.Array]
Compute laplacian of scalar-valued function on the manifold.
Given a function \(f: M \rightarrow \mathbb{R}\), we can compute the Laplacian by taking the divergence of the exterior derivative.12 Precisely, we can compute
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fn |
typing.Callable[[src.riemax.manifold.types.M[jax.Array]], jax.Array]
|
scalar function to compute laplacian of |
required |
metric |
src.riemax.manifold.types.MetricFn
|
function defining the metric tensor on the manifold |
required |
Returns:
Name | Type | Description |
---|---|---|
transformed |
typing.Callable[[src.riemax.manifold.types.M[jax.Array]], jax.Array]
|
Function which computes laplacian of scalar-valued functions on the manifold. |