Mercurial > hg > octave-nkf
annotate liboctave/Array-util.h @ 12283:0664a7ddd944 release-3-4-x
README.MacOS: Spelling corrections.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Fri, 28 Jan 2011 22:27:17 -0500 |
parents | 12df7854fa7c |
children | 72c96de7a403 |
rev | line source |
---|---|
4588 | 1 /* |
2 | |
11523 | 3 Copyright (C) 2000-2011 John W. Eaton |
4588 | 4 |
5 This file is part of Octave. | |
6 | |
7 Octave is free software; you can redistribute it and/or modify it | |
8 under the terms of the GNU General Public License as published by the | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
4588 | 11 |
12 Octave is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
4588 | 20 |
21 */ | |
22 | |
23 #if !defined (octave_Array_util_h) | |
24 #define octave_Array_util_h 1 | |
25 | |
26 #include "Array.h" | |
27 #include "dim-vector.h" | |
28 #include "idx-vector.h" | |
11130
7c573eb981eb
consistently give error for operator not applied to NaN values
John W. Eaton <jwe@octave.org>
parents:
11129
diff
changeset
|
29 #include "lo-array-gripes.h" |
4588 | 30 |
6108 | 31 extern OCTAVE_API bool index_in_bounds (const Array<octave_idx_type>& ra_idx, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
32 const dim_vector& dimensions); |
4588 | 33 |
6108 | 34 extern OCTAVE_API void increment_index (Array<octave_idx_type>& ra_idx, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
35 const dim_vector& dimensions, |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
36 int start_dimension = 0); |
4588 | 37 |
6108 | 38 extern OCTAVE_API octave_idx_type get_scalar_idx (Array<octave_idx_type>& idx, dim_vector& dims); |
4588 | 39 |
6108 | 40 extern OCTAVE_API octave_idx_type num_ones (const Array<octave_idx_type>& ra_idx); |
4588 | 41 |
6108 | 42 extern OCTAVE_API bool is_scalar (const dim_vector& dim); |
4588 | 43 |
7642
9a4541c622b5
refactor Array::assignN dimensioning code for empty initial matrices
David Bateman <dbateman@free.fr>
parents:
7246
diff
changeset
|
44 extern OCTAVE_API bool is_vector (const dim_vector& dim); |
9a4541c622b5
refactor Array::assignN dimensioning code for empty initial matrices
David Bateman <dbateman@free.fr>
parents:
7246
diff
changeset
|
45 |
6108 | 46 extern OCTAVE_API bool any_ones (const Array<octave_idx_type>& arr); |
4588 | 47 |
10645
8645b7087859
abstract scalar index checking off Array<T> (prep for struct optimizations)
Jaroslav Hajek <highegg@gmail.com>
parents:
10512
diff
changeset
|
48 // These four compute a linear index for given dimensions, throwing |
8645b7087859
abstract scalar index checking off Array<T> (prep for struct optimizations)
Jaroslav Hajek <highegg@gmail.com>
parents:
10512
diff
changeset
|
49 // exceptions on invalid indices. |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
50 extern OCTAVE_API octave_idx_type |
10645
8645b7087859
abstract scalar index checking off Array<T> (prep for struct optimizations)
Jaroslav Hajek <highegg@gmail.com>
parents:
10512
diff
changeset
|
51 compute_index (octave_idx_type n, const dim_vector& dims); |
8645b7087859
abstract scalar index checking off Array<T> (prep for struct optimizations)
Jaroslav Hajek <highegg@gmail.com>
parents:
10512
diff
changeset
|
52 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
53 extern OCTAVE_API octave_idx_type |
10645
8645b7087859
abstract scalar index checking off Array<T> (prep for struct optimizations)
Jaroslav Hajek <highegg@gmail.com>
parents:
10512
diff
changeset
|
54 compute_index (octave_idx_type i, octave_idx_type j, const dim_vector& dims); |
8645b7087859
abstract scalar index checking off Array<T> (prep for struct optimizations)
Jaroslav Hajek <highegg@gmail.com>
parents:
10512
diff
changeset
|
55 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
56 extern OCTAVE_API octave_idx_type |
10645
8645b7087859
abstract scalar index checking off Array<T> (prep for struct optimizations)
Jaroslav Hajek <highegg@gmail.com>
parents:
10512
diff
changeset
|
57 compute_index (octave_idx_type i, octave_idx_type j, octave_idx_type k, |
8645b7087859
abstract scalar index checking off Array<T> (prep for struct optimizations)
Jaroslav Hajek <highegg@gmail.com>
parents:
10512
diff
changeset
|
58 const dim_vector& dims); |
8645b7087859
abstract scalar index checking off Array<T> (prep for struct optimizations)
Jaroslav Hajek <highegg@gmail.com>
parents:
10512
diff
changeset
|
59 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
60 extern OCTAVE_API octave_idx_type |
10645
8645b7087859
abstract scalar index checking off Array<T> (prep for struct optimizations)
Jaroslav Hajek <highegg@gmail.com>
parents:
10512
diff
changeset
|
61 compute_index (const Array<octave_idx_type>& ra_idx, const dim_vector& dims); |
4588 | 62 |
6108 | 63 extern OCTAVE_API Array<octave_idx_type> conv_to_int_array (const Array<idx_vector>& a); |
4588 | 64 |
6108 | 65 extern OCTAVE_API Array<idx_vector> conv_to_array (const idx_vector *tmp, const octave_idx_type len); |
4588 | 66 |
6108 | 67 extern OCTAVE_API dim_vector freeze (Array<idx_vector>& ra_idx, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
68 const dim_vector& dimensions, int resize_ok); |
4588 | 69 |
6108 | 70 extern OCTAVE_API bool vector_equivalent (const dim_vector& dv); |
4588 | 71 |
6108 | 72 extern OCTAVE_API bool all_ok (const Array<idx_vector>& ra_idx); |
4588 | 73 |
6108 | 74 extern OCTAVE_API bool any_orig_empty (const Array<idx_vector>& ra_idx); |
4588 | 75 |
6108 | 76 extern OCTAVE_API bool all_colon_equiv (const Array<idx_vector>& ra_idx, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
77 const dim_vector& frozen_lengths); |
4588 | 78 |
6108 | 79 extern OCTAVE_API bool all_ones (const Array<octave_idx_type>& arr); |
4588 | 80 |
6108 | 81 extern OCTAVE_API Array<octave_idx_type> get_elt_idx (const Array<idx_vector>& ra_idx, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
82 const Array<octave_idx_type>& result_idx); |
4588 | 83 |
6108 | 84 extern OCTAVE_API Array<octave_idx_type> get_ra_idx (octave_idx_type idx, const dim_vector& dims); |
4588 | 85 |
8290
7cbe01c21986
improve dense array indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
7922
diff
changeset
|
86 extern OCTAVE_API dim_vector zero_dims_inquire (const Array<idx_vector>& ia, |
7cbe01c21986
improve dense array indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
7922
diff
changeset
|
87 const dim_vector& rhdv); |
7cbe01c21986
improve dense array indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
7922
diff
changeset
|
88 |
7cbe01c21986
improve dense array indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
7922
diff
changeset
|
89 extern OCTAVE_API dim_vector zero_dims_inquire (const idx_vector& i, const idx_vector& j, |
7cbe01c21986
improve dense array indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
7922
diff
changeset
|
90 const dim_vector& rhdv); |
4588 | 91 |
9479
d9716e3ee0dd
supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
92 extern OCTAVE_API idx_vector sub2ind (const dim_vector& dv, const Array<idx_vector>& idxa); |
d9716e3ee0dd
supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
93 |
d9716e3ee0dd
supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
94 extern OCTAVE_API Array<idx_vector> ind2sub (const dim_vector& dv, const idx_vector& idx); |
d9716e3ee0dd
supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
95 |
7241 | 96 struct |
97 permute_vector | |
98 { | |
99 octave_idx_type pidx; | |
100 octave_idx_type iidx; | |
101 }; | |
102 | |
7246 | 103 extern int OCTAVE_API permute_vector_compare (const void *a, const void *b); |
7241 | 104 |
4588 | 105 #endif |