Mercurial > hg > octave-nkf
annotate liboctave/array/Array-util.h @ 19898:4197fc428c7d
maint: Update copyright notices for 2015.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 11 Feb 2015 14:19:08 -0500 |
parents | 49a5a4be04a1 |
children |
rev | line source |
---|---|
4588 | 1 /* |
2 | |
19898
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
17769
diff
changeset
|
3 Copyright (C) 2000-2015 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, |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
32 const dim_vector& dimensions); |
4588 | 33 |
6108 | 34 extern OCTAVE_API void increment_index (Array<octave_idx_type>& ra_idx, |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
35 const dim_vector& dimensions, |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
36 int start_dimension = 0); |
4588 | 37 |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
38 extern OCTAVE_API octave_idx_type get_scalar_idx (Array<octave_idx_type>& idx, |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
39 dim_vector& dims); |
4588 | 40 |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
41 extern OCTAVE_API octave_idx_type num_ones (const Array<octave_idx_type>& |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
42 ra_idx); |
4588 | 43 |
6108 | 44 extern OCTAVE_API bool is_scalar (const dim_vector& dim); |
4588 | 45 |
7642
9a4541c622b5
refactor Array::assignN dimensioning code for empty initial matrices
David Bateman <dbateman@free.fr>
parents:
7246
diff
changeset
|
46 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
|
47 |
6108 | 48 extern OCTAVE_API bool any_ones (const Array<octave_idx_type>& arr); |
4588 | 49 |
10645
8645b7087859
abstract scalar index checking off Array<T> (prep for struct optimizations)
Jaroslav Hajek <highegg@gmail.com>
parents:
10512
diff
changeset
|
50 // 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
|
51 // exceptions on invalid indices. |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
52 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
|
53 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
|
54 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
55 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
|
56 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
|
57 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
58 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
|
59 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
|
60 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
|
61 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
62 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
|
63 compute_index (const Array<octave_idx_type>& ra_idx, const dim_vector& dims); |
4588 | 64 |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
65 extern OCTAVE_API Array<octave_idx_type> |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
66 conv_to_int_array (const Array<idx_vector>& a); |
4588 | 67 |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
68 extern OCTAVE_API Array<idx_vector> conv_to_array (const idx_vector *tmp, |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
69 const octave_idx_type len); |
4588 | 70 |
6108 | 71 extern OCTAVE_API dim_vector freeze (Array<idx_vector>& ra_idx, |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
72 const dim_vector& dimensions, |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
73 int resize_ok); |
4588 | 74 |
6108 | 75 extern OCTAVE_API bool vector_equivalent (const dim_vector& dv); |
4588 | 76 |
6108 | 77 extern OCTAVE_API bool all_ok (const Array<idx_vector>& ra_idx); |
4588 | 78 |
6108 | 79 extern OCTAVE_API bool any_orig_empty (const Array<idx_vector>& ra_idx); |
4588 | 80 |
6108 | 81 extern OCTAVE_API bool all_colon_equiv (const Array<idx_vector>& ra_idx, |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
82 const dim_vector& frozen_lengths); |
4588 | 83 |
6108 | 84 extern OCTAVE_API bool all_ones (const Array<octave_idx_type>& arr); |
4588 | 85 |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
86 extern OCTAVE_API Array<octave_idx_type> |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
87 get_elt_idx (const Array<idx_vector>& ra_idx, |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
88 const Array<octave_idx_type>& result_idx); |
4588 | 89 |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
90 extern OCTAVE_API Array<octave_idx_type> get_ra_idx (octave_idx_type idx, |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
91 const dim_vector& dims); |
4588 | 92 |
8290
7cbe01c21986
improve dense array indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
7922
diff
changeset
|
93 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
|
94 const dim_vector& rhdv); |
7cbe01c21986
improve dense array indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
7922
diff
changeset
|
95 |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
96 extern OCTAVE_API dim_vector zero_dims_inquire (const idx_vector& i, |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
97 const idx_vector& j, |
8290
7cbe01c21986
improve dense array indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
7922
diff
changeset
|
98 const dim_vector& rhdv); |
4588 | 99 |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
100 extern OCTAVE_API idx_vector sub2ind (const dim_vector& dv, |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
101 const Array<idx_vector>& idxa); |
9479
d9716e3ee0dd
supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
102 |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
103 extern OCTAVE_API Array<idx_vector> ind2sub (const dim_vector& dv, |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
104 const idx_vector& idx); |
9479
d9716e3ee0dd
supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
105 |
7241 | 106 struct |
107 permute_vector | |
108 { | |
109 octave_idx_type pidx; | |
110 octave_idx_type iidx; | |
111 }; | |
112 | |
7246 | 113 extern int OCTAVE_API permute_vector_compare (const void *a, const void *b); |
7241 | 114 |
4588 | 115 #endif |