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