Mercurial > hg > octave-nkf
comparison src/ov-base-sparse.h @ 5785:6b9cec830d72
[project @ 2006-05-03 19:32:46 by dbateman]
author | dbateman |
---|---|
date | Wed, 03 May 2006 19:32:48 +0000 |
parents | 8d7162924bd3 |
children | bd3041e30d97 |
comparison
equal
deleted
inserted
replaced
5784:70f7659d0fb9 | 5785:6b9cec830d72 |
---|---|
34 #include "oct-obj.h" | 34 #include "oct-obj.h" |
35 #include "ov-base.h" | 35 #include "ov-base.h" |
36 #include "ov-typeinfo.h" | 36 #include "ov-typeinfo.h" |
37 | 37 |
38 #include "boolSparse.h" | 38 #include "boolSparse.h" |
39 #include "SparseType.h" | 39 #include "MatrixType.h" |
40 | 40 |
41 class Octave_map; | 41 class Octave_map; |
42 | 42 |
43 class tree_walker; | 43 class tree_walker; |
44 | 44 |
48 class | 48 class |
49 octave_base_sparse : public octave_base_value | 49 octave_base_sparse : public octave_base_value |
50 { | 50 { |
51 public: | 51 public: |
52 | 52 |
53 octave_base_sparse (void) : octave_base_value (), typ (SparseType ()) { } | 53 octave_base_sparse (void) : octave_base_value (), typ (MatrixType ()) { } |
54 | 54 |
55 octave_base_sparse (const T& a) : octave_base_value (), matrix (a), | 55 octave_base_sparse (const T& a) : octave_base_value (), matrix (a), |
56 typ (SparseType ()) | 56 typ (MatrixType ()) |
57 { | 57 { |
58 if (matrix.ndims () == 0) | 58 if (matrix.ndims () == 0) |
59 matrix.resize (dim_vector (0, 0)); | 59 matrix.resize (dim_vector (0, 0)); |
60 } | 60 } |
61 | 61 |
62 octave_base_sparse (const T& a, const SparseType& t) : octave_base_value (), | 62 octave_base_sparse (const T& a, const MatrixType& t) : octave_base_value (), |
63 matrix (a), typ (t) | 63 matrix (a), typ (t) |
64 { | 64 { |
65 if (matrix.ndims () == 0) | 65 if (matrix.ndims () == 0) |
66 matrix.resize (dim_vector (0, 0)); | 66 matrix.resize (dim_vector (0, 0)); |
67 } | 67 } |
115 octave_value resize (const dim_vector& dv, bool = false) const; | 115 octave_value resize (const dim_vector& dv, bool = false) const; |
116 | 116 |
117 octave_value all (int dim = 0) const { return matrix.all (dim); } | 117 octave_value all (int dim = 0) const { return matrix.all (dim); } |
118 octave_value any (int dim = 0) const { return matrix.any (dim); } | 118 octave_value any (int dim = 0) const { return matrix.any (dim); } |
119 | 119 |
120 SparseType sparse_type (void) const { return typ; } | 120 MatrixType matrix_type (void) const { return typ; } |
121 SparseType sparse_type (const SparseType& _typ) const | 121 MatrixType matrix_type (const MatrixType& _typ) const |
122 { SparseType ret = typ; typ = _typ; return ret; } | 122 { MatrixType ret = typ; typ = _typ; return ret; } |
123 | 123 |
124 bool is_matrix_type (void) const { return true; } | 124 bool is_matrix_type (void) const { return true; } |
125 | 125 |
126 bool is_numeric_type (void) const { return true; } | 126 bool is_numeric_type (void) const { return true; } |
127 | 127 |
150 | 150 |
151 protected: | 151 protected: |
152 | 152 |
153 T matrix; | 153 T matrix; |
154 | 154 |
155 mutable SparseType typ; | 155 mutable MatrixType typ; |
156 }; | 156 }; |
157 | 157 |
158 #endif | 158 #endif |
159 | 159 |
160 /* | 160 /* |