Loading…
CppCon 2015 has ended
Thursday, September 24 • 9:30am - 10:00am
C++ Multi-dimensional Arrays for Computational Physics and Applied Mathematics

Log in to save this to your schedule, view media, leave feedback and see who's attending!

The language feature of passing a multi-dimensional array to a function without specifying all its dimensions at compile time is crucial for computational physics and applied mathematics. For example a matrix is a two dimensional array and a matrix inversion function which needs to know the size of the matrix at compile time would be of limited use. Major general purpose languages such as C, Java and C# support this feature. Of course, scientific programming languages like Fortran, Matlab and R also support this feature.

C++ is perhaps the only major programming language which does not allow passing a multi-dimensional array to a function unless the size of all the dimensions except the first one is known at compile time. Due to this limitation of C++, various libraries have been developed for using multi-dimensional arrays in C++. Some of these libraries are Blitz++, Armadillo, Eigen and boost.multi_array. These libraries are very large and complex. While they do provide a wide variety of features, they have a learning curve which may be difficult to justify for something as basic as passing multi-dimensional arrays to functions. Also the computational physics or applied mathematics code becomes dependent on a large non-standard library. Hence its usage will be limited to only those scientists who are willing to install these non-standard libraries.

The reference feature of C++ allows us to develop a multi-dimensional array class. The class has a small number of lines of code and hence the code can be included with the scientific application code. We use this class to write programs for various areas of computational physics and show that the class is easy to use and it leads to readable programs.

Speakers
PG

Pramod Gupta

Research Scientist, University of Washington
Pramod Gupta is a research scientist at the Department of Astronomy at the University of Washington. He works on computational astrophysics using C++ and other languages. He is interested in parallel computing and he has used both the established techniques such as MPI and OpenMP... Read More →


Thursday September 24, 2015 9:30am - 10:00am PDT
Franklin (407) Meydenbauer Center

Attendees (0)