C++ Multi-dimensional Arrays for Computational Physics and Applied Mathematics

Play C++ Multi-dimensional Arrays for Computational Physics and Applied Mathematics
Sign in to queue


Presentation Slides, PDFs, Source Code and other presenter materials are available at: https://github.com/cppcon/cppcon2015 — 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. — 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 and the newer techniques such as Hadoop and CUDA/GPU. He has taught a graduate course on astrophysics. He holds several United States patents. He has presented papers at APS(American Physical Society), AAS(American Astronomical Society), ACM and IEEE conferences. He obtained his Ph.D. in computational physics from the University of Rochester in New York. — Videos Filmed & Edited by Bash Films: http://www.BashFilms.com









Download this episode

The Discussion

Add Your 2 Cents