projnormal.formulas.projected_normal_iso.moments

Exact moments of the projected normal distribution with isotropic covariance.

Functions

batch_second_moment(mean_x, var_x)

Compute the average second moment of a set of projected normals Y_i = X_i/||X_i||, where X_i~N(mean_x_i, sigma^2*I).

mean(mean_x, var_x)

Compute the mean of \(y = x/\sqrt{x^T x}\), where \(x \sim \mathcal{N}(\mu_x, \Sigma_x)\) and \(\Sigma_x = \sigma^2 I\).

second_moment(mean_x, var_x)

Compute the second moment matrix of \(y = x/\sqrt{x^T x}\), where \(x \sim \mathcal{N}(\mu_x, \Sigma_x)\) and \(\Sigma_x = \sigma^2 I\).

batch_second_moment(mean_x, var_x)

Compute the average second moment of a set of projected normals Y_i = X_i/||X_i||, where X_i~N(mean_x_i, sigma^2*I).

This function computes this average efficiently.

Parameters:
  • mean_x (torch.Tensor, shape (n_points, n_dim)) – Mean of X.

  • var_x (torch.Tensor, shape ()) – Variance of X elements.

Returns:

Average second moment of projected gaussians.

Return type:

torch.Tensor, shape (n_dim, n_dim)

mean(mean_x, var_x)

Compute the mean of \(y = x/\sqrt{x^T x}\), where \(x \sim \mathcal{N}(\mu_x, \Sigma_x)\) and \(\Sigma_x = \sigma^2 I\). This is done using the exact analytic formulas.

Parameters:
  • mean_x (torch.Tensor) – Mean of x. Shape is (n_dim,).

  • var_x (torch.tensor) – variance of x. shape is ().

Returns:

Expected value for the projected normal. Shape is (n_dim,).

Return type:

torch.Tensor

second_moment(mean_x, var_x)

Compute the second moment matrix of \(y = x/\sqrt{x^T x}\), where \(x \sim \mathcal{N}(\mu_x, \Sigma_x)\) and \(\Sigma_x = \sigma^2 I\). This is done using the exact analytic formulas.

Parameters:
  • mean_x (torch.Tensor) – Mean of x. Shape is (n_dim,).

  • var_x (torch.tensor) – variance of x. shape is ().

Returns:

Second moment matrix of \(y\). Shape is (n_dim, n_dim).

Return type:

torch.Tensor