File: Complex.h

package info (click to toggle)
epix 1.2.22-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,256 kB
  • sloc: cpp: 16,847; sh: 5,054; makefile: 159; lisp: 6
file content (97 lines) | stat: -rw-r--r-- 2,811 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/* 
 * Complex.h -- ePiX::Complex number class
 *
 * This file is part of ePiX, a C++ library for creating high-quality 
 * figures in LaTeX 
 *
 * Version 1.2.18
 * Last Change: September 17, 2017
 *
 * 
 * Copyright (C) 2007, 2008, 2017
 * Andrew D. Hwang <ahwang -at- holycross -dot- edu>
 * Department of Mathematics and Computer Science
 * College of the Holy Cross
 * Worcester, MA, 01610-2395, USA
 *
 *
 * ePiX 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 of the License, or
 * (at your option) any later version.
 *
 * ePiX 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 ePiX; if not, write to the Free Software Foundation, Inc.,
 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */

#ifndef EPIX_COMPLEX
#define EPIX_COMPLEX

namespace ePiX {

  class Complex {
  public:
    Complex(double real=0, double imag=0);

    Complex& operator += (const Complex& arg);
    Complex& operator -= (const Complex& arg);
    Complex& operator *= (const Complex& arg);
    Complex& operator /= (const Complex& arg);
    Complex& conj();

    const bool operator == (const Complex& arg) const;
    const bool operator != (const Complex& arg) const;

    double re() const;
    double im() const;
    double Arg(int branch = 0) const; // Arg(0, 0) = 0;
    double norm() const;

  private:
    double m_real;
    double m_imag;
  }; // end of class Complex

  const Complex operator+ (Complex arg1, const Complex& arg2);
  const Complex operator- (Complex arg1, const Complex& arg2);
  const Complex operator- (Complex arg);

  const Complex operator* (Complex arg1, const Complex& arg2);
  const Complex operator/ (Complex arg1, const Complex& arg2);

  double Arg(const Complex& arg, int branch = 0);
  double norm(const Complex& arg);

  Complex expC(const Complex&);
  Complex logC(const Complex&, int branch=0);

  Complex sqrtC(const Complex&, int branch=0);
  Complex rootC(const Complex&, int order, int branch=0);
  Complex powC(const Complex&, int);

  Complex SinC(const Complex&);
  Complex CosC(const Complex&);

  Complex TanC(const Complex&);
  Complex CotC(const Complex&);

  Complex SecC(const Complex&);
  Complex CscC(const Complex&);

  Complex SinhC(const Complex&);
  Complex CoshC(const Complex&);

  Complex TanhC(const Complex&);
  Complex CothC(const Complex&);

  Complex SechC(const Complex&);
  Complex CschC(const Complex&);
} // end of namespace

#endif /* EPIX_COMPLEX */