JOINT   INSTITUTE   FOR   NUCLEAR   RESEARCH
lit JINRLIB   Program   Library

CPX - complex number utility


Authors: Mihai Tiberiu Dima, Maria Dima
rus

Highlights

The class fields an embodiment of complex numbers in a high performance slimline templated polymorphic package - part of the NXV4 "Math_on_Paper Software" concept, allowing users to work with the computer almost as with pen on paper.

Example       cpx<int> i(0,1)  ;
          double   u = 1.0 ;
          auto     z = u+i ;

Evidently, z will be instantiated as cpx<double> - transparent to the user (grace to the class' type-calculator returning the appropriate type from the "+" operator):

         double + cpx<int> = cpx<double>

    The class is move-semantix compliant, for superior speed, and slim (all strictly non-class members being implemented as friend operators and functions - for a total of over 1180 instantiations of the usual algebraic/logical operators).

    The class overloads the cout operator to display complex numbers in a pedantic manner.

Example  cout << boolalpha << i << endl  ;
         cout << z << endl               ;
         cout << noboolalpha << z << endl;

will display     i.int
         (1+i).double
          1+i


    The class implements the correct foliage of the sqrt and log functions, as well as exponentiation of complex to the power of complex - together with the full complement of algebraic and logical operators.

 


Documentation -   manual, with main & application tutorials

Downloads        - C++ libs(1) as *.tgz, *.zip and examples: 1, 2, 3, 4, appl

                            (1)gcc-4.4.7 20120313 //... linux-2.6.32-504.12.2.el6.x86_64




     This project was realised in the framework of the 05-6-1119-2014/2023 "New Investigation Tools in Computational Physics" research theme, of the Meshcheryakov Laboratory of Information Technologies JINR.




home up e-mail