comparison src/pt-mat.cc @ 2086:bfb775fb6fe8

[project @ 1996-04-25 05:55:19 by jwe]
author jwe
date Thu, 25 Apr 1996 05:55:19 +0000
parents 003570e69c7b
children 97a566037a75
comparison
equal deleted inserted replaced
2085:7603b37325db 2086:bfb775fb6fe8
51 tm_row_const 51 tm_row_const
52 { 52 {
53 private: 53 private:
54 54
55 class 55 class
56 tm_row_const_rep : public SLList<tree_constant> 56 tm_row_const_rep : public SLList<octave_value>
57 { 57 {
58 public: 58 public:
59 59
60 tm_row_const_rep (void) 60 tm_row_const_rep (void)
61 : SLList<tree_constant> (), count (1), nr (0), nc (0), 61 : SLList<octave_value> (), count (1), nr (0), nc (0),
62 all_str (false), is_cmplx (false), ok (false) { } 62 all_str (false), is_cmplx (false), ok (false) { }
63 63
64 tm_row_const_rep (const tree_matrix_row& mr) 64 tm_row_const_rep (const tree_matrix_row& mr)
65 : SLList<tree_constant> (), count (1), nr (0), nc (0), 65 : SLList<octave_value> (), count (1), nr (0), nc (0),
66 all_str (false), is_cmplx (false), ok (false) 66 all_str (false), is_cmplx (false), ok (false)
67 { init (mr); } 67 { init (mr); }
68 68
69 ~tm_row_const_rep (void) { } 69 ~tm_row_const_rep (void) { }
70 70
127 int cols (void) { return rep->nc; } 127 int cols (void) { return rep->nc; }
128 128
129 bool all_strings (void) const { return rep->all_str; } 129 bool all_strings (void) const { return rep->all_str; }
130 bool is_complex (void) const { return rep->is_cmplx; } 130 bool is_complex (void) const { return rep->is_cmplx; }
131 131
132 tree_constant& operator () (Pix p) { return rep->operator () (p); } 132 octave_value& operator () (Pix p) { return rep->operator () (p); }
133 133
134 const tree_constant& operator () (Pix p) const 134 const octave_value& operator () (Pix p) const
135 { return rep->operator () (p); } 135 { return rep->operator () (p); }
136 136
137 Pix first (void) const { return rep->first (); } 137 Pix first (void) const { return rep->first (); }
138 void next (Pix& p) const { rep->next (p); } 138 void next (Pix& p) const { rep->next (p); }
139 139
158 158
159 for (Pix p = mr.first (); p != 0; mr.next (p)) 159 for (Pix p = mr.first (); p != 0; mr.next (p))
160 { 160 {
161 tree_expression *elt = mr (p); 161 tree_expression *elt = mr (p);
162 162
163 tree_constant tmp = elt->eval (false); 163 octave_value tmp = elt->eval (false);
164 164
165 if (error_state || tmp.is_undefined ()) 165 if (error_state || tmp.is_undefined ())
166 break; 166 break;
167 else 167 else
168 { 168 {
429 429
430 // Just about as ugly as it gets. 430 // Just about as ugly as it gets.
431 // Less ugly than before, anyway. 431 // Less ugly than before, anyway.
432 // Looking better all the time. 432 // Looking better all the time.
433 433
434 tree_constant 434 octave_value
435 tree_matrix::eval (bool /* print */) 435 tree_matrix::eval (bool /* print */)
436 { 436 {
437 tree_constant retval; 437 octave_value retval;
438 438
439 tm_const tmp (*this); 439 tm_const tmp (*this);
440 440
441 if (tmp) 441 if (tmp)
442 { 442 {
468 468
469 tm_row_const row = tmp (p); 469 tm_row_const row = tmp (p);
470 470
471 for (Pix q = row.first (); q != 0; row.next (q)) 471 for (Pix q = row.first (); q != 0; row.next (q))
472 { 472 {
473 tree_constant elt = row (q); 473 octave_value elt = row (q);
474 474
475 if (found_complex) 475 if (found_complex)
476 { 476 {
477 if (elt.is_real_scalar ()) 477 if (elt.is_real_scalar ())
478 cm (put_row, put_col) = elt.double_value (); 478 cm (put_row, put_col) = elt.double_value ();
513 m.insert (m_elt, put_row, put_col); 513 m.insert (m_elt, put_row, put_col);
514 } 514 }
515 } 515 }
516 516
517 if (all_strings && chm.rows () > 0 && chm.cols () > 0) 517 if (all_strings && chm.rows () > 0 && chm.cols () > 0)
518 retval = tree_constant (chm, true); 518 retval = octave_value (chm, true);
519 else if (found_complex) 519 else if (found_complex)
520 retval = cm; 520 retval = cm;
521 else 521 else
522 retval = m; 522 retval = m;
523 523