C++ Programming Language ======================== Learning C++ ------------ - **The best way to learn programming is, always, writing your own code!** - `CppCoreGuidelines - The C++ Core Guidelines are a set of tried-and-true guidelines, rules, and best practices about coding in C++ `__ - The `website version is here `__ - The C++ Core Guidelines are a collaborative effort led by Bjarne Stroustrup, much like the C++ language itself. They are the result of many person-years of discussion and design across a number of organizations. - `A Chinese translation can be found here `__ - `LearnCpp.com - Tutorials to help you master C++ and object-oriented programming `__ - LearnCpp.com is a free website devoted to teaching you how to program in C++. Whether you’ve had any prior programming experience or not, the tutorials on this site will walk you through all the steps to write, compile, and debug your C++ programs, all with plenty of examples. - `Awesome Modern C++ - A collection of resources on modern C++ `__ - The goal is to collect a list of resources to help people learn about and leverage modern C++11 and beyond. The `website is here `__ - `Modern CPP Tutorial - C++11/14/17 `__ - This is a **Chinese** on-line book: <高速上手 C++11/14/17> - `modern-cpp-features - A cheatsheet of modern C++ language and library features `__ - Descriptions and examples of new features in C++ For Python Coders ~~~~~~~~~~~~~~~~~ - `A Transition Guide from Python 2.x to C++ `__ Useful Libraries ---------------- Performance ~~~~~~~~~~~ - `Tips for Optimizing C/C++ Code `__ - Very practical and useful guides for optimizing C/C++. - `AwesomePerfCpp - A curated list of awesome C/C++ performance optimization resources `__ - Including talks, articles, libraries, and tools - `cpp-taskflow - Modern C++ Parallel Task Programming Library `__ - A fast C++ header-only library to help you quickly write parallel programs with complex task dependencies - `mimalloc - mimalloc is a compact general purpose allocator with excellent performance `__ - By Microsoft. mimalloc (pronounced “me-malloc”) is a general purpose allocator with excellent performance characteristics. It is a drop-in replacement for malloc and can be used in other programs without code changes. Numerical ~~~~~~~~~ - `GSL - GNU Scientific Library `__ - The library provides a wide range of mathematical routines such as random number generators, special functions and least-squares fitting. There are over 1000 functions in total with an extensive test suite. - The `online reference manual can be found here `__. - `Eigen - a C++ template library for linear algebra: matrices, vectors, numerical solvers, and related algorithms `__ - `Armadillo - C++ library for linear algebra & scientific computing `__ - **Armadillo** is a high quality linear algebra library (matrix maths) for the C++ language, aiming towards a good balance between speed and ease of use - `xtensor - Multi-dimensional arrays with broadcasting and lazy computing `__ - **xtensor** is a C++ library meant for numerical analysis with multi-dimensional array expressions. **xtensor** can be used to process NumPy data structures inplace using Python’s buffer protocol. Optimization ~~~~~~~~~~~~ - `OptimLib - a lightweight C++ library of numerical optimization methods for nonlinear functions `__ - A C++11 library of local and global optimization algorithms, as well as root finding techniques, supporting a large number of algorithms. - `nlopt - library for nonlinear optimization `__ - **NLopt** is a library for nonlinear local and global optimization, for functions with and without gradient information. - `ceres-solver - open source C++ library for modeling and solving large, complicated optimization problems `__ - It can be used to solve Non-linear Least Squares problems with bounds constraints and general unconstrained optimization problems. `Used by Google for good reasons `__. - `CppNumericalSolvers - L-BFGS-B for TensorFlow or pure C++11 and other optimization methods `__ - A **header-only** library with bindings to C++, **TensorFlow** and **Matlab**. - Easy to use, and support a list of algorithms. Astronomy Related ~~~~~~~~~~~~~~~~~ - `CCfits - object oriented interface to the cfitsio library `__ - It is designed to make the capabilities of cfitsio available to programmers working in C++. It is written in ANSI C++ and implemented using the C++ Standard Library with namespaces, exception handling, and member template functions. Code to Study ------------- - `GalSim - The modular galaxy image simulation toolkit `__ - **GalSim** is a very sophisticated system that pretty much includes everything you need to know about optics, observational astronomy, photometry, models of galaxies, and weak lensing. - It also teachs you how to communicate between C++ and Python. - `imfit - an open-source astronomical image-fitting program `__ - Everything on modeling galaxies using least-chi-square or MCMC methods. - `libprofit - low-level C++ library that produces images based on different luminosity profiles `__ - Light-weight library to learn about modeling galaxies and image convolution. - `TreeCorr - Code for efficiently computing 2-point and 3-point correlation functions `__