Mercurial > hg > octave-nkf
annotate liboctave/array/Array3.h @ 19174:04dc55bf71e8
adjust spacing in gnuplot legend when non default font size is used.
* scripts/plot/util/private/__go_draw_axes__.m add spacing spec to key
definition in __go_draw_axes__
author | Serviscope Minor <serviscope_minor@verybigfrog.com> |
---|---|
date | Mon, 04 Aug 2014 20:49:32 +0100 |
parents | 49a5a4be04a1 |
children |
rev | line source |
---|---|
1993 | 1 // Template array classes |
1988 | 2 /* |
3 | |
17744
d63878346099
maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents:
15271
diff
changeset
|
4 Copyright (C) 1996-2013 John W. Eaton |
1988 | 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. | |
1988 | 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/>. | |
1988 | 21 |
22 */ | |
23 | |
24 #if !defined (octave_Array3_h) | |
25 #define octave_Array3_h 1 | |
26 | |
27 #include <cassert> | |
28 #include <cstdlib> | |
29 | |
4513 | 30 #include "Array.h" |
1988 | 31 #include "lo-error.h" |
32 | |
33 class idx_vector; | |
34 | |
35 // Three dimensional array class. | |
36 | |
37 template <class T> | |
3585 | 38 class |
4513 | 39 Array3 : public Array<T> |
1988 | 40 { |
41 public: | |
42 | |
4513 | 43 Array3 (void) : Array<T> (dim_vector (0, 0, 0)) { } |
1988 | 44 |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
45 Array3 (octave_idx_type r, octave_idx_type c, |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
46 octave_idx_type p) : Array<T> (dim_vector (r, c, p)) { } |
1988 | 47 |
5275 | 48 Array3 (octave_idx_type r, octave_idx_type c, octave_idx_type p, const T& val) |
4513 | 49 : Array<T> (dim_vector (r, c, p), val) { } |
1988 | 50 |
4513 | 51 Array3 (const Array3<T>& a) |
52 : Array<T> (a, a.dims ()) { } | |
53 | |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
54 Array3 (const Array<T>& a, octave_idx_type r, octave_idx_type c, |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
55 octave_idx_type p) |
4513 | 56 : Array<T> (a, dim_vector (r, c, p)) { } |
1988 | 57 |
58 ~Array3 (void) { } | |
59 | |
60 Array3<T>& operator = (const Array3<T>& a) | |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
61 { |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
62 if (this != &a) |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
63 Array<T>::operator = (a); |
1988 | 64 |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
65 return *this; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
66 } |
1988 | 67 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11570
diff
changeset
|
68 void resize (octave_idx_type r, octave_idx_type c, octave_idx_type p) |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
69 { Array<T>::resize (dim_vector (r, c, p)); } |
2306 | 70 |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
71 void resize (octave_idx_type r, octave_idx_type c, octave_idx_type p, |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
72 const T& val) |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
73 { Array<T>::resize (dim_vector (r, c, p), val); } |
7433 | 74 |
7463
2467639bd8c0
eliminate UNDEFINED sort mode
John W. Eaton <jwe@octave.org>
parents:
7433
diff
changeset
|
75 Array3<T> sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
76 { |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
77 Array<T> tmp = Array<T>::sort (dim, mode); |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
78 return Array3<T> (tmp, tmp.rows (), tmp.columns (), tmp.pages ()); |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
79 } |
7433 | 80 |
81 Array3<T> sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0, | |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
82 sortmode mode = ASCENDING) const |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
83 { |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
84 Array<T> tmp = Array<T>::sort (sidx, dim, mode); |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
85 return Array3<T> (tmp, tmp.rows (), tmp.columns (), tmp.pages ()); |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
86 } |
1988 | 87 }; |
88 | |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
89 // If we're with GNU C++, issue a warning. |
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
90 #ifdef __GNUC__ |
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
91 #warning Using Array3<T> is deprecated. Use Array<T> directly. |
1988 | 92 #endif |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
93 |
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
94 #endif |