457
|
1 /* |
|
2 |
7017
|
3 Copyright (C) 1994, 1995, 1996, 1997, 2000, 2002, 2004, 2005, 2006, |
|
4 2007 John W. Eaton |
457
|
5 |
|
6 This file is part of Octave. |
|
7 |
|
8 Octave is free software; you can redistribute it and/or modify it |
|
9 under the terms of the GNU General Public License as published by the |
7016
|
10 Free Software Foundation; either version 3 of the License, or (at your |
|
11 option) any later version. |
457
|
12 |
|
13 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
16 for more details. |
|
17 |
|
18 You should have received a copy of the GNU General Public License |
7016
|
19 along with Octave; see the file COPYING. If not, see |
|
20 <http://www.gnu.org/licenses/>. |
457
|
21 |
|
22 */ |
|
23 |
|
24 #if !defined (octave_ComplexDET_h) |
|
25 #define octave_ComplexDET_h 1 |
|
26 |
3503
|
27 #include <iostream> |
457
|
28 |
1650
|
29 #include "oct-cmplx.h" |
457
|
30 |
5775
|
31 // FIXME -- we could use templates here; compare with dbleDET.h |
5634
|
32 |
1881
|
33 class |
6108
|
34 OCTAVE_API |
1881
|
35 ComplexDET |
457
|
36 { |
1881
|
37 friend class ComplexMatrix; |
5164
|
38 friend class SparseComplexMatrix; |
532
|
39 |
457
|
40 public: |
|
41 |
5634
|
42 ComplexDET (void) : c2 (0), c10 (0), e2 (0), e10 (0), base2 (false) { } |
1528
|
43 |
|
44 ComplexDET (const ComplexDET& a) |
5634
|
45 : c2 (a.c2), c10 (a.c10), e2 (a.e2), e10 (a.e10), base2 (a.base2) |
|
46 { } |
457
|
47 |
1528
|
48 ComplexDET& operator = (const ComplexDET& a) |
|
49 { |
1881
|
50 if (this != &a) |
|
51 { |
5634
|
52 c2 = a.c2; |
|
53 e2 = a.e2; |
|
54 |
|
55 c10 = a.c10; |
|
56 e10 = a.e10; |
|
57 |
|
58 base2 = a.base2; |
1881
|
59 } |
1528
|
60 return *this; |
|
61 } |
457
|
62 |
5634
|
63 bool value_will_overflow (void) const; |
|
64 bool value_will_underflow (void) const; |
|
65 |
|
66 // These two functions were originally defined in base 10, so we are |
|
67 // preserving that interface here. |
1528
|
68 |
5634
|
69 Complex coefficient (void) const { return coefficient10 (); } |
|
70 int exponent (void) const { return exponent10 (); } |
1528
|
71 |
5634
|
72 Complex coefficient10 (void) const { return c10; } |
|
73 int exponent10 (void) const { return e10; } |
|
74 |
|
75 Complex coefficient2 (void) const { return c2; } |
|
76 int exponent2 (void) const { return e2; } |
1528
|
77 |
457
|
78 Complex value (void) const; |
|
79 |
3504
|
80 friend std::ostream& operator << (std::ostream& os, const ComplexDET& a); |
457
|
81 |
|
82 private: |
|
83 |
5634
|
84 // Constructed this way, we assume base 2. |
|
85 |
|
86 ComplexDET (const Complex& c, int e) |
|
87 : c2 (c), c10 (0), e2 (e), e10 (0), base2 (true) |
1528
|
88 { |
5634
|
89 initialize10 (); |
1528
|
90 } |
457
|
91 |
5634
|
92 // Original interface had only this constructor and it was assumed |
|
93 // to be base 10, so we are preserving that interface here. |
|
94 |
|
95 ComplexDET (const Complex *d) |
|
96 : c2 (0), c10 (d[0]), e2 (0), e10 (static_cast<int> (d[1].real ())), |
|
97 base2 (false) |
|
98 { |
|
99 initialize2 (); |
|
100 } |
|
101 |
|
102 void initialize2 (void); |
|
103 void initialize10 (void); |
|
104 |
|
105 Complex c2; |
|
106 Complex c10; |
|
107 |
|
108 int e2; |
|
109 int e10; |
|
110 |
|
111 // TRUE means the original values were provided in base 2. |
|
112 bool base2; |
457
|
113 }; |
|
114 |
|
115 #endif |
|
116 |
|
117 /* |
|
118 ;;; Local Variables: *** |
|
119 ;;; mode: C++ *** |
|
120 ;;; End: *** |
|
121 */ |