A matrix-vector multiply parallelized using boost::MPI
An obvious way to improve the code is to use standard containers to manage memory instead of raw pointers.

For this code, I would choose std::vector&lt;double&gt; for vector and result, and probably std::vector&lt;std::vector&lt;double&gt;&gt; for matrix (though note that this isn't the most cache-friendly choice for a 2-d matrix).  Remember, we can refer to a std::vector's elements as a plain array using the data() member if needed (here, the iterators should be sufficient).

That allows us to eliminate all the delete[] operations, as destructors will take care of that for us - including the non-local exits where new[] throws std::bad_alloc.



This loop looks wasteful:


    for(unsigned j = 0; j &lt; N; j++){
        if(i==j) {matrix[i][j] = i+j;}
    }



As the body is conditional on i==j, that's simply equivalent to

        matrix[i][i] = i+i;




I don't have experience with MPI, so not commenting on its use.  It's probably worth making N be const, and possibly also defining a useful variable:

auto const chunk_size = N/world.size();


Is the variable env needed?  If constructing a boost::mpi::environment has some useful side-effect, it may be worth an explanatory comment, as it currently looks like an unused variable (if this is something obvious and expected in MPI, then disregard this comment).