Add a test program to compute cost and gradient using Slice
intersections