📄 complex_.gml
字号:
:P.
.ix 'Complex class'
This class is used for the storage and manipulation of complex
numbers, which are often represented by
:ITALICS.real
and
:ITALICS.imaginary
components (Cartesian coordinates), or by
:ITALICS.magnitude
and
:ITALICS.angle
(polar coordinates). Each object stores exactly one complex number.
An object may be used in expressions in the same manner as floating-point
values.
:P.
The class documented here is the Open Watcom legacy complex class. It
is not the
:MONO.std::complex
class template specified by Standard C++.
.*
:CLFNM.Complex
:CMT.========================================================================
:LIBF fmt='hdr'.Complex
:HFILE.complex.h
:CLSS.
The &cls. is used for the storage and
manipulation of complex numbers, which are often represented by
:ITALICS.real
and
:ITALICS.imaginary
components (Cartesian coordinates), or by
:ITALICS.magnitude
and
:ITALICS.angle
(polar coordinates). Each &obj. stores exactly one complex number.
A &obj. may be used in expressions in the same manner as floating-point values.
:HDG.Public Member Functions
The following constructors and destructors are declared:
:MFNL.
:MFCD cd_idx='c'.Complex();
:MFCD cd_idx='c'.Complex( Complex const & );
:MFCD cd_idx='c'.Complex( double, double = 0.0 );
:MFCD cd_idx='d' .~~Complex();
:eMFNL.
:P.
The following arithmetic member functions are declared:
:MFNL.
:MFN index='operator =' .Complex &.operator =( Complex const & );
:MFN index='operator =' .Complex &.operator =( double );
:MFN index='operator +='.Complex &.operator +=( Complex const & );
:MFN index='operator +='.Complex &.operator +=( double );
:MFN index='operator -='.Complex &.operator -=( Complex const & );
:MFN index='operator -='.Complex &.operator -=( double );
:MFN index='operator *='.Complex &.operator *=( Complex const & );
:MFN index='operator *='.Complex &.operator *=( double );
:MFN index='operator /='.Complex &.operator /=( Complex const & );
:MFN index='operator /='.Complex &.operator /=( double );
:MFN index='operator +' .Complex operator +() const;
:MFN index='operator -' .Complex operator -() const;
:MFN index='imag' .double imag() const;
:MFN index='real' .double real() const;
:eMFNL.
:HDG.Friend Functions
The following I/O Stream inserter and extractor friend functions are declared:
:RFNL.
:RFN index='operator >>'.friend istream &.operator >>( istream &, Complex & );
:RFN index='operator <<'.friend ostream &.operator <<( ostream &, Complex const & );
:eRFNL.
:HDG.Related Operators
The following operators are declared:
:RFNL.
:RFN index='operator +' .Complex operator +( Complex const &, Complex const & );
:RFN index='operator +' .Complex operator +( Complex const &, double );
:RFN index='operator +' .Complex operator +( double , Complex const & );
:RFN index='operator -' .Complex operator -( Complex const &, Complex const & );
:RFN index='operator -' .Complex operator -( Complex const &, double );
:RFN index='operator -' .Complex operator -( double , Complex const & );
:RFN index='operator *' .Complex operator *( Complex const &, Complex const & );
:RFN index='operator *' .Complex operator *( Complex const &, double );
:RFN index='operator *' .Complex operator *( double , Complex const & );
:RFN index='operator /' .Complex operator /( Complex const &, Complex const & );
:RFN index='operator /' .Complex operator /( Complex const &, double );
:RFN index='operator /' .Complex operator /( double , Complex const & );
:RFN index='operator =='.int operator ==( Complex const &, Complex const & );
:RFN index='operator =='.int operator ==( Complex const &, double );
:RFN index='operator =='.int operator ==( double , Complex const & );
:RFN index='operator !='.int operator !=( Complex const &, Complex const & );
:RFN index='operator !='.int operator !=( Complex const &, double );
:RFN index='operator !='.int operator !=( double , Complex const & );
:eRFNL.
:HDG.Related Functions
The following related functions are declared:
:RFNL.
:RFN index='abs' .double abs ( Complex const & );
:RFN index='acos' .Complex acos ( Complex const & );
:RFN index='acosh'.Complex acosh( Complex const & );
:RFN index='arg' .double arg ( Complex const & );
:RFN index='asin' .Complex asin ( Complex const & );
:RFN index='asinh'.Complex asinh( Complex const & );
:RFN index='atan' .Complex atan ( Complex const & );
:RFN index='atanh'.Complex atanh( Complex const & );
:RFN index='conj' .Complex conj ( Complex const & );
:RFN index='cos' .Complex cos ( Complex const & );
:RFN index='cosh' .Complex cosh ( Complex const & );
:RFN index='exp' .Complex exp ( Complex const & );
:RFN index='imag' .double imag ( Complex const & );
:RFN index='log' .Complex log ( Complex const & );
:RFN index='log10'.Complex log10( Complex const & );
:RFN index='norm' .double norm ( Complex const & );
:RFN index='polar'.Complex polar( double , double = 0 );
:RFN index='pow' .Complex pow ( Complex const &, Complex const & );
:RFN index='pow' .Complex pow ( Complex const &, double );
:RFN index='pow' .Complex pow ( double , Complex const & );
:RFN index='pow' .Complex pow ( Complex const &, int );
:RFN index='real' .double real ( Complex const & );
:RFN index='sin' .Complex sin ( Complex const & );
:RFN index='sinh' .Complex sinh ( Complex const & );
:RFN index='sqrt' .Complex sqrt ( Complex const & );
:RFN index='tan' .Complex tan ( Complex const & );
:RFN index='tanh' .Complex tanh ( Complex const & );
:eRFNL.
:eCLSS.
:eLIBF.
:CMT.========================================================================
:LIBF fmt='fun'.abs
:SNPL.
:SNPFLF .#include <complex.h>
:SNPR index='abs'.double abs( Complex const &.num );
:eSNPL.
:SMTICS.
The &fn. computes the magnitude of
:ARG.num
:CONT., which is equivalent to the length (magnitude) of the vector when the
:ARG.num
is represented in polar coordinates.
:RSLTS.
The &fn. returns the magnitude of
:ARG.num
:PERIOD.
:SALSO.
:SAL typ='fun'.arg
:SAL typ='fun'.norm
:SAL typ='fun'.polar
:eSALSO.
:eLIBF.
:CMT.========================================================================
:LIBF fmt='fun'.acos
:SNPL.
:SNPFLF .#include <complex.h>
:SNPR index='acos'.Complex acos( Complex const &.num );
:eSNPL.
:SMTICS.
The &fn. computes the arccosine of
:ARG.num
:PERIOD.
:RSLTS.
The &fn. returns the arccosine of
:ARG.num
:PERIOD.
:SALSO.
:SAL typ='fun'.asin
:SAL typ='fun'.atan
:SAL typ='fun'.cos
:eSALSO.
:eLIBF.
:CMT.========================================================================
:LIBF fmt='fun'.acosh
:SNPL.
:SNPFLF .#include <complex.h>
:SNPR index='acosh'.Complex acosh( Complex const &.num );
:eSNPL.
:SMTICS.
The &fn. computes the inverse hyperbolic cosine of
:ARG.num
:PERIOD.
:RSLTS.
The &fn. returns the inverse hyperbolic cosine of
:ARG.num
:PERIOD.
:SALSO.
:SAL typ='fun'.asinh
:SAL typ='fun'.atanh
:SAL typ='fun'.cosh
:eSALSO.
:eLIBF.
:CMT.========================================================================
:LIBF fmt='fun'.arg
:SNPL.
:SNPFLF .#include <complex.h>
:SNPR index='arg'.double arg( Complex const &.num );
:eSNPL.
:SMTICS.
The &fn. computes the angle of the vector when the
:ARG.num
is represented in polar coordinates.
The angle has the same sign as the real component of the
:ARG.num
:PERIOD.
It is positive in the 1st and 2nd quadrants, and negative in the 3rd
and 4th quadrants.
:RSLTS.
The &fn. returns the angle of the vector when the
:ARG.num
is represented in polar coordinates.
:SALSO.
:SAL typ='fun'.abs
:SAL typ='fun'.norm
:SAL typ='fun'.polar
:eSALSO.
:eLIBF.
:CMT.========================================================================
:LIBF fmt='fun'.asin
:SNPL.
:SNPFLF .#include <complex.h>
:SNPR index='asin'.Complex asin( Complex const &.num );
:eSNPL.
:SMTICS.
The &fn. computes the arcsine of
:ARG.num
:PERIOD.
:RSLTS.
The &fn. returns the arcsine of
:ARG.num
:PERIOD.
:SALSO.
:SAL typ='fun'.acos
:SAL typ='fun'.atan
:SAL typ='fun'.sin
:eSALSO.
:eLIBF.
:CMT.========================================================================
:LIBF fmt='fun'.asinh
:SNPL.
:SNPFLF .#include <complex.h>
:SNPR index='asinh'.Complex asinh( Complex const &.num );
:eSNPL.
:SMTICS.
The &fn. computes the inverse hyperbolic sine of
:ARG.num
:PERIOD.
:RSLTS.
The &fn. returns the inverse hyperbolic sine of
:ARG.num
:PERIOD.
:SALSO.
:SAL typ='fun'.acosh
:SAL typ='fun'.atanh
:SAL typ='fun'.sinh
:eSALSO.
:eLIBF.
:CMT.========================================================================
:LIBF fmt='fun'.atan
:SNPL.
:SNPFLF .#include <complex.h>
:SNPR index='atan'.Complex atan( Complex const &.num );
:eSNPL.
:SMTICS.
The &fn. computes the arctangent of
:ARG.num
:PERIOD.
:RSLTS.
The &fn. returns the arctangent of
:ARG.num
:PERIOD.
:SALSO.
:SAL typ='fun'.acos
:SAL typ='fun'.asin
:SAL typ='fun'.tan
:eSALSO.
:eLIBF.
:CMT.========================================================================
:LIBF fmt='fun'.atanh
:SNPL.
:SNPFLF .#include <complex.h>
:SNPR index='atanh'.Complex atanh( Complex const &.num );
:eSNPL.
:SMTICS.
The &fn. computes the inverse hyperbolic tangent of
:ARG.num
:PERIOD.
:RSLTS.
The &fn. returns the inverse hyperbolic tangent of
:ARG.num
:PERIOD.
:SALSO.
:SAL typ='fun'.acosh
:SAL typ='fun'.asinh
:SAL typ='fun'.tanh
:eSALSO.
:eLIBF.
:CMT.========================================================================
:LIBF fmt='ctor' prot='public'.Complex
:SNPL.
:SNPFLF .#include <complex.h>
:SNPFLF .public:
:SNPCD cd_idx='c'.Complex::Complex();
:eSNPL.
:SMTICS.
This form of the &fn. creates a default &obj. with value zero for both
the real and imaginary components.
:RSLTS.
This form of the &fn. produces a default &obj.:PERIOD.
:SALSO.
:SAL typ='dtor'.
:SAL typ='mfun'.real
:SAL typ='mfun'.imag
:eSALSO.
:eLIBF.
:CMT.========================================================================
:LIBF fmt='ctor' prot='public'.Complex
:SNPL.
:SNPFLF .#include <complex.h>
:SNPFLF .public:
:SNPCD cd_idx='c'.Complex::Complex( Complex const &.num );
:eSNPL.
:SMTICS.
This form of the &fn. creates a &obj. with the same value as
:ARG.num
:PERIOD.
:RSLTS.
This form of the &fn. produces a &obj.:PERIOD.
:SALSO.
:SAL typ='dtor'.
:SAL typ='mfun'.real
:SAL typ='mfun'.imag
:eSALSO.
:eLIBF.
:CMT.========================================================================
:LIBF fmt='ctor' prot='public'.Complex
:SNPL.
:SNPFLF .#include <complex.h>
:SNPFLF .public:
:SNPCD cd_idx='c'.Complex::Complex( double real, double imag = 0.0 );
:eSNPL.
:SMTICS.
This form of the &fn. creates a &obj. with the real component set to
:ARG.real
and the imaginary component set to
:ARG.imag
:PERIOD.
If no imaginary component is specified,
:ARG.imag
takes the default value of zero.
:RSLTS.
This form of the &fn. produces a &obj.:PERIOD.
:SALSO.
:SAL typ='dtor'.
:SAL typ='mfun'.real
:SAL typ='mfun'.imag
:eSALSO.
:eLIBF.
:CMT.========================================================================
:LIBF fmt='dtor' prot='public'.~~Complex
:SNPL.
:SNPFLF .#include <complex.h>
:SNPFLF .public:
:SNPCD cd_idx='d'.Complex::~~Complex();
:eSNPL.
:SMTICS.
The &fn. destroys the &obj.:PERIOD.
The call to the &fn. is inserted implicitly by the compiler
at the point where the &obj. goes out of scope.
:RSLTS.
The &obj. is destroyed.
:SALSO.
:SAL typ='ctor'.
:eSALSO.
:eLIBF.
:CMT.========================================================================
:LIBF fmt='fun'.conj
:SNPL.
:SNPFLF .#include <complex.h>
:SNPR index='conj'.Complex conj( Complex const &.num );
:eSNPL.
:SMTICS.
The &fn. computes the conjugate of
:ARG.num
:PERIOD.
The conjugate consists of the unchanged real component, and the negative of
the imaginary component.
:RSLTS.
The &fn. returns the conjugate of
:ARG.num
:PERIOD.
:eLIBF.
:CMT.========================================================================
:LIBF fmt='fun'.cos
:SNPL.
:SNPFLF .#include <complex.h>
:SNPR index='cos'.Complex cos( Complex const &.num );
:eSNPL.
:SMTICS.
The &fn. computes the cosine of
:ARG.num
:PERIOD.
:RSLTS.
The &fn. returns the cosine of
:ARG.num
:PERIOD.
:SALSO.
:SAL typ='fun'.acos
:SAL typ='fun'.sin
:SAL typ='fun'.tan
:eSALSO.
:eLIBF.
:CMT.========================================================================
:LIBF fmt='fun'.cosh
:SNPL.
:SNPFLF .#include <complex.h>
:SNPR index='cosh'.Complex cosh( Complex const &.num );
:eSNPL.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -