ITP Lecture Archive

Programming Techniques for Scientific Simulations – HS 2010

Download all documents (zip, 8.0 MB).

Course lecturer:


Prof. Dr. Matthias Troyer
+41 44 633 25 89
HIT K 31.8
Wolfgang-Pauli-Strasse 27
ETH Zurich

Course tutors:


Mr. Tama Ma
+41 44 633 76 55
HIT K 31.3
Wolfgang-Pauli-Strasse 27
ETH Zurich


Mr. Jan Gukelberger
+41 44 633 79 61
HIT K 31.5
Wolfgang-Pauli-Strasse 27
ETH Zurich

Course information

This lecture provides an overview of programming techniques for scientific simulations. The focus is on advances C++ programming techniques and scientific software libraries. Based on an overview over the hardware components of PCs and supercomputer, optimization methods for scientific simulation codes are explained.

The time duration for the course is:

HCI J 3 -- Every Wednesday, 3.00pm - 4.45pm

Exercises: (either one of the following)
HIT F 21 -- Every Wednesday, 1.00pm - 2.45pm
HIT H 51 -- Every Tuesday, 12.00pm - 2.00pm

Lecture scripts

The lecture scripts can be downloaded individually from the following.

Week 01: Introduction
Week 01: A basic of C and C++
Week 02: More basic C and C++
Week 02: Numerical integration
Week 03: Templates and generic programming
Week 04: Introduction to classes
Week 05: An introduction to the hardware of your PC
Week 06: Operators, Function objects, More about templates
Week 07+08: Algorithms and Data Structure in C++
Week 09: Inheritance, Exceptions, and a C++ review from modular to generic programming Inheritance and Exceptions Part 2
Week 10: To code or not to code?
Week 11: Optimization in C++
Week 12: Monte Carlo Integration and Random Numbers
Week 14: An introduction to parallel computing

Tutorial exercises and solutions

The tutorial exercises and solutions can be downloaded from the following.

Week 01: None
Week 02: Exercise 1
Week 03: Exercise 2
Week 04: Exercise 3
Week 05: Exercise 4
Week 06: Exercise 5 (Paper on Penna Model)
Week 07: Exercise 6
Week 08: Exercise 7
Week 09: Exercise 8
Week 10: Exercise 9
Week 11: Exercise 10
Week 12: Exercise 11
Week 13: Exercise 12

Useful references for this course

UNIX operating system for dummies (external link)
VI editor for dummies (external link)
LATEX for dummies (external link)
A PYTHON tutorial (external link)
A C++ tutorial (external link)

Some example C++ codes

Hallo, I am Tama Ma!
right rectangular integration of sin x
how to create and use static library
how to make use of function pointers in STL algorithms (eg. std::accumulate)
how to make use of (boost) lambda expressions as function pointers in STL algorithm (eg. std::transform)
example on boost random number generator