Learn R Programming

splitFeas (version 0.1.0)

project_ball: Projection onto a ball

Description

project_ball computes the Euclidean projection of a point onto a ball.

Usage

project_ball(x, center, r)

Arguments

x

Point to project

center

Center of the sphere

r

Radius of the sphere

Examples

Run this code
# 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