From nobody Fri Apr 11 16:35:32 2025 X-Original-To: dev-commits-ports-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4ZZ2Nj4mgDz5sJPf; Fri, 11 Apr 2025 16:35:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ZZ2Nj0JJsz3MfX; Fri, 11 Apr 2025 16:35:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1744389333; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Gixz7+AOUSjQNiOcyJ2eg4d+A6RLkG1+SMqpY6xcXiM=; b=ui2XwGp42dxIdqk7pUSgnlk0JAbSs7drpbFIX+d1uQEq74tkBVN2vsmQCh/qspt7b2vQBh SceSujCm3ricKUNDkzH254uFzK+Xhh0ejp3RThFnQHQ+YqVfsnpOBks/CEDjfrlS99JWGR akkraVY/obJpH5QmZ7JrTV+XveZIwJOZVM4YYFlk/FOUKAM1mIoIEWYqQmXLEOa9PrKTFN B9sZhCRE+DnOyrwrwqRsoTqR803uvZVp1Skx3Zg7/C+EkKFruM53qhmtuI8qHPiDuDHP7f o+xfnfHzqs23Ft+vAvN/pJCLTEglvJNa6JzrW5QuLipgzTrApWCdpuVw8CASvQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1744389333; a=rsa-sha256; cv=none; b=F54Gv+r3yOXX4/BMXPThtc01ehfccb0Iw/4RPeg08oJ4Z8v5kI2N2AiKn2KlRJlmtOFheV 9vtVIZehPnb4ebnzgA9+53340KAECYc+ZgTlsSQsUSzoTFpUPUMw4g7p4UOn4TEqZKr/gi FjC9pvQGx5h46zOUVcl8bBms3FBzC8aDkAcFoq26UeTyvUkWKeyWRv8P6c5pAI2sGicobv govB4+dEQ5MfM9duInBVdpRJBY0148joPxRRu3/fqfTBHJexcb0BMcjRL5s/UitIocihdQ w+vgr1AgK0KMCgXrweI5/vQO80fW1ySVxDPjdZl5FLu5gXnOS65YYezoMb/jdA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1744389333; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Gixz7+AOUSjQNiOcyJ2eg4d+A6RLkG1+SMqpY6xcXiM=; b=Iz2AVXw89S825L5w/I50AlKHn7mvLznhIST9quZ9nnP3uX6N41xTM4R3lvU6Tzv+vWDiSp AiwM3HdYHsiRC15yUGlCZWkqoVxiZQKOVOAKir41GCFMhDfCNYwqfD7ezwuyMrze0HQ8zi L4e5NPtfPlmM9nEgLSyJ1Livw7KcDobhwSUitOqQvy5TVZN4hrSlCbY3Xr41WrJ2XG3B+s P05XDOnqDc4Q5FxiIUYDaslwxZdnjk372+TDuOl9VeU8Vn07OsN15LAono56tjx4a4QstM W7pluc0CqTi/Rb07MoR4FfqhLh6r8DRQrxD3LTSFisyHwfFoqEbs/YtrFUfz9w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4ZZ2Nh6xf7zh2B; Fri, 11 Apr 2025 16:35:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 53BGZWu1035548; Fri, 11 Apr 2025 16:35:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 53BGZWUk035545; Fri, 11 Apr 2025 16:35:32 GMT (envelope-from git) Date: Fri, 11 Apr 2025 16:35:32 GMT Message-Id: <202504111635.53BGZWUk035545@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Thierry Thomas Subject: git: 114f9ea81cb8 - main - math/lcalc: upgrade to 2.1.0 List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-ports-main@freebsd.org Sender: owner-dev-commits-ports-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: thierry X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 114f9ea81cb828f373fae402ea05b9db4cc7f91b Auto-Submitted: auto-generated The branch main has been updated by thierry: URL: https://cgit.FreeBSD.org/ports/commit/?id=114f9ea81cb828f373fae402ea05b9db4cc7f91b commit 114f9ea81cb828f373fae402ea05b9db4cc7f91b Author: Thierry Thomas AuthorDate: 2025-04-11 14:20:40 +0000 Commit: Thierry Thomas CommitDate: 2025-04-11 16:34:50 +0000 math/lcalc: upgrade to 2.1.0 Release notes at https://gitlab.com/sagemath/lcalc/-/releases/2.1.0 --- math/lcalc/Makefile | 9 +- math/lcalc/distinfo | 6 +- math/lcalc/files/patch-src_libLfunction_Lcomplex.h | 1201 -------------------- math/lcalc/files/patch-src_libLfunction_Lglobals.h | 24 - .../lcalc/files/patch-src_libLfunction_Makefile.am | 10 - math/lcalc/files/patch-src_libLfunction_mpreal.h | 11 - math/lcalc/pkg-plist | 4 +- 7 files changed, 8 insertions(+), 1257 deletions(-) diff --git a/math/lcalc/Makefile b/math/lcalc/Makefile index 245816bcac10..c4dc68f3cd21 100644 --- a/math/lcalc/Makefile +++ b/math/lcalc/Makefile @@ -1,6 +1,5 @@ PORTNAME= lcalc -PORTVERSION= 2.0.5 -PORTREVISION= 4 +PORTVERSION= 2.1.0 CATEGORIES= math MASTER_SITES= ftp://ftp.fu-berlin.de/unix/misc/sage/spkg/upstream/lcalc/ @@ -15,10 +14,8 @@ LIB_DEPENDS= libgmp.so:math/gmp \ libmpfr.so:math/mpfr \ libpari.so:math/pari -#USE_GITHUB= yes -#GH_ACCOUNT= agrawroh -#GH_PROJECT= l-calc -#GH_TAGNAME= 4c57471 +#USE_GITLAB= yes +#GL_ACCOUNT= sagemath USES= autoreconf compiler:c++11-lang gmake libtool localbase \ pkgconfig tar:xz diff --git a/math/lcalc/distinfo b/math/lcalc/distinfo index 23fafd79a282..dddbd06f510e 100644 --- a/math/lcalc/distinfo +++ b/math/lcalc/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1651073020 -SHA256 (lcalc-2.0.5.tar.xz) = d780c385579cc6ee45fa27ccd2d3a3c4157fbb5ef8cd1b8951d1028bbc64c035 -SIZE (lcalc-2.0.5.tar.xz) = 830360 +TIMESTAMP = 1744379557 +SHA256 (lcalc-2.1.0.tar.xz) = eca4f7de5f1129a9cec2cd2f012a8362c8489e746f07adae3229dd8eb2541f79 +SIZE (lcalc-2.1.0.tar.xz) = 831000 diff --git a/math/lcalc/files/patch-src_libLfunction_Lcomplex.h b/math/lcalc/files/patch-src_libLfunction_Lcomplex.h deleted file mode 100644 index 71c3421e9a1d..000000000000 --- a/math/lcalc/files/patch-src_libLfunction_Lcomplex.h +++ /dev/null @@ -1,1201 +0,0 @@ ---- src/libLfunction/Lcomplex.h.orig 2021-12-19 17:09:15 UTC -+++ src/libLfunction/Lcomplex.h -@@ -1,1198 +0,0 @@ --// The template and inlines for the -*- C++ -*- complex number classes. -- --// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 --// Free Software Foundation, Inc. --// --// This file is part of the GNU ISO C++ Library. This library is free --// software; you can redistribute it and/or modify it under the --// terms of the GNU General Public License as published by the --// Free Software Foundation; either version 2, or (at your option) --// any later version. -- --// This library is distributed in the hope that it will be useful, --// but WITHOUT ANY WARRANTY; without even the implied warranty of --// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --// GNU General Public License for more details. -- --// You should have received a copy of the GNU General Public License along --// with this library; see the file COPYING. If not, write to the Free --// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, --// USA. -- --// As a special exception, you may use this file as part of a free software --// library without restriction. Specifically, if other files instantiate --// templates or use macros or inline functions from this file, or you compile --// this file and link it with other files to produce an executable, this --// file does not by itself cause the resulting executable to be covered by --// the GNU General Public License. This exception does not however --// invalidate any other reasons why the executable file might be covered by --// the GNU General Public License. -- --// --// ISO C++ 14882: 26.2 Complex Numbers --// Note: this is not a conforming implementation. --// Initially implemented by Ulrich Drepper --// Improved by Gabriel Dos Reis --// -- --/** @file complex -- * This is a Standard C++ Library header. You should @c #include this header -- * in your programs, rather than any of the "st[dl]_*.h" implementation files. -- */ -- --#ifndef _CPP_COMPLEX --#define _CPP_COMPLEX 1 -- --#pragma GCC system_header -- --//no longer include: --//#include only thing used was is_floating... --//gcc 4.0 cpp_type_traits.h is not compatible with gcc 3.3. --//But Lcomplex.h file was derived --//from gcc 3.3 complex header file. The only thing used from that header file is __is_floating, so I just --//renamed it in this file to __is_floating_old (to avoid conflict with other includes of --//) and cut and paste and renamed the old __is_floating. -- --#include --#include -- --namespace std --{ -- // Forward declarations -- template class complex; -- template<> class complex; -- template<> class complex; -- template<> class complex; -- -- template _Tp abs(const complex<_Tp>&); -- template _Tp arg(const complex<_Tp>&); -- template _Tp norm(const complex<_Tp>&); -- -- template complex<_Tp> conj(const complex<_Tp>&); -- template complex<_Tp> polar(const _Tp&, const _Tp& = 0); -- -- // Transcendentals: -- template complex<_Tp> cos(const complex<_Tp>&); -- template complex<_Tp> cosh(const complex<_Tp>&); -- template complex<_Tp> exp(const complex<_Tp>&); -- template complex<_Tp> log(const complex<_Tp>&); -- template complex<_Tp> log10(const complex<_Tp>&); -- template complex<_Tp> pow(const complex<_Tp>&, const _Up&); -- template complex<_Tp> pow(const _Up&, const complex<_Tp>&); -- template complex<_Tp> pow(const complex<_Tp>&, int); -- template complex<_Tp> pow(const complex<_Tp>&, const complex<_Tp>&); -- template complex<_Tp> pow(const _Tp&, const complex<_Tp>&); -- template complex<_Tp> sin(const complex<_Tp>&); -- template complex<_Tp> sinh(const complex<_Tp>&); -- template complex<_Tp> sqrt(const complex<_Tp>&); -- template complex<_Tp> tan(const complex<_Tp>&); -- template complex<_Tp> tanh(const complex<_Tp>&); -- -- -- // 26.2.2 Primary template class complex -- template -- class complex -- { -- public: -- typedef _Tp value_type; -- -- complex(const _Tp& = 0, const _Tp& = 0); -- complex(const int&); -- complex(const double&); -- -- // Let's the compiler synthetize the copy constructor -- // complex (const complex<_Tp>&); -- template -- complex(const _Up&); -- template -- complex(const complex<_Up>&); -- -- _Tp real() const; -- _Tp imag() const; -- -- template complex<_Tp>& operator=(const _Up&); -- complex<_Tp>& operator=(const _Tp&); -- complex<_Tp>& operator=(const int&); -- complex<_Tp>& operator=(const double&); -- complex<_Tp>& operator+=(const _Tp&); -- complex<_Tp>& operator-=(const _Tp&); -- complex<_Tp>& operator*=(const _Tp&); -- complex<_Tp>& operator/=(const _Tp&); -- -- // Let's the compiler synthetize the -- // copy and assignment operator -- // complex<_Tp>& operator= (const complex<_Tp>&); -- template -- complex<_Tp>& operator=(const complex<_Up>&); -- template -- complex<_Tp>& operator+=(const complex<_Up>&); -- template -- complex<_Tp>& operator-=(const complex<_Up>&); -- template -- complex<_Tp>& operator*=(const complex<_Up>&); -- template -- complex<_Tp>& operator/=(const complex<_Up>&); -- -- friend void reset(complex<_Tp>& C) { -- reset(C._M_real); -- reset(C._M_imag); -- } -- -- private: -- _Tp _M_real, _M_imag; -- }; -- -- template -- inline _Tp -- complex<_Tp>::real() const { return _M_real; } -- -- template -- inline _Tp -- complex<_Tp>::imag() const { return _M_imag; } -- -- template -- inline -- complex<_Tp>::complex(const _Tp& __r, const _Tp& __i) { -- _M_real=__r; -- _M_imag=__i; -- } -- -- template template -- inline -- complex<_Tp>::complex(const _Up& r) { -- _M_real=r; -- _M_imag=0.; -- } -- -- template -- inline -- complex<_Tp>::complex(const int& r) { -- _M_real=r; -- _M_imag=0.; -- } -- template -- inline -- complex<_Tp>::complex(const double& r) { -- _M_real=r; -- _M_imag=0.; -- } -- -- template -- template -- inline -- complex<_Tp>::complex(const complex<_Up>& __z) -- : _M_real(__z.real()), _M_imag(__z.imag()) { } -- -- template template -- complex<_Tp>& -- complex<_Tp>::operator=(const _Up& __t) -- { -- _M_real = __t; -- _M_imag = _Tp(0); -- return *this; -- } -- -- -- template -- complex<_Tp>& -- complex<_Tp>::operator=(const _Tp& __t) -- { -- _M_real = __t; -- _M_imag = _Tp(0); -- return *this; -- } -- -- template -- complex<_Tp>& -- complex<_Tp>::operator=(const int& __t) -- { -- _M_real = __t; -- _M_imag = _Tp(0); -- return *this; -- } -- -- template -- complex<_Tp>& -- complex<_Tp>::operator=(const double& __t) -- { -- _M_real = __t; -- _M_imag = _Tp(0); -- return *this; -- } -- -- // 26.2.5/1 -- template -- inline complex<_Tp>& -- complex<_Tp>::operator+=(const _Tp& __t) -- { -- _M_real += __t; -- return *this; -- } -- -- // 26.2.5/3 -- template -- inline complex<_Tp>& -- complex<_Tp>::operator-=(const _Tp& __t) -- { -- _M_real -= __t; -- return *this; -- } -- -- // 26.2.5/5 -- template -- complex<_Tp>& -- complex<_Tp>::operator*=(const _Tp& __t) -- { -- _M_real *= __t; -- _M_imag *= __t; -- return *this; -- } -- -- // 26.2.5/7 -- template -- complex<_Tp>& -- complex<_Tp>::operator/=(const _Tp& __t) -- { -- _M_real /= __t; -- _M_imag /= __t; -- return *this; -- } -- -- template -- template -- complex<_Tp>& -- complex<_Tp>::operator=(const complex<_Up>& __z) -- { -- _M_real = __z.real(); -- _M_imag = __z.imag(); -- return *this; -- } -- -- // 26.2.5/9 -- template -- template -- complex<_Tp>& -- complex<_Tp>::operator+=(const complex<_Up>& __z) -- { -- _M_real += __z.real(); -- _M_imag += __z.imag(); -- return *this; -- } -- -- // 26.2.5/11 -- template -- template -- complex<_Tp>& -- complex<_Tp>::operator-=(const complex<_Up>& __z) -- { -- _M_real -= __z.real(); -- _M_imag -= __z.imag(); -- return *this; -- } -- -- // 26.2.5/13 -- // XXX: This is a grammar school implementation. -- template -- template -- complex<_Tp>& -- complex<_Tp>::operator*=(const complex<_Up>& __z) -- { -- const _Tp __r = _M_real * __z.real() - _M_imag * __z.imag(); -- _M_imag = _M_real * __z.imag() + _M_imag * __z.real(); -- _M_real = __r; -- return *this; -- } -- -- // 26.2.5/15 -- // XXX: This is a grammar school implementation. -- template -- template -- complex<_Tp>& -- complex<_Tp>::operator/=(const complex<_Up>& __z) -- { -- const _Tp __r = _M_real * __z.real() + _M_imag * __z.imag(); -- const _Tp __n = norm(__z); -- _M_imag = (_M_imag * __z.real() - _M_real * __z.imag()) / __n; -- _M_real = __r / __n; -- return *this; -- } -- -- // Operators: -- template -- inline complex<_Tp> -- operator+(const complex<_Tp>& __x, const complex<_Tp>& __y) -- { return complex<_Tp> (__x) += __y; } -- -- template -- inline complex<_Tp> -- operator+(const complex<_Tp>& __x, const _Up& __y) -- { return complex<_Tp> (__x) += __y; } -- -- template -- inline complex<_Tp> -- operator+(const _Up& __x, const complex<_Tp>& __y) -- { return complex<_Tp> (__y) += __x; } -- -- template -- inline complex<_Tp> -- operator-(const complex<_Tp>& __x, const complex<_Tp>& __y) -- { return complex<_Tp> (__x) -= __y; } -- -- template -- inline complex<_Tp> -- operator-(const complex<_Tp>& __x, const _Up& __y) -- { return complex<_Tp> (__x) -= __y; } -- -- template -- inline complex<_Tp> -- operator-(const _Up& __x, const complex<_Tp>& __y) -- { return complex<_Tp> (__x) -= __y; } -- -- template -- inline complex<_Tp> -- operator*(const complex<_Tp>& __x, const complex<_Tp>& __y) -- { return complex<_Tp> (__x) *= __y; } -- -- template -- inline complex<_Tp> -- operator*(const complex<_Tp>& __x, const _Up& __y) -- { return complex<_Tp> (__x) *= __y; } -- -- template -- inline complex<_Tp> -- operator*(const _Up& __x, const complex<_Tp>& __y) -- { return complex<_Tp> (__y) *= __x; } -- -- template -- inline complex<_Tp> -- operator/(const complex<_Tp>& __x, const complex<_Tp>& __y) -- { return complex<_Tp> (__x) /= __y; } -- -- template -- inline complex<_Tp> -- operator/(const complex<_Tp>& __x, const _Up& __y) -- { return complex<_Tp> (__x) /= __y; } -- -- template -- inline complex<_Tp> -- operator/(const _Up& __x, const complex<_Tp>& __y) -- { return complex<_Tp> (__x) /= __y; } -- -- template -- inline complex<_Tp> -- operator+(const complex<_Tp>& __x) -- { return __x; } -- -- template -- inline complex<_Tp> -- operator-(const complex<_Tp>& __x) -- { return complex<_Tp>(-__x.real(), -__x.imag()); } -- -- template -- inline bool -- operator==(const complex<_Tp>& __x, const complex<_Tp>& __y) -- { return __x.real() == __y.real() && __x.imag() == __y.imag(); } -- -- template -- inline bool -- operator==(const complex<_Tp>& __x, const _Up& __y) -- { return __x.real() == __y && __x.imag() == _Tp(0); } -- -- template -- inline bool -- operator==(const _Up& __x, const complex<_Tp>& __y) -- { return __x == __y.real() && _Tp(0) == __y.imag(); } -- -- template -- inline bool -- operator!=(const complex<_Tp>& __x, const complex<_Tp>& __y) -- { return __x.real() != __y.real() || __x.imag() != __y.imag(); } -- -- template -- inline bool -- operator!=(const complex<_Tp>& __x, const _Up& __y) -- { return __x.real() != __y || __x.imag() != _Tp(0); } -- -- template -- inline bool -- operator!=(const _Up& __x, const complex<_Tp>& __y) -- { return __x != __y.real() || _Tp(0) != __y.imag(); } -- -- template -- basic_istream<_CharT, _Traits>& -- operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x) -- { -- _Tp __re_x, __im_x; -- _CharT __ch; -- __is >> __ch; -- if (__ch == '(') -- { -- __is >> __re_x >> __ch; -- if (__ch == ',') -- { -- __is >> __im_x >> __ch; -- if (__ch == ')') -- __x = complex<_Tp>(__re_x, __im_x); -- else -- __is.setstate(ios_base::failbit); -- } -- else if (__ch == ')') -- __x = complex<_Tp>(__re_x, _Tp(0)); -- else -- __is.setstate(ios_base::failbit); -- } -- else -- { -- __is.putback(__ch); -- __is >> __re_x; -- __x = complex<_Tp>(__re_x, _Tp(0)); -- } -- return __is; -- } -- -- template -- basic_ostream<_CharT, _Traits>& -- operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x) -- { -- basic_ostringstream<_CharT, _Traits> __s; -- __s.flags(__os.flags()); -- __s.imbue(__os.getloc()); -- __s.precision(__os.precision()); -- __s << '(' << __x.real() << ',' << __x.imag() << ')'; -- return __os << __s.str(); -- } -- -- // Values -- template -- inline _Tp -- real(const complex<_Tp>& __z) -- { return __z.real(); } -- -- template -- inline _Tp -- imag(const complex<_Tp>& __z) -- { return __z.imag(); } -- -- template -- inline _Tp -- abs(const complex<_Tp>& __z) -- { -- _Tp __x = __z.real(); -- _Tp __y = __z.imag(); -- const _Tp __s = max(abs(__x), abs(__y)); -- if (__s == _Tp(0)) // well ... -- return __s; -- __x /= __s; -- __y /= __s; -- return __s * sqrt(__x * __x + __y * __y); -- } -- -- template -- inline _Tp -- arg(const complex<_Tp>& __z) -- { return atan2(__z.imag(), __z.real()); } -- -- // 26.2.7/5: norm(__z) returns the squared magintude of __z. -- // As defined, norm() is -not- a norm is the common mathematical -- // sens used in numerics. The helper class _Norm_helper<> tries to -- // distinguish between builtin floating point and the rest, so as -- // to deliver an answer as close as possible to the real value. -- template -- struct _Norm_helper -- { -- template -- static inline _Tp _S_do_it(const complex<_Tp>& __z) -- { -- const _Tp __x = __z.real(); -- const _Tp __y = __z.imag(); -- return __x * __x + __y * __y; -- } -- }; -- -- template<> -- struct _Norm_helper -- { -- template -- static inline _Tp _S_do_it(const complex<_Tp>& __z) -- { -- _Tp __res = abs(__z); -- return __res * __res; -- } -- }; -- -- //============= added from gcc 3.3 cpp_type_traits.h and renamed __is_floating_old -- // -- // Floating point types -- // -- template -- struct __is_floating_old -- { -- enum -- { -- _M_type = 0 -- }; -- }; -- -- // three specializations (float, double and 'long double') -- template<> -- struct __is_floating_old -- { -- enum -- { -- _M_type = 1 -- }; -- }; -- -- template<> -- struct __is_floating_old -- { -- enum -- { -- _M_type = 1 -- }; -- }; -- -- template<> -- struct __is_floating_old -- { -- enum -- { -- _M_type = 1 -- }; -- }; -- -- -- //============== end cut and paste and rename __is_floating -- -- template -- inline _Tp -- norm(const complex<_Tp>& __z) -- { -- return _Norm_helper<__is_floating_old<_Tp>::_M_type>::_S_do_it(__z); -- } -- -- template -- inline complex<_Tp> -- polar(const _Tp& __rho, const _Tp& __theta) -- { return complex<_Tp>(__rho * cos(__theta), __rho * sin(__theta)); } -- -- template -- inline complex<_Tp> -- conj(const complex<_Tp>& __z) -- { return complex<_Tp>(__z.real(), -__z.imag()); } -- -- // Transcendentals -- template -- inline complex<_Tp> -- cos(const complex<_Tp>& __z) -- { -- const _Tp __x = __z.real(); -- const _Tp __y = __z.imag(); -- return complex<_Tp>(cos(__x) * cosh(__y), -sin(__x) * sinh(__y)); -- } -- -- template -- inline complex<_Tp> -- cosh(const complex<_Tp>& __z) -- { -- const _Tp __x = __z.real(); -- const _Tp __y = __z.imag(); -- return complex<_Tp>(cosh(__x) * cos(__y), sinh(__x) * sin(__y)); -- } -- -- template -- inline complex<_Tp> -- exp(const complex<_Tp>& __z) -- { return polar(exp(__z.real()), __z.imag()); } -- -- template -- inline complex<_Tp> -- log(const complex<_Tp>& __z) -- { return complex<_Tp>(log(abs(__z)), arg(__z)); } -- -- template -- inline complex<_Tp> -- log10(const complex<_Tp>& __z) -- { return log(__z) / log(_Tp(10.0)); } -- -- template -- inline complex<_Tp> -- sin(const complex<_Tp>& __z) -- { -- const _Tp __x = __z.real(); -- const _Tp __y = __z.imag(); -- return complex<_Tp>(sin(__x) * cosh(__y), cos(__x) * sinh(__y)); -- } -- -- template -- inline complex<_Tp> -- sinh(const complex<_Tp>& __z) -- { -- const _Tp __x = __z.real(); -- const _Tp __y = __z.imag(); -- return complex<_Tp>(sinh(__x) * cos(__y), cosh(__x) * sin(__y)); -- } -- -- template -- complex<_Tp> -- sqrt(const complex<_Tp>& __z) -- { -- _Tp __x = __z.real(); -- _Tp __y = __z.imag(); -- -- if (__x == _Tp(0)) -- { -- _Tp __t = sqrt(abs(__y) / 2); -- return complex<_Tp>(__t, __y < _Tp(0) ? __t=-__t : __t); -- } -- else -- { -- _Tp __t = sqrt(2 * (abs(__z) + abs(__x))); -- _Tp __u = __t / 2; -- return __x > _Tp(0) -- ? complex<_Tp>(__u, __y / __t) -- : complex<_Tp>(abs(__y) / __t, __y < _Tp(0) ? __u=-__u : __u); -- } -- } -- -- template -- inline complex<_Tp> -- tan(const complex<_Tp>& __z) -- { -- return sin(__z) / cos(__z); -- } -- -- template -- inline complex<_Tp> -- tanh(const complex<_Tp>& __z) -- { -- return sinh(__z) / cosh(__z); -- } -- -- // Code from bits/cmath.cc, written by Gabriel Dos Reis -- template inline complex<_Tp> -- pow(const complex<_Tp>& __z, int __n) -- { -- complex<_Tp> __y = __n % 2 ? __z : complex<_Tp>(1); -- complex<_Tp> __x = __z; -- -- while (__n >>= 1) -- { -- __x = __x * __x; -- if (__n % 2) -- __y = __y * __x; -- } -- -- return __y; -- -- } -- -- -- template -- inline complex<_Tp> -- pow(const complex<_Tp>& __x, const _Up& __y) -- { -- return exp(__y * log(__x)); -- } -- -- template -- inline complex<_Tp> -- pow(const _Up& __x, const complex<_Tp>& __y) -- { -- return exp(__y * log(__x)); -- } -- -- template -- inline complex<_Tp> -- pow(const complex<_Tp>& __x, const complex<_Tp>& __y) -- { -- return exp(__y * log(__x)); -- } -- -- template -- inline complex<_Tp> -- pow(const _Tp& __x, const complex<_Tp>& __y) -- { -- return exp(__y * log(__x)); -- } -- -- // 26.2.3 complex specializations -- // complex specialization -- template<> class complex -- { -- public: -- typedef float value_type; -- -- complex(float = 0.0f, float = 0.0f); --#ifdef _GLIBCPP_BUGGY_COMPLEX -- complex(const complex& __z) : _M_value(__z._M_value) { } --#endif -- explicit complex(const complex&); -- explicit complex(const complex&); -- -- float real() const; -- float imag() const; -- -- complex& operator=(float); -- complex& operator+=(float); -- complex& operator-=(float); -- complex& operator*=(float); -- complex& operator/=(float); -- -- // Let's the compiler synthetize the copy and assignment -- // operator. It always does a pretty good job. -- // complex& operator= (const complex&); -- template -- complex&operator=(const complex<_Tp>&); -- template -- complex& operator+=(const complex<_Tp>&); -- template -- complex& operator-=(const complex<_Tp>&); -- template -- complex& operator*=(const complex<_Tp>&); -- template -- complex&operator/=(const complex<_Tp>&); -- -- private: -- typedef __complex__ float _ComplexT; -- _ComplexT _M_value; -- -- complex(_ComplexT __z) : _M_value(__z) { } -- -- friend class complex; -- friend class complex; -- }; -- -- inline float -- complex::real() const -- { return __real__ _M_value; } -- -- inline float -- complex::imag() const -- { return __imag__ _M_value; } -- -- inline -- complex::complex(float r, float i) -- { -- __real__ _M_value = r; -- __imag__ _M_value = i; -- } -- -- inline complex& -- complex::operator=(float __f) -- { -- __real__ _M_value = __f; -- __imag__ _M_value = 0.0f; -- return *this; -- } -- -- inline complex& -- complex::operator+=(float __f) -- { -- __real__ _M_value += __f; -- return *this; -- } -- -- inline complex& -- complex::operator-=(float __f) -- { -- __real__ _M_value -= __f; -- return *this; -- } -- -- inline complex& -- complex::operator*=(float __f) -- { -- _M_value *= __f; -- return *this; -- } -- -- inline complex& -- complex::operator/=(float __f) -- { -- _M_value /= __f; -- return *this; -- } -- -- template -- inline complex& -- complex::operator=(const complex<_Tp>& __z) -- { -- __real__ _M_value = __z.real(); -- __imag__ _M_value = __z.imag(); -- return *this; -- } -- -- template -- inline complex& -- complex::operator+=(const complex<_Tp>& __z) -- { -- __real__ _M_value += __z.real(); -- __imag__ _M_value += __z.imag(); -- return *this; -- } -- -- template -- inline complex& -- complex::operator-=(const complex<_Tp>& __z) -- { -- __real__ _M_value -= __z.real(); -- __imag__ _M_value -= __z.imag(); -- return *this; -- } -- -- template -- inline complex& -- complex::operator*=(const complex<_Tp>& __z) -- { -- _ComplexT __t; -- __real__ __t = __z.real(); -- __imag__ __t = __z.imag(); -- _M_value *= __t; -- return *this; -- } -- -- template -- inline complex& -- complex::operator/=(const complex<_Tp>& __z) -- { -- _ComplexT __t; -- __real__ __t = __z.real(); -- __imag__ __t = __z.imag(); -- _M_value /= __t; -- return *this; -- } -- -- // 26.2.3 complex specializations -- // complex specialization -- template<> class complex -- { -- public: -- typedef double value_type; -- -- complex(double =0.0, double =0.0); --#ifdef _GLIBCPP_BUGGY_COMPLEX -- complex(const complex& __z) : _M_value(__z._M_value) { } --#endif -- complex(const complex&); -- explicit complex(const complex&); -- -- double real() const; -- double imag() const; -- -- complex& operator=(double); -- complex& operator+=(double); -- complex& operator-=(double); -- complex& operator*=(double); -- complex& operator/=(double); -- -- // The compiler will synthetize this, efficiently. -- // complex& operator= (const complex&); -- template -- complex& operator=(const complex<_Tp>&); -- template -- complex& operator+=(const complex<_Tp>&); -- template -- complex& operator-=(const complex<_Tp>&); -- template -- complex& operator*=(const complex<_Tp>&); -- template -- complex& operator/=(const complex<_Tp>&); -- -- private: -- typedef __complex__ double _ComplexT; -- _ComplexT _M_value; -- -- complex(_ComplexT __z) : _M_value(__z) { } -- -- friend class complex; -- friend class complex; -- }; -- *** 357 LINES SKIPPED ***