4588
|
1 /* |
|
2 |
|
3 Copyright (C) 2000 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 2, or (at your option) any |
|
10 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, write to the Free |
5307
|
19 Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
20 02110-1301, USA. |
4588
|
21 |
|
22 */ |
|
23 |
|
24 #if !defined (octave_Array_util_h) |
|
25 #define octave_Array_util_h 1 |
|
26 |
|
27 #include <cassert> |
|
28 |
|
29 #include "Array.h" |
|
30 #include "dim-vector.h" |
|
31 #include "idx-vector.h" |
|
32 #include "lo-error.h" |
|
33 |
5275
|
34 extern bool index_in_bounds (const Array<octave_idx_type>& ra_idx, |
4588
|
35 const dim_vector& dimensions); |
|
36 |
5275
|
37 extern void increment_index (Array<octave_idx_type>& ra_idx, |
4588
|
38 const dim_vector& dimensions, |
|
39 int start_dimension = 0); |
|
40 |
5275
|
41 extern octave_idx_type get_scalar_idx (Array<octave_idx_type>& idx, dim_vector& dims); |
4588
|
42 |
5275
|
43 extern octave_idx_type num_ones (const Array<octave_idx_type>& ra_idx); |
4588
|
44 |
|
45 extern bool is_scalar (const dim_vector& dim); |
|
46 |
5275
|
47 extern bool any_ones (const Array<octave_idx_type>& arr); |
4588
|
48 |
5275
|
49 extern octave_idx_type compute_index (const Array<octave_idx_type>& ra_idx, const dim_vector& dims); |
4588
|
50 |
5275
|
51 extern Array<octave_idx_type> conv_to_int_array (const Array<idx_vector>& a); |
4588
|
52 |
5275
|
53 extern Array<idx_vector> conv_to_array (const idx_vector *tmp, const octave_idx_type len); |
4588
|
54 |
|
55 extern dim_vector freeze (Array<idx_vector>& ra_idx, |
|
56 const dim_vector& dimensions, int resize_ok); |
|
57 |
5519
|
58 extern bool vector_equivalent (const dim_vector& dv); |
4588
|
59 |
|
60 extern bool all_ok (const Array<idx_vector>& ra_idx); |
|
61 |
|
62 extern bool any_orig_empty (const Array<idx_vector>& ra_idx); |
|
63 |
|
64 extern bool all_colon_equiv (const Array<idx_vector>& ra_idx, |
|
65 const dim_vector& frozen_lengths); |
|
66 |
5275
|
67 extern bool is_in (octave_idx_type num, const idx_vector& idx); |
4588
|
68 |
5275
|
69 extern octave_idx_type how_many_lgt (const octave_idx_type num, idx_vector& idxv); |
4588
|
70 |
5275
|
71 extern bool all_ones (const Array<octave_idx_type>& arr); |
4588
|
72 |
5275
|
73 extern Array<octave_idx_type> get_elt_idx (const Array<idx_vector>& ra_idx, |
|
74 const Array<octave_idx_type>& result_idx); |
4588
|
75 |
5275
|
76 extern Array<octave_idx_type> get_ra_idx (octave_idx_type idx, const dim_vector& dims); |
4588
|
77 |
|
78 extern dim_vector short_freeze (Array<idx_vector>& ra_idx, |
|
79 const dim_vector& dimensions, |
|
80 int resize_ok); |
|
81 |
5275
|
82 extern Array<octave_idx_type> calc_permutated_idx (const Array<octave_idx_type>& old_idx, |
|
83 const Array<octave_idx_type>& perm_vec, bool inv); |
4669
|
84 |
|
85 extern void gripe_nonconformant (const char *op, int op1_len, int op2_len); |
|
86 |
|
87 extern void gripe_nonconformant (const char *op, int op1_nr, int op1_nc, |
|
88 int op2_nr, int op2_nc); |
|
89 |
|
90 |
|
91 extern void gripe_nonconformant (const char *op, dim_vector& op1_dims, |
|
92 dim_vector& op2_dims); |
|
93 |
4588
|
94 #endif |
|
95 |
|
96 /* |
|
97 ;;; Local Variables: *** |
|
98 ;;; mode: C++ *** |
|
99 ;;; End: *** |
|
100 */ |