Mercurial > hg > octave-lyh
annotate liboctave/dRowVector.h @ 14704:551566201318 stable release-3-6-2
Version 3.6.2 released.
* configure.ac (AC_INIT): Version is now 3.6.2.
(OCTAVE_RELEASE_DATE): Now 2012-05-31.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 31 May 2012 11:22:15 -0400 |
parents | 72c96de7a403 |
children | 13cc11418393 |
rev | line source |
---|---|
458 | 1 /* |
2 | |
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
11574
diff
changeset
|
3 Copyright (C) 1994-2012 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 | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
458 | 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 | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
458 | 20 |
21 */ | |
22 | |
23 #if !defined (octave_RowVector_h) | |
24 #define octave_RowVector_h 1 | |
25 | |
1214 | 26 #include "MArray.h" |
458 | 27 |
28 #include "mx-defs.h" | |
29 | |
3585 | 30 class |
6108 | 31 OCTAVE_API |
3585 | 32 RowVector : public MArray<double> |
458 | 33 { |
34 public: | |
35 | |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
36 RowVector (void) : MArray<double> (dim_vector (1, 0)) { } |
3585 | 37 |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
38 explicit RowVector (octave_idx_type n) |
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
39 : MArray<double> (dim_vector (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 |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
43 RowVector (octave_idx_type n, double val) |
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
44 : MArray<double> (dim_vector (1, n), val) { } |
3585 | 45 |
46 RowVector (const RowVector& a) : MArray<double> (a) { } | |
47 | |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
48 RowVector (const MArray<double>& a) : MArray<double> (a.as_row ()) { } |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
49 |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
50 RowVector (const Array<double>& a) : MArray<double> (a.as_row ()) { } |
458 | 51 |
52 RowVector& operator = (const RowVector& a) | |
53 { | |
1214 | 54 MArray<double>::operator = (a); |
458 | 55 return *this; |
56 } | |
57 | |
2386 | 58 bool operator == (const RowVector& a) const; |
59 bool operator != (const RowVector& a) const; | |
458 | 60 |
1359 | 61 // destructive insert/delete/reorder operations |
458 | 62 |
5275 | 63 RowVector& insert (const RowVector& a, octave_idx_type c); |
458 | 64 |
65 RowVector& fill (double val); | |
5275 | 66 RowVector& fill (double val, octave_idx_type c1, octave_idx_type c2); |
458 | 67 |
68 RowVector append (const RowVector& a) const; | |
69 | |
70 ColumnVector transpose (void) const; | |
71 | |
6108 | 72 friend OCTAVE_API RowVector real (const ComplexRowVector& a); |
73 friend OCTAVE_API RowVector imag (const ComplexRowVector& a); | |
1205 | 74 |
1359 | 75 // resize is the destructive equivalent for this one |
458 | 76 |
5275 | 77 RowVector extract (octave_idx_type c1, octave_idx_type c2) const; |
458 | 78 |
5275 | 79 RowVector extract_n (octave_idx_type c1, octave_idx_type n) const; |
4316 | 80 |
1359 | 81 // row vector by matrix -> row vector |
458 | 82 |
6108 | 83 friend OCTAVE_API RowVector operator * (const RowVector& a, const Matrix& b); |
458 | 84 |
1359 | 85 // other operations |
458 | 86 |
87 double min (void) const; | |
88 double max (void) const; | |
89 | |
1359 | 90 // i/o |
458 | 91 |
6108 | 92 friend OCTAVE_API std::ostream& operator << (std::ostream& os, const RowVector& a); |
93 friend OCTAVE_API std::istream& operator >> (std::istream& is, RowVector& a); | |
458 | 94 |
11574
a83bad07f7e3
attempt better backward compatibility for Array resize functions
John W. Eaton <jwe@octave.org>
parents:
11570
diff
changeset
|
95 void resize (octave_idx_type n, |
a83bad07f7e3
attempt better backward compatibility for Array resize functions
John W. Eaton <jwe@octave.org>
parents:
11570
diff
changeset
|
96 const double& rfv = Array<double>::resize_fill_value ()) |
a83bad07f7e3
attempt better backward compatibility for Array resize functions
John W. Eaton <jwe@octave.org>
parents:
11570
diff
changeset
|
97 { |
a83bad07f7e3
attempt better backward compatibility for Array resize functions
John W. Eaton <jwe@octave.org>
parents:
11570
diff
changeset
|
98 Array<double>::resize (dim_vector (1, n), rfv); |
a83bad07f7e3
attempt better backward compatibility for Array resize functions
John W. Eaton <jwe@octave.org>
parents:
11570
diff
changeset
|
99 } |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
100 |
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
101 void clear (octave_idx_type n) |
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
102 { Array<double>::clear (1, n); } |
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
103 |
458 | 104 }; |
105 | |
1205 | 106 // row vector by column vector -> scalar |
107 | |
6108 | 108 double OCTAVE_API operator * (const RowVector& a, const ColumnVector& b); |
1205 | 109 |
6108 | 110 Complex OCTAVE_API operator * (const RowVector& a, const ComplexColumnVector& b); |
1205 | 111 |
112 // other operations | |
113 | |
6108 | 114 OCTAVE_API RowVector linspace (double x1, double x2, octave_idx_type n); |
1196 | 115 |
3573 | 116 MARRAY_FORWARD_DEFS (MArray, RowVector, double) |
117 | |
458 | 118 #endif |