GNU Octave  4.0.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-2015 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
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>
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
int OCTAVE_API permute_vector_compare(const void *a, const void *b)
Definition: Array-util.cc:652
const octave_base_value const Array< octave_idx_type > & ra_idx
OCTAVE_API octave_idx_type get_scalar_idx(Array< octave_idx_type > &idx, dim_vector &dims)
Definition: Array-util.cc:80
OCTAVE_API void increment_index(Array< octave_idx_type > &ra_idx, const dim_vector &dimensions, int start_dimension=0)
Definition: Array-util.cc:59
OCTAVE_API Array< octave_idx_type > get_ra_idx(octave_idx_type idx, const dim_vector &dims)
Definition: Array-util.cc:390
OCTAVE_API bool is_scalar(const dim_vector &dim)
Definition: Array-util.cc:115
OCTAVE_API idx_vector sub2ind(const dim_vector &dv, const Array< idx_vector > &idxa)
Definition: Array-util.cc:530
OCTAVE_API Array< idx_vector > conv_to_array(const idx_vector *tmp, const octave_idx_type len)
Definition: Array-util.cc:245
OCTAVE_API bool all_ones(const Array< octave_idx_type > &arr)
Definition: Array-util.cc:359
OCTAVE_API bool vector_equivalent(const dim_vector &dv)
Definition: Array-util.cc:276
OCTAVE_API bool index_in_bounds(const Array< octave_idx_type > &ra_idx, const dim_vector &dimensions)
Definition: Array-util.cc:34
OCTAVE_API Array< octave_idx_type > conv_to_int_array(const Array< idx_vector > &a)
Definition: Array-util.cc:234
OCTAVE_API octave_idx_type compute_index(octave_idx_type n, const dim_vector &dims)
Definition: Array-util.cc:178
OCTAVE_API octave_idx_type num_ones(const Array< octave_idx_type > &ra_idx)
Definition: Array-util.cc:101
OCTAVE_API bool any_ones(const Array< octave_idx_type > &arr)
Definition: Array-util.cc:161
OCTAVE_API Array< idx_vector > ind2sub(const dim_vector &dv, const idx_vector &idx)
Definition: Array-util.cc:603
OCTAVE_API bool is_vector(const dim_vector &dim)
Definition: Array-util.cc:141
OCTAVE_API bool all_colon_equiv(const Array< idx_vector > &ra_idx, const dim_vector &frozen_lengths)
Definition: Array-util.cc:335
OCTAVE_API Array< octave_idx_type > get_elt_idx(const Array< idx_vector > &ra_idx, const Array< octave_idx_type > &result_idx)
Definition: Array-util.cc:376
OCTAVE_API bool all_ok(const Array< idx_vector > &ra_idx)
Definition: Array-util.cc:297
OCTAVE_API dim_vector zero_dims_inquire(const Array< idx_vector > &ia, const dim_vector &rhdv)
Definition: Array-util.cc:424
octave_idx_type iidx
Definition: Array-util.h:110
octave_idx_type pidx
Definition: Array-util.h:109
OCTAVE_API bool any_orig_empty(const Array< idx_vector > &ra_idx)
Definition: Array-util.cc:316
OCTAVE_API dim_vector freeze(Array< idx_vector > &ra_idx, const dim_vector &dimensions, int resize_ok)
Definition: Array-util.cc:256