Multidimensional matrix recursion.