GNU Octave 11.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
Array-util.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 2000-2026 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-oct.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
72conv_to_array (const octave::idx_vector *tmp, const octave_idx_type len);
73
76 int resize_ok);
77
78extern OCTAVE_API bool vector_equivalent (const dim_vector& dv);
79
80extern OCTAVE_API bool
82
83extern OCTAVE_API bool
85 const dim_vector& frozen_lengths);
86
87extern OCTAVE_API bool all_ones (const Array<octave_idx_type>& arr);
88
91 const Array<octave_idx_type>& result_idx);
92
94 const dim_vector& dims);
95
98
100zero_dims_inquire (const octave::idx_vector& i, const octave::idx_vector& j,
101 const dim_vector& rhdv);
102
103extern OCTAVE_API octave::idx_vector
104sub2ind (const dim_vector& dv, const Array<octave::idx_vector>& idxa);
105
107ind2sub (const dim_vector& dv, const octave::idx_vector& idx);
108
115
116extern int OCTAVE_API permute_vector_compare (const void *a, const void *b);
117
118#endif
Array< octave_idx_type > get_ra_idx(octave_idx_type idx, const dim_vector &dims)
octave_idx_type compute_index(octave_idx_type n, const dim_vector &dims)
bool is_scalar(const dim_vector &dim)
int permute_vector_compare(const void *a, const void *b)
dim_vector zero_dims_inquire(const Array< octave::idx_vector > &ia, const dim_vector &rhdv)
octave::idx_vector sub2ind(const dim_vector &dv, const Array< octave::idx_vector > &idxa)
bool all_ones(const Array< octave_idx_type > &arr)
octave_idx_type num_ones(const Array< octave_idx_type > &ra_idx)
bool all_colon_equiv(const Array< octave::idx_vector > &ra_idx, const dim_vector &frozen_lengths)
void increment_index(Array< octave_idx_type > &ra_idx, const dim_vector &dimensions, int start_dimension=0)
Definition Array-util.cc:60
bool vector_equivalent(const dim_vector &dv)
bool any_ones(const Array< octave_idx_type > &arr)
Array< octave::idx_vector > conv_to_array(const octave::idx_vector *tmp, const octave_idx_type len)
dim_vector freeze(Array< octave::idx_vector > &ra_idx, const dim_vector &dimensions, int resize_ok)
bool any_orig_empty(const Array< octave::idx_vector > &ra_idx)
Array< octave::idx_vector > ind2sub(const dim_vector &dv, const octave::idx_vector &idx)
bool isvector(const dim_vector &dim)
Array< octave_idx_type > get_elt_idx(const Array< octave::idx_vector > &ra_idx, const Array< octave_idx_type > &result_idx)
bool index_in_bounds(const Array< octave_idx_type > &ra_idx, const dim_vector &dimensions)
Definition Array-util.cc:35
Array< octave_idx_type > conv_to_int_array(const Array< octave::idx_vector > &a)
octave_idx_type get_scalar_idx(Array< octave_idx_type > &idx, dim_vector &dims)
Definition Array-util.cc:81
N Dimensional Array with copy-on-write semantics.
Definition Array-base.h:130
Vector representing the dimensions (size) of an Array.
Definition dim-vector.h:92
#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:112
octave_idx_type iidx
Definition Array-util.h:113
F77_RET_T len
Definition xerbla.cc:61