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