Mercurial > hg > octave-lyh
annotate liboctave/array/dColVector.h @ 17136:f72ffae1fcc3
delaunay.m: Fixed matlab compatibility and input check for single matrix (bug #39644)
* scripts/geometry/delaunay.m: check for equal size of X and Y, check for 2 column single matrix input, added 2 tests for these two changes
author | Andreas Weber <andreas.weber@hs-offenburg.de> |
---|---|
date | Thu, 01 Aug 2013 15:16:14 +0200 |
parents | 648dabbb4c6b |
children |
rev | line source |
---|---|
458 | 1 /* |
2 | |
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
3 Copyright (C) 1994-2012 John W. Eaton |
10521
4d1fc073fbb7
add some missing copyright stmts
Jaroslav Hajek <highegg@gmail.com>
parents:
10364
diff
changeset
|
4 Copyright (C) 2010 VZLU Prague |
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_ColumnVector_h) | |
25 #define octave_ColumnVector_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 ColumnVector : public MArray<double> |
458 | 34 { |
35 public: | |
36 | |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
37 ColumnVector (void) : MArray<double> (dim_vector (0, 1)) { } |
3585 | 38 |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
39 explicit ColumnVector (octave_idx_type n) |
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
40 : MArray<double> (dim_vector (n, 1)) { } |
3585 | 41 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11574
diff
changeset
|
42 explicit ColumnVector (const dim_vector& dv) |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
43 : MArray<double> (dv.as_column ()) { } |
9612
66970dd627f6
further liboctave design improvements
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
44 |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
45 ColumnVector (octave_idx_type n, double val) |
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
46 : MArray<double> (dim_vector (n, 1), val) { } |
3585 | 47 |
48 ColumnVector (const ColumnVector& a) : MArray<double> (a) { } | |
49 | |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
50 ColumnVector (const MArray<double>& a) : MArray<double> (a.as_column ()) { } |
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
51 ColumnVector (const Array<double>& a) : MArray<double> (a.as_column ()) { } |
458 | 52 |
53 ColumnVector& operator = (const ColumnVector& a) | |
54 { | |
1214 | 55 MArray<double>::operator = (a); |
458 | 56 return *this; |
57 } | |
58 | |
2386 | 59 bool operator == (const ColumnVector& a) const; |
60 bool operator != (const ColumnVector& a) const; | |
458 | 61 |
1359 | 62 // destructive insert/delete/reorder operations |
458 | 63 |
5275 | 64 ColumnVector& insert (const ColumnVector& a, octave_idx_type r); |
458 | 65 |
66 ColumnVector& fill (double val); | |
5275 | 67 ColumnVector& fill (double val, octave_idx_type r1, octave_idx_type r2); |
458 | 68 |
69 ColumnVector stack (const ColumnVector& a) const; | |
70 | |
71 RowVector transpose (void) const; | |
72 | |
6108 | 73 friend OCTAVE_API ColumnVector real (const ComplexColumnVector& a); |
74 friend OCTAVE_API ColumnVector imag (const ComplexColumnVector& a); | |
1205 | 75 |
1359 | 76 // resize is the destructive equivalent for this one |
458 | 77 |
5275 | 78 ColumnVector extract (octave_idx_type r1, octave_idx_type r2) const; |
458 | 79 |
5275 | 80 ColumnVector extract_n (octave_idx_type r1, octave_idx_type n) const; |
4316 | 81 |
1359 | 82 // matrix by column vector -> column vector operations |
458 | 83 |
6108 | 84 friend OCTAVE_API ColumnVector operator * (const Matrix& a, const ColumnVector& b); |
458 | 85 |
1359 | 86 // diagonal matrix by column vector -> column vector operations |
458 | 87 |
6108 | 88 friend OCTAVE_API ColumnVector operator * (const DiagMatrix& a, const ColumnVector& b); |
458 | 89 |
1359 | 90 // other operations |
458 | 91 |
92 double min (void) const; | |
93 double max (void) const; | |
94 | |
10363
a0728e81ed25
improve diag matrix interface & implementation
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
95 ColumnVector abs (void) const; |
a0728e81ed25
improve diag matrix interface & implementation
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
96 |
1359 | 97 // i/o |
458 | 98 |
6108 | 99 friend OCTAVE_API std::ostream& operator << (std::ostream& os, const ColumnVector& a); |
100 friend OCTAVE_API std::istream& operator >> (std::istream& is, ColumnVector& a); | |
458 | 101 |
14616
13cc11418393
improve handling of default resize fill value for arrays
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
102 void resize (octave_idx_type n, const double& rfv = 0) |
11574
a83bad07f7e3
attempt better backward compatibility for Array resize functions
John W. Eaton <jwe@octave.org>
parents:
11570
diff
changeset
|
103 { |
a83bad07f7e3
attempt better backward compatibility for Array resize functions
John W. Eaton <jwe@octave.org>
parents:
11570
diff
changeset
|
104 Array<double>::resize (dim_vector (n, 1), rfv); |
a83bad07f7e3
attempt better backward compatibility for Array resize functions
John W. Eaton <jwe@octave.org>
parents:
11570
diff
changeset
|
105 } |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
106 |
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
107 void clear (octave_idx_type n) |
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
108 { Array<double>::clear (n, 1); } |
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
109 |
458 | 110 }; |
111 | |
5508 | 112 // Publish externally used friend functions. |
113 | |
6108 | 114 extern OCTAVE_API ColumnVector real (const ComplexColumnVector& a); |
115 extern OCTAVE_API ColumnVector imag (const ComplexColumnVector& a); | |
5508 | 116 |
3573 | 117 MARRAY_FORWARD_DEFS (MArray, ColumnVector, double) |
118 | |
458 | 119 #endif |