comparison liboctave/Array-util.h @ 4588:19bfd295f400

[project @ 2003-11-10 17:18:48 by jwe]
author jwe
date Mon, 10 Nov 2003 17:22:02 +0000
parents
children 77566be8b9e9
comparison
equal deleted inserted replaced
4587:7b957b442818 4588:19bfd295f400
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
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
21 */
22
23 #if !defined (octave_Array_util_h)
24 #define octave_Array_util_h 1
25
26 #include <cassert>
27
28 #include "Array.h"
29 #include "dim-vector.h"
30 #include "idx-vector.h"
31 #include "lo-error.h"
32
33 extern bool index_in_bounds (const Array<int>& ra_idx,
34 const dim_vector& dimensions);
35
36 extern void increment_index (Array<int>& ra_idx,
37 const dim_vector& dimensions,
38 int start_dimension = 0);
39
40 extern int get_scalar_idx (Array<int>& idx, dim_vector& dims);
41
42 extern int num_ones (const Array<int>& ra_idx);
43
44 extern bool is_scalar (const dim_vector& dim);
45
46 extern bool any_ones (const Array<int>& arr);
47
48 extern int compute_index (const Array<int>& ra_idx, const dim_vector& dims);
49
50 extern Array<int> conv_to_int_array (const Array<idx_vector>& a);
51
52 extern Array<idx_vector> conv_to_array (const idx_vector *tmp, const int len);
53
54 extern dim_vector freeze (Array<idx_vector>& ra_idx,
55 const dim_vector& dimensions, int resize_ok);
56
57 extern bool vector_equivalent (const Array<int>& ra_idx);
58
59 extern bool equal_arrays (const dim_vector& a, const dim_vector& b);
60
61 extern bool all_ok (const Array<idx_vector>& ra_idx);
62
63 extern bool any_orig_empty (const Array<idx_vector>& ra_idx);
64
65 extern bool any_zero_len (const dim_vector& frozen_lengths);
66
67 extern dim_vector get_zero_len_size (const dim_vector& frozen_lengths,
68 const dim_vector& dimensions);
69
70 extern bool all_colon_equiv (const Array<idx_vector>& ra_idx,
71 const dim_vector& frozen_lengths);
72
73 extern bool is_in (int num, const idx_vector& idx);
74
75 extern int how_many_lgt (const int num, idx_vector& idxv);
76
77 extern bool all_ones (const Array<int>& arr);
78
79 extern Array<int> get_elt_idx (const Array<idx_vector>& ra_idx,
80 const Array<int>& result_idx);
81
82 extern int number_of_elements (const dim_vector ra_idx);
83
84 extern Array<int> get_ra_idx (int idx, const dim_vector& dims);
85
86 extern dim_vector short_freeze (Array<idx_vector>& ra_idx,
87 const dim_vector& dimensions,
88 int resize_ok);
89
90 #endif
91
92 /*
93 ;;; Local Variables: ***
94 ;;; mode: C++ ***
95 ;;; End: ***
96 */