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