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