458
|
1 /* |
|
2 |
1882
|
3 Copyright (C) 1996 John W. Eaton |
458
|
4 |
|
5 This file is part of Octave. |
|
6 |
|
7 Octave is free software; you can redistribute it and/or modify it |
|
8 under the terms of the GNU General Public License as published by the |
|
9 Free Software Foundation; either version 2, or (at your option) any |
|
10 later version. |
|
11 |
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
15 for more details. |
|
16 |
|
17 You should have received a copy of the GNU General Public License |
|
18 along with Octave; see the file COPYING. If not, write to the Free |
1315
|
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
458
|
20 |
|
21 */ |
|
22 |
|
23 #if !defined (octave_RowVector_h) |
|
24 #define octave_RowVector_h 1 |
|
25 |
1296
|
26 #if defined (__GNUG__) |
|
27 #pragma interface |
|
28 #endif |
|
29 |
1214
|
30 #include "MArray.h" |
458
|
31 |
|
32 #include "mx-defs.h" |
|
33 |
1214
|
34 class RowVector : public MArray<double> |
458
|
35 { |
|
36 friend class ColumnVector; |
|
37 |
|
38 public: |
|
39 |
1214
|
40 RowVector (void) : MArray<double> () { } |
|
41 RowVector (int n) : MArray<double> (n) { } |
|
42 RowVector (int n, double val) : MArray<double> (n, val) { } |
|
43 RowVector (const MArray<double>& a) : MArray<double> (a) { } |
|
44 RowVector (const RowVector& a) : MArray<double> (a) { } |
458
|
45 |
|
46 RowVector& operator = (const RowVector& a) |
|
47 { |
1214
|
48 MArray<double>::operator = (a); |
458
|
49 return *this; |
|
50 } |
|
51 |
2386
|
52 bool operator == (const RowVector& a) const; |
|
53 bool operator != (const RowVector& a) const; |
458
|
54 |
1359
|
55 // destructive insert/delete/reorder operations |
458
|
56 |
|
57 RowVector& insert (const RowVector& a, int c); |
|
58 |
|
59 RowVector& fill (double val); |
|
60 RowVector& fill (double val, int c1, int c2); |
|
61 |
|
62 RowVector append (const RowVector& a) const; |
|
63 |
|
64 ColumnVector transpose (void) const; |
|
65 |
1205
|
66 friend RowVector real (const ComplexRowVector& a); |
|
67 friend RowVector imag (const ComplexRowVector& a); |
|
68 |
1359
|
69 // resize is the destructive equivalent for this one |
458
|
70 |
|
71 RowVector extract (int c1, int c2) const; |
|
72 |
1359
|
73 // row vector by row vector -> row vector operations |
458
|
74 |
|
75 RowVector& operator += (const RowVector& a); |
|
76 RowVector& operator -= (const RowVector& a); |
|
77 |
1359
|
78 // row vector by matrix -> row vector |
458
|
79 |
|
80 friend RowVector operator * (const RowVector& a, const Matrix& b); |
|
81 |
1359
|
82 // other operations |
458
|
83 |
|
84 friend RowVector map (d_d_Mapper f, const RowVector& a); |
1205
|
85 friend RowVector map (d_c_Mapper f, const ComplexRowVector& a); |
458
|
86 void map (d_d_Mapper f); |
|
87 |
|
88 double min (void) const; |
|
89 double max (void) const; |
|
90 |
1359
|
91 // i/o |
458
|
92 |
|
93 friend ostream& operator << (ostream& os, const RowVector& a); |
532
|
94 friend istream& operator >> (istream& is, RowVector& a); |
458
|
95 |
|
96 private: |
|
97 |
1214
|
98 RowVector (double *d, int l) : MArray<double> (d, l) { } |
458
|
99 }; |
|
100 |
1205
|
101 // row vector by column vector -> scalar |
|
102 |
|
103 double operator * (const RowVector& a, const ColumnVector& b); |
|
104 |
|
105 Complex operator * (const RowVector& a, const ComplexColumnVector& b); |
|
106 |
|
107 // other operations |
|
108 |
1196
|
109 RowVector linspace (double x1, double x2, int n); |
|
110 |
458
|
111 #endif |
|
112 |
|
113 /* |
|
114 ;;; Local Variables: *** |
|
115 ;;; mode: C++ *** |
|
116 ;;; End: *** |
|
117 */ |