Mercurial > octave-nkf
annotate liboctave/dColVector.h @ 9612:66970dd627f6
further liboctave design improvements
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Fri, 04 Sep 2009 11:22:53 +0200 |
parents | eb63fbe60fab |
children | f80c566bc751 |
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_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 | |
1214 | 37 ColumnVector (void) : MArray<double> () { } |
3585 | 38 |
5275 | 39 explicit ColumnVector (octave_idx_type n) : MArray<double> (n) { } |
3585 | 40 |
9612
66970dd627f6
further liboctave design improvements
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
41 explicit ColumnVector (const dim_vector& dv) : MArray<double> (dv) { } |
66970dd627f6
further liboctave design improvements
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
42 |
5275 | 43 ColumnVector (octave_idx_type n, double val) : MArray<double> (n, val) { } |
3585 | 44 |
45 ColumnVector (const ColumnVector& a) : MArray<double> (a) { } | |
46 | |
1214 | 47 ColumnVector (const MArray<double>& a) : MArray<double> (a) { } |
458 | 48 |
49 ColumnVector& operator = (const ColumnVector& a) | |
50 { | |
1214 | 51 MArray<double>::operator = (a); |
458 | 52 return *this; |
53 } | |
54 | |
2386 | 55 bool operator == (const ColumnVector& a) const; |
56 bool operator != (const ColumnVector& a) const; | |
458 | 57 |
1359 | 58 // destructive insert/delete/reorder operations |
458 | 59 |
5275 | 60 ColumnVector& insert (const ColumnVector& a, octave_idx_type r); |
458 | 61 |
62 ColumnVector& fill (double val); | |
5275 | 63 ColumnVector& fill (double val, octave_idx_type r1, octave_idx_type r2); |
458 | 64 |
65 ColumnVector stack (const ColumnVector& a) const; | |
66 | |
67 RowVector transpose (void) const; | |
68 | |
6108 | 69 friend OCTAVE_API ColumnVector real (const ComplexColumnVector& a); |
70 friend OCTAVE_API ColumnVector imag (const ComplexColumnVector& a); | |
1205 | 71 |
1359 | 72 // resize is the destructive equivalent for this one |
458 | 73 |
5275 | 74 ColumnVector extract (octave_idx_type r1, octave_idx_type r2) const; |
458 | 75 |
5275 | 76 ColumnVector extract_n (octave_idx_type r1, octave_idx_type n) const; |
4316 | 77 |
1359 | 78 // matrix by column vector -> column vector operations |
458 | 79 |
6108 | 80 friend OCTAVE_API ColumnVector operator * (const Matrix& a, const ColumnVector& b); |
458 | 81 |
1359 | 82 // diagonal matrix by column vector -> column vector operations |
458 | 83 |
6108 | 84 friend OCTAVE_API ColumnVector operator * (const DiagMatrix& a, const ColumnVector& b); |
458 | 85 |
1359 | 86 // other operations |
458 | 87 |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
88 typedef double (*dmapper) (double); |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
89 typedef Complex (*cmapper) (const Complex&); |
2676 | 90 |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
91 ColumnVector map (dmapper fcn) const; |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
92 ComplexColumnVector map (cmapper fcn) const; |
458 | 93 |
94 double min (void) const; | |
95 double max (void) const; | |
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 |
102 private: | |
103 | |
5275 | 104 ColumnVector (double *d, octave_idx_type l) : MArray<double> (d, l) { } |
458 | 105 }; |
106 | |
5508 | 107 // Publish externally used friend functions. |
108 | |
6108 | 109 extern OCTAVE_API ColumnVector real (const ComplexColumnVector& a); |
110 extern OCTAVE_API ColumnVector imag (const ComplexColumnVector& a); | |
5508 | 111 |
3573 | 112 MARRAY_FORWARD_DEFS (MArray, ColumnVector, double) |
113 | |
458 | 114 #endif |
115 | |
116 /* | |
117 ;;; Local Variables: *** | |
118 ;;; mode: C++ *** | |
119 ;;; End: *** | |
120 */ |