Stefano Lonardoni
This is a collection of exercises written during Laboratorio di Simulazione Numerica (A.A. 2023-2024) @UNIMI. It's a pair of C++ codes for data generation and jupyter-notebook for data analysis.
Disclaimer: I've used this course to experiment with classes and some features of C++ such as smart pointers. This has resulted in some garbled code and it is not easy to read.
For building and running the C++ codes cmake and make are required, in addiction of a c/c++ compiler (tested on gcc 13.3, 8.5 and clang 17.0). Dependencies linkage should be handled by CMake, but the user is required to provide them.
Data formatting in c++is done through fmtlib and it is provided through CMake.
Some exercises will use the armadillo libraries,OpenMP for dirty and fast speedup, and exercise_10 uses mpich implementation of the MPI interaface.
All the data analysis is done through jupyter-notebook using as kernel python 3.12.2 with the following python modules: mathplotlib, numpy, math, scipy and for the last two exercises tensorflow on the kernel 3.9.
Clone this repo. In the root directory create a folder called build. This is needed by cmake for storing the required configuration and Makefile files.
mkdir buildNavigate to the directory just created and run cmake:
cd build
cmake ..Once finished, cmake will have configured the necessary Makefile for each exercise. The codes can now be compiled and run. Navigate to the desidered exercise's folder (inside the build directory) or compile all of the targets by running make in the build directory.
Targets installing the exercises are provided. Run the following command in the build directory:
make installThis will store all the exectubles inside the bin folder in the root of the project.
The data generated will be stored in a direcotry called data. The Jupyter notebooks will use this folder for the data analysis.
| Exercise | Topic | Codes | Notebook |
|---|---|---|---|
| 01 | Pseudo-random numbers | Codes | Notebook |
| 02 | Monte Carlo integration and random walks | Codes | Notebook |
| 03 | Option pricing with Monte Carlo methods | Codes | Notebook |
| 04 | Molecular dynamics | Codes | Notebook |
| 05 | Quantum wavefunctions | Codes | Notebook |
| 06 | Ising and Gibbs simulation | Codes | Notebook |
| 07 | NVE vs NVT and autocorrelation | Codes | Notebook |
| 08 | Quantum waveform sampling and simulated annealing | Codes | Notebook |
| 09 | Genetic algorithm for TSP | Codes | Notebook |
| 10 | MPI parallelization for TSP | Codes | Notebook |
| 11 | Fitting functions with machine learning | nope | Notebook, 01, Notebook, 02, Notebook, 03 |
| 12 | Deep Neural Networks and CNN for image recognition | nope | Notebook, 01, Notebook, 02 & 03 |
This project is licensed under the MIT License.