458
|
1 /* |
|
2 |
2847
|
3 Copyright (C) 1996, 1997 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 |
4192
|
26 #if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION) |
1296
|
27 #pragma interface |
|
28 #endif |
|
29 |
1214
|
30 #include "MArray.h" |
458
|
31 |
|
32 #include "mx-defs.h" |
|
33 |
3585
|
34 class |
|
35 RowVector : public MArray<double> |
458
|
36 { |
|
37 public: |
|
38 |
1214
|
39 RowVector (void) : MArray<double> () { } |
3585
|
40 |
|
41 explicit RowVector (int n) : MArray<double> (n) { } |
|
42 |
1214
|
43 RowVector (int n, double val) : MArray<double> (n, val) { } |
3585
|
44 |
|
45 RowVector (const RowVector& a) : MArray<double> (a) { } |
|
46 |
1214
|
47 RowVector (const MArray<double>& a) : MArray<double> (a) { } |
458
|
48 |
|
49 RowVector& operator = (const RowVector& a) |
|
50 { |
1214
|
51 MArray<double>::operator = (a); |
458
|
52 return *this; |
|
53 } |
|
54 |
2386
|
55 bool operator == (const RowVector& a) const; |
|
56 bool operator != (const RowVector& a) const; |
458
|
57 |
1359
|
58 // destructive insert/delete/reorder operations |
458
|
59 |
|
60 RowVector& insert (const RowVector& a, int c); |
|
61 |
|
62 RowVector& fill (double val); |
|
63 RowVector& fill (double val, int c1, int c2); |
|
64 |
|
65 RowVector append (const RowVector& a) const; |
|
66 |
|
67 ColumnVector transpose (void) const; |
|
68 |
1205
|
69 friend RowVector real (const ComplexRowVector& a); |
|
70 friend RowVector imag (const ComplexRowVector& a); |
|
71 |
1359
|
72 // resize is the destructive equivalent for this one |
458
|
73 |
|
74 RowVector extract (int c1, int c2) const; |
|
75 |
1359
|
76 // row vector by matrix -> row vector |
458
|
77 |
|
78 friend RowVector operator * (const RowVector& a, const Matrix& b); |
|
79 |
1359
|
80 // other operations |
458
|
81 |
2676
|
82 RowVector map (d_d_Mapper f) const; |
|
83 |
|
84 RowVector& apply (d_d_Mapper f); |
458
|
85 |
|
86 double min (void) const; |
|
87 double max (void) const; |
|
88 |
1359
|
89 // i/o |
458
|
90 |
3504
|
91 friend std::ostream& operator << (std::ostream& os, const RowVector& a); |
|
92 friend std::istream& operator >> (std::istream& is, RowVector& a); |
458
|
93 |
|
94 private: |
|
95 |
1214
|
96 RowVector (double *d, int l) : MArray<double> (d, l) { } |
458
|
97 }; |
|
98 |
1205
|
99 // row vector by column vector -> scalar |
|
100 |
|
101 double operator * (const RowVector& a, const ColumnVector& b); |
|
102 |
|
103 Complex operator * (const RowVector& a, const ComplexColumnVector& b); |
|
104 |
|
105 // other operations |
|
106 |
1196
|
107 RowVector linspace (double x1, double x2, int n); |
|
108 |
3573
|
109 MARRAY_FORWARD_DEFS (MArray, RowVector, double) |
|
110 |
458
|
111 #endif |
|
112 |
|
113 /* |
|
114 ;;; Local Variables: *** |
|
115 ;;; mode: C++ *** |
|
116 ;;; End: *** |
|
117 */ |