comparison src/OPERATORS/op-cs-sm.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
55 double d = v2.scalar_value (); 55 double d = v2.scalar_value ();
56 56
57 if (d == 0.0) 57 if (d == 0.0)
58 gripe_divide_by_zero (); 58 gripe_divide_by_zero ();
59 59
60 return octave_value (v1.complex_value () / d); 60 return octave_value (SparseComplexMatrix (1, 1, v1.complex_value () / d));
61 } 61 }
62 else 62 else
63 { 63 {
64 MatrixType typ = v2.matrix_type (); 64 MatrixType typ = v2.matrix_type ();
65 ComplexMatrix m1 = ComplexMatrix (1, 1, v1.complex_value ()); 65 ComplexMatrix m1 = ComplexMatrix (1, 1, v1.complex_value ());
82 82
83 Complex d = v1.complex_value (); 83 Complex d = v1.complex_value ();
84 octave_value retval; 84 octave_value retval;
85 85
86 if (d == 0.0) 86 if (d == 0.0)
87 { 87 gripe_divide_by_zero ();
88 gripe_divide_by_zero ();
89 88
90 retval = octave_value (v2.matrix_value () / d); 89 retval = octave_value (v2.sparse_matrix_value () / d);
91 }
92 else
93 retval = octave_value (v2.sparse_matrix_value () / d);
94 90
95 return retval; 91 return retval;
96 } 92 }
97 93
98 DEFBINOP_FN (lt, complex, sparse_matrix, mx_el_lt) 94 DEFBINOP_FN (lt, complex, sparse_matrix, mx_el_lt)
112 108
113 Complex d = v1.complex_value (); 109 Complex d = v1.complex_value ();
114 octave_value retval; 110 octave_value retval;
115 111
116 if (d == 0.0) 112 if (d == 0.0)
117 { 113 gripe_divide_by_zero ();
118 gripe_divide_by_zero ();
119 114
120 retval = octave_value (v2.matrix_value () / d); 115 retval = octave_value (v2.sparse_matrix_value () / d);
121 }
122 else
123 retval = octave_value (v2.sparse_matrix_value () / d);
124 116
125 return retval; 117 return retval;
126 } 118 }
127 119
128 DEFBINOP_FN (el_and, complex, sparse_matrix, mx_el_and) 120 DEFBINOP_FN (el_and, complex, sparse_matrix, mx_el_and)