adding 3D matrix