GNU Octave  3.8.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Array-util.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2000-2013 John W. Eaton
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
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
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
18 along with Octave; see the file COPYING. If not, see
19 <http://www.gnu.org/licenses/>.
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"
29 #include "lo-array-gripes.h"
30 
31 extern OCTAVE_API bool index_in_bounds (const Array<octave_idx_type>& ra_idx,
32  const dim_vector& dimensions);
33 
34 extern OCTAVE_API void increment_index (Array<octave_idx_type>& ra_idx,
35  const dim_vector& dimensions,
36  int start_dimension = 0);
37 
39  dim_vector& dims);
40 
41 extern OCTAVE_API octave_idx_type num_ones (const Array<octave_idx_type>&
42  ra_idx);
43 
44 extern OCTAVE_API bool is_scalar (const dim_vector& dim);
45 
46 extern OCTAVE_API bool is_vector (const dim_vector& dim);
47 
48 extern OCTAVE_API bool any_ones (const Array<octave_idx_type>& arr);
49 
50 // These four compute a linear index for given dimensions, throwing
51 // exceptions on invalid indices.
52 extern OCTAVE_API octave_idx_type
54 
55 extern OCTAVE_API octave_idx_type
57 
58 extern OCTAVE_API octave_idx_type
60  const dim_vector& dims);
61 
62 extern OCTAVE_API octave_idx_type
63 compute_index (const Array<octave_idx_type>& ra_idx, const dim_vector& dims);
64 
65 extern OCTAVE_API Array<octave_idx_type>
67 
68 extern OCTAVE_API Array<idx_vector> conv_to_array (const idx_vector *tmp,
69  const octave_idx_type len);
70 
71 extern OCTAVE_API dim_vector freeze (Array<idx_vector>& ra_idx,
72  const dim_vector& dimensions,
73  int resize_ok);
74 
75 extern OCTAVE_API bool vector_equivalent (const dim_vector& dv);
76 
77 extern OCTAVE_API bool all_ok (const Array<idx_vector>& ra_idx);
78 
79 extern OCTAVE_API bool any_orig_empty (const Array<idx_vector>& ra_idx);
80 
81 extern OCTAVE_API bool all_colon_equiv (const Array<idx_vector>& ra_idx,
82  const dim_vector& frozen_lengths);
83 
84 extern OCTAVE_API bool all_ones (const Array<octave_idx_type>& arr);
85 
86 extern OCTAVE_API Array<octave_idx_type>
87 get_elt_idx (const Array<idx_vector>& ra_idx,
88  const Array<octave_idx_type>& result_idx);
89 
91  const dim_vector& dims);
92 
93 extern OCTAVE_API dim_vector zero_dims_inquire (const Array<idx_vector>& ia,
94  const dim_vector& rhdv);
95 
96 extern OCTAVE_API dim_vector zero_dims_inquire (const idx_vector& i,
97  const idx_vector& j,
98  const dim_vector& rhdv);
99 
100 extern OCTAVE_API idx_vector sub2ind (const dim_vector& dv,
101  const Array<idx_vector>& idxa);
102 
103 extern OCTAVE_API Array<idx_vector> ind2sub (const dim_vector& dv,
104  const idx_vector& idx);
105 
106 struct
108 {
111 };
112 
113 extern int OCTAVE_API permute_vector_compare (const void *a, const void *b);
114 
115 #endif