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