Skip to contents

Simulates random samples from a Riemannian normal distribution on symmetric positive definite matrices.

Usage

rspdnorm(n, refpt, disp, met)

Arguments

n

Number of samples to generate.

refpt

Reference point on the manifold, represented as a symmetric positive definite matrix. Must be an object of class dppMatrix from the Matrix package.

disp

Dispersion matrix defining the spread of the distribution. Must be an object of class dppMatrix from the Matrix package.

met

A metric object of class rmetric.

Value

An object of class CSample containing the generated samples.

Examples

if (requireNamespace("Matrix", quietly = TRUE)) {
  library(Matrix)
  data(airm)
  refpt <- diag(2) |>
    Matrix::nearPD() |>
    _$mat |>
    Matrix::pack()
  disp <- diag(3) |>
    Matrix::nearPD() |>
    _$mat |>
    Matrix::pack()
  rspdnorm(10, refpt, disp, airm)
}
#> <CSample>
#>   Public:
#>     center: function () 
#>     change_ref_pt: function (new_ref_pt) 
#>     clone: function (deep = FALSE) 
#>     compute_conns: function () 
#>     compute_dists: function () 
#>     compute_fmean: function (tol = 0.05, max_iter = 20, lr = 0.2) 
#>     compute_sample_cov: function () 
#>     compute_tangents: function (ref_pt = default_ref_pt(private$p)) 
#>     compute_unvecs: function () 
#>     compute_variation: function () 
#>     compute_vecs: function () 
#>     connectomes: active binding
#>     distances: active binding
#>     frechet_mean: active binding
#>     initialize: function (conns = NULL, tan_imgs = NULL, vec_imgs = NULL, centered = NULL, 
#>     is_centered: active binding
#>     matrix_size: active binding
#>     mfd_dim: active binding
#>     ref_point: active binding
#>     riem_metric: active binding
#>     sample_cov: active binding
#>     sample_size: active binding
#>     tangent_images: active binding
#>     variation: active binding
#>     vector_images: active binding
#>   Private:
#>     centered: FALSE
#>     conns: NULL
#>     d: 3
#>     dists: NULL
#>     f_mean: NULL
#>     metric_obj: rmetric
#>     n: 10
#>     p: 2
#>     s_cov: NULL
#>     tangent_handler: TangentImageHandler, R6
#>     var: NULL
#>     vec_imgs: 0.468154420450533 0.362951255864986 -1.30454354503478 0. ...