Mercurial > hg > octave-lyh
diff src/OPERATORS/op-scm-cs.cc @ 6221:8e0f1eda266b
[project @ 2007-01-03 17:23:33 by jwe]
author | jwe |
---|---|
date | Wed, 03 Jan 2007 17:23:34 +0000 |
parents | 6b9cec830d72 |
children | 93c65f2a5668 |
line wrap: on
line diff
--- a/src/OPERATORS/op-scm-cs.cc +++ b/src/OPERATORS/op-scm-cs.cc @@ -74,13 +74,24 @@ { CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_complex&); - MatrixType typ = v1.matrix_type (); - SparseComplexMatrix m1 = v1.sparse_complex_matrix_value (); - ComplexMatrix m2 = ComplexMatrix (1, 1, v2.complex_value ()); - ComplexMatrix ret = xleftdiv (m1, m2, typ); - v1.matrix_type (typ); + if (v1.rows() == 1 && v1.columns() == 1) + { + Complex d = v1.complex_value (); + + if (d == 0.0) + gripe_divide_by_zero (); - return ret; + return octave_value (v2.complex_value () / d); + } + else + { + MatrixType typ = v1.matrix_type (); + SparseComplexMatrix m1 = v1.sparse_complex_matrix_value (); + ComplexMatrix m2 = ComplexMatrix (1, 1, v2.complex_value ()); + ComplexMatrix ret = xleftdiv (m1, m2, typ); + v1.matrix_type (typ); + return ret; + } } DEFBINOP_FN (lt, sparse_complex_matrix, complex, mx_el_lt)