Mercurial > hg > octave-lyh
comparison liboctave/dColVector.h @ 458:38cb88095913
[project @ 1994-06-06 00:41:10 by jwe]
Initial revision
author | jwe |
---|---|
date | Mon, 06 Jun 1994 00:41:10 +0000 |
parents | |
children | 2ca256b77602 |
comparison
equal
deleted
inserted
replaced
457:3d4b4f0fa5ba | 458:38cb88095913 |
---|---|
1 // -*- C++ -*- | |
2 /* | |
3 | |
4 Copyright (C) 1992, 1993, 1994 John W. Eaton | |
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_ColumnVector_h) | |
25 #define octave_ColumnVector_h 1 | |
26 | |
27 #if defined (__GNUG__) | |
28 #pragma interface | |
29 #endif | |
30 | |
31 #include "Array.h" | |
32 | |
33 #include "mx-defs.h" | |
34 | |
35 extern "C++" { | |
36 | |
37 class ColumnVector : public Array<double> | |
38 { | |
39 friend class RowVector; | |
40 | |
41 public: | |
42 | |
43 ColumnVector (void) : Array<double> () { } | |
44 ColumnVector (int n) : Array<double> (n) { } | |
45 ColumnVector (int n, double val) : Array<double> (n, val) { } | |
46 ColumnVector (const Array<double>& a) : Array<double> (a) { } | |
47 ColumnVector (const ColumnVector& a) : Array<double> (a) { } | |
48 // ColumnVector (double a) : Array<double> (1, a) { } | |
49 | |
50 ColumnVector& operator = (const ColumnVector& a) | |
51 { | |
52 Array<double>::operator = (a); | |
53 return *this; | |
54 } | |
55 | |
56 // operator Array<double>& () const { return *this; } | |
57 | |
58 int operator == (const ColumnVector& a) const; | |
59 int operator != (const ColumnVector& a) const; | |
60 | |
61 // destructive insert/delete/reorder operations | |
62 | |
63 ColumnVector& insert (const ColumnVector& a, int r); | |
64 | |
65 ColumnVector& fill (double val); | |
66 ColumnVector& fill (double val, int r1, int r2); | |
67 | |
68 ColumnVector stack (const ColumnVector& a) const; | |
69 | |
70 RowVector transpose (void) const; | |
71 | |
72 // resize is the destructive equivalent for this one | |
73 | |
74 ColumnVector extract (int r1, int r2) const; | |
75 | |
76 // column vector by column vector -> column vector operations | |
77 | |
78 ColumnVector& operator += (const ColumnVector& a); | |
79 ColumnVector& operator -= (const ColumnVector& a); | |
80 | |
81 // column vector by scalar -> column vector operations | |
82 | |
83 friend ComplexColumnVector operator + (const ColumnVector& a, | |
84 const Complex& s); | |
85 friend ComplexColumnVector operator - (const ColumnVector& a, | |
86 const Complex& s); | |
87 friend ComplexColumnVector operator * (const ColumnVector& a, | |
88 const Complex& s); | |
89 friend ComplexColumnVector operator / (const ColumnVector& a, | |
90 const Complex& s); | |
91 | |
92 // scalar by column vector -> column vector operations | |
93 | |
94 friend ComplexColumnVector operator + (const Complex& s, | |
95 const ColumnVector& a); | |
96 friend ComplexColumnVector operator - (const Complex& s, | |
97 const ColumnVector& a); | |
98 friend ComplexColumnVector operator * (const Complex& s, | |
99 const ColumnVector& a); | |
100 friend ComplexColumnVector operator / (const Complex& s, | |
101 const ColumnVector& a); | |
102 | |
103 // column vector by row vector -> matrix operations | |
104 | |
105 friend Matrix operator * (const ColumnVector& a, const RowVector& a); | |
106 | |
107 friend ComplexMatrix operator * (const ColumnVector& a, | |
108 const ComplexRowVector& b); | |
109 | |
110 // column vector by column vector -> column vector operations | |
111 | |
112 friend ComplexColumnVector operator + (const ComplexColumnVector& a, | |
113 const ComplexColumnVector& b); | |
114 | |
115 friend ComplexColumnVector operator - (const ComplexColumnVector& a, | |
116 const ComplexColumnVector& b); | |
117 | |
118 friend ComplexColumnVector product (const ComplexColumnVector& a, | |
119 const ComplexColumnVector& b); | |
120 | |
121 friend ComplexColumnVector quotient (const ComplexColumnVector& a, | |
122 const ComplexColumnVector& b); | |
123 | |
124 // other operations | |
125 | |
126 friend ColumnVector map (d_d_Mapper f, const ColumnVector& a); | |
127 void map (d_d_Mapper f); | |
128 | |
129 double min (void) const; | |
130 double max (void) const; | |
131 | |
132 // i/o | |
133 | |
134 friend ostream& operator << (ostream& os, const ColumnVector& a); | |
135 friend ostream& operator >> (ostream& is, ColumnVector& a); | |
136 | |
137 #define KLUDGE_VECTORS | |
138 #define TYPE double | |
139 #define KL_VEC_TYPE ColumnVector | |
140 #include "mx-kludge.h" | |
141 #undef KLUDGE_VECTORS | |
142 #undef TYPE | |
143 #undef KL_VEC_TYPE | |
144 | |
145 private: | |
146 | |
147 ColumnVector (double *d, int l) : Array<double> (d, l) { } | |
148 }; | |
149 | |
150 } // extern "C++" | |
151 | |
152 #endif | |
153 | |
154 /* | |
155 ;;; Local Variables: *** | |
156 ;;; mode: C++ *** | |
157 ;;; page-delimiter: "^/\\*" *** | |
158 ;;; End: *** | |
159 */ |