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_ColumnVector_h) |
|
24 #define octave_ColumnVector_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 ColumnVector : public MArray<double> |
458
|
35 { |
532
|
36 friend class Matrix; |
458
|
37 friend class RowVector; |
|
38 |
|
39 public: |
|
40 |
1214
|
41 ColumnVector (void) : MArray<double> () { } |
|
42 ColumnVector (int n) : MArray<double> (n) { } |
|
43 ColumnVector (int n, double val) : MArray<double> (n, val) { } |
|
44 ColumnVector (const MArray<double>& a) : MArray<double> (a) { } |
|
45 ColumnVector (const ColumnVector& a) : MArray<double> (a) { } |
458
|
46 |
|
47 ColumnVector& operator = (const ColumnVector& a) |
|
48 { |
1214
|
49 MArray<double>::operator = (a); |
458
|
50 return *this; |
|
51 } |
|
52 |
2386
|
53 bool operator == (const ColumnVector& a) const; |
|
54 bool operator != (const ColumnVector& a) const; |
458
|
55 |
1359
|
56 // destructive insert/delete/reorder operations |
458
|
57 |
|
58 ColumnVector& insert (const ColumnVector& a, int r); |
|
59 |
|
60 ColumnVector& fill (double val); |
|
61 ColumnVector& fill (double val, int r1, int r2); |
|
62 |
|
63 ColumnVector stack (const ColumnVector& a) const; |
|
64 |
|
65 RowVector transpose (void) const; |
|
66 |
1205
|
67 friend ColumnVector real (const ComplexColumnVector& a); |
|
68 friend ColumnVector imag (const ComplexColumnVector& a); |
|
69 |
1359
|
70 // resize is the destructive equivalent for this one |
458
|
71 |
|
72 ColumnVector extract (int r1, int r2) const; |
|
73 |
1359
|
74 // column vector by column vector -> column vector operations |
458
|
75 |
|
76 ColumnVector& operator += (const ColumnVector& a); |
|
77 ColumnVector& operator -= (const ColumnVector& a); |
|
78 |
1359
|
79 // matrix by column vector -> column vector operations |
458
|
80 |
1205
|
81 friend ColumnVector operator * (const Matrix& a, const ColumnVector& b); |
458
|
82 |
1359
|
83 // diagonal matrix by column vector -> column vector operations |
458
|
84 |
1205
|
85 friend ColumnVector operator * (const DiagMatrix& a, const ColumnVector& b); |
458
|
86 |
1359
|
87 // other operations |
458
|
88 |
|
89 friend ColumnVector map (d_d_Mapper f, const ColumnVector& a); |
1205
|
90 friend ColumnVector map (d_c_Mapper f, const ComplexColumnVector& a); |
458
|
91 void map (d_d_Mapper f); |
|
92 |
|
93 double min (void) const; |
|
94 double max (void) const; |
|
95 |
1359
|
96 // i/o |
458
|
97 |
|
98 friend ostream& operator << (ostream& os, const ColumnVector& a); |
532
|
99 friend istream& operator >> (istream& is, ColumnVector& a); |
458
|
100 |
|
101 private: |
|
102 |
1214
|
103 ColumnVector (double *d, int l) : MArray<double> (d, l) { } |
458
|
104 }; |
|
105 |
|
106 #endif |
|
107 |
|
108 /* |
|
109 ;;; Local Variables: *** |
|
110 ;;; mode: C++ *** |
|
111 ;;; End: *** |
|
112 */ |