Home | History | Annotate | Download | only in stl

Lines Matching full:complex

21 // This header declares the template class complex, as described in
22 // in the draft C++ standard. Single-precision complex numbers
23 // are complex<float>, double-precision are complex<double>, and
24 // quad precision are complex<long double>.
26 // Note that the template class complex is declared within namespace
36 struct complex {
38 typedef complex<_Tp> _Self;
41 complex() : _M_re(0), _M_im(0) {}
42 complex(const value_type& __x)
44 complex(const value_type& __x, const value_type& __y)
46 complex(const _Self& __z)
57 explicit complex(const complex<_Tp2>& __z)
61 _Self& operator=(const complex<_Tp2>& __z) {
98 // Arithmetic op= operations involving two complex arguments.
110 template <class _Tp2> _Self& operator+= (const complex<_Tp2>& __z) {
116 template <class _Tp2> _Self& operator-= (const complex<_Tp2>& __z) {
122 template <class _Tp2> _Self& operator*= (const complex<_Tp2>& __z) {
130 template <class _Tp2> _Self& operator/= (const complex<_Tp2>& __z) {
176 // from complex<float> to complex<double>, and complex<double> to
177 // complex<long double>.
180 struct _STLP_CLASS_DECLSPEC complex<float> {
182 typedef complex<float> _Self;
185 complex(value_type __x = 0.0f, value_type __y = 0.0f)
188 complex(const complex<float>& __z) : _M_re(__z._M_re), _M_im(__z._M_im) {}
190 inline explicit complex(const complex<double>& __z);
192 inline explicit complex(const complex<long double>& __z);
224 // Arithmetic op= operations involving two complex arguments.
236 complex<float>& operator=(const complex<_Tp2>& __z) {
243 complex<float>& operator+= (const complex<_Tp2>& __z) {
250 complex<float>& operator-= (const complex<_Tp2>& __z) {
257 complex<float>& operator*= (const complex<_Tp2>& __z) {
266 complex<float>& operator/= (const complex<_Tp2>& __z) {
318 struct _STLP_CLASS_DECLSPEC complex<double> {
320 typedef complex<double> _Self;
324 complex(value_type __x = 0.0, value_type __y = 0.0)
327 complex(const complex<double>& __z)
329 inline complex(const complex<float>& __z);
331 explicit inline complex(const complex<long double>& __z);
363 // Arithmetic op= operations involving two complex arguments.
374 complex<double>& operator=(const complex<_Tp2>& __z) {
381 complex<double>& operator+= (const complex<_Tp2>& __z) {
388 complex<double>& operator-= (const complex<_Tp2>& __z) {
395 complex<double>& operator*= (const complex<_Tp2>& __z) {
404 complex<double>& operator/= (const complex<_Tp2>& __z) {
458 struct _STLP_CLASS_DECLSPEC complex<long double> {
460 typedef complex<long double> _Self;
463 complex(value_type __x = 0.0l, value_type __y = 0.0l)
466 complex(const complex<long double>& __z)
468 inline complex(const complex<float>& __z);
469 inline complex(const complex<double>& __z);
501 // Arithmetic op= operations involving two complex arguments.
514 complex<long double>& operator=(const complex<_Tp2>& __z) {
521 complex<long double>& operator+= (const complex<_Tp2>& __z) {
528 complex<long double>& operator-= (const complex<_Tp2>& __z) {
535 complex<long double>& operator*= (const complex<_Tp2>& __z) {
544 complex<long double>& operator/= (const complex<_Tp2>& __z) {
600 inline complex<float>::complex(const complex<double>& __z)
602 inline complex<double>::complex(const complex<float>& __z)
605 inline complex<float>::complex(const complex<long double>& __z)
607 inline complex<double>::complex(const complex<long double>& __z)
609 inline complex<long double>::complex(const complex<float>& __z)
611 inline complex<long double>::complex(const complex<double>& __z)
618 inline complex<_Tp> _STLP_CALL operator+(const complex<_Tp>& __z)
622 complex<_Tp> _STLP_CALL operator-(const complex<_Tp>& __z)
623 { return complex<_Tp>(-__z._M_re, -__z._M_im); }
628 inline complex<_Tp> _STLP_CALL operator+(const _Tp& __x, const complex<_Tp>& __z)
629 { return complex<_Tp>(__x + __z._M_re, __z._M_im); }
632 inline complex<_Tp> _STLP_CALL operator+(const complex<_Tp>& __z, const _Tp& __x)
633 { return complex<_Tp>(__z._M_re + __x, __z._M_im); }
636 inline complex<_Tp> _STLP_CALL operator-(const _Tp& __x, const complex<_Tp>& __z)
637 { return complex<_Tp>(__x - __z._M_re, -__z._M_im); }
640 inline complex<_Tp> _STLP_CALL operator-(const complex<_Tp>& __z, const _Tp& __x)
641 { return complex<_Tp>(__z._M_re - __x, __z._M_im); }
644 inline complex<_Tp> _STLP_CALL operator*(const _Tp& __x, const complex<_Tp>& __z)
645 { return complex<_Tp>(__x * __z._M_re, __x * __z._M_im); }
648 inline complex<_Tp> _STLP_CALL operator*(const complex<_Tp>& __z, const _Tp& __x)
649 { return complex<_Tp>(__z._M_re * __x, __z._M_im * __x); }
652 inline complex<_Tp> _STLP_CALL operator/(const _Tp& __x, const complex<_Tp>& __z) {
653 complex<_Tp> __result;
654 complex<_Tp>::_div(__x,
661 inline complex<_Tp> _STLP_CALL operator/(const complex<_Tp>& __z, const _Tp& __x)
662 { return complex<_Tp>(__z._M_re / __x, __z._M_im / __x); }
664 // Non-member arithmetic operations involving two complex arguments
667 inline complex<_Tp> _STLP_CALL
668 operator+(const complex<_Tp>& __z1, const complex<_Tp>& __z2)
669 { return complex<_Tp>(__z1._M_re + __z2._M_re, __z1._M_im + __z2._M_im); }
672 inline complex<_Tp> _STLP_CALL
673 operator-(const complex<_Tp>& __z1, const complex<_Tp>& __z2)
674 { return complex<_Tp>(__z1._M_re - __z2._M_re, __z1._M_im - __z2._M_im); }
677 inline complex<_Tp> _STLP_CALL
678 operator*(const complex<_Tp>& __z1, const complex<_Tp>& __z2) {
679 return complex<_Tp>(__z1._M_re * __z2._M_re - __z1._M_im * __z2._M_im,
684 inline complex<_Tp> _STLP_CALL
685 operator/(const complex<_Tp>& __z1, const complex<_Tp>& __z2) {
686 complex<_Tp> __result;
687 complex<_Tp>::_div(__z1._M_re, __z1._M_im,
696 inline bool _STLP_CALL operator==(const complex<_Tp>& __z1, const complex<_Tp>& __z2)
700 inline bool _STLP_CALL operator==(const complex<_Tp>& __z, const _Tp& __x)
704 inline bool _STLP_CALL operator==(const _Tp& __x, const complex<_Tp>& __z)
712 inline bool _STLP_CALL operator!=(const complex<_Tp>& __z1, const complex<_Tp>& __z2)
718 inline bool _STLP_CALL operator!=(const complex<_Tp>& __z, const _Tp& __x)
722 inline bool _STLP_CALL operator!=(const _Tp& __x, const complex<_Tp>& __z)
727 inline _Tp _STLP_CALL real(const complex<_Tp>& __z)
731 inline _Tp _STLP_CALL imag(const complex<_Tp>& __z)
735 _Tp _STLP_CALL abs(const complex<_Tp>& __z);
738 _Tp _STLP_CALL arg(const complex<_Tp>& __z);
741 inline _Tp _STLP_CALL norm(const complex<_Tp>& __z)
745 inline complex<_Tp> _STLP_CALL conj(const complex<_Tp>& __z)
746 { return complex<_Tp>(__z._M_re, -__z._M_im); }
749 complex<_Tp> _STLP_CALL polar(const _Tp& __rho)
750 { return complex<_Tp>(__rho, 0); }
753 complex<_Tp> _STLP_CALL polar(const _Tp& __rho, const _Tp& __phi);
756 _STLP_DECLSPEC float _STLP_CALL abs(const complex<float>&);
758 _STLP_DECLSPEC double _STLP_CALL abs(const complex<double>&);
760 _STLP_DECLSPEC float _STLP_CALL arg(const complex<float>&);
762 _STLP_DECLSPEC double _STLP_CALL arg(const complex<double>&);
764 _STLP_DECLSPEC complex<float> _STLP_CALL polar(const float& __rho, const float& __phi);
766 _STLP_DECLSPEC complex<double> _STLP_CALL polar(const double& __rho, const double& __phi);
769 _Tp _STLP_CALL abs(const complex<_Tp>& __z)
770 { return _Tp(abs(complex<double>(double(__z.real()), double(__z.imag())))); }
773 _Tp _STLP_CALL arg(const complex<_Tp>& __z)
774 { return _Tp(arg(complex<double>(double(__z.real()), double(__z.imag())))); }
777 complex<_Tp> _STLP_CALL polar(const _Tp& __rho, const _Tp& __phi) {
778 complex<double> __tmp = polar(double(__rho), double(__phi));
779 return complex<_Tp>(_Tp(__tmp.real()), _Tp(__tmp.imag()));
784 _STLP_DECLSPEC long double _STLP_CALL arg(const complex<long double>&);
786 _STLP_DECLSPEC long double _STLP_CALL abs(const complex<long double>&);
788 _STLP_DECLSPEC complex<long double> _STLP_CALL polar(const long double&, const long double&);
802 // Complex output, in the form (re,im). We use a two-step process
806 operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __z);
810 operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __z);
816 operator>>(basic_istream<char, char_traits<char> >& __is, complex<float>& __z);
820 operator>>(basic_istream<char, char_traits<char> >& __is, complex<double>& __z);
824 operator<<(basic_ostream<char, char_traits<char> >& __is, const complex<float>& __z);
828 operator<<(basic_ostream<char, char_traits<char> >& __is, const complex<double>& __z);
833 operator>>(basic_istream<char, char_traits<char> >& __is, complex<long double>& __z);
837 operator<<(basic_ostream<char, char_traits<char> >& __is, const complex<long double>& __z);
844 operator>>(basic_istream<wchar_t, char_traits<wchar_t> >&, complex<double>&);
846 operator<<(basic_ostream<wchar_t, char_traits<wchar_t> >&, const complex<double>&);
848 operator>>(basic_istream<wchar_t, char_traits<wchar_t> >&, complex<float>&);
850 operator<<(basic_ostream<wchar_t, char_traits<wchar_t> >&, const complex<float>&);
854 operator>>(basic_istream<wchar_t, char_traits<wchar_t> >&, complex<long double>&);
856 operator<<(basic_ostream<wchar_t, char_traits<wchar_t> >&, const complex<long double>&);
866 _STLP_DECLSPEC complex<float> _STLP_CALL sqrt(const complex<float>&);
868 _STLP_DECLSPEC complex<float> _STLP_CALL exp(const complex<float>&);
869 _STLP_DECLSPEC complex<float> _STLP_CALL log(const complex<float>&);
870 _STLP_DECLSPEC complex<float> _STLP_CALL log10(const complex<float>&);
872 _STLP_DECLSPEC complex<float> _STLP_CALL pow(const complex<float>&, int);
873 _STLP_DECLSPEC complex<float> _STLP_CALL pow(const complex<float>&, const float&);
874 _STLP_DECLSPEC complex<float> _STLP_CALL pow(const float&, const complex<float>&);
875 _STLP_DECLSPEC complex<float> _STLP_CALL pow(const complex<float>&, const complex<float>&);
877 _STLP_DECLSPEC complex<float> _STLP_CALL sin(const complex<float>&);
878 _STLP_DECLSPEC complex<float> _STLP_CALL cos(const complex<float>&);
879 _STLP_DECLSPEC complex<float> _STLP_CALL tan(const complex<float>&);
881 _STLP_DECLSPEC complex<float> _STLP_CALL sinh(const complex<float>&);
882 _STLP_DECLSPEC complex<float> _STLP_CALL cosh(const complex<float>&);
883 _STLP_DECLSPEC complex<float> _STLP_CALL tanh(const complex<float>&);
885 _STLP_DECLSPEC complex<double> _STLP_CALL sqrt(const complex<double>&);
887 _STLP_DECLSPEC complex<double> _STLP_CALL exp(const complex<double>&);
888 _STLP_DECLSPEC complex<double> _STLP_CALL log(const complex<double>&);
889 _STLP_DECLSPEC complex<double> _STLP_CALL log10(const complex<double>&);
891 _STLP_DECLSPEC complex<double> _STLP_CALL pow(const complex<double>&, int);
892 _STLP_DECLSPEC complex<double> _STLP_CALL pow(const complex<double>&, const double&);
893 _STLP_DECLSPEC complex<double> _STLP_CALL pow(const double&, const complex<double>&);
894 _STLP_DECLSPEC complex<double> _STLP_CALL pow(const complex<double>&, const complex<double>&);
896 _STLP_DECLSPEC complex<double> _STLP_CALL sin(const complex<double>&);
897 _STLP_DECLSPEC complex<double> _STLP_CALL cos(const complex<double>&);
898 _STLP_DECLSPEC complex<double> _STLP_CALL tan(const complex<double>&);
900 _STLP_DECLSPEC complex<double> _STLP_CALL sinh(const complex<double>&);
901 _STLP_DECLSPEC complex<double> _STLP_CALL cosh(const complex<double>&);
902 _STLP_DECLSPEC complex<double> _STLP_CALL tanh(const complex<double>&);
905 _STLP_DECLSPEC complex<long double> _STLP_CALL sqrt(const complex<long double>&);
906 _STLP_DECLSPEC complex<long double> _STLP_CALL exp(const complex<long double>&);
907 _STLP_DECLSPEC complex<long double> _STLP_CALL log(const complex<long double>&);
908 _STLP_DECLSPEC complex<long double> _STLP_CALL log10(const complex<long double>&);
910 _STLP_DECLSPEC complex<long double> _STLP_CALL pow(const complex<long double>&, int);
911 _STLP_DECLSPEC complex<long double> _STLP_CALL pow(const complex<long double>&, const long double&);
912 _STLP_DECLSPEC complex<long double> _STLP_CALL pow(const long double&, const complex<long double>&);
913 _STLP_DECLSPEC complex<long double> _STLP_CALL pow(const complex<long double>&,
914 const complex<long double>&);
916 _STLP_DECLSPEC complex<long double> _STLP_CALL sin(const complex<long double>&);
917 _STLP_DECLSPEC complex<long double> _STLP_CALL cos(const complex<long double>&);
918 _STLP_DECLSPEC complex<long double> _STLP_CALL tan(const complex<long double>&);
920 _STLP_DECLSPEC complex<long double> _STLP_CALL sinh(const complex<long double>&);
921 _STLP_DECLSPEC complex<long double> _STLP_CALL cosh(const complex<long double>&);
922 _STLP_DECLSPEC complex<long double> _STLP_CALL tanh(const complex<long double>&);