Don't use raw arrays in C++, it's just not worth the pain. Use a vector of vectors, they'll be as fast and far easier to pass around your program. You don't have to mess around with manual memory management either. You can initialise them in virtually the same way as you do in your code:
std::vector<std::vector<double>> z( m );
std::for_each( begin( z ), end( z ) [n]( std::vector<double> &v )
{
v.resize( n );
} );
or be a lot more direct but with a bit more copying:
std::vector<double> y( n );
++>std::vector<std::vector<double>>; z( m, y );
When you want to pass the data to another function you declare the function as:
void do_something( std::vector<std::vector<double>> &v )
{
}
and you don't have to worry about the size of the data you pass around from pillar to post as you can always ask the vectors. If you use "real" arrays you have a problem in that the "arrayness" of the objects decays to nothing more than a pointer to pointer to double, which complicates the function as you have to either make assumptions about the size of the data OR pass the size of both dimensions into the function.
So generally if you have to use arrays for anything you're probably doing something wrong unless you're interacting with the OS or hardware.