C-XSC - A C++ Class Library for Extended Scientific Computing  2.5.4
C-XSC - A C++ Class Library for Extended Scientific Computing Documentation


The speed of digital Computers is ever increasing. While the emphasis in computing was traditionally on speed, more emphasis can now be put on accuracy and reliability of results. Numerical mathematics has devised algorithms which deliver highly accurate and automatically verified results by applying mathematical fixed-point theorems. This means that these computation carry their own accuracy control. However, their implementation requires suitable arithmetic support and powerful programming tools which are not generally available.

Different hardware solutions are available for Personal Computers, Workstations, Mainframes and Super Computers. In particular a vector arithmetic coprocessor for the PC has been developed in VLSI-technology. Language support is available on the basis of FORTRAN, PASCAL, and C (ACRITH-XSC, Fortran-XSC, PASCAL-XSC, and C- XSC). Problem-solving routines with automatic result verification have been developed for many standard problems of numerical analysis as for linear or nonlinear systems of equations, for differential and integral equations, etc. as well as for a large number of applications in the engineering and natural sciences.

Language eXtensions for Scientific Computation provide all features indispensable for modern numerical software development, such as

  • Operator concept (user-defined operators)
  • Overloading concept
  • Module concept
  • Dynamic arrays
  • Controlled rounding
  • Predefined arithmetic data types real, (extended real), complex, interval, complex interval, and corresponding vector and matrix types
  • Predefined arithmetic operators of highest accuracy for the arithmetic data types
  • Predefined elementary functions of highest accuracy for the arithmetic data types
  • Data type dotprecision for the exact representation of dot products
  • Library of mathematical problem-solving routines with automatic result verification and high accuracy

Simple programming examples

To learn how to use the C-XSC class library you can read the page Simple programming examples and follow the examples described there.

For more experienced users the C++ Toolbox for Verified Computing is the more interesting place. There you find much more sophisticated examples on how to use the C-XSC class library.

C++ Toolbox for Verified Computing

The C++ Toolbox for Verified Computing is the C++ edition of the Numerical Toolbox for Verified Computing. The programs of the original edition were written in PASCAL-XSC, a PASCAL eXtension for Scientific Computation.

The methods presented here are practical, reliable, and elegant. They are provided in theory, algorithmic descriptions, and implementations to solve a number of basic numerical problems in a reliable way.

Selecting the precision of dot product computations

By default, C-XSC uses a software emulation of a long fix-point accumulator for dot product computations, which delivers results with maximum accuracy. This means that all operations by default are only one rounding away from the exact result. However, due to the software emulation these operations are slow.

The user can change the default behaviour for the overloaded operators by setting the global integer variable opdotprec to a value K. All dot products computed with overloaded operators (for example in a matrix-matrix product), are then carried out in (simulated) K-fold double precision. For K=1, pure floating point operations are used. For K>=2, the DotK algorithm, based on so-called error free transformations is used. Accuracy of the results and computing costs increase with K. For K=0, the default setting, the long accumulator is used as before.

When computing dot product expressions using the dotprecision classes, the precision used in each call of the accumulate-function can be set via the member function set_dotprec of the dotprecision classes. The meaning of the setting is the same as for the operators.

For more information, see: Zimmer, M.; Krämer, W.; Bohlender, G.; Hofschuster, W.: Extension of the C-XSC Library with Scalar Products with Selectable Accuracy Published in: Serdica Journal of Computing, Vol. 4, No. 3, p. 349-370, 2010

Using a BLAS-library

For best performance, it is suggested to make use of the BLAS support of C-XSC. BLAS support can be used for the overloaded operator* of the dense vector and matrix types. To activate it, the global variable opdotprec must be set to 1 and the flag -DCXSC_USE_BLAS must be set during compilation. The program must then be linked to an optimized BLAS and CBLAS library. When activating BLAS support, and intermediate midpoint-radius-format is used for intervals, which might result in some additional overestimation.

Please note that the BLAS library used must allow the changing of the rounding mode. Suitable BLAS-librarier in our tests were ATLAS and the Intel MKL. Not supported at the moment is GoTo BLAS.

For more information, see:

Zimmer, M.; Krämer, W.; Hofschuster, W.: Using C-XSC in High Performance Computing Preprint 2009/5, Universität Wuppertal, 2009 Revised version submitted for publication (PARA2010): Walter Krämer, Michael Zimmer, Werner Hofschuster: Using C-XSC for High Performance Verified Computing PARA 2010, Reykjavik, Iceland, Part II, LNCS 7134, Springer-Verlag, pp. 168-178, 2012

Activating OpenMP support

Some of the C-XSC operators can be parallelized using OpenMP. This is especially helpful when using higher precision computations or if no BLAS-library is available. To activate OpenMP support, set the appropriate OpenMP flag of your compiler and additionally the flag -DCXSC_USE_OPENMP during the compilation of your program.

Using C-XSC in a Multi-Threaded Environment

Since C-XSC is now nearly twenty years old, thread-safety has not been a focus in its development for a long time. In recent years, a lot of work has been invested into making C-XSC fit for high performance computing and the threadsafety of C-XSC has been vastly improved in the process.

More information can be found in:

Zimmer, M.: "Using C-XSC in a Multi-Threaded Environment" Preprint BUW-WRSWT 2011/2, Universität Wuppertal, 2011, http://www2.math.uni-wuppertal.de/wrswt/preprints/prep_11_2.pdf


The work on C-XSC started in 1990 at the Institute for Applied Mathematics (Prof. Kulisch), University of Karlsruhe. Many colleagues and scientists have directly and indirectly contributed to the realization of C-XSC. The authors would like to thank each of them for his or her cooperation. Special thanks go to U. Allendörfer, C. Baumhof, H. Berlejung, H. Bleher, H. Böhm, B. Bohl, G. Bohlender, F. Blomquist, K. Braune, H.H. Chen, D. Cordes, A. Davidenkoff, H.-C. Fischer, M. Grimmer, K. Grüner, R. Hammer, M. Hinz, M. Hocks, B. Höffgen, W. Hofschuster, P. Januscke, E. Kaucher, R. Kelch, R. Kirchner, R. Klatte, W. Klein, W. Krämer, U. Kulisch, C. Lawo, M. Metzger, W.L. Miranker, M. Neaga, M. Neher, D. Ratz, M. Rauch, S. Ritterbusch, S.M. Rump, R. Saier, D. Schiriaev, L. Schmidt, G. Schumacher, U. Storck, J. Suckfüll, F. Toussaint, C. Ullrich, W. Walter, S. Wedner, G. Werheit, A. Wiethoff, H.W. Wippermann, J. Wolff von Gudenberg and M. Zimmer.

C-XSC is an outcome of an ongoing collaboration of the Institute for Applied Mathematics (Prof. Kulisch), University of Karlsruhe and the Institute for Scientific Computing/Software Engineering (Prof. Krämer), University of Wuppertal. For the latest news and up to date software contact http://www.math.uni-wuppertal.de/~xsc/ .

Thanks to the referees for valuable comments and suggestions.

February 2014