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 |
|
32 #include "chNDArray.h" |
|
33 #include "mx-base.h" |
|
34 #include "lo-ieee.h" |
|
35 |
4532
|
36 #include "ArrayN-inline.h" |
|
37 |
4514
|
38 // XXX FIXME XXX -- this is not quite the right thing. |
|
39 |
4556
|
40 boolNDArray |
4514
|
41 charNDArray::all (int dim) const |
|
42 { |
4556
|
43 MX_ND_ALL_ANY (MX_ND_ALL_EVAL (elem (iter_idx) == ' ')); |
4514
|
44 } |
|
45 |
4556
|
46 boolNDArray |
4514
|
47 charNDArray::any (int dim) const |
|
48 { |
4556
|
49 MX_ND_ALL_ANY (MX_ND_ANY_EVAL (elem (iter_idx) != ' ')); |
4514
|
50 } |
|
51 |
|
52 charMatrix |
|
53 charNDArray::matrix_value (void) const |
|
54 { |
|
55 charMatrix retval; |
|
56 |
|
57 int nd = ndims (); |
|
58 |
|
59 switch (nd) |
|
60 { |
|
61 case 1: |
|
62 retval = charMatrix (Array2<char> (*this, dimensions(0), 1)); |
|
63 break; |
|
64 |
|
65 case 2: |
|
66 retval = charMatrix (Array2<char> (*this, dimensions(0), |
|
67 dimensions(1))); |
|
68 break; |
|
69 |
|
70 default: |
|
71 (*current_liboctave_error_handler) |
|
72 ("invalid converstion of charNDArray to charMatrix"); |
|
73 break; |
|
74 } |
|
75 |
|
76 return retval; |
|
77 } |
|
78 |
4532
|
79 void |
|
80 charNDArray::increment_index (Array<int>& ra_idx, |
|
81 const dim_vector& dimensions, |
|
82 int start_dimension) |
|
83 { |
|
84 ::increment_index (ra_idx, dimensions, start_dimension); |
|
85 } |
|
86 |
4556
|
87 int |
|
88 charNDArray::compute_index (Array<int>& ra_idx, |
|
89 const dim_vector& dimensions) |
|
90 { |
|
91 return ::compute_index (ra_idx, dimensions); |
|
92 } |
|
93 |
4514
|
94 /* |
|
95 ;;; Local Variables: *** |
|
96 ;;; mode: C++ *** |
|
97 ;;; End: *** |
|
98 */ |