Mercurial > hg > octave-lyh
annotate liboctave/dRowVector.h @ 11498:367bfee35ba0
data member initialization fixes
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 13 Jan 2011 02:37:45 -0500 |
parents | 96ed7c629bbd |
children | fd0a3ac60b0e |
rev | line source |
---|---|
458 | 1 /* |
2 | |
7017 | 3 Copyright (C) 1994, 1995, 1996, 1997, 2000, 2002, 2003, 2004, 2005, |
8920 | 4 2006, 2007, 2008 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 | |
7016 | 10 Free Software Foundation; either version 3 of the License, or (at your |
11 option) any later version. | |
458 | 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 | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
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 |
6108 | 32 OCTAVE_API |
3585 | 33 RowVector : public MArray<double> |
458 | 34 { |
35 public: | |
36 | |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
37 RowVector (void) : MArray<double> (1, 0) { } |
3585 | 38 |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
39 explicit RowVector (octave_idx_type n) : MArray<double> (1, n) { } |
3585 | 40 |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
41 explicit RowVector (const dim_vector& dv) : MArray<double> (dv.as_row ()) { } |
9612
66970dd627f6
further liboctave design improvements
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
42 |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
43 RowVector (octave_idx_type n, double val) : MArray<double> (1, n, val) { } |
3585 | 44 |
45 RowVector (const RowVector& a) : MArray<double> (a) { } | |
46 | |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
47 RowVector (const MArray<double>& a) : MArray<double> (a.as_row ()) { } |
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
48 RowVector (const Array<double>& a) : MArray<double> (a.as_row ()) { } |
458 | 49 |
50 RowVector& operator = (const RowVector& a) | |
51 { | |
1214 | 52 MArray<double>::operator = (a); |
458 | 53 return *this; |
54 } | |
55 | |
2386 | 56 bool operator == (const RowVector& a) const; |
57 bool operator != (const RowVector& a) const; | |
458 | 58 |
1359 | 59 // destructive insert/delete/reorder operations |
458 | 60 |
5275 | 61 RowVector& insert (const RowVector& a, octave_idx_type c); |
458 | 62 |
63 RowVector& fill (double val); | |
5275 | 64 RowVector& fill (double val, octave_idx_type c1, octave_idx_type c2); |
458 | 65 |
66 RowVector append (const RowVector& a) const; | |
67 | |
68 ColumnVector transpose (void) const; | |
69 | |
6108 | 70 friend OCTAVE_API RowVector real (const ComplexRowVector& a); |
71 friend OCTAVE_API RowVector imag (const ComplexRowVector& a); | |
1205 | 72 |
1359 | 73 // resize is the destructive equivalent for this one |
458 | 74 |
5275 | 75 RowVector extract (octave_idx_type c1, octave_idx_type c2) const; |
458 | 76 |
5275 | 77 RowVector extract_n (octave_idx_type c1, octave_idx_type n) const; |
4316 | 78 |
1359 | 79 // row vector by matrix -> row vector |
458 | 80 |
6108 | 81 friend OCTAVE_API RowVector operator * (const RowVector& a, const Matrix& b); |
458 | 82 |
1359 | 83 // other operations |
458 | 84 |
85 double min (void) const; | |
86 double max (void) const; | |
87 | |
1359 | 88 // i/o |
458 | 89 |
6108 | 90 friend OCTAVE_API std::ostream& operator << (std::ostream& os, const RowVector& a); |
91 friend OCTAVE_API std::istream& operator >> (std::istream& is, RowVector& a); | |
458 | 92 |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
93 void resize (octave_idx_type n, const double& rfv = Array<double>::resize_fill_value ()) |
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
94 { Array<double>::resize (1, n, rfv); } |
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
95 |
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
96 void clear (octave_idx_type n) |
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
97 { Array<double>::clear (1, n); } |
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
98 |
458 | 99 }; |
100 | |
1205 | 101 // row vector by column vector -> scalar |
102 | |
6108 | 103 double OCTAVE_API operator * (const RowVector& a, const ColumnVector& b); |
1205 | 104 |
6108 | 105 Complex OCTAVE_API operator * (const RowVector& a, const ComplexColumnVector& b); |
1205 | 106 |
107 // other operations | |
108 | |
6108 | 109 OCTAVE_API RowVector linspace (double x1, double x2, octave_idx_type n); |
1196 | 110 |
3573 | 111 MARRAY_FORWARD_DEFS (MArray, RowVector, double) |
112 | |
458 | 113 #endif |