Scientific Programming++ Single channel
Chair (Coordinator) and Rapporteur: CRISTIANO DE MICHELE
Lecturers
Objectives
GENERAL OBJECTIVES:
The course “Scientific Programming++” aims to provide the necessary knowledge to understand the object-oriented programming paradigm and to apply it in writing computer programs using the C++ language for solving simple scientific problems. The scientific problems considered will attempt to cover as broadly as possible all areas of modern physics. This course will introduce and use modern C++ language, intended as a natural evolution of the C language, learned in previous courses on computing methods, and it will introduce the generic programming. Practical lectures are planned during the course, during which students will be able to implement algorithms in C++ for solving scientific problems, such as solving differential equations, vector and matrix calculus, computation of eigenvectors and eigenvalues, data fitting, and numerical simulations of lattice systems. Students will work on C++ code proposed during practical lectures, but also on their own final project, for which they will have to present the results obtained, thus having the opportunity to refine their communication skills in the scientific field. Additionally, through the development of their own project, students will demonstrate their level of understanding of the topics covered in the course and their ability to autonomously apply the acquired knowledge
SPECIFIC OBJECTIVES:
A - Knowledge and understanding
OF 1) Understand the differences among possible programmming paradigms
OF 2) Know object oriented paradigm with applications to scientific computing
OF 3) Know modern C++ language as a tool to implement object oriented programming
OF 4) Know the basics of generic programming realized through C++ language
B - Application skills
OF 5) Ability to implement one’s own simulation code in C++
OF 6) Ability to find the correct algorithm to solve a given scientific problem
OF 7) Be able to develop computer codes in C++ to solve numerically a scientific problem
C - Autonomy of judgment
OF 8) Be able to critically analyze the results of numerical calculations in order to assess their validity
OF 9) Be able to acquire autonomously new knowledge in order to tackle new problems that require additional numeric techniques with respect to those already learned.
OF 10) Be able to identify the best technique or algorithm to solve and study a physical problem numerically.
D - Communication skills
OF 11) Know how to communicate clearly to specialists and non-specialists, through manuscripts and presentations, the results obtained.
OF 12) Know how to clearly discuss a scientific topic.
OF 13) Know how to reproduce calculations related to a given scientific topic in a critical and informed manner.
E - Ability to learn
OF 14) Have the ability to learn new algorithms and numerical techniques
OF 15) Be able to conceive and develop their own project consisting of writing a code in C++ to solve a scientific problem numerically
OF 16) Be able to overcome difficulties and unexpected challenges in the implementation of numerical techniques through original ideas and solutions.
Learning outcomes
The student should acquire a basic knowledge of the C language and
should be able to understand and use it to solve scientific problems.
Prerequisites
It is recommended that you have a basic understanding of the C programming language
Programme
The course will generally illustrate the fundamentals of the C++ language through examples and simple programs to implement in order to learn the language.
At the beginning, an overview of the different programming paradigms will be provided: procedural, object-oriented (inheritance, polymorphism, and encapsulation), and functional.
There will also be a review of the C language, discussing common aspects and differences between C++ and C.
Detailed topics covered in the course:
- Introduction to C++
- Constants, namespaces, dynamic memory management, pointers, references, and arrays
- Classes and objects: private, protected, and public members, setters and getters. Class interface, header and source files
- Dynamic memory (dynamic allocation of class members), constructors and destructors, the this pointer and const methods, default argument values. The const modifier for arguments
- Operators and their overloading with examples. Global functions and operators. friend functions and operators. Static members and static data inside functions. Static methods. Creation of a vector class. Curly brace initialization. Functions and constructors with a variable number of arguments (initializer_list). Overloading of the square bracket operator and the parentheses operator
- Inheritance: public, private, and protected derivation. Function overloading and polymorphism. Virtual functions and pure virtual functions (abstract classes). Virtual destructors. Inheritance vs composition.
- Copy constructor and casting. Overview of string usage and input/output in C++.
- Introduction to templates and generic programming. Classes and metaclasses. Template functions. Use of constexpr, using, and auto in generic programming
- Selected Design patterns: observer, strategy, factory [4 hours] * Artificial neurons and Multi Layer Perceptron (MLP) networks
- Implementation of an MLP network: forward propagation and matrix multiplications.
- Training of an MLP network: backpropagation
- Eigen library for matrix multiplication.
PRACTICAL LESSONS
C++ implementation of an MLP network for number and letter recognition using the Eigen and opencv libraries.
Books
- C++ How to program (5th edition), H. Deitel and P. Deitel, Prentice Hall
[Introductory book, suitable for those new to C++]
- The C++ Programming Language (4th edition), Bjarne Stroustrup, Addison-Wesley Professional
[Reference book; the equivalent of the Kernighan-Ritchie book for the C language]
- Effective Modern C++, Scott Meyers, O'Reilly Media
[For those already familiar with C++03 who want to transition to modern C++, specifically the C++11 and C++14 standards]
- Make your own neural network, Tariq Rashid, CreateSpace Independent Publishing Platform (2016) ISBN-10: 1530826608
Lessons mode
The course consists of approximately 60 hours of lectures interspersed with hands-on sessions, during which students will be asked to write simple C++ code to solve exercises related to the topics covered in the lectures and to continue working on a project to develop their own neural network in C++ for recognizing numbers.
Frequency
lectures and practical classes are not mandatory
Exam mode
The final assessment consists of an oral exam in which students will discuss a final project of their choice. The instructor will provide a list of possible topics before the exam. The project involves developing simulation code and writing a short paper (no more than 10 pages).
The final project will be an extension of the project students will work on during the course’s lab sessions, which will involve implementing an MLP neural network for digit recognition in C++.
Example exam questions
The student will be asked for details about the implementation
of the final project. These details will cover both the implementation
in C++ and the logic of the algorithms used.
Sustainability goals
- Academic year2026/2027
- Degree program to which the course belongsPhysics
- Lesson code10616849
- Year and semester3rd year - 1st semester
- Activity typeAttività formative affini ed integrative
- Academic areaAttività formative affini o integrative
- SSDFIS/01
- Mandatory presenceNo
- Languageita
- CFU6 CFU
- Total duration60 hours
- Hours distribution24 classroom hours, 36 training hours