03.12.2012 Views

C++ for Scientists - Technische Universität Dresden

C++ for Scientists - Technische Universität Dresden

C++ for Scientists - Technische Universität Dresden

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

10<br />

C ++ was not a reliable computer language in the nineties : code was not portable, object<br />

code not efficient and had a large size. This made C ++ unpopular in scientific computing. This<br />

changed at the end of the nineties : the compilers produced more efficient code, and the standard<br />

was more and more supported by compilers. Especially the ability to inline small functions and<br />

the introduction of complex numbers in the C99 standard made C ++ more attractive to scientific<br />

programmers.<br />

Together with the development of compilers, numerical libraries are being developed in C ++<br />

that offer great flexibility together with efficiency. This work is still ongoing and more and<br />

more software is being written in C ++. Currently, other languages used <strong>for</strong> numerics are FOR-<br />

TRAN 77 (even new codes!), Fortran 95, and Matlab. More and more becoming popular is<br />

Python. The nice thing about Python is that it is relatively easy to link C ++ functions and<br />

classes into Python scripts. Writing such interfaces is not a subject of this course.<br />

The goal of this course is to introduce students to the exciting world of C ++ programming <strong>for</strong><br />

scientific applications. The course does not offer a deep study of the programming language<br />

itself, but rather focuses on those aspects that make C ++ suitable <strong>for</strong> scientific programming.<br />

Language concepts are introduced and applied to numerical programming, together with the<br />

STL and Boost.<br />

Starting C ++ programmers often adopt a Java programming style: both languages are object<br />

oriented, but there are subtle differences that allow C ++ to produce more compact expressions.<br />

For example, C ++ classes typically do not have getters and setters as this is often the case<br />

in Java classes. This will be discussed in more detail in the course. We use the following<br />

convention, which is also used by Boost, that is one of the good examples of C ++ software.<br />

Classes and variables are denoted by lower case characters. Underscores are used as separator<br />

in symbols. An exception are matrices that are written as single capitals <strong>for</strong> the simularity with<br />

the mathematical notation. Mixed upper and lower case characters (CamelCase) are typically<br />

used <strong>for</strong> concepts. Constants are often (as in C) written in capital.<br />

0.2 Outline<br />

The topics that will be discussed are several aspects of the syntax of C ++, illustrated by small<br />

numerical programs, an introduction to meta programming, expression templates, STL, boost,<br />

MTL4, and GLAS. We will also discuss interoperability with other languages. The first three<br />

chapters discuss basic language aspects, such as functions, types, and classes, inheritance and<br />

generic programming, include examples from STL. The remaining chapters discuss topics that<br />

are of great importance <strong>for</strong> numerical applications: functors, expression templates, and interoperability<br />

with FORTRAN and C.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!