gambit is hosted by Hepforge, IPPP Durham
GAMBIT  v1.5.0-252-gf9a3f78
a Global And Modular Bsm Inference Tool
Gambit::FcomplexT< T > Class Template Reference

Fortran complex type. More...

#include <util_types.hpp>

Collaboration diagram for Gambit::FcomplexT< T >:

Public Member Functions

 FcomplexT ()
 Default constructor. More...
 
 ~FcomplexT ()
 Default destructor. More...
 
template<typename T2 >
 FcomplexT (const FcomplexT< T2 > &in)
 Default copy constructor. More...
 
 FcomplexT (const std::complex< T > &in)
 Constructor from a C++ complex type. More...
 
 FcomplexT (const T &in)
 Constructor from a single instance of some type. More...
 
template<typename T2 >
FcomplexToperator= (const FcomplexT< T2 > &in)
 Assignment from another Fortran complex type. More...
 
FcomplexToperator= (const std::complex< T > &in)
 Assignment from a C++ complex type. More...
 
FcomplexToperator= (const T &in)
 Assignment from a single instance of some type. More...
 
template<typename T2 >
 operator FcomplexT< T2 > ()
 Type casting to another Fortran complex type. More...
 
 operator std::complex< T > ()
 Type casting to a C++ complex type. More...
 
abs () const
 
template<typename T2 >
FcomplexT operator* (const FcomplexT< T2 > &in)
 
template<typename T2 >
FcomplexT operator/ (const FcomplexT< T2 > &in)
 

Public Attributes

re
 
im
 

Detailed Description

template<typename T>
class Gambit::FcomplexT< T >

Fortran complex type.

Use typdef versions instead of the DO NOT UNDER ANY CIRCUMSTANCE add new member variables to this class!

Definition at line 524 of file util_types.hpp.

Constructor & Destructor Documentation

◆ FcomplexT() [1/4]

template<typename T>
Gambit::FcomplexT< T >::FcomplexT ( )
inline

Default constructor.

Definition at line 530 of file util_types.hpp.

530 {}

◆ ~FcomplexT()

template<typename T>
Gambit::FcomplexT< T >::~FcomplexT ( )
inline

Default destructor.

Definition at line 532 of file util_types.hpp.

532 {}

◆ FcomplexT() [2/4]

template<typename T>
template<typename T2 >
Gambit::FcomplexT< T >::FcomplexT ( const FcomplexT< T2 > &  in)
inline

Default copy constructor.

Definition at line 535 of file util_types.hpp.

References Gambit::FcomplexT< T >::im, and Gambit::FcomplexT< T >::re.

536  {
537  re = in.re;
538  im = in.im;
539  }

◆ FcomplexT() [3/4]

template<typename T>
Gambit::FcomplexT< T >::FcomplexT ( const std::complex< T > &  in)
inline

Constructor from a C++ complex type.

Definition at line 541 of file util_types.hpp.

542  {
543  re = in.real();
544  im = in.imag();
545  }

◆ FcomplexT() [4/4]

template<typename T>
Gambit::FcomplexT< T >::FcomplexT ( const T &  in)
inline

Constructor from a single instance of some type.

Definition at line 547 of file util_types.hpp.

548  {
549  re = in;
550  im = 0.0;
551  }

Member Function Documentation

◆ abs()

template<typename T>
T Gambit::FcomplexT< T >::abs ( ) const
inline

Definition at line 586 of file util_types.hpp.

Referenced by Gambit::FcomplexT< T >::operator/().

587  {
588  return sqrt(re*re + im*im);
589  }
Here is the caller graph for this function:

◆ operator FcomplexT< T2 >()

template<typename T>
template<typename T2 >
Gambit::FcomplexT< T >::operator FcomplexT< T2 > ( )
inline

Type casting to another Fortran complex type.

Definition at line 576 of file util_types.hpp.

577  {
578  return FcomplexT<T2>(std::complex<T2>(re, im));
579  }

◆ operator std::complex< T >()

template<typename T>
Gambit::FcomplexT< T >::operator std::complex< T > ( )
inline

Type casting to a C++ complex type.

Definition at line 581 of file util_types.hpp.

582  {
583  return std::complex<T>(re, im);
584  }

◆ operator*()

template<typename T>
template<typename T2 >
FcomplexT Gambit::FcomplexT< T >::operator* ( const FcomplexT< T2 > &  in)
inline

Definition at line 592 of file util_types.hpp.

References Gambit::FcomplexT< T >::im, and Gambit::FcomplexT< T >::re.

593  {
594  FcomplexT out;
595 
596  out.re = re*in.re - im*in.im;
597  out.im = re*in.im + im*in.re;
598 
599  return out;
600  }
FcomplexT()
Default constructor.
Definition: util_types.hpp:530

◆ operator/()

template<typename T>
template<typename T2 >
FcomplexT Gambit::FcomplexT< T >::operator/ ( const FcomplexT< T2 > &  in)
inline

Definition at line 603 of file util_types.hpp.

References Gambit::FcomplexT< T >::abs(), Gambit::FcomplexT< T >::im, and Gambit::FcomplexT< T >::re.

604  {
605  FcomplexT out;
606 
607  if(in.abs() != 0)
608  {
609  out.re = (re*in.re + im*in.im) / in.abs();
610  out.im = (im*in.re - re*in.im) / in.abs();
611  }
612  else
613  {
614  out.re = 0;
615  out.im = 0;
616  }
617 
618  return out;
619  }
FcomplexT()
Default constructor.
Definition: util_types.hpp:530
Here is the call graph for this function:

◆ operator=() [1/3]

template<typename T>
template<typename T2 >
FcomplexT& Gambit::FcomplexT< T >::operator= ( const FcomplexT< T2 > &  in)
inline

Assignment from another Fortran complex type.

Definition at line 554 of file util_types.hpp.

References Gambit::FcomplexT< T >::im, and Gambit::FcomplexT< T >::re.

555  {
556  re = in.re;
557  im = in.im;
558  return *this;
559  }

◆ operator=() [2/3]

template<typename T>
FcomplexT& Gambit::FcomplexT< T >::operator= ( const std::complex< T > &  in)
inline

Assignment from a C++ complex type.

Definition at line 561 of file util_types.hpp.

562  {
563  re = in.real();
564  im = in.imag();
565  return *this;
566  }

◆ operator=() [3/3]

template<typename T>
FcomplexT& Gambit::FcomplexT< T >::operator= ( const T &  in)
inline

Assignment from a single instance of some type.

Definition at line 568 of file util_types.hpp.

569  {
570  re = in;
571  im = 0.0;
572  return *this;
573  }

Member Data Documentation

◆ im

◆ re


The documentation for this class was generated from the following file: