c++ multidimensional arrays with some mathematical functionality