C++

C++11/14 for scientific computing VI

Floating-point exceptions During a numerical calculation various kinds of run-time errors may occur. In C++, such an error may be indicated via floating-point exceptions or via the (global but thread-local) variable errno. Floating-point exceptions are completely unrelated to C++ exceptions. When an floating-point exception is raised by an erroneous operation, the exception is simply noted… Continue reading C++11/14 for scientific computing VI

Performance

Boosting NumPy with MKL

The Intel Math Kernel Library (MKL) contains a collection of highly optimized numerical functions.  Among others, it provides implementations of Blas functions and Lapack functions for various linear algebra problems. A program, which is dynamically linked against the standard Blas and Lapack libraries, can easily benefit from alternative optimized implementations by replacing libblas.so and liblapack.so… Continue reading Boosting NumPy with MKL

C++

Revisiting the named parameter idiom in C++14

Some programming languages have functions with named parameters. Named parameters let the programmer pass the parameters to a function in any order and they are distinguished by a name. So the programmer can explicitly pass all the needed parameters and default values without worrying about the order used in the function declaration. In C++, however,… Continue reading Revisiting the named parameter idiom in C++14

C++ · MPI · parallel computing

MPL – A message passing library

The Message Passing Interface (MPI) Standard defines a message passing library, which serves as the basis for many high-performance computing applications today. It provides portable scalable functions for data exchange in parallel computations for various parallel computing architectures. Originally application programing interfaces had been defined for C and Fortran as well as for C++. In… Continue reading MPL – A message passing library

C++

C++11/14 for scientific computing V

$\boldsymbol{\lambda}$ functions Anonymous functions, often called $\lambda$ functions, are a common feature of scientific programming languages, e.g., Male and Matlab. They are particularly usefull when functions are employed, which take other functions as arguments.  For example, a numerical root finding algorithm requires to specify a function as an input parameter. C++11 introduces $\lambda$ functions to… Continue reading C++11/14 for scientific computing V

C++

C++11/14 for scientific computing IV

Random numbers C++98 inherited from C the standard functions rand and srand and the macro RAND_MAX for generating pseudo-random numbers. These functions suffer several problems. For example, it has been never specified which algorithm is used in rand to produce pseudo-random numbers. Thus, in C and in C++98 the outcome of a Monte Carlo simulation… Continue reading C++11/14 for scientific computing IV