GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
Array-util.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 2000-2021 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if ! defined (octave_Array_util_h)
27 #define octave_Array_util_h 1
28 
29 #include "octave-config.h"
30 
31 #include "Array.h"
32 #include "lo-array-errwarn.h"
33 
34 extern OCTAVE_API bool index_in_bounds (const Array<octave_idx_type>& ra_idx,
35  const dim_vector& dimensions);
36 
37 extern OCTAVE_API void increment_index (Array<octave_idx_type>& ra_idx,
38  const dim_vector& dimensions,
39  int start_dimension = 0);
40 
42  dim_vector& dims);
43 
44 extern OCTAVE_API octave_idx_type num_ones (const Array<octave_idx_type>&
45  ra_idx);
46 
47 extern OCTAVE_API bool is_scalar (const dim_vector& dim);
48 
49 extern OCTAVE_API bool isvector (const dim_vector& dim);
50 
51 extern OCTAVE_API bool any_ones (const Array<octave_idx_type>& arr);
52 
53 // These four compute a linear index for given dimensions, throwing
54 // exceptions on invalid indices.
55 extern OCTAVE_API octave_idx_type
57 
58 extern OCTAVE_API octave_idx_type
60 
61 extern OCTAVE_API octave_idx_type
63  const dim_vector& dims);
64 
65 extern OCTAVE_API octave_idx_type
67 
68 extern OCTAVE_API Array<octave_idx_type>
70 
71 extern OCTAVE_API Array<idx_vector> conv_to_array (const idx_vector *tmp,
72  const octave_idx_type len);
73 
74 extern OCTAVE_API dim_vector freeze (Array<idx_vector>& ra_idx,
75  const dim_vector& dimensions,
76  int resize_ok);
77 
78 extern OCTAVE_API bool vector_equivalent (const dim_vector& dv);
79 
80 extern OCTAVE_API bool all_ok (const Array<idx_vector>& ra_idx);
81 
82 extern OCTAVE_API bool any_orig_empty (const Array<idx_vector>& ra_idx);
83 
84 extern OCTAVE_API bool all_colon_equiv (const Array<idx_vector>& ra_idx,
85  const dim_vector& frozen_lengths);
86 
87 extern OCTAVE_API bool all_ones (const Array<octave_idx_type>& arr);
88 
89 extern OCTAVE_API Array<octave_idx_type>
91  const Array<octave_idx_type>& result_idx);
92 
94  const dim_vector& dims);
95 
96 extern OCTAVE_API dim_vector zero_dims_inquire (const Array<idx_vector>& ia,
97  const dim_vector& rhdv);
98 
99 extern OCTAVE_API dim_vector zero_dims_inquire (const idx_vector& i,
100  const idx_vector& j,
101  const dim_vector& rhdv);
102 
103 extern OCTAVE_API idx_vector sub2ind (const dim_vector& dv,
104  const Array<idx_vector>& idxa);
105 
106 extern OCTAVE_API Array<idx_vector> ind2sub (const dim_vector& dv,
107  const idx_vector& idx);
108 
109 struct
111 {
114 };
115 
116 extern int OCTAVE_API permute_vector_compare (const void *a, const void *b);
117 
118 #endif
OCTAVE_API bool isvector(const dim_vector &dim)
Definition: Array-util.cc:140
OCTAVE_API bool any_orig_empty(const Array< idx_vector > &ra_idx)
Definition: Array-util.cc:321
OCTAVE_API bool any_ones(const Array< octave_idx_type > &arr)
Definition: Array-util.cc:160
OCTAVE_API dim_vector freeze(Array< idx_vector > &ra_idx, const dim_vector &dimensions, int resize_ok)
Definition: Array-util.cc:261
OCTAVE_API Array< idx_vector > conv_to_array(const idx_vector *tmp, const octave_idx_type len)
Definition: Array-util.cc:250
OCTAVE_API octave_idx_type get_scalar_idx(Array< octave_idx_type > &idx, dim_vector &dims)
Definition: Array-util.cc:81
OCTAVE_API bool all_colon_equiv(const Array< idx_vector > &ra_idx, const dim_vector &frozen_lengths)
Definition: Array-util.cc:340
OCTAVE_API bool is_scalar(const dim_vector &dim)
Definition: Array-util.cc:116
int OCTAVE_API permute_vector_compare(const void *a, const void *b)
Definition: Array-util.cc:665
OCTAVE_API bool index_in_bounds(const Array< octave_idx_type > &ra_idx, const dim_vector &dimensions)
Definition: Array-util.cc:35
OCTAVE_API bool all_ok(const Array< idx_vector > &ra_idx)
Definition: Array-util.cc:302
OCTAVE_API idx_vector sub2ind(const dim_vector &dv, const Array< idx_vector > &idxa)
Definition: Array-util.cc:535
OCTAVE_API bool vector_equivalent(const dim_vector &dv)
Definition: Array-util.cc:281
OCTAVE_API Array< idx_vector > ind2sub(const dim_vector &dv, const idx_vector &idx)
Definition: Array-util.cc:620
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:381
OCTAVE_API octave_idx_type compute_index(octave_idx_type n, const dim_vector &dims)
Definition: Array-util.cc:177
OCTAVE_API Array< octave_idx_type > conv_to_int_array(const Array< idx_vector > &a)
Definition: Array-util.cc:239
OCTAVE_API dim_vector zero_dims_inquire(const Array< idx_vector > &ia, const dim_vector &rhdv)
Definition: Array-util.cc:429
OCTAVE_API Array< octave_idx_type > get_ra_idx(octave_idx_type idx, const dim_vector &dims)
Definition: Array-util.cc:395
OCTAVE_API void increment_index(Array< octave_idx_type > &ra_idx, const dim_vector &dimensions, int start_dimension=0)
Definition: Array-util.cc:60
OCTAVE_API octave_idx_type num_ones(const Array< octave_idx_type > &ra_idx)
Definition: Array-util.cc:102
OCTAVE_API bool all_ones(const Array< octave_idx_type > &arr)
Definition: Array-util.cc:364
Vector representing the dimensions (size) of an Array.
Definition: dim-vector.h:95
octave_idx_type n
Definition: mx-inlines.cc:753
const octave_base_value const Array< octave_idx_type > & ra_idx
octave_idx_type pidx
Definition: Array-util.h:112
octave_idx_type iidx
Definition: Array-util.h:113
F77_RET_T len
Definition: xerbla.cc:61