File: sample_sphere_volume.Rd

package info (click to toggle)
r-cran-igraph 2.1.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 27,044 kB
  • sloc: ansic: 204,981; cpp: 21,711; fortran: 4,090; yacc: 1,229; lex: 519; sh: 52; makefile: 8
file content (46 lines) | stat: -rw-r--r-- 1,387 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/embedding.R
\name{sample_sphere_volume}
\alias{sample_sphere_volume}
\title{Sample vectors uniformly from the volume of a sphere}
\usage{
sample_sphere_volume(dim, n = 1, radius = 1, positive = TRUE)
}
\arguments{
\item{dim}{Integer scalar, the dimension of the random vectors.}

\item{n}{Integer scalar, the sample size.}

\item{radius}{Numeric scalar, the radius of the sphere to sample.}

\item{positive}{Logical scalar, whether to sample from the positive orthant
of the sphere.}
}
\value{
A \code{dim} (length of the \code{alpha} vector for
\code{sample_dirichlet()}) times \code{n} matrix, whose columns are the sample
vectors.
}
\description{
Sample finite-dimensional vectors to use as latent position vectors in
random dot product graphs
}
\details{
\code{sample_sphere_volume()} generates uniform samples from \eqn{S^{dim-1}}
(the \code{(dim-1)}-sphere) i.e. the Euclidean norm of the samples is
smaller or equal to \code{radius}.
}
\examples{
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
}
\seealso{
Other latent position vector samplers: 
\code{\link{sample_dirichlet}()},
\code{\link{sample_sphere_surface}()}
}
\concept{latent position vector samplers}