powered by
project_ball computes the Euclidean projection of a point onto a ball.
project_ball
project_ball(x, center, r)
Point to project
Center of the sphere
Radius of the sphere
# NOT RUN { set.seed(12345) p <- 3 center <- rnorm(p) r <- runif(1) x <- rnorm(p) y <- project_ball(x,center,r) # }
Run the code above in your browser using DataLab