Mercurial > hg > octave-nkf
annotate liboctave/CRowVector.h @ 10509:ddbd812d09aa
properly compress sparse matrices after assembly
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Mon, 12 Apr 2010 12:57:44 +0200 |
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_ComplexRowVector_h) | |
25 #define octave_ComplexRowVector_h 1 | |
26 | |
1214 | 27 #include "MArray.h" |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10312
diff
changeset
|
28 #include "dRowVector.h" |
458 | 29 |
30 #include "mx-defs.h" | |
31 | |
3585 | 32 class |
6108 | 33 OCTAVE_API |
3585 | 34 ComplexRowVector : public MArray<Complex> |
458 | 35 { |
36 friend class ComplexColumnVector; | |
37 | |
38 public: | |
39 | |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10312
diff
changeset
|
40 ComplexRowVector (void) : MArray<Complex> (1, 0) { } |
3585 | 41 |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10312
diff
changeset
|
42 explicit ComplexRowVector (octave_idx_type n) : MArray<Complex> (1, n) { } |
3585 | 43 |
9612
66970dd627f6
further liboctave design improvements
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
44 explicit ComplexRowVector (const dim_vector& dv) : MArray<Complex> (dv) { } |
66970dd627f6
further liboctave design improvements
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
45 |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10312
diff
changeset
|
46 ComplexRowVector (octave_idx_type n, const Complex& val) : MArray<Complex> (1, n, val) { } |
3585 | 47 |
48 ComplexRowVector (const ComplexRowVector& a) : MArray<Complex> (a) { } | |
49 | |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10312
diff
changeset
|
50 ComplexRowVector (const MArray<Complex>& a) : MArray<Complex> (a.as_row ()) { } |
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10312
diff
changeset
|
51 ComplexRowVector (const Array<Complex>& a) : MArray<Complex> (a.as_row ()) { } |
3585 | 52 |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10312
diff
changeset
|
53 explicit ComplexRowVector (const RowVector& a) : MArray<Complex> (a) { } |
458 | 54 |
55 ComplexRowVector& operator = (const ComplexRowVector& a) | |
56 { | |
1214 | 57 MArray<Complex>::operator = (a); |
458 | 58 return *this; |
59 } | |
60 | |
2386 | 61 bool operator == (const ComplexRowVector& a) const; |
62 bool operator != (const ComplexRowVector& a) const; | |
458 | 63 |
1359 | 64 // destructive insert/delete/reorder operations |
458 | 65 |
5275 | 66 ComplexRowVector& insert (const RowVector& a, octave_idx_type c); |
67 ComplexRowVector& insert (const ComplexRowVector& a, octave_idx_type c); | |
458 | 68 |
69 ComplexRowVector& fill (double val); | |
70 ComplexRowVector& fill (const Complex& val); | |
5275 | 71 ComplexRowVector& fill (double val, octave_idx_type c1, octave_idx_type c2); |
72 ComplexRowVector& fill (const Complex& val, octave_idx_type c1, octave_idx_type c2); | |
458 | 73 |
74 ComplexRowVector append (const RowVector& a) const; | |
75 ComplexRowVector append (const ComplexRowVector& a) const; | |
76 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7503
diff
changeset
|
77 ComplexColumnVector hermitian (void) const; |
458 | 78 ComplexColumnVector transpose (void) const; |
79 | |
80 friend ComplexRowVector conj (const ComplexRowVector& a); | |
81 | |
1359 | 82 // resize is the destructive equivalent for this one |
458 | 83 |
5275 | 84 ComplexRowVector extract (octave_idx_type c1, octave_idx_type c2) const; |
458 | 85 |
5275 | 86 ComplexRowVector extract_n (octave_idx_type c1, octave_idx_type n) const; |
4316 | 87 |
1359 | 88 // row vector by row vector -> row vector operations |
458 | 89 |
90 ComplexRowVector& operator += (const RowVector& a); | |
91 ComplexRowVector& operator -= (const RowVector& a); | |
92 | |
1359 | 93 // row vector by matrix -> row vector |
458 | 94 |
95 friend ComplexRowVector operator * (const ComplexRowVector& a, | |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
96 const ComplexMatrix& b); |
458 | 97 |
1205 | 98 friend ComplexRowVector operator * (const RowVector& a, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
99 const ComplexMatrix& b); |
1205 | 100 |
1359 | 101 // other operations |
458 | 102 |
103 Complex min (void) const; | |
104 Complex max (void) const; | |
105 | |
1359 | 106 // i/o |
458 | 107 |
3504 | 108 friend std::ostream& operator << (std::ostream& os, const ComplexRowVector& a); |
109 friend std::istream& operator >> (std::istream& is, ComplexRowVector& a); | |
458 | 110 |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10312
diff
changeset
|
111 void resize (octave_idx_type n, const Complex& rfv = Array<Complex>::resize_fill_value ()) |
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10312
diff
changeset
|
112 { Array<Complex>::resize (1, n, rfv); } |
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10312
diff
changeset
|
113 |
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10312
diff
changeset
|
114 void clear (octave_idx_type n) |
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10312
diff
changeset
|
115 { Array<Complex>::clear (1, n); } |
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10312
diff
changeset
|
116 |
458 | 117 }; |
118 | |
1205 | 119 // row vector by column vector -> scalar |
120 | |
121 Complex operator * (const ComplexRowVector& a, const ColumnVector& b); | |
122 | |
123 Complex operator * (const ComplexRowVector& a, const ComplexColumnVector& b); | |
124 | |
125 // other operations | |
126 | |
6108 | 127 OCTAVE_API ComplexRowVector linspace (const Complex& x1, const Complex& x2, octave_idx_type n); |
1196 | 128 |
3573 | 129 MARRAY_FORWARD_DEFS (MArray, ComplexRowVector, Complex) |
130 | |
458 | 131 #endif |