458
|
1 // -*- C++ -*- |
|
2 /* |
|
3 |
1011
|
4 Copyright (C) 1992, 1993, 1994, 1995 John W. Eaton |
458
|
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_ComplexRowVector_h) |
|
25 #define octave_ComplexRowVector_h 1 |
|
26 |
|
27 #include "Array.h" |
|
28 |
|
29 #include "mx-defs.h" |
|
30 |
|
31 extern "C++" { |
|
32 |
|
33 class ComplexRowVector : public Array<Complex> |
|
34 { |
|
35 friend class ComplexColumnVector; |
|
36 |
|
37 public: |
|
38 |
|
39 ComplexRowVector (void) : Array<Complex> () { } |
|
40 ComplexRowVector (int n) : Array<Complex> (n) { } |
|
41 ComplexRowVector (int n, const Complex& val) : Array<Complex> (n, val) { } |
|
42 ComplexRowVector (const RowVector& a); |
|
43 ComplexRowVector (const Array<Complex>& a) : Array<Complex> (a) { } |
|
44 ComplexRowVector (const ComplexRowVector& a) : Array<Complex> (a) { } |
|
45 |
|
46 ComplexRowVector& operator = (const ComplexRowVector& a) |
|
47 { |
|
48 Array<Complex>::operator = (a); |
|
49 return *this; |
|
50 } |
|
51 |
|
52 int operator == (const ComplexRowVector& a) const; |
|
53 int operator != (const ComplexRowVector& a) const; |
|
54 |
|
55 // destructive insert/delete/reorder operations |
|
56 |
|
57 ComplexRowVector& insert (const RowVector& a, int c); |
|
58 ComplexRowVector& insert (const ComplexRowVector& a, int c); |
|
59 |
|
60 ComplexRowVector& fill (double val); |
|
61 ComplexRowVector& fill (const Complex& val); |
|
62 ComplexRowVector& fill (double val, int c1, int c2); |
|
63 ComplexRowVector& fill (const Complex& val, int c1, int c2); |
|
64 |
|
65 ComplexRowVector append (const RowVector& a) const; |
|
66 ComplexRowVector append (const ComplexRowVector& a) const; |
|
67 |
|
68 ComplexColumnVector hermitian (void) const; // complex conjugate transpose. |
|
69 ComplexColumnVector transpose (void) const; |
|
70 |
|
71 friend ComplexRowVector conj (const ComplexRowVector& a); |
|
72 |
|
73 // resize is the destructive equivalent for this one |
|
74 |
|
75 ComplexRowVector extract (int c1, int c2) const; |
|
76 |
|
77 // row vector by row vector -> row vector operations |
|
78 |
|
79 ComplexRowVector& operator += (const RowVector& a); |
|
80 ComplexRowVector& operator -= (const RowVector& a); |
|
81 |
|
82 ComplexRowVector& operator += (const ComplexRowVector& a); |
|
83 ComplexRowVector& operator -= (const ComplexRowVector& a); |
|
84 |
|
85 // row vector by scalar -> row vector operations |
|
86 |
|
87 friend ComplexRowVector operator + (const ComplexRowVector& a, double s); |
|
88 friend ComplexRowVector operator - (const ComplexRowVector& a, double s); |
|
89 friend ComplexRowVector operator * (const ComplexRowVector& a, double s); |
|
90 friend ComplexRowVector operator / (const ComplexRowVector& a, double s); |
|
91 |
1205
|
92 friend ComplexRowVector operator + (const RowVector& a, const Complex& s); |
|
93 friend ComplexRowVector operator - (const RowVector& a, const Complex& s); |
|
94 friend ComplexRowVector operator * (const RowVector& a, const Complex& s); |
|
95 friend ComplexRowVector operator / (const RowVector& a, const Complex& s); |
|
96 |
458
|
97 // scalar by row vector -> row vector operations |
|
98 |
|
99 friend ComplexRowVector operator + (double s, const ComplexRowVector& a); |
|
100 friend ComplexRowVector operator - (double s, const ComplexRowVector& a); |
|
101 friend ComplexRowVector operator * (double s, const ComplexRowVector& a); |
|
102 friend ComplexRowVector operator / (double s, const ComplexRowVector& a); |
|
103 |
1205
|
104 friend ComplexRowVector operator + (const Complex& s, const RowVector& a); |
|
105 friend ComplexRowVector operator - (const Complex& s, const RowVector& a); |
|
106 friend ComplexRowVector operator * (const Complex& s, const RowVector& a); |
|
107 friend ComplexRowVector operator / (const Complex& s, const RowVector& a); |
458
|
108 |
|
109 // row vector by matrix -> row vector |
|
110 |
|
111 friend ComplexRowVector operator * (const ComplexRowVector& a, |
|
112 const ComplexMatrix& b); |
|
113 |
1205
|
114 friend ComplexRowVector operator * (const RowVector& a, |
|
115 const ComplexMatrix& b); |
|
116 |
458
|
117 // row vector by row vector -> row vector operations |
|
118 |
|
119 friend ComplexRowVector operator + (const ComplexRowVector& a, |
|
120 const RowVector& b); |
|
121 friend ComplexRowVector operator - (const ComplexRowVector& a, |
|
122 const RowVector& b); |
|
123 |
1205
|
124 friend ComplexRowVector operator + (const RowVector& a, |
|
125 const ComplexRowVector& b); |
|
126 friend ComplexRowVector operator - (const RowVector& a, |
|
127 const ComplexRowVector& b); |
|
128 |
458
|
129 friend ComplexRowVector product (const ComplexRowVector& a, |
|
130 const RowVector& b); |
|
131 friend ComplexRowVector quotient (const ComplexRowVector& a, |
|
132 const RowVector& b); |
|
133 |
1205
|
134 friend ComplexRowVector product (const RowVector& a, |
|
135 const ComplexRowVector& b); |
|
136 friend ComplexRowVector quotient (const RowVector& a, |
|
137 const ComplexRowVector& b); |
|
138 |
458
|
139 // other operations |
|
140 |
|
141 friend ComplexRowVector map (c_c_Mapper f, const ComplexRowVector& a); |
|
142 void map (c_c_Mapper f); |
|
143 |
|
144 Complex min (void) const; |
|
145 Complex max (void) const; |
|
146 |
|
147 // i/o |
|
148 |
|
149 friend ostream& operator << (ostream& os, const ComplexRowVector& a); |
532
|
150 friend istream& operator >> (istream& is, ComplexRowVector& a); |
458
|
151 |
|
152 #define KLUDGE_VECTORS |
|
153 #define TYPE Complex |
|
154 #define KL_VEC_TYPE ComplexRowVector |
|
155 #include "mx-kludge.h" |
|
156 #undef KLUDGE_VECTORS |
|
157 #undef TYPE |
|
158 #undef KL_VEC_TYPE |
|
159 |
|
160 private: |
|
161 |
|
162 ComplexRowVector (Complex *d, int l) : Array<Complex> (d, l) { } |
|
163 }; |
|
164 |
1205
|
165 // row vector by column vector -> scalar |
|
166 |
|
167 Complex operator * (const ComplexRowVector& a, const ColumnVector& b); |
|
168 |
|
169 Complex operator * (const ComplexRowVector& a, const ComplexColumnVector& b); |
|
170 |
|
171 // other operations |
|
172 |
1196
|
173 ComplexRowVector linspace (const Complex& x1, const Complex& x2, int n); |
|
174 |
458
|
175 } // extern "C++" |
|
176 |
|
177 #endif |
|
178 |
|
179 /* |
|
180 ;;; Local Variables: *** |
|
181 ;;; mode: C++ *** |
|
182 ;;; page-delimiter: "^/\\*" *** |
|
183 ;;; End: *** |
|
184 */ |