Memory Allocation for High-Dimensional Data Structures

1. General Methods

For a very large application, dynamic memory allocation is common in C/C++ programming.
For example, I ported Basin Modeling application from SUN workstation to PC 486
in 1992, cutting memory usage up to 90%. Generally two types of dynamic memory
allocation methods are wildly used to deal with high dimensional data structures.
One is to use 1D to represent nD as shown in the follow:

2. Source Code

MemA.h uses C++ template and operator overloading to implement 1D, 2D, and 3D
based on method 1. It is easy to extend to high dimension, such as 4D and 5D.
It is especially useful to port applications from Fortran to C++.

Top White Papers and Webcasts

Live Event Date: April 21, 2015 @ 1:00 p.m. ET / 10:00 a.m. PT
For mid-sized companies, the challenge of serving people and providing better service is forcing a re-evaluation of their contact centers to improve customer experiences. While these growing enterprises are driving much of the market's innovation, they must remain nimble in how they operate, and be very responsive to customer needs. This upcoming eSeminar reveals five ways mid-size organizations can gain needed agility and examines how delivering …

The 2014 State of DevOps Report — based on a survey of 9,200+ people in IT operations, software development and technology management roles in 110 countries — reveals:
Companies with high-performing IT organizations are twice as likely to exceed their profitability, market share and productivity goals.
IT performance improves with DevOps maturity, and strongly correlates with well-known DevOps practices.
Job satisfaction is the No. 1 predictor of performance against organizational …