xdimensional array function