GNU Octave 7.1.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-2022 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
35 const dim_vector& dimensions);
36
38 const dim_vector& dimensions,
39 int start_dimension = 0);
40
42 dim_vector& dims);
43
45 ra_idx);
46
47extern OCTAVE_API bool is_scalar (const dim_vector& dim);
48
49extern OCTAVE_API bool isvector (const dim_vector& dim);
50
51extern 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.
57
60
63 const dim_vector& dims);
64
67
70
73
76 int resize_ok);
77
78extern OCTAVE_API bool vector_equivalent (const dim_vector& dv);
79
81
82extern OCTAVE_API bool
84
85extern OCTAVE_API bool
87 const dim_vector& frozen_lengths);
88
89extern OCTAVE_API bool all_ones (const Array<octave_idx_type>& arr);
90
93 const Array<octave_idx_type>& result_idx);
94
96 const dim_vector& dims);
97
100
103 const dim_vector& rhdv);
104
106sub2ind (const dim_vector& dv, const Array<octave::idx_vector>& idxa);
107
109ind2sub (const dim_vector& dv, const octave::idx_vector& idx);
110
111struct
113{
116};
117
118extern int OCTAVE_API permute_vector_compare (const void *a, const void *b);
119
120#endif
OCTAVE_API Array< octave_idx_type > get_ra_idx(octave_idx_type idx, const dim_vector &dims)
Definition: Array-util.cc:395
OCTAVE_API dim_vector zero_dims_inquire(const Array< octave::idx_vector > &ia, const dim_vector &rhdv)
Definition: Array-util.cc:429
OCTAVE_API bool isvector(const dim_vector &dim)
Definition: Array-util.cc:140
OCTAVE_API bool any_ones(const Array< octave_idx_type > &arr)
Definition: Array-util.cc:160
OCTAVE_API Array< octave::idx_vector > ind2sub(const dim_vector &dv, const octave::idx_vector &idx)
Definition: Array-util.cc:619
OCTAVE_API dim_vector freeze(Array< octave::idx_vector > &ra_idx, const dim_vector &dimensions, int resize_ok)
Definition: Array-util.cc:261
OCTAVE_API bool all_colon_equiv(const Array< octave::idx_vector > &ra_idx, const dim_vector &frozen_lengths)
Definition: Array-util.cc:340
OCTAVE_API octave_idx_type get_scalar_idx(Array< octave_idx_type > &idx, dim_vector &dims)
Definition: Array-util.cc:81
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:664
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< octave::idx_vector > &ra_idx)
Definition: Array-util.cc:302
OCTAVE_API Array< octave_idx_type > get_elt_idx(const Array< octave::idx_vector > &ra_idx, const Array< octave_idx_type > &result_idx)
Definition: Array-util.cc:381
OCTAVE_API bool vector_equivalent(const dim_vector &dv)
Definition: Array-util.cc:281
OCTAVE_API Array< octave_idx_type > conv_to_int_array(const Array< octave::idx_vector > &a)
Definition: Array-util.cc:239
OCTAVE_API octave::idx_vector sub2ind(const dim_vector &dv, const Array< octave::idx_vector > &idxa)
Definition: Array-util.cc:524
OCTAVE_API octave_idx_type compute_index(octave_idx_type n, const dim_vector &dims)
Definition: Array-util.cc:177
OCTAVE_API bool any_orig_empty(const Array< octave::idx_vector > &ra_idx)
Definition: Array-util.cc:321
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
OCTAVE_API Array< octave::idx_vector > conv_to_array(const octave::idx_vector *tmp, const octave_idx_type len)
Definition: Array-util.cc:250
Vector representing the dimensions (size) of an Array.
Definition: dim-vector.h:94
#define OCTAVE_API
Definition: main.in.cc:55
const octave_base_value const Array< octave_idx_type > & ra_idx
octave_idx_type pidx
Definition: Array-util.h:114
octave_idx_type iidx
Definition: Array-util.h:115
F77_RET_T len
Definition: xerbla.cc:61