R igraph 手册页

如果您从 R 中使用 igraph,请使用此选项

sample_sphere_volume {igraph}R 文档

从球体的体积中均匀采样向量

描述

采样有限维向量,用作随机点积图中的潜在位置向量

用法

sample_sphere_volume(dim, n = 1, radius = 1, positive = TRUE)

参数

dim

整数标量,随机向量的维度。

n

整数标量,样本大小。

radius

数值标量,球体采样的半径。

positive

逻辑标量,是否从球体的正卦限采样。

详细信息

sample_sphere_volumeS^{dim-1} ((dim-1)-球面) 生成均匀样本,即样本的欧几里得范数小于或等于 radius

一个 dim (sample_dirichletalpha 向量的长度) 乘以 n 的矩阵,其列是样本向量。

参见

其他潜在位置向量采样器: sample_dirichlet(), sample_sphere_surface()

示例

lpvs.sph.vol <- sample_sphere_volume(dim=10, n=20, radius=1)
RDP.graph.4  <- sample_dot_product(lpvs.sph.vol)
vec.norm     <- apply(lpvs.sph.vol, 2, function(x) { sum(x^2) })
vec.norm

[包 igraph 版本 1.3.5 索引]