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