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 |
|
23 #if !defined (octave_matrix_h) |
|
24 #define octave_matrix_h 1 |
|
25 |
4192
|
26 #if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION) |
2376
|
27 #pragma interface |
|
28 #endif |
|
29 |
|
30 #include <cstdlib> |
|
31 |
3503
|
32 #include <iostream> |
2376
|
33 #include <string> |
|
34 |
|
35 #include "mx-base.h" |
2477
|
36 #include "oct-alloc.h" |
2376
|
37 #include "str-vec.h" |
|
38 |
|
39 #include "error.h" |
|
40 #include "ov-base.h" |
3219
|
41 #include "ov-base-mat.h" |
2376
|
42 #include "ov-typeinfo.h" |
|
43 |
|
44 class Octave_map; |
|
45 class octave_value_list; |
|
46 |
|
47 class tree_walker; |
|
48 |
|
49 // Real matrix values. |
|
50 |
|
51 class |
4513
|
52 octave_matrix : public octave_base_matrix<NDArray> |
2376
|
53 { |
|
54 public: |
|
55 |
|
56 octave_matrix (void) |
4513
|
57 : octave_base_matrix<NDArray> () { } |
2376
|
58 |
|
59 octave_matrix (const Matrix& m) |
4513
|
60 : octave_base_matrix<NDArray> (m) { } |
|
61 |
|
62 octave_matrix (const NDArray& nda) |
|
63 : octave_base_matrix<NDArray> (nda) { } |
2376
|
64 |
|
65 octave_matrix (const DiagMatrix& d) |
4513
|
66 : octave_base_matrix<NDArray> (Matrix (d)) { } |
2376
|
67 |
3418
|
68 octave_matrix (const RowVector& v) |
4513
|
69 : octave_base_matrix<NDArray> (Matrix (v)) { } |
2376
|
70 |
3418
|
71 octave_matrix (const ColumnVector& v) |
4513
|
72 : octave_base_matrix<NDArray> (Matrix (v)) { } |
2376
|
73 |
|
74 octave_matrix (const octave_matrix& m) |
4513
|
75 : octave_base_matrix<NDArray> (m) { } |
2376
|
76 |
|
77 ~octave_matrix (void) { } |
|
78 |
3933
|
79 octave_value *clone (void) const { return new octave_matrix (*this); } |
|
80 octave_value *empty_clone (void) const { return new octave_matrix (); } |
2376
|
81 |
2410
|
82 octave_value *try_narrowing_conversion (void); |
|
83 |
4513
|
84 // XXX FIXME XXX |
|
85 idx_vector index_vector (void) const { return idx_vector (matrix_value ()); } |
2376
|
86 |
|
87 bool is_real_matrix (void) const { return true; } |
|
88 |
|
89 bool is_real_type (void) const { return true; } |
|
90 |
|
91 bool valid_as_scalar_index (void) const; |
|
92 |
|
93 double double_value (bool = false) const; |
|
94 |
3145
|
95 double scalar_value (bool frc_str_conv = false) const |
|
96 { return double_value (frc_str_conv); } |
2916
|
97 |
4513
|
98 Matrix matrix_value (bool = false) const; |
2376
|
99 |
|
100 Complex complex_value (bool = false) const; |
|
101 |
4513
|
102 ComplexMatrix complex_matrix_value (bool = false) const; |
2376
|
103 |
4507
|
104 NDArray double_nd_array_value (bool = false) const |
4513
|
105 { return matrix; } |
4505
|
106 |
2376
|
107 void increment (void) { matrix += 1.0; } |
|
108 |
|
109 void decrement (void) { matrix -= 1.0; } |
|
110 |
4457
|
111 octave_value convert_to_str_internal (bool pad, bool force) const; |
2376
|
112 |
|
113 private: |
|
114 |
3219
|
115 DECLARE_OCTAVE_ALLOCATOR |
2477
|
116 |
3219
|
117 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA |
2376
|
118 }; |
|
119 |
|
120 #endif |
|
121 |
|
122 /* |
|
123 ;;; Local Variables: *** |
|
124 ;;; mode: C++ *** |
|
125 ;;; End: *** |
|
126 */ |