powered by
project_square computes the Euclidean projection of a point onto a square.
project_square
project_square(x, center, r)
Point to project
Center of the square
Half the length of a side
# NOT RUN { set.seed(12345) p <- 2 center <- matrix(rnorm(p),p,1) r <- runif(1) x <- matrix(rnorm(p),p,1) y <- project_square(x,center,r) # }
Run the code above in your browser using DataLab