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