2376
|
1 /* |
|
2 |
2847
|
3 Copyright (C) 1996, 1997 John W. Eaton |
2376
|
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 |
4192
|
23 #if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION) |
2376
|
24 #pragma implementation |
|
25 #endif |
|
26 |
|
27 #ifdef HAVE_CONFIG_H |
|
28 #include <config.h> |
|
29 #endif |
|
30 |
3503
|
31 #include <iostream> |
2901
|
32 |
2376
|
33 #include "lo-ieee.h" |
|
34 #include "mx-base.h" |
|
35 |
3219
|
36 #include "ov-base.h" |
|
37 #include "ov-base-mat.h" |
|
38 #include "ov-base-mat.cc" |
2376
|
39 #include "ov-ch-mat.h" |
|
40 #include "gripes.h" |
|
41 #include "pr-output.h" |
|
42 |
3219
|
43 template class octave_base_matrix<charMatrix>; |
2376
|
44 |
3219
|
45 DEFINE_OCTAVE_ALLOCATOR (octave_char_matrix); |
2477
|
46 |
3219
|
47 DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_char_matrix, "char matrix"); |
2376
|
48 |
|
49 bool |
|
50 octave_char_matrix::valid_as_scalar_index (void) const |
|
51 { |
3136
|
52 bool retval = false; |
|
53 error ("octave_char_matrix::valid_as_scalar_index(): not implemented"); |
|
54 return retval; |
2376
|
55 } |
|
56 |
|
57 double |
|
58 octave_char_matrix::double_value (bool) const |
|
59 { |
4102
|
60 double retval = lo_ieee_nan_value (); |
2376
|
61 |
|
62 if ((rows () == 1 && columns () == 1) |
|
63 || (Vdo_fortran_indexing && rows () > 0 && columns () > 0)) |
|
64 retval = matrix (0, 0); |
|
65 else |
|
66 gripe_invalid_conversion ("character matrix", "real scalar"); |
|
67 |
|
68 return retval; |
|
69 } |
|
70 |
|
71 Complex |
|
72 octave_char_matrix::complex_value (bool) const |
|
73 { |
4102
|
74 double tmp = lo_ieee_nan_value (); |
|
75 |
|
76 Complex retval (tmp, tmp); |
2376
|
77 |
|
78 if ((rows () == 1 && columns () == 1) |
|
79 || (Vdo_fortran_indexing && rows () > 0 && columns () > 0)) |
|
80 retval = matrix (0, 0); |
|
81 else |
|
82 gripe_invalid_conversion ("character matrix", "complex scalar"); |
|
83 |
|
84 return retval; |
|
85 } |
|
86 |
|
87 /* |
|
88 ;;; Local Variables: *** |
|
89 ;;; mode: C++ *** |
|
90 ;;; End: *** |
|
91 */ |