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 #include "Array.h" |
|
28 |
|
29 #include "mx-defs.h" |
|
30 |
|
31 extern "C++" { |
|
32 |
|
33 class ComplexColumnVector : public Array<Complex> |
|
34 { |
532
|
35 friend class ColumnVector; |
458
|
36 friend class ComplexRowVector; |
532
|
37 friend class ComplexMatrix; |
458
|
38 |
|
39 public: |
|
40 |
|
41 ComplexColumnVector (void) : Array<Complex> () { } |
|
42 ComplexColumnVector (int n) : Array<Complex> (n) { } |
|
43 ComplexColumnVector (int n, const Complex& val) |
|
44 : Array<Complex> (n, val) { } |
|
45 ComplexColumnVector (const ColumnVector& a); |
|
46 ComplexColumnVector (const Array<Complex>& a) : Array<Complex> (a) { } |
|
47 ComplexColumnVector (const ComplexColumnVector& a) : Array<Complex> (a) { } |
|
48 // ComplexColumnVector (double a) : Array<Complex> (1, a) { } |
|
49 // ComplexColumnVector (const Complex& a) : Array<Complex> (1, a) { } |
|
50 |
|
51 ComplexColumnVector& operator = (const ComplexColumnVector& a) |
|
52 { |
|
53 Array<Complex>::operator = (a); |
|
54 return *this; |
|
55 } |
|
56 |
|
57 // operator Array<Complex>& () const { return *this; } |
|
58 |
|
59 int operator == (const ComplexColumnVector& a) const; |
|
60 int operator != (const ComplexColumnVector& a) const; |
|
61 |
|
62 // destructive insert/delete/reorder operations |
|
63 |
|
64 ComplexColumnVector& insert (const ColumnVector& a, int r); |
|
65 ComplexColumnVector& insert (const ComplexColumnVector& a, int r); |
|
66 |
|
67 ComplexColumnVector& fill (double val); |
|
68 ComplexColumnVector& fill (const Complex& val); |
|
69 ComplexColumnVector& fill (double val, int r1, int r2); |
|
70 ComplexColumnVector& fill (const Complex& val, int r1, int r2); |
|
71 |
|
72 ComplexColumnVector stack (const ColumnVector& a) const; |
|
73 ComplexColumnVector stack (const ComplexColumnVector& a) const; |
|
74 |
|
75 ComplexRowVector hermitian (void) const; // complex conjugate transpose. |
|
76 ComplexRowVector transpose (void) const; |
|
77 |
|
78 friend ColumnVector real (const ComplexColumnVector& a); |
|
79 friend ColumnVector imag (const ComplexColumnVector& a); |
|
80 friend ComplexColumnVector conj (const ComplexColumnVector& a); |
|
81 |
|
82 // resize is the destructive equivalent for this one |
|
83 |
|
84 ComplexColumnVector extract (int r1, int r2) const; |
|
85 |
|
86 // column vector by column vector -> column vector operations |
|
87 |
|
88 ComplexColumnVector& operator += (const ColumnVector& a); |
|
89 ComplexColumnVector& operator -= (const ColumnVector& a); |
|
90 |
|
91 ComplexColumnVector& operator += (const ComplexColumnVector& a); |
|
92 ComplexColumnVector& operator -= (const ComplexColumnVector& a); |
|
93 |
|
94 // column vector by scalar -> column vector operations |
|
95 |
|
96 friend ComplexColumnVector operator + (const ComplexColumnVector& a, |
|
97 double s); |
|
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 |
|
105 // scalar by column vector -> column vector operations |
|
106 |
|
107 friend ComplexColumnVector operator + (double s, |
|
108 const ComplexColumnVector& a); |
|
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 |
|
116 // column vector by row vector -> matrix operations |
|
117 |
|
118 friend ComplexMatrix operator * (const ComplexColumnVector& a, |
|
119 const ComplexRowVector& b); |
|
120 |
|
121 // column vector by column vector -> column vector operations |
|
122 |
|
123 friend ComplexColumnVector operator + (const ComplexColumnVector& a, |
|
124 const ColumnVector& b); |
|
125 friend ComplexColumnVector operator - (const ComplexColumnVector& a, |
|
126 const ColumnVector& b); |
|
127 |
|
128 friend ComplexColumnVector product (const ComplexColumnVector& a, |
|
129 const ColumnVector& b); |
|
130 friend ComplexColumnVector quotient (const ComplexColumnVector& a, |
|
131 const ColumnVector& b); |
|
132 |
|
133 // other operations |
|
134 |
|
135 friend ComplexColumnVector map (c_c_Mapper f, const ComplexColumnVector& a); |
|
136 friend ColumnVector map (d_c_Mapper f, const ComplexColumnVector& a); |
|
137 void map (c_c_Mapper f); |
|
138 |
|
139 Complex min (void) const; |
|
140 Complex max (void) const; |
|
141 |
|
142 // i/o |
|
143 |
|
144 friend ostream& operator << (ostream& os, const ComplexColumnVector& a); |
532
|
145 friend istream& operator >> (istream& is, ComplexColumnVector& a); |
458
|
146 |
|
147 #define KLUDGE_VECTORS |
|
148 #define TYPE Complex |
|
149 #define KL_VEC_TYPE ComplexColumnVector |
|
150 #include "mx-kludge.h" |
|
151 #undef KLUDGE_VECTORS |
|
152 #undef TYPE |
|
153 #undef KL_VEC_TYPE |
|
154 |
532
|
155 // private: |
|
156 // XXX FIXME XXX -- why does it not work to make this private, with |
|
157 // ColumnVector declared as a friend of ComplexColumnVector? It seems |
|
158 // to work for the similar case with Matrix/ComplexMatrix. Hmm... |
458
|
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 */ |