Skip to contents

Changes the reference point for tangent space representations on a Riemannian manifold. Supports parallel processing via the futureverse framework for improved performance on large datasets.

Usage

relocate(old_ref, new_ref, images, met, progress = FALSE)

Arguments

old_ref

A reference point on the manifold to be replaced. Must be an object of class dppMatrix from the Matrix package.

new_ref

The new reference point on the manifold. Must be an object of class dppMatrix from the Matrix package.

images

A list of tangent representations relative to the old reference point. Each element in the list must be an object of class dspMatrix.

met

A metric object of class rmetric, containing functions for Riemannian operations (logarithmic map, exponential map, vectorization, and inverse vectorization).

progress

Logical indicating whether to show progress during computation (default: FALSE). Requires progressr package.

Value

A list of tangent representations relative to the new reference point. Each element in the returned list will be an object of class dspMatrix.

Details

This function uses parallel processing when the number of images exceeds a threshold and parallel processing is enabled via set_parallel_plan(). For small datasets, sequential processing is used automatically to avoid parallelization overhead.

Examples

if (requireNamespace("Matrix", quietly = TRUE)) {
  library(Matrix)
  data(airm)
  old_ref <- diag(2) |>
    Matrix::nearPD() |>
    _$mat |>
    Matrix::pack()
  new_ref <- diag(c(2, 3)) |>
    Matrix::nearPD() |>
    _$mat |>
    Matrix::pack()
  images <- list(
    diag(2) |> Matrix::symmpart() |> Matrix::pack(),
    diag(c(1, 0.5)) |> Matrix::symmpart() |> Matrix::pack()
  )
  relocate(old_ref, new_ref, images, airm)
}
#> [[1]]
#> 2 x 2 Matrix of class "dspMatrix"
#>           [,1]       [,2]
#> [1,] 0.6137056  0.0000000
#> [2,] 0.0000000 -0.2958369
#> 
#> [[2]]
#> 2 x 2 Matrix of class "dspMatrix"
#>           [,1]      [,2]
#> [1,] 0.6137056  0.000000
#> [2,] 0.0000000 -1.795837
#>