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 |
5307
|
19 Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
20 02110-1301, USA. |
458
|
21 |
|
22 */ |
|
23 |
|
24 #if !defined (octave_RowVector_h) |
|
25 #define octave_RowVector_h 1 |
|
26 |
1214
|
27 #include "MArray.h" |
458
|
28 |
|
29 #include "mx-defs.h" |
|
30 |
3585
|
31 class |
|
32 RowVector : public MArray<double> |
458
|
33 { |
|
34 public: |
|
35 |
1214
|
36 RowVector (void) : MArray<double> () { } |
3585
|
37 |
5275
|
38 explicit RowVector (octave_idx_type n) : MArray<double> (n) { } |
3585
|
39 |
5275
|
40 RowVector (octave_idx_type n, double val) : MArray<double> (n, val) { } |
3585
|
41 |
|
42 RowVector (const RowVector& a) : MArray<double> (a) { } |
|
43 |
1214
|
44 RowVector (const MArray<double>& 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 |
5275
|
57 RowVector& insert (const RowVector& a, octave_idx_type c); |
458
|
58 |
|
59 RowVector& fill (double val); |
5275
|
60 RowVector& fill (double val, octave_idx_type c1, octave_idx_type c2); |
458
|
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 |
5275
|
71 RowVector extract (octave_idx_type c1, octave_idx_type c2) const; |
458
|
72 |
5275
|
73 RowVector extract_n (octave_idx_type c1, octave_idx_type n) const; |
4316
|
74 |
1359
|
75 // row vector by matrix -> row vector |
458
|
76 |
|
77 friend RowVector operator * (const RowVector& a, const Matrix& b); |
|
78 |
1359
|
79 // other operations |
458
|
80 |
2676
|
81 RowVector map (d_d_Mapper f) const; |
|
82 |
|
83 RowVector& apply (d_d_Mapper f); |
458
|
84 |
|
85 double min (void) const; |
|
86 double max (void) const; |
|
87 |
1359
|
88 // i/o |
458
|
89 |
3504
|
90 friend std::ostream& operator << (std::ostream& os, const RowVector& a); |
|
91 friend std::istream& operator >> (std::istream& is, RowVector& a); |
458
|
92 |
|
93 private: |
|
94 |
5275
|
95 RowVector (double *d, octave_idx_type l) : MArray<double> (d, l) { } |
458
|
96 }; |
|
97 |
1205
|
98 // row vector by column vector -> scalar |
|
99 |
|
100 double operator * (const RowVector& a, const ColumnVector& b); |
|
101 |
|
102 Complex operator * (const RowVector& a, const ComplexColumnVector& b); |
|
103 |
|
104 // other operations |
|
105 |
5275
|
106 RowVector linspace (double x1, double x2, octave_idx_type n); |
1196
|
107 |
3573
|
108 MARRAY_FORWARD_DEFS (MArray, RowVector, double) |
|
109 |
458
|
110 #endif |
|
111 |
|
112 /* |
|
113 ;;; Local Variables: *** |
|
114 ;;; mode: C++ *** |
|
115 ;;; End: *** |
|
116 */ |