comparison src/ov-cx-mat.cc @ 3220:3deb1105fbc1

[project @ 1998-11-19 00:06:30 by jwe]
author jwe
date Thu, 19 Nov 1998 00:06:34 +0000
parents 30770ba4457a
children eba59b8c64dc
comparison
equal deleted inserted replaced
3219:30770ba4457a 3220:3deb1105fbc1
88 retval = new octave_matrix (::real (matrix)); 88 retval = new octave_matrix (::real (matrix));
89 89
90 return retval; 90 return retval;
91 } 91 }
92 92
93 octave_value
94 octave_complex_matrix::do_index_op (const octave_value_list& idx)
95 {
96 octave_value retval;
97
98 int len = idx.length ();
99
100 switch (len)
101 {
102 case 2:
103 {
104 idx_vector i = idx (0).index_vector ();
105 idx_vector j = idx (1).index_vector ();
106
107 retval = ComplexMatrix (matrix.index (i, j));
108 }
109 break;
110
111 case 1:
112 {
113 idx_vector i = idx (0).index_vector ();
114
115 retval = ComplexMatrix (matrix.index (i));
116 }
117 break;
118
119 default:
120 error ("invalid number of indices (%d) for complex matrix value", len);
121 break;
122 }
123
124 return retval;
125 }
126
127 #if !defined (CXX_NEW_FRIEND_TEMPLATE_DECL) 93 #if !defined (CXX_NEW_FRIEND_TEMPLATE_DECL)
128 extern void assign (Array2<Complex>&, const Array2<Complex>&); 94 extern void assign (Array2<Complex>&, const Array2<Complex>&);
129 #endif 95 #endif
130 96
131 void 97 void
216 bool 182 bool
217 octave_complex_matrix::valid_as_zero_index (void) const 183 octave_complex_matrix::valid_as_zero_index (void) const
218 { 184 {
219 // XXX FIXME XXX 185 // XXX FIXME XXX
220 return false; 186 return false;
221 }
222
223 bool
224 octave_complex_matrix::is_true (void) const
225 {
226 bool retval = false;
227
228 if (rows () == 0 || columns () == 0)
229 {
230 int flag = Vpropagate_empty_matrices;
231
232 if (flag < 0)
233 warning ("empty matrix used in conditional expression");
234 else if (flag == 0)
235 error ("empty matrix used in conditional expression");
236 }
237 else
238 {
239 Matrix m = (matrix.all ()) . all ();
240
241 retval = (m.rows () == 1 && m.columns () == 1 && m (0, 0) != 0.0);
242 }
243
244 return retval;
245 } 187 }
246 188
247 double 189 double
248 octave_complex_matrix::double_value (bool force_conversion) const 190 octave_complex_matrix::double_value (bool force_conversion) const
249 { 191 {