4514
|
1 // N-D Array manipulations. |
|
2 /* |
|
3 |
|
4 Copyright (C) 2003 John W. Eaton |
|
5 |
|
6 This file is part of Octave. |
|
7 |
|
8 Octave is free software; you can redistribute it and/or modify it |
|
9 under the terms of the GNU General Public License as published by the |
|
10 Free Software Foundation; either version 2, or (at your option) any |
|
11 later version. |
|
12 |
|
13 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
16 for more details. |
|
17 |
|
18 You should have received a copy of the GNU General Public License |
|
19 along with Octave; see the file COPYING. If not, write to the Free |
|
20 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
21 |
|
22 */ |
|
23 |
|
24 #if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION) |
|
25 #pragma implementation |
|
26 #endif |
|
27 |
|
28 #ifdef HAVE_CONFIG_H |
|
29 #include <config.h> |
|
30 #endif |
|
31 |
4588
|
32 #include "Array-util.h" |
4514
|
33 #include "chNDArray.h" |
|
34 #include "mx-base.h" |
|
35 #include "lo-ieee.h" |
|
36 |
|
37 // XXX FIXME XXX -- this is not quite the right thing. |
|
38 |
4556
|
39 boolNDArray |
4514
|
40 charNDArray::all (int dim) const |
|
41 { |
4569
|
42 MX_ND_ANY_ALL_REDUCTION (MX_ND_ALL_EVAL (elem (iter_idx) == ' '), true); |
4514
|
43 } |
|
44 |
4556
|
45 boolNDArray |
4514
|
46 charNDArray::any (int dim) const |
|
47 { |
4569
|
48 MX_ND_ANY_ALL_REDUCTION (MX_ND_ANY_EVAL (elem (iter_idx) != ' '), false); |
4514
|
49 } |
|
50 |
|
51 charMatrix |
|
52 charNDArray::matrix_value (void) const |
|
53 { |
|
54 charMatrix retval; |
|
55 |
|
56 int nd = ndims (); |
|
57 |
|
58 switch (nd) |
|
59 { |
|
60 case 1: |
|
61 retval = charMatrix (Array2<char> (*this, dimensions(0), 1)); |
|
62 break; |
|
63 |
|
64 case 2: |
|
65 retval = charMatrix (Array2<char> (*this, dimensions(0), |
|
66 dimensions(1))); |
|
67 break; |
|
68 |
|
69 default: |
|
70 (*current_liboctave_error_handler) |
|
71 ("invalid converstion of charNDArray to charMatrix"); |
|
72 break; |
|
73 } |
|
74 |
|
75 return retval; |
|
76 } |
|
77 |
4532
|
78 void |
|
79 charNDArray::increment_index (Array<int>& ra_idx, |
|
80 const dim_vector& dimensions, |
|
81 int start_dimension) |
|
82 { |
|
83 ::increment_index (ra_idx, dimensions, start_dimension); |
|
84 } |
|
85 |
4556
|
86 int |
|
87 charNDArray::compute_index (Array<int>& ra_idx, |
|
88 const dim_vector& dimensions) |
|
89 { |
|
90 return ::compute_index (ra_idx, dimensions); |
|
91 } |
|
92 |
4514
|
93 /* |
|
94 ;;; Local Variables: *** |
|
95 ;;; mode: C++ *** |
|
96 ;;; End: *** |
|
97 */ |