grapes-wt-grapes function

Computation of the matrix with rows being the linearized matrix products of transposed X[,,i] and B.