x
Yes
No
Do you want to visit DriveHQ English website?
Inicio
Características
Precios
Prueba gratuita
Software cliente
Acerca de nosotros
Servidor de archivos
|
Solución de copias de seguridad
|
Servidor FTP
|
Servidor de correo electrónico
|
Alojamiento web
|
Software cliente
Servidor de archivos
Solución de copia de seguridad
Servidor FTP
Servidor de correo electrónico
Alojamiento web
Software cliente
simple_complex.hpp - Hosted on DriveHQ Cloud IT Platform
Arriba
Subir
Descargar
Compartir
Publicar
Nueva carpeta
Nuevo archivo
Copiar
Cortar
Eliminar
Pegar
Clasificación
Actualizar
Ruta de la carpeta: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\references\boost_1_35_0\boost\math\special_functions\detail\simple_complex.hpp
Girar
Efecto
Propiedad
Historial
// Copyright (c) 2007 John Maddock // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_MATH_SF_DETAIL_SIMPLE_COMPLEX_HPP #define BOOST_MATH_SF_DETAIL_SIMPLE_COMPLEX_HPP namespace boost{ namespace math{ namespace detail{ namespace sc{ template
class simple_complex { public: simple_complex() : r(0), i(0) {} simple_complex(T a) : r(a) {} template
simple_complex(U a) : r(a) {} simple_complex(T a, T b) : r(a), i(b) {} simple_complex& operator += (const simple_complex& o) { r += o.r; i += o.i; return *this; } simple_complex& operator -= (const simple_complex& o) { r -= o.r; i -= o.i; return *this; } simple_complex& operator *= (const simple_complex& o) { T lr = r * o.r - i * o.i; T li = i * o.r + r * o.i; r = lr; i = li; return *this; } simple_complex& operator /= (const simple_complex& o) { BOOST_MATH_STD_USING T lr; T li; if(fabs(o.r) > fabs(o.i)) { T rat = o.i / o.r; lr = r + i * rat; li = i - r * rat; rat = o.r + o.i * rat; lr /= rat; li /= rat; } else { T rat = o.r / o.i; lr = i + r * rat; li = i * rat - r; rat = o.r * rat + o.i; lr /= rat; li /= rat; } r = lr; i = li; return *this; } bool operator == (const simple_complex& o) { return (r == o.r) && (i == o.i); } bool operator != (const simple_complex& o) { return !((r == o.r) && (i == o.i)); } bool operator == (const T& o) { return (r == o) && (i == 0); } simple_complex& operator += (const T& o) { r += o; return *this; } simple_complex& operator -= (const T& o) { r -= o; return *this; } simple_complex& operator *= (const T& o) { r *= o; i *= o; return *this; } simple_complex& operator /= (const T& o) { r /= o; i /= o; return *this; } T real()const { return r; } T imag()const { return i; } private: T r, i; }; template
inline simple_complex
operator+(const simple_complex
& a, const simple_complex
& b) { simple_complex
result(a); result += b; return result; } template
inline simple_complex
operator-(const simple_complex
& a, const simple_complex
& b) { simple_complex
result(a); result -= b; return result; } template
inline simple_complex
operator*(const simple_complex
& a, const simple_complex
& b) { simple_complex
result(a); result *= b; return result; } template
inline simple_complex
operator/(const simple_complex
& a, const simple_complex
& b) { simple_complex
result(a); result /= b; return result; } template
inline T real(const simple_complex
& c) { return c.real(); } template
inline T imag(const simple_complex
& c) { return c.imag(); } template
inline T abs(const simple_complex
& c) { return hypot(c.real(), c.imag()); } }}}} // namespace #endif
simple_complex.hpp
Dirección de la página
Dirección del archivo
Anterior
22/24
Siguiente
Descargar
( 3 KB )
Comments
Total ratings:
0
Average rating:
No clasificado
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.