StatMech
Loading...
Searching...
No Matches
Eigen Namespace Reference

Classes

struct  NumTraits< Complex_t< T > >
 

Functions

template<typename charT , typename traits >
std::basic_ostream< charT, traits > & operator<< (std::basic_ostream< charT, traits > &strm, const std::complex< double > &c)
 
template<typename charT , typename traits , typename RealType >
std::basic_ostream< charT, traits > & operator<< (std::basic_ostream< charT, traits > &strm, const Complex_t< RealType > &c)
 

Function Documentation

◆ operator<<() [1/2]

template<typename charT , typename traits , typename RealType >
std::basic_ostream< charT, traits > & Eigen::operator<< ( std::basic_ostream< charT, traits > &  strm,
const Complex_t< RealType > &  c 
)
237 {
238 constexpr size_t precision = 4;
239 constexpr size_t realWidth = precision + 7;
240 constexpr size_t imagWidth = realWidth;
241 constexpr size_t width = realWidth + imagWidth + 2;
242 constexpr double epsilon = 1.0e-8;
243 std::stringstream buff("");
244 buff << std::showpos << std::scientific << std::setprecision(precision);
245 if(std::abs(c.real()) < epsilon && std::abs(c.imag()) < 1.0e-8)
246 buff << 0;
247 else if(std::abs(c.real()) > epsilon && std::abs(c.imag()) < epsilon) { buff << c.real(); }
248 else if(std::abs(c.real()) < epsilon && std::abs(c.imag()) > epsilon) {
249 buff << c.imag() << "*i";
250 }
251 else { buff << c.real() << c.imag() << "*i"; }
252 strm << std::setw(width) << buff.str();
253 return strm;
254 }
std::stringstream buff("")

◆ operator<<() [2/2]

template<typename charT , typename traits >
std::basic_ostream< charT, traits > & Eigen::operator<< ( std::basic_ostream< charT, traits > &  strm,
const std::complex< double > &  c 
)
6 {
7 if( std::abs(c.real()) < 1.0e-8 && std::abs(c.imag()) < 1.0e-8 ) strm << 0;
8 if( std::abs(c.real()) > 1.0e-8) strm << std::showpos << c.real();
9 if( std::abs(c.imag()) > 1.0e-8) strm << std::showpos << c.imag() << "*i";
10 strm << std::noshowpos;
11 return strm;
12 }