comparison src/OPERATORS/op-cs-scm.cc @ 8835:1685c61542f8

Don't perform narrowing to full matrices in mixed spare scalar operators
author David Bateman <dbateman@free.fr>
date Sat, 21 Feb 2009 01:27:23 +0100
parents e5055ed23f52
children eb63fbe60fab
comparison
equal deleted inserted replaced
8834:8dd69187c4a2 8835:1685c61542f8
53 Complex d = v2.complex_value (); 53 Complex d = v2.complex_value ();
54 54
55 if (d == 0.0) 55 if (d == 0.0)
56 gripe_divide_by_zero (); 56 gripe_divide_by_zero ();
57 57
58 return octave_value (v1.complex_value () / d); 58 return octave_value (SparseComplexMatrix (1, 1, v1.complex_value () / d));
59 } 59 }
60 else 60 else
61 { 61 {
62 MatrixType typ = v2.matrix_type (); 62 MatrixType typ = v2.matrix_type ();
63 ComplexMatrix m1 = ComplexMatrix (1, 1, v1.complex_value ()); 63 ComplexMatrix m1 = ComplexMatrix (1, 1, v1.complex_value ());
105 105
106 Complex d = v1.complex_value (); 106 Complex d = v1.complex_value ();
107 octave_value retval; 107 octave_value retval;
108 108
109 if (d == 0.0) 109 if (d == 0.0)
110 { 110 gripe_divide_by_zero ();
111 gripe_divide_by_zero ();
112 111
113 retval = octave_value (v2.complex_matrix_value () / d); 112 retval = octave_value (v2.sparse_complex_matrix_value () / d);
114 }
115 else
116 retval = octave_value (v2.sparse_complex_matrix_value () / d);
117 113
118 return retval; 114 return retval;
119 } 115 }
120 116
121 DEFBINOP_FN (el_and, complex, sparse_complex_matrix, mx_el_and) 117 DEFBINOP_FN (el_and, complex, sparse_complex_matrix, mx_el_and)