Changeset 1517 in Sophya for trunk/SophyaLib/TArray/matharr.h
- Timestamp:
- Jun 12, 2001, 6:21:13 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/TArray/matharr.h
r1226 r1517 110 110 { MathArray<T> ma; double mean, sig; return( ma.MeanSigma(a, mean, sig) ); } 111 111 112 113 //! Class for simple mathematical operation on complex arrays 114 template <class T> 115 class ComplexMathArray { 116 public: 117 // Applying a function 118 // Replaces the input array content with the result f(x) 119 virtual TArray< complex<T> >& ApplyFunctionInPlace(TArray< complex<T> >& a, 120 Arr_ComplexDoubleFunctionOfX f); 121 // Creates a new array and fills it with f(x) 122 virtual TArray< complex<T> > ApplyFunction(TArray< complex<T> > const & a, 123 Arr_ComplexDoubleFunctionOfX f); 124 125 // Creates a new array and fills it with f(x) 126 virtual TArray< complex<T> > FillFrom(TArray<T> const & p_real, 127 TArray<T> const & p_imag); 128 129 // Returns real-imaginary part of the complex array 130 virtual TArray<T> real(TArray< complex<T> > const & a); 131 virtual TArray<T> imag(TArray< complex<T> > const & a); 132 133 // Returns module and phase of the complex input array 134 virtual TArray<T> module2(TArray< complex<T> > const & a); 135 virtual TArray<T> module(TArray< complex<T> > const & a); 136 virtual TArray<T> phase(TArray< complex<T> > const & a); 137 }; 138 139 /*! \ingroup TArray \fn real(const TArray< complex<T> >&) 140 \brief Return the \b real part of the input complex array \b a */ 141 template <class T> 142 inline TArray<T> real(const TArray< complex<T> >& a) 143 { ComplexMathArray<T> cma; return( cma.real(a) ); } 144 145 /*! \ingroup TArray \fn imag(const TArray< complex<T> >&) 146 \brief Return the \b imaginary part of the input complex array \b a */ 147 template <class T> 148 inline TArray<T> imag(const TArray< complex<T> >& a) 149 { ComplexMathArray<T> cma; return( cma.imag(a) ); } 150 151 /*! \ingroup TArray \fn module2(const TArray< complex<T> >&) 152 \brief Return the \b module squared of the input complex array \b a */ 153 template <class T> 154 inline TArray<T> module2(const TArray< complex<T> >& a) 155 { ComplexMathArray<T> cma; return( cma.module2(a) ); } 156 157 /*! \ingroup TArray \fn module(const TArray< complex<T> >&) 158 \brief Return the \b module of the input complex array \b a */ 159 template <class T> 160 inline TArray<T> module(const TArray< complex<T> >& a) 161 { ComplexMathArray<T> cma; return( cma.module(a) ); } 162 163 /*! \ingroup TArray \fn phase(const TArray< complex<T> >&) 164 \brief Return the \b phase of the input complex array \b a */ 165 template <class T> 166 inline TArray<T> phase(const TArray< complex<T> >& a) 167 { ComplexMathArray<T> cma; return( cma.phase(a) ); } 168 169 /*! \ingroup TArray \fn ComplexArray(const TArray<T> &, const TArray<T> &) 170 \brief Return a complex array, with real and imaginary parts filled from the arguments */ 171 template <class T> 172 inline TArray< complex<T> > ComplexArray(const TArray<T> & p_real, 173 const TArray<T> & p_imag) 174 { ComplexMathArray<T> cma; return( cma.FillFrom(p_real, p_imag) ); } 175 176 112 177 } // Fin du namespace 113 178
Note:
See TracChangeset
for help on using the changeset viewer.