458
|
1 // -*- C++ -*- |
|
2 /* |
|
3 |
|
4 Copyright (C) 1992, 1993, 1994 John W. Eaton |
|
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 |
|
10 Free Software Foundation; either version 2, or (at your option) any |
|
11 later version. |
|
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 |
|
19 along with Octave; see the file COPYING. If not, write to the Free |
|
20 Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
|
21 |
|
22 */ |
|
23 |
|
24 #if !defined (octave_ComplexColumnVector_h) |
|
25 #define octave_ComplexColumnVector_h 1 |
|
26 |
|
27 #if defined (__GNUG__) |
|
28 #pragma interface |
|
29 #endif |
|
30 |
|
31 #include "Array.h" |
|
32 |
|
33 #include "mx-defs.h" |
|
34 |
|
35 extern "C++" { |
|
36 |
|
37 class ComplexColumnVector : public Array<Complex> |
|
38 { |
|
39 friend class ComplexRowVector; |
|
40 |
|
41 public: |
|
42 |
|
43 ComplexColumnVector (void) : Array<Complex> () { } |
|
44 ComplexColumnVector (int n) : Array<Complex> (n) { } |
|
45 ComplexColumnVector (int n, const Complex& val) |
|
46 : Array<Complex> (n, val) { } |
|
47 ComplexColumnVector (const ColumnVector& a); |
|
48 ComplexColumnVector (const Array<Complex>& a) : Array<Complex> (a) { } |
|
49 ComplexColumnVector (const ComplexColumnVector& a) : Array<Complex> (a) { } |
|
50 // ComplexColumnVector (double a) : Array<Complex> (1, a) { } |
|
51 // ComplexColumnVector (const Complex& a) : Array<Complex> (1, a) { } |
|
52 |
|
53 ComplexColumnVector& operator = (const ComplexColumnVector& a) |
|
54 { |
|
55 Array<Complex>::operator = (a); |
|
56 return *this; |
|
57 } |
|
58 |
|
59 // operator Array<Complex>& () const { return *this; } |
|
60 |
|
61 int operator == (const ComplexColumnVector& a) const; |
|
62 int operator != (const ComplexColumnVector& a) const; |
|
63 |
|
64 // destructive insert/delete/reorder operations |
|
65 |
|
66 ComplexColumnVector& insert (const ColumnVector& a, int r); |
|
67 ComplexColumnVector& insert (const ComplexColumnVector& a, int r); |
|
68 |
|
69 ComplexColumnVector& fill (double val); |
|
70 ComplexColumnVector& fill (const Complex& val); |
|
71 ComplexColumnVector& fill (double val, int r1, int r2); |
|
72 ComplexColumnVector& fill (const Complex& val, int r1, int r2); |
|
73 |
|
74 ComplexColumnVector stack (const ColumnVector& a) const; |
|
75 ComplexColumnVector stack (const ComplexColumnVector& a) const; |
|
76 |
|
77 ComplexRowVector hermitian (void) const; // complex conjugate transpose. |
|
78 ComplexRowVector transpose (void) const; |
|
79 |
|
80 friend ColumnVector real (const ComplexColumnVector& a); |
|
81 friend ColumnVector imag (const ComplexColumnVector& a); |
|
82 friend ComplexColumnVector conj (const ComplexColumnVector& a); |
|
83 |
|
84 // resize is the destructive equivalent for this one |
|
85 |
|
86 ComplexColumnVector extract (int r1, int r2) const; |
|
87 |
|
88 // column vector by column vector -> column vector operations |
|
89 |
|
90 ComplexColumnVector& operator += (const ColumnVector& a); |
|
91 ComplexColumnVector& operator -= (const ColumnVector& a); |
|
92 |
|
93 ComplexColumnVector& operator += (const ComplexColumnVector& a); |
|
94 ComplexColumnVector& operator -= (const ComplexColumnVector& a); |
|
95 |
|
96 // column vector by scalar -> column vector operations |
|
97 |
|
98 friend ComplexColumnVector operator + (const ComplexColumnVector& a, |
|
99 double s); |
|
100 friend ComplexColumnVector operator - (const ComplexColumnVector& a, |
|
101 double s); |
|
102 friend ComplexColumnVector operator * (const ComplexColumnVector& a, |
|
103 double s); |
|
104 friend ComplexColumnVector operator / (const ComplexColumnVector& a, |
|
105 double s); |
|
106 |
|
107 // scalar by column vector -> column vector operations |
|
108 |
|
109 friend ComplexColumnVector operator + (double s, |
|
110 const ComplexColumnVector& a); |
|
111 friend ComplexColumnVector operator - (double s, |
|
112 const ComplexColumnVector& a); |
|
113 friend ComplexColumnVector operator * (double s, |
|
114 const ComplexColumnVector& a); |
|
115 friend ComplexColumnVector operator / (double s, |
|
116 const ComplexColumnVector& a); |
|
117 |
|
118 // column vector by row vector -> matrix operations |
|
119 |
|
120 friend ComplexMatrix operator * (const ComplexColumnVector& a, |
|
121 const ComplexRowVector& b); |
|
122 |
|
123 // column vector by column vector -> column vector operations |
|
124 |
|
125 friend ComplexColumnVector operator + (const ComplexColumnVector& a, |
|
126 const ColumnVector& b); |
|
127 friend ComplexColumnVector operator - (const ComplexColumnVector& a, |
|
128 const ColumnVector& b); |
|
129 |
|
130 friend ComplexColumnVector product (const ComplexColumnVector& a, |
|
131 const ColumnVector& b); |
|
132 friend ComplexColumnVector quotient (const ComplexColumnVector& a, |
|
133 const ColumnVector& b); |
|
134 |
|
135 // other operations |
|
136 |
|
137 friend ComplexColumnVector map (c_c_Mapper f, const ComplexColumnVector& a); |
|
138 friend ColumnVector map (d_c_Mapper f, const ComplexColumnVector& a); |
|
139 void map (c_c_Mapper f); |
|
140 |
|
141 Complex min (void) const; |
|
142 Complex max (void) const; |
|
143 |
|
144 // i/o |
|
145 |
|
146 friend ostream& operator << (ostream& os, const ComplexColumnVector& a); |
|
147 friend ostream& operator >> (ostream& is, ComplexColumnVector& a); |
|
148 |
|
149 #define KLUDGE_VECTORS |
|
150 #define TYPE Complex |
|
151 #define KL_VEC_TYPE ComplexColumnVector |
|
152 #include "mx-kludge.h" |
|
153 #undef KLUDGE_VECTORS |
|
154 #undef TYPE |
|
155 #undef KL_VEC_TYPE |
|
156 |
|
157 private: |
|
158 |
|
159 ComplexColumnVector (Complex *d, int l) : Array<Complex> (d, l) { } |
|
160 }; |
|
161 |
|
162 } // extern "C++" |
|
163 |
|
164 #endif |
|
165 |
|
166 /* |
|
167 ;;; Local Variables: *** |
|
168 ;;; mode: C++ *** |
|
169 ;;; page-delimiter: "^/\\*" *** |
|
170 ;;; End: *** |
|
171 */ |