GNU Octave
3.8.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
liboctave
array
Array3.h
Go to the documentation of this file.
1
// Template array classes
2
/*
3
4
Copyright (C) 1996-2013 John W. Eaton
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
10
Free Software Foundation; either version 3 of the License, or (at your
11
option) any later version.
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
19
along with Octave; see the file COPYING. If not, see
20
<http://www.gnu.org/licenses/>.
21
22
*/
23
24
#if !defined (octave_Array3_h)
25
#define octave_Array3_h 1
26
27
#include <cassert>
28
#include <cstdlib>
29
30
#include "
Array.h
"
31
#include "
lo-error.h
"
32
33
class
idx_vector
;
34
35
// Three dimensional array class.
36
37
template
<
class
T>
38
class
39
Array3
:
public
Array<T>
40
{
41
public
:
42
43
Array3
(
void
) :
Array
<T> (
dim_vector
(0, 0, 0)) { }
44
45
Array3
(
octave_idx_type
r,
octave_idx_type
c,
46
octave_idx_type
p) :
Array
<T> (
dim_vector
(r, c, p)) { }
47
48
Array3
(
octave_idx_type
r,
octave_idx_type
c,
octave_idx_type
p,
const
T& val)
49
:
Array
<T> (
dim_vector
(r, c, p), val) { }
50
51
Array3
(
const
Array3<T>
& a)
52
:
Array
<T> (a, a.dims ()) { }
53
54
Array3
(
const
Array<T>
& a,
octave_idx_type
r,
octave_idx_type
c,
55
octave_idx_type
p)
56
:
Array
<T> (a,
dim_vector
(r, c, p)) { }
57
58
~Array3
(
void
) { }
59
60
Array3<T>
&
operator =
(
const
Array3<T>
& a)
61
{
62
if
(
this
!= &a)
63
Array<T>::operator =
(a);
64
65
return
*
this
;
66
}
67
68
void
resize (
octave_idx_type
r,
octave_idx_type
c,
octave_idx_type
p)
69
{
Array<T>::resize
(
dim_vector
(r, c, p)); }
70
71
void
resize (
octave_idx_type
r,
octave_idx_type
c,
octave_idx_type
p,
72
const
T& val)
73
{
Array<T>::resize
(
dim_vector
(r, c, p), val); }
74
75
Array3<T>
sort
(
octave_idx_type
dim = 0,
sortmode
mode =
ASCENDING
)
const
76
{
77
Array<T>
tmp =
Array<T>::sort
(dim, mode);
78
return
Array3<T>
(tmp, tmp.
rows
(), tmp.
columns
(), tmp.
pages
());
79
}
80
81
Array3<T>
sort
(
Array<octave_idx_type>
&sidx,
octave_idx_type
dim = 0,
82
sortmode
mode =
ASCENDING
)
const
83
{
84
Array<T>
tmp =
Array<T>::sort
(sidx, dim, mode);
85
return
Array3<T>
(tmp, tmp.
rows
(), tmp.
columns
(), tmp.
pages
());
86
}
87
};
88
89
// If we're with GNU C++, issue a warning.
90
#ifdef __GNUC__
91
#warning Using Array3<T> is deprecated. Use Array<T> directly.
92
#endif
93
94
#endif
Generated on Mon Dec 30 2013 03:04:39 for GNU Octave by
1.8.1.2