Thomas Geiger | 1 Jan 2007 19:38
Picon

Approaching XML import/export

Hello list members,


first let me introduce myself quickly - my name is Thomas Geiger, currently a CS student at the Vorarlberg University of Applied Sciences ( http://www.fhv.at).

By begin of February I'll start working on my diploma thesis which aims to integrate GNU Octave into a grid environment (based on Globus Toolkit - http://www.globus.org/toolkit/) and - as you could imagine - this road map might also include XML support (read/write) for Octave.

Just my two cents on XML - after having taken a look at the XML threads of this list, my favorite approach is 6 (a custom written parser, http://wiki.octave.org/wiki.pl?XML-tools-for-Octave). The proposed solution would make use of a well performing parser like expat (benchmarks neet to be done on this choice), and follow 4 (geodise toolbox) from a functionality point of view.  For an initial version I'd suggest to stick on a Octave only format (validated by XSD), the import of other formats/standards (also MatLab?) could be handled by usage of XSLT transformations/further hacks later on (hopefully).

Important for me to know - is already someone working on this, otherwise I'd like to - of course there needs to be some more detailed negotiation regarding the features.


kind regards and of course a happy new year,
tom

David Bateman | 2 Jan 2007 10:22

Re: [prudhomm <at> debian.org: [Pkg-scicomp-devel] suitesparse and octave]

Rafael Laboissiere wrote:
> I am forwarding below a message from Christophe Prud'homme sent to the
> pkg-scicomp-devel devel mailing list regarding the renaming of the
> libufsparse package in Debian into libsuitesparse, as done by the upstream
> authors.
>
> In order to use this new package for building the octave2.9 package, we need
> to patch the Octave sources.  Please, tell me if we need to change anything
> else than liboctave/oct-sparse.h.
>
> Rafael
>
>
> ----- Forwarded message from Christophe Prud'homme <prudhomm <at> debian.org> -----
>
> From: Christophe Prud'homme <prudhomm <at> debian.org>
> Subject: [Pkg-scicomp-devel] suitesparse and octave
> Date: Fri, 22 Dec 2006 13:39:53 +0100
> To: pkg-scicomp-devel <at> lists.alioth.debian.org
> Organization: Debian GNU/Linux
> Message-Id: <200612221339.54162.prudhomm <at> debian.org>
>
> Rafael,
>
> I just put suitesparse on pkg-scicomp and it is ready for consumption 
> the only visible change is that the headers are now in 
> /usr/include/suitesparse 
>
> is that a problem ?
>
> the dynamic libs still have the same version, I don't think the interfaces has 
> changed at all, but I will check that.
>
> cu
> C.
>   
I've already added to the cvs of octave an autoconf test for the
sparsesuite headers in the location /usr/include/sparsesuite and so this
is fine at least from the 2.9.10 release when it is released...

D.

--

-- 
David Bateman                                David.Bateman <at> motorola.com
Motorola Labs - Paris                        +33 1 69 35 48 04 (Ph) 
Parc Les Algorithmes, Commune de St Aubin    +33 6 72 01 06 33 (Mob) 
91193 Gif-Sur-Yvette FRANCE                  +33 1 69 35 77 01 (Fax) 

The information contained in this communication has been classified as: 

[x] General Business Information 
[ ] Motorola Internal Use Only 
[ ] Motorola Confidential Proprietary

Michael Goffioul | 2 Jan 2007 15:20
Picon

Octave crash on console closing (Win32)

Hi,

Under Windows, when closing the command window with octave running, octave
crashes in octave_jump_to_enclosing_context(), at the longjmp call. As 
this part
of the code is quite complex and I don't understand everything, could 
anyone tell
me what's expected to happen?

The backtrace is roughly the following:
- w32_sigint_handler() is called with sig==CTRL_CLOSE_EVENT
- user_abort()
- octave_jump_to_enclosing_context()
- longjmp() => segmentation fault

I would expect that octave quits itself nicely, but I don't know how 
this would happen.

Michael.

David Bateman | 2 Jan 2007 15:36

Re: Octave crash on console closing (Win32)

Michael Goffioul wrote:
> Hi,
>
> Under Windows, when closing the command window with octave running,
> octave
> crashes in octave_jump_to_enclosing_context(), at the longjmp call. As
> this part
> of the code is quite complex and I don't understand everything, could
> anyone tell
> me what's expected to happen?
>
> The backtrace is roughly the following:
> - w32_sigint_handler() is called with sig==CTRL_CLOSE_EVENT
> - user_abort()
> - octave_jump_to_enclosing_context()
> - longjmp() => segmentation fault
>
> I would expect that octave quits itself nicely, but I don't know how
> this would happen.
>
> Michael.
>
>
>
I've seen the same behavior with mingw but never bothered tracking it
down.. I worked on that portion of the code in 2005 to get the ctrl-c
behavior working correctly. However, the most competent person in that
section of the code is probably Paul Kienzle as he proposed the solution
for the original signal handler for mingw.

D.

--

-- 
David Bateman                                David.Bateman <at> motorola.com
Motorola Labs - Paris                        +33 1 69 35 48 04 (Ph) 
Parc Les Algorithmes, Commune de St Aubin    +33 6 72 01 06 33 (Mob) 
91193 Gif-Sur-Yvette FRANCE                  +33 1 69 35 77 01 (Fax) 

The information contained in this communication has been classified as: 

[x] General Business Information 
[ ] Motorola Internal Use Only 
[ ] Motorola Confidential Proprietary

Aaron Birenboim | 2 Jan 2007 15:17

MEX interface

I have some MatLab mex code which both traverses, and creates some
MatLab structures.
These structures have basic numeric fields in them, and
cell-arrays of strings.

Is the current mex code likely to be able to create (for return values)
and traverse structure parameters?

If it might be relatively straightforward to add this capability,
and it does not yet exist, how might I go about joining the team?

Aaron Birenboim
Senior Software Engineer
Tau Technologies

David Bateman | 3 Jan 2007 10:02

Re: MEX interface

Aaron Birenboim wrote:
> I have some MatLab mex code which both traverses, and creates some
> MatLab structures.
> These structures have basic numeric fields in them, and
> cell-arrays of strings.
>
> Is the current mex code likely to be able to create (for return values)
> and traverse structure parameters?
>
> If it might be relatively straightforward to add this capability,
> and it does not yet exist, how might I go about joining the team?
>
> Aaron Birenboim
> Senior Software Engineer
> Tau Technologies
>
>
>   
Have you tried compiling this code with a 2.9.9 or octave cvs? I suspect
it might just work..

D.

--

-- 
David Bateman                                David.Bateman <at> motorola.com
Motorola Labs - Paris                        +33 1 69 35 48 04 (Ph) 
Parc Les Algorithmes, Commune de St Aubin    +33 6 72 01 06 33 (Mob) 
91193 Gif-Sur-Yvette FRANCE                  +33 1 69 35 77 01 (Fax) 

The information contained in this communication has been classified as: 

[x] General Business Information 
[ ] Motorola Internal Use Only 
[ ] Motorola Confidential Proprietary

Alois Schloegl | 3 Jan 2007 13:01
Picon
Favicon

Re: Approaching XML import/export

octave-maintainers-request <at> octave.org wrote:
>
> Message: 1
> Date: Mon, 1 Jan 2007 19:38:53 +0100
> From: "Thomas Geiger" <tom.geiger <at> gmail.com>
> Subject: Approaching XML import/export
> To: octave-maintainers <at> octave.org
> Message-ID:
> 	<32edb7f60701011038t3ef686a0ic8b4465c25b4a62b <at> mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hello list members,
>
>
> first let me introduce myself quickly - my name is Thomas Geiger, currently
> a CS student at the Vorarlberg University of Applied Sciences (
> http://www.fhv.at).
>
> By begin of February I'll start working on my diploma thesis which aims to
> integrate GNU Octave into a grid environment (based on Globus Toolkit -
> http://www.globus.org/toolkit/) and - as you could imagine - this road map
> might also include XML support (read/write) for Octave.
>
> Just my two cents on XML - after having taken a look at the XML threads of
> this list, my favorite approach is 6 (a custom written parser,
> http://wiki.octave.org/wiki.pl?XML-tools-for-Octave).<http://wiki.octave.org/wiki.pl?XML-tools-for-Octave>The
> proposed solution would make use of a well performing parser like
> expat
> (benchmarks neet to be done on this choice), and follow 4 (geodise toolbox)
> from a functionality point of view.  For an initial version I'd suggest to
> stick on a Octave only format (validated by XSD), the import of other
> formats/standards (also MatLab?) could be handled by usage of XSLT
> transformations/further hacks later on (hopefully).
>
> Important for me to know - is already someone working on this, otherwise I'd
> like to - of course there needs to be some more detailed negotiation
> regarding the features.
>
>   

Hello Tom,

If you read http://wiki.octave.org/wiki.pl?XML-tools-for-Octave , you 
see that Andy Adler was working on an expat-based approach, too. [10]. 
He posted a first version here
http://www.cae.wisc.edu/pipermail/octave-maintainers/2006-June/000315.html

I recommend reading the following discussion. Andy had also some more 
ideas about the output format
see here:  
http://www.cae.wisc.edu/pipermail/octave-maintainers/2006-June/000379.html
I do not know whether the latest version of Andy's approach is somewhere 
available.

Andy, what is the status of your approach?

Alois

<mailto:octave-maintainers%40octave.org?Subject=XML%20tools%20for%20Octave&In-Reply-To=Pine.LNX.4.64.0606291320570.6572%40denney.homeip.net>

michael.goffioul | 3 Jan 2007 15:52
Picon

RE: Re: Sparse matrix problem

> Ok, this was a lot more work than I though it would be, but here is the
> patch. Basically it allows scalars to be stored in a sparse matrix
> container and to be treated as if they were scalars. This is necessary
> as Mathworks chose the path of letting the user store scalars as sparse
> matrices rather than automatically reconverting these to scalars. In any
> case the attached patch makes octave matlab compatible for scalars
> stored as sparse matrices for all operators...
 
But it does not solve the fact that (note element-wise division):
 
[1+i 2-i] ./ [0 0-i]
 
gives under Octave
 
[NaN + NaNi     1 +   2i]
 
and under Matlab
 
[Inf +    Infi   1.0000 + 2.0000i]
 
Does it?
 
Michael.
 

michael.goffioul | 3 Jan 2007 16:48
Picon

Patch: async "system" under Win32

The attached patch implements async "system" under plain Win32.
 
Michael.
 



Attachment (oct-system-async.diff): application/octet-stream, 1420 bytes
David Bateman | 3 Jan 2007 12:57

Re: Sparse matrix problem

David Bateman wrote:
>
> With octave 2.9.9+ I get
>
> octave:1> sparse(1+i)/sparse(0)
> warning: matrix singular to machine precision, rcond = 0
> warning: attempting to find minimum norm solution
> ans = 0
> octave:2> (1+i)/0
> warning: division by zero
> ans = NaN - NaNi
> octave:3> (1+i)/0
> warning: division by zero
> ans = NaN - NaNi
> octave:4> 1/0
> warning: division by zero
> ans = Inf
>
>
> with matlab R2006b I get
>
> >> 1/0
> Warning: Divide by zero.
>
> ans =
>
>   Inf
>
> >> (1+1i)/0
> Warning: Divide by zero.
>
> ans =
>
>      Inf +    Infi
>
> >> sparse(1+1i)/sparse(0)
> Warning: Divide by zero.
>
> ans =
>
>   (1,1)         Inf +    Infi
>
> I believe the (1+1i)/0 issue is the fault of my c++ complex class
> implementation and not in octave at all. However, the sparse issue is
> different. The problem here is there is no sparse scalar class (it
> doesn't make sense), and so the standard matrix "/" operator is used.
> So I'm get the answer back from CXSparse's QR solver. To get this
> right will need care to be taken in the "\" and "/" operator that the
> size of the sparse matrix passed isn't in fact a scalar, and if it is
> to convert to scalar before the operators. However if we do that, then
> something like "speye(5)*sparse(2)" should also be valid and in fact
> is in matlab. This is a bit of a mess and easier would be to have
> "sparse(2)" return a scalar rather than a sparse matrix, though that
> will break other things.
>
> I'll make a possible patch for consideration, but there are lots of
> files to touch to get this right..

Ok, this was a lot more work than I though it would be, but here is the
patch. Basically it allows scalars to be stored in a sparse matrix
container and to be treated as if they were scalars. This is necessary
as Mathworks chose the path of letting the user store scalars as sparse
matrices rather than automatically reconverting these to scalars. In any
case the attached patch makes octave matlab compatible for scalars
stored as sparse matrices for all operators...

D.

-- 
David Bateman                                David.Bateman <at> motorola.com
Motorola Labs - Paris                        +33 1 69 35 48 04 (Ph) 
Parc Les Algorithmes, Commune de St Aubin    +33 6 72 01 06 33 (Mob) 
91193 Gif-Sur-Yvette FRANCE                  +33 1 69 35 77 01 (Fax) 

The information contained in this communication has been classified as: 

[x] General Business Information 
[ ] Motorola Internal Use Only 
[ ] Motorola Confidential Proprietary

*** ./liboctave/MSparse.cc.orig17	2007-01-02 23:28:38.156693217 +0100
--- ./liboctave/MSparse.cc	2007-01-03 11:30:08.717350882 +0100
***************
*** 288,294 ****
      octave_idx_type b_nr = b.rows (); \
      octave_idx_type b_nc = b.cols (); \
   \
!     if (a_nr != b_nr || a_nc != b_nc) \
        gripe_nonconformant ("operator " # OP, a_nr, a_nc, b_nr, b_nc); \
      else \
        { \
--- 288,336 ----
      octave_idx_type b_nr = b.rows (); \
      octave_idx_type b_nc = b.cols (); \
   \
!     if (a_nr == 1 && a_nc == 1) \
!       { \
!         if (a.elem(0,0) == 0.) \
!           r = MSparse<T> (b); \
!         else \
!           { \
! 	    r = MSparse<T> (b_nr, b_nc, a.data(0) OP 0.); \
!             \
!             for (octave_idx_type j = 0 ; j < b_nc ; j++) \
!               { \
!                 OCTAVE_QUIT; \
!                 octave_idx_type idxj = j * b_nr; \
!                 for (octave_idx_type i = b.cidx(j) ; i < b.cidx(j+1) ; i++) \
!                   { \
!                    OCTAVE_QUIT; \
!                    r.data(idxj + b.ridx(i)) = a.data(0) OP b.data(i); \
! 		  } \
!               } \
!             r.maybe_compress (); \
!           } \
!       } \
!     else if (b_nr == 1 && b_nc == 1) \
!       { \
!         if (b.elem(0,0) == 0.) \
!           r = MSparse<T> (a); \
!         else \
!           { \
! 	    r = MSparse<T> (a_nr, a_nc, 0. OP b.data(0)); \
!             \
!             for (octave_idx_type j = 0 ; j < a_nc ; j++) \
!               { \
!                 OCTAVE_QUIT; \
!                 octave_idx_type idxj = j * a_nr; \
!                 for (octave_idx_type i = a.cidx(j) ; i < a.cidx(j+1) ; i++) \
!                   { \
!                     OCTAVE_QUIT; \
!                     r.data(idxj + a.ridx(i)) = a.data(i) OP b.data(0); \
! 		  } \
!               } \
!             r.maybe_compress (); \
!           } \
!       } \
!     else if (a_nr != b_nr || a_nc != b_nc) \
        gripe_nonconformant ("operator " # OP, a_nr, a_nc, b_nr, b_nc); \
      else \
        { \
***************
*** 363,369 ****
      octave_idx_type b_nr = b.rows (); \
      octave_idx_type b_nc = b.cols (); \
   \
!     if (a_nr != b_nr || a_nc != b_nc) \
        gripe_nonconformant (#FCN, a_nr, a_nc, b_nr, b_nc); \
      else \
        { \
--- 405,445 ----
      octave_idx_type b_nr = b.rows (); \
      octave_idx_type b_nc = b.cols (); \
   \
!     if (a_nr == 1 && a_nc == 1) \
!       { \
!         if (a.elem(0,0) == 0.) \
!           r = MSparse<T> (b_nr, b_nc); \
!         else \
!           { \
! 	    r = MSparse<T> (b); \
!             octave_idx_type b_nnz = b.nnz(); \
!             \
!             for (octave_idx_type i = 0 ; i < b_nnz ; i++) \
!               { \
!                 OCTAVE_QUIT; \
!                 r.data (i) = a.data(0) OP r.data(i); \
!               } \
!             r.maybe_compress (); \
!           } \
!       } \
!     else if (b_nr == 1 && b_nc == 1) \
!       { \
!         if (b.elem(0,0) == 0.) \
!           r = MSparse<T> (a_nr, a_nc); \
!         else \
!           { \
! 	    r = MSparse<T> (a); \
!             octave_idx_type a_nnz = a.nnz(); \
!             \
!             for (octave_idx_type i = 0 ; i < a_nnz ; i++) \
!               { \
!                 OCTAVE_QUIT; \
!                 r.data (i) = r.data(i) OP b.data(0); \
!               } \
!             r.maybe_compress (); \
!           } \
!       } \
!     else if (a_nr != b_nr || a_nc != b_nc) \
        gripe_nonconformant (#FCN, a_nr, a_nc, b_nr, b_nc); \
      else \
        { \
***************
*** 429,435 ****
      octave_idx_type b_nr = b.rows (); \
      octave_idx_type b_nc = b.cols (); \
   \
!     if (a_nr != b_nr || a_nc != b_nc) \
        gripe_nonconformant (#FCN, a_nr, a_nc, b_nr, b_nc); \
      else \
        { \
--- 505,567 ----
      octave_idx_type b_nr = b.rows (); \
      octave_idx_type b_nc = b.cols (); \
   \
!     if (a_nr == 1 && a_nc == 1) \
!       { \
!         T val = a.elem (0,0); \
!         T fill = val OP T(); \
!         if (fill == T()) \
!           { \
!             octave_idx_type b_nnz = b.nnz(); \
!             r = MSparse<T> (b); \
!             for (octave_idx_type i = 0 ; i < b_nnz ; i++) \
!               r.data (i) = val OP r.data(i); \
!             r.maybe_compress (); \
!           } \
!         else \
!           { \
!             r = MSparse<T> (b_nr, b_nc, fill); \
!             for (octave_idx_type j = 0 ; j < b_nc ; j++) \
!               { \
!                 OCTAVE_QUIT; \
!                 octave_idx_type idxj = j * b_nr; \
!                 for (octave_idx_type i = b.cidx(j) ; i < b.cidx(j+1) ; i++) \
!                   { \
!                     OCTAVE_QUIT; \
!                     r.data(idxj + b.ridx(i)) = val OP b.data(i); \
! 		  } \
!               } \
!             r.maybe_compress (); \
!           } \
!       } \
!     else if (b_nr == 1 && b_nc == 1) \
!       { \
!         T val = b.elem (0,0); \
!         T fill = T() OP val; \
!         if (fill == T()) \
!           { \
!             octave_idx_type a_nnz = a.nnz(); \
!             r = MSparse<T> (a); \
!             for (octave_idx_type i = 0 ; i < a_nnz ; i++) \
!               r.data (i) = r.data(i) OP val; \
!             r.maybe_compress (); \
!           } \
!         else \
!           { \
!             r = MSparse<T> (a_nr, a_nc, fill); \
!             for (octave_idx_type j = 0 ; j < a_nc ; j++) \
!               { \
!                 OCTAVE_QUIT; \
!                 octave_idx_type idxj = j * a_nr; \
!                 for (octave_idx_type i = a.cidx(j) ; i < a.cidx(j+1) ; i++) \
!                   { \
!                     OCTAVE_QUIT; \
!                     r.data(idxj + a.ridx(i)) = a.data(i) OP val; \
! 		  } \
!               } \
!             r.maybe_compress (); \
!           } \
!       } \
!     else if (a_nr != b_nr || a_nc != b_nc) \
        gripe_nonconformant (#FCN, a_nr, a_nc, b_nr, b_nc); \
      else \
        { \
*** ./liboctave/Sparse-op-defs.h.orig17	2007-01-02 17:31:00.889785383 +0100
--- ./liboctave/Sparse-op-defs.h	2007-01-03 11:44:04.315418044 +0100
***************
*** 24,29 ****
--- 24,30 ----
  #define octave_sparse_op_defs_h 1
  
  #include "Array-util.h"
+ #include "mx-ops.h"
  
  #define SPARSE_BIN_OP_DECL(R, OP, X, Y) \
    extern OCTAVE_API R OP (const X&, const Y&)
***************
*** 473,479 ****
      octave_idx_type m2_nr = m2.rows (); \
      octave_idx_type m2_nc = m2.cols (); \
   \
!     if (m1_nr != m2_nr || m1_nc != m2_nc) \
        gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \
      else \
        { \
--- 474,522 ----
      octave_idx_type m2_nr = m2.rows (); \
      octave_idx_type m2_nc = m2.cols (); \
   \
!     if (m1_nr == 1 && m1_nc == 1) \
!       { \
!         if (m1.elem(0,0) == 0.) \
!           r = R (m2); \
!         else \
!           { \
! 	    r = R (m2_nr, m2_nc, m1.data(0) OP 0.); \
!             \
!             for (octave_idx_type j = 0 ; j < m2_nc ; j++) \
!               { \
!                 OCTAVE_QUIT; \
!                 octave_idx_type idxj = j * m2_nr; \
!                 for (octave_idx_type i = m2.cidx(j) ; i < m2.cidx(j+1) ; i++) \
!                   { \
!                     OCTAVE_QUIT; \
!                     r.data(idxj + m2.ridx(i)) = m1.data(0) OP m2.data(i); \
! 		  } \
!               } \
!             r.maybe_compress (); \
!           } \
!       } \
!     else if (m2_nr == 1 && m2_nc == 1) \
!       { \
!         if (m2.elem(0,0) == 0.) \
!           r = R (m1); \
!         else \
!           { \
! 	    r = R (m1_nr, m1_nc, 0. OP m2.data(0)); \
!             \
!             for (octave_idx_type j = 0 ; j < m1_nc ; j++) \
!               { \
!                 OCTAVE_QUIT; \
!                 octave_idx_type idxj = j * m1_nr; \
!                 for (octave_idx_type i = m1.cidx(j) ; i < m1.cidx(j+1) ; i++) \
!                   { \
!                     OCTAVE_QUIT; \
!                     r.data(idxj + m1.ridx(i)) = m1.data(i) OP m2.data(0); \
! 		  } \
!               } \
!             r.maybe_compress (); \
!           } \
!       } \
!     else if (m1_nr != m2_nr || m1_nc != m2_nc) \
        gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \
      else \
        { \
***************
*** 547,553 ****
      octave_idx_type m2_nr = m2.rows (); \
      octave_idx_type m2_nc = m2.cols (); \
   \
!     if (m1_nr != m2_nr || m1_nc != m2_nc) \
        gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \
      else \
        { \
--- 590,630 ----
      octave_idx_type m2_nr = m2.rows (); \
      octave_idx_type m2_nc = m2.cols (); \
   \
!     if (m1_nr == 1 && m1_nc == 1) \
!       { \
!         if (m1.elem(0,0) == 0.) \
!           r = R (m2_nr, m2_nc); \
!         else \
!           { \
! 	    r = R (m2); \
!             octave_idx_type m2_nnz = m2.nnz(); \
!             \
!             for (octave_idx_type i = 0 ; i < m2_nnz ; i++) \
!               { \
!                 OCTAVE_QUIT; \
!                 r.data (i) = m1.data(0) OP r.data(i); \
!               } \
!             r.maybe_compress (); \
!           } \
!       } \
!     else if (m2_nr == 1 && m2_nc == 1) \
!       { \
!         if (m2.elem(0,0) == 0.) \
!           r = R (m1_nr, m1_nc); \
!         else \
!           { \
! 	    r = R (m1); \
!             octave_idx_type m1_nnz = m1.nnz(); \
!             \
!             for (octave_idx_type i = 0 ; i < m1_nnz ; i++) \
!               { \
!                 OCTAVE_QUIT; \
!                 r.data (i) = r.data(i) OP m2.data(0); \
!               } \
!             r.maybe_compress (); \
!           } \
!       } \
!     else if (m1_nr != m2_nr || m1_nc != m2_nc) \
        gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \
      else \
        { \
***************
*** 611,617 ****
      octave_idx_type m2_nr = m2.rows (); \
      octave_idx_type m2_nc = m2.cols (); \
   \
!     if (m1_nr != m2_nr || m1_nc != m2_nc) \
        gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \
      else \
        { \
--- 688,746 ----
      octave_idx_type m2_nr = m2.rows (); \
      octave_idx_type m2_nc = m2.cols (); \
   \
!     if (m1_nr == 1 && m1_nc == 1) \
!       { \
!         if ((m1.elem (0,0) OP Complex()) == Complex()) \
!           { \
!             octave_idx_type m2_nnz = m2.nnz(); \
!             r = R (m2); \
!             for (octave_idx_type i = 0 ; i < m2_nnz ; i++) \
!               r.data (i) = m1.elem(0,0) OP r.data(i); \
!             r.maybe_compress (); \
!           } \
!         else \
!           { \
!             r = R (m2_nr, m2_nc, m1.elem(0,0) OP Complex ()); \
!             for (octave_idx_type j = 0 ; j < m2_nc ; j++) \
!               { \
!                 OCTAVE_QUIT; \
!                 octave_idx_type idxj = j * m2_nr; \
!                 for (octave_idx_type i = m2.cidx(j) ; i < m2.cidx(j+1) ; i++) \
!                   { \
!                     OCTAVE_QUIT; \
!                     r.data(idxj + m2.ridx(i)) = m1.elem(0,0) OP m2.data(i); \
! 		  } \
!               } \
!             r.maybe_compress (); \
!           } \
!       } \
!     else if (m2_nr == 1 && m2_nc == 1) \
!       { \
!         if ((Complex() OP m1.elem (0,0)) == Complex()) \
!           { \
!             octave_idx_type m1_nnz = m1.nnz(); \
!             r = R (m1); \
!             for (octave_idx_type i = 0 ; i < m1_nnz ; i++) \
!               r.data (i) = r.data(i) OP m2.elem(0,0); \
!             r.maybe_compress (); \
!           } \
!         else \
!           { \
!             r = R (m1_nr, m1_nc, Complex() OP m2.elem(0,0)); \
!             for (octave_idx_type j = 0 ; j < m1_nc ; j++) \
!               { \
!                 OCTAVE_QUIT; \
!                 octave_idx_type idxj = j * m1_nr; \
!                 for (octave_idx_type i = m1.cidx(j) ; i < m1.cidx(j+1) ; i++) \
!                   { \
!                     OCTAVE_QUIT; \
!                     r.data(idxj + m1.ridx(i)) = m1.data(i) OP m2.elem(0,0); \
! 		  } \
!               } \
!             r.maybe_compress (); \
!           } \
!       } \
!     else if (m1_nr != m2_nr || m1_nc != m2_nc) \
        gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \
      else \
        { \
***************
*** 698,704 ****
      octave_idx_type m2_nr = m2.rows (); \
      octave_idx_type m2_nc = m2.cols (); \
      \
!     if (m1_nr == m2_nr && m1_nc == m2_nc) \
        { \
  	if (m1_nr != 0 || m1_nc != 0) \
  	  { \
--- 827,845 ----
      octave_idx_type m2_nr = m2.rows (); \
      octave_idx_type m2_nc = m2.cols (); \
      \
!     if (m1_nr == 1 && m1_nc == 1) \
!       { \
!         extern OCTAVE_API SparseBoolMatrix F (const double&, const M2&); \
!         extern OCTAVE_API SparseBoolMatrix F (const Complex&, const M2&); \
!         r = F (m1.elem(0,0), m2); \
!       } \
!     else if (m2_nr == 1 && m2_nc == 1) \
!       { \
!         extern OCTAVE_API SparseBoolMatrix F (const M1&, const double&); \
!         extern OCTAVE_API SparseBoolMatrix F (const M1&, const Complex&); \
!         r = F (m1, m2.elem(0,0)); \
!       } \
!     else if (m1_nr == m2_nr && m1_nc == m2_nc) \
        { \
  	if (m1_nr != 0 || m1_nc != 0) \
  	  { \
***************
*** 764,770 ****
      octave_idx_type m2_nr = m2.rows (); \
      octave_idx_type m2_nc = m2.cols (); \
      \
!     if (m1_nr == m2_nr && m1_nc == m2_nc) \
        { \
  	if (m1_nr != 0 || m1_nc != 0) \
  	  { \
--- 905,923 ----
      octave_idx_type m2_nr = m2.rows (); \
      octave_idx_type m2_nc = m2.cols (); \
      \
!     if (m1_nr == 1 && m1_nc == 1) \
!       { \
!         extern OCTAVE_API SparseBoolMatrix F (const double&, const M2&); \
!         extern OCTAVE_API SparseBoolMatrix F (const Complex&, const M2&); \
!         r = F (m1.elem(0,0), m2); \
!       } \
!     else if (m2_nr == 1 && m2_nc == 1) \
!       { \
!         extern OCTAVE_API SparseBoolMatrix F (const M1&, const double&); \
!         extern OCTAVE_API SparseBoolMatrix F (const M1&, const Complex&); \
!         r = F (m1, m2.elem(0,0)); \
!       } \
!     else if (m1_nr == m2_nr && m1_nc == m2_nc) \
        { \
  	if (m1_nr != 0 || m1_nc != 0) \
  	  { \
***************
*** 836,842 ****
      octave_idx_type m2_nr = m2.rows (); \
      octave_idx_type m2_nc = m2.cols (); \
   \
!     if (m1_nr != m2_nr || m1_nc != m2_nc) \
        gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \
      else \
        { \
--- 989,997 ----
      octave_idx_type m2_nr = m2.rows (); \
      octave_idx_type m2_nc = m2.cols (); \
   \
!     if (m2_nr == 1 && m2_nc == 1) \
!       r = R (m1 OP m2.elem(0,0)); \
!     else if (m1_nr != m2_nr || m1_nc != m2_nc) \
        gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \
      else \
        { \
***************
*** 861,867 ****
      octave_idx_type m2_nr = m2.rows (); \
      octave_idx_type m2_nc = m2.cols (); \
   \
!     if (m1_nr != m2_nr || m1_nc != m2_nc) \
        gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \
      else \
        { \
--- 1016,1024 ----
      octave_idx_type m2_nr = m2.rows (); \
      octave_idx_type m2_nc = m2.cols (); \
   \
!     if (m2_nr == 1 && m2_nc == 1) \
!       r = R (m1 OP m2.elem(0,0)); \
!     else if (m1_nr != m2_nr || m1_nc != m2_nc) \
        gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \
      else \
        { \
***************
*** 924,930 ****
      octave_idx_type m2_nr = m2.rows (); \
      octave_idx_type m2_nc = m2.cols (); \
      \
!     if (m1_nr == m2_nr && m1_nc == m2_nc) \
        { \
  	if (m1_nr != 0 || m1_nc != 0) \
  	  { \
--- 1081,1089 ----
      octave_idx_type m2_nr = m2.rows (); \
      octave_idx_type m2_nc = m2.cols (); \
      \
!     if (m2_nr == 1 && m2_nc == 1) \
!       r = SparseBoolMatrix (F (m1, m2.elem(0,0))); \
!     else if (m1_nr == m2_nr && m1_nc == m2_nc) \
        { \
  	if (m1_nr != 0 || m1_nc != 0) \
  	  { \
***************
*** 990,996 ****
      octave_idx_type m2_nr = m2.rows (); \
      octave_idx_type m2_nc = m2.cols (); \
      \
!     if (m1_nr == m2_nr && m1_nc == m2_nc) \
        { \
  	if (m1_nr != 0 || m1_nc != 0) \
  	  { \
--- 1149,1157 ----
      octave_idx_type m2_nr = m2.rows (); \
      octave_idx_type m2_nc = m2.cols (); \
      \
!     if (m2_nr == 1 && m2_nc == 1) \
!       r = SparseBoolMatrix  (F (m1, m2.elem(0,0))); \
!     else if (m1_nr == m2_nr && m1_nc == m2_nc) \
        { \
  	if (m1_nr != 0 || m1_nc != 0) \
  	  { \
***************
*** 1062,1068 ****
      octave_idx_type m2_nr = m2.rows (); \
      octave_idx_type m2_nc = m2.cols (); \
   \
!     if (m1_nr != m2_nr || m1_nc != m2_nc) \
        gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \
      else \
        { \
--- 1223,1231 ----
      octave_idx_type m2_nr = m2.rows (); \
      octave_idx_type m2_nc = m2.cols (); \
   \
!     if (m1_nr == 1 && m1_nc == 1) \
!       r = R (m1.elem(0,0) OP m2); \
!     else if (m1_nr != m2_nr || m1_nc != m2_nc) \
        gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \
      else \
        { \
***************
*** 1087,1093 ****
      octave_idx_type m2_nr = m2.rows (); \
      octave_idx_type m2_nc = m2.cols (); \
   \
!     if (m1_nr != m2_nr || m1_nc != m2_nc) \
        gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \
      else \
        { \
--- 1250,1258 ----
      octave_idx_type m2_nr = m2.rows (); \
      octave_idx_type m2_nc = m2.cols (); \
   \
!     if (m1_nr == 1 && m1_nc == 1) \
!       r = R (m1.elem(0,0) OP m2); \
!     else if (m1_nr != m2_nr || m1_nc != m2_nc) \
        gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \
      else \
        { \
***************
*** 1150,1156 ****
      octave_idx_type m2_nr = m2.rows (); \
      octave_idx_type m2_nc = m2.cols (); \
      \
!     if (m1_nr == m2_nr && m1_nc == m2_nc) \
        { \
  	if (m1_nr != 0 || m1_nc != 0) \
  	  { \
--- 1315,1323 ----
      octave_idx_type m2_nr = m2.rows (); \
      octave_idx_type m2_nc = m2.cols (); \
      \
!     if (m1_nr == 1 && m1_nc == 1) \
!       r = SparseBoolMatrix (F (m1.elem(0,0), m2)); \
!     else if (m1_nr == m2_nr && m1_nc == m2_nc) \
        { \
  	if (m1_nr != 0 || m1_nc != 0) \
  	  { \
***************
*** 1216,1222 ****
      octave_idx_type m2_nr = m2.rows (); \
      octave_idx_type m2_nc = m2.cols (); \
      \
!     if (m1_nr == m2_nr && m1_nc == m2_nc) \
        { \
  	if (m1_nr != 0 || m1_nc != 0) \
  	  { \
--- 1383,1391 ----
      octave_idx_type m2_nr = m2.rows (); \
      octave_idx_type m2_nc = m2.cols (); \
      \
!     if (m1_nr == 1 && m1_nc == 1) \
!       r = SparseBoolMatrix (F (m1.elem(0,0), m2)); \
!     else if (m1_nr == m2_nr && m1_nc == m2_nc) \
        { \
  	if (m1_nr != 0 || m1_nc != 0) \
  	  { \
***************
*** 1540,1546 ****
    octave_idx_type a_nr = a.rows (); \
    octave_idx_type a_nc = a.cols (); \
    \
!   if (nc != a_nr) \
      { \
        gripe_nonconformant ("operator *", nr, nc, a_nr, a_nc); \
        return RET_TYPE (); \
--- 1709,1757 ----
    octave_idx_type a_nr = a.rows (); \
    octave_idx_type a_nc = a.cols (); \
    \
!   if (nr == 1 && nc == 1) \
!    { \
!      RET_EL_TYPE s = m.elem(0,0); \
!      octave_idx_type nz = a.nnz(); \
!      RET_TYPE r (a_nr, a_nc, nz); \
!      \
!      for (octave_idx_type i = 0; i < nz; i++) \
!        { \
!          OCTAVE_QUIT; \
! 	 r.data(i) = s * a.data(i); \
! 	 r.ridx(i) = a.ridx(i); \
!        } \
!      for (octave_idx_type i = 0; i < a_nc + 1; i++) \
!        { \
!          OCTAVE_QUIT; \
!          r.cidx(i) = a.cidx(i); \
!        } \
!      \
!      r.maybe_compress (true); \
!      return r; \
!    } \
!   else if (a_nr == 1 && a_nc == 1) \
!    { \
!      RET_EL_TYPE s = a.elem(0,0); \
!      octave_idx_type nz = m.nnz(); \
!      RET_TYPE r (nr, nc, nz); \
!      \
!      for (octave_idx_type i = 0; i < nz; i++) \
!        { \
!          OCTAVE_QUIT; \
! 	 r.data(i) = m.data(i) * s; \
! 	 r.ridx(i) = m.ridx(i); \
!        } \
!      for (octave_idx_type i = 0; i < nc + 1; i++) \
!        { \
!          OCTAVE_QUIT; \
!          r.cidx(i) = m.cidx(i); \
!        } \
!      \
!      r.maybe_compress (true); \
!      return r; \
!    } \
!   else if (nc != a_nr) \
      { \
        gripe_nonconformant ("operator *", nr, nc, a_nr, a_nc); \
        return RET_TYPE (); \
***************
*** 1667,1673 ****
    octave_idx_type a_nr = a.rows (); \
    octave_idx_type a_nc = a.cols (); \
    \
!   if (nc != a_nr) \
      { \
        gripe_nonconformant ("operator *", nr, nc, a_nr, a_nc); \
        return RET_TYPE (); \
--- 1878,1897 ----
    octave_idx_type a_nr = a.rows (); \
    octave_idx_type a_nc = a.cols (); \
    \
!   if (nr == 1 && nc == 1) \
!     { \
!       RET_TYPE retval (a_nr, a_nc, ZERO); \
!       for (octave_idx_type i = 0; i < a_nc ; i++) \
! 	{ \
! 	  for (octave_idx_type j = 0; j < a_nr; j++) \
! 	    { \
!               OCTAVE_QUIT; \
! 	      retval.elem (j,i) += a.elem(j,i) * m.elem(0,0); \
! 	    } \
!         } \
!       return retval; \
!     } \
!   else if (nc != a_nr) \
      { \
        gripe_nonconformant ("operator *", nr, nc, a_nr, a_nc); \
        return RET_TYPE (); \
***************
*** 1697,1703 ****
    octave_idx_type a_nr = a.rows (); \
    octave_idx_type a_nc = a.cols (); \
    \
!   if (nc != a_nr) \
      { \
        gripe_nonconformant ("operator *", nr, nc, a_nr, a_nc); \
        return RET_TYPE (); \
--- 1921,1940 ----
    octave_idx_type a_nr = a.rows (); \
    octave_idx_type a_nc = a.cols (); \
    \
!   if (a_nr == 1 && a_nc == 1) \
!     { \
!       RET_TYPE retval (nr, nc, ZERO); \
!       for (octave_idx_type i = 0; i < nc ; i++) \
! 	{ \
! 	  for (octave_idx_type j = 0; j < nr; j++) \
! 	    { \
!               OCTAVE_QUIT; \
! 	      retval.elem (j,i) += a.elem(0,0) * m.elem(j,i); \
! 	    } \
!         } \
!       return retval; \
!     } \
!   else if (nc != a_nr) \
      { \
        gripe_nonconformant ("operator *", nr, nc, a_nr, a_nc); \
        return RET_TYPE (); \
*** ./src/OPERATORS/op-scm-cm.cc.orig17	2007-01-02 17:31:36.525997450 +0100
--- ./src/OPERATORS/op-scm-cm.cc	2007-01-02 18:07:29.581398528 +0100
***************
*** 67,79 ****
  DEFBINOP (ldiv, sparse_complex_matrix, complex_matrix)
  {
    CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_complex_matrix&);
-   MatrixType typ = v1.matrix_type ();
  
!   ComplexMatrix ret = xleftdiv (v1.sparse_complex_matrix_value (), 
! 				v2.complex_matrix_value (), typ);
! 
!   v1.matrix_type (typ);
!   return ret;
  }
  
  DEFBINOP_FN (lt, sparse_complex_matrix, complex_matrix, mx_el_lt)
--- 67,92 ----
  DEFBINOP (ldiv, sparse_complex_matrix, complex_matrix)
  {
    CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_complex_matrix&);
  
!   if (v1.rows() == 1 && v1.columns() == 1)
!     {
!       Complex d = v1.complex_value ();
! 
!       if (d == 0.0)
! 	gripe_divide_by_zero ();
! 
!       return octave_value (v2.complex_array_value () / d);
!     }
!   else
!     {
!       MatrixType typ = v1.matrix_type ();
! 
!       ComplexMatrix ret = xleftdiv (v1.sparse_complex_matrix_value (), 
! 		      v2.complex_matrix_value (), typ);
! 
!       v1.matrix_type (typ);
!       return ret;
!     }
  }
  
  DEFBINOP_FN (lt, sparse_complex_matrix, complex_matrix, mx_el_lt)
*** ./src/OPERATORS/op-scm-cs.cc.orig17	2007-01-02 17:31:47.967422624 +0100
--- ./src/OPERATORS/op-scm-cs.cc	2007-01-02 17:56:32.885995099 +0100
***************
*** 74,86 ****
  {
    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);
  
!   return ret;
  }
  
  DEFBINOP_FN (lt, sparse_complex_matrix, complex, mx_el_lt)
--- 74,97 ----
  {
    CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_complex&);
  
!   if (v1.rows() == 1 && v1.columns() == 1)
!     {
!       Complex d = v1.complex_value ();
! 
!       if (d == 0.0)
! 	gripe_divide_by_zero ();
  
!       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)
*** ./src/OPERATORS/op-scm-m.cc.orig17	2007-01-02 17:32:05.730529445 +0100
--- ./src/OPERATORS/op-scm-m.cc	2007-01-02 17:58:28.309121529 +0100
***************
*** 69,81 ****
  {
    CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_matrix&);
    
!   MatrixType typ = v1.matrix_type ();
! 
!   ComplexMatrix ret = xleftdiv (v1.sparse_complex_matrix_value (), 
! 				v2.matrix_value (), typ);
! 
!   v1.matrix_type (typ);
!   return ret;
  }
  
  DEFBINOP_FN (lt, sparse_complex_matrix, matrix, mx_el_lt)
--- 69,93 ----
  {
    CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_matrix&);
    
!   if (v1.rows() == 1 && v1.columns() == 1)
!     {
!       Complex d = v1.complex_value ();
! 
!       if (d == 0.0)
! 	gripe_divide_by_zero ();
! 
!       return octave_value (v2.array_value () / d);
!     }
!   else
!     {
!       MatrixType typ = v1.matrix_type ();
! 
!       ComplexMatrix ret = xleftdiv (v1.sparse_complex_matrix_value (), 
! 				    v2.matrix_value (), typ);
! 
!       v1.matrix_type (typ);
!       return ret;
!     }
  }
  
  DEFBINOP_FN (lt, sparse_complex_matrix, matrix, mx_el_lt)
*** ./src/OPERATORS/op-scm-scm.cc.orig17	2007-01-02 18:03:43.968987419 +0100
--- ./src/OPERATORS/op-scm-scm.cc	2007-01-02 18:03:29.966705168 +0100
***************
*** 97,108 ****
  {
    CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, 
  		   const octave_sparse_complex_matrix&);
!   MatrixType typ = v2.matrix_type ();
!   SparseComplexMatrix ret = xdiv (v1.sparse_complex_matrix_value (), 
! 				  v2.sparse_complex_matrix_value (), typ);
    
!   v2.matrix_type (typ);
!   return ret;
  }
  
  DEFBINOPX (pow, sparse_complex_matrix, sparse_complex_matrix)
--- 97,121 ----
  {
    CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, 
  		   const octave_sparse_complex_matrix&);
!  
!   if (v2.rows() == 1 && v2.columns() == 1)
!     {
!       Complex d = v2.complex_value ();
! 
!       if (d == 0.0)
! 	gripe_divide_by_zero ();
! 
!       return octave_value (v1.sparse_complex_matrix_value () / d);
!     }
!   else
!     {
!       MatrixType typ = v2.matrix_type ();
!       SparseComplexMatrix ret = xdiv (v1.sparse_complex_matrix_value (), 
! 				      v2.sparse_complex_matrix_value (), typ);
    
!       v2.matrix_type (typ);
!       return ret;
!     }
  }
  
  DEFBINOPX (pow, sparse_complex_matrix, sparse_complex_matrix)
***************
*** 115,127 ****
  {
    CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, 
  		   const octave_sparse_complex_matrix&);
-   MatrixType typ = v1.matrix_type ();
- 
-   SparseComplexMatrix ret = xleftdiv (v1.sparse_complex_matrix_value (), 
- 				      v2.sparse_complex_matrix_value (), typ);
  
!   v1.matrix_type (typ);
!   return ret;
  }
  
  DEFBINOP_FN (lt, sparse_complex_matrix, sparse_complex_matrix, mx_el_lt)
--- 128,154 ----
  {
    CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, 
  		   const octave_sparse_complex_matrix&);
  
!   if (v1.rows() == 1 && v1.columns() == 1)
!     {
!       Complex d = v1.complex_value ();
! 
!       if (d == 0.0)
! 	gripe_divide_by_zero ();
! 
!       return octave_value (v2.sparse_complex_matrix_value () / d);
!     }
!   else
!     {
!       MatrixType typ = v1.matrix_type ();
! 
!       SparseComplexMatrix ret = 
! 	xleftdiv (v1.sparse_complex_matrix_value (), 
! 		  v2.sparse_complex_matrix_value (), typ);
! 
!       v1.matrix_type (typ);
!       return ret;
!     }
  }
  
  DEFBINOP_FN (lt, sparse_complex_matrix, sparse_complex_matrix, mx_el_lt)
*** ./src/OPERATORS/op-sm-cs.cc.orig17	2007-01-02 18:14:12.325609106 +0100
--- ./src/OPERATORS/op-sm-cs.cc	2007-01-02 18:13:30.316783120 +0100
***************
*** 74,86 ****
  {
    CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_complex&);
  
!   MatrixType typ = v1.matrix_type ();
!   SparseMatrix m1 = v1.sparse_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_matrix, complex, mx_el_lt)
--- 74,97 ----
  {
    CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_complex&);
  
!   if (v1.rows() == 1 && v1.columns() == 1)
!     {
!       double d = v1.scalar_value ();
! 
!       if (d == 0.0)
! 	gripe_divide_by_zero ();
  
!       return octave_value (v2.complex_value () / d);
!     }
!   else
!     {
!       MatrixType typ = v1.matrix_type ();
!       SparseMatrix m1 = v1.sparse_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_matrix, complex, mx_el_lt)
*** ./src/OPERATORS/op-sm-cm.cc.orig17	2007-01-02 18:12:46.489049958 +0100
--- ./src/OPERATORS/op-sm-cm.cc	2007-01-02 18:12:33.206736670 +0100
***************
*** 67,79 ****
  DEFBINOP (ldiv, sparse_matrix, complex_matrix)
  {
    CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_complex_matrix&);
-   MatrixType typ = v1.matrix_type ();
  
!   ComplexMatrix ret = xleftdiv (v1.sparse_matrix_value (), 
! 				v2.complex_matrix_value (), typ);
! 
!   v1.matrix_type (typ);
!   return ret;
  }
  
  DEFBINOP_FN (lt, sparse_matrix, complex_matrix, mx_el_lt)
--- 67,92 ----
  DEFBINOP (ldiv, sparse_matrix, complex_matrix)
  {
    CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_complex_matrix&);
  
!   if (v1.rows() == 1 && v1.columns() == 1)
!     {
!       double d = v1.scalar_value ();
! 
!       if (d == 0.0)
! 	gripe_divide_by_zero ();
! 
!       return octave_value (v2.complex_array_value () / d);
!     }
!   else
!     {
!       MatrixType typ = v1.matrix_type ();
! 
!       ComplexMatrix ret = xleftdiv (v1.sparse_matrix_value (), 
! 				    v2.complex_matrix_value (), typ);
! 
!       v1.matrix_type (typ);
!       return ret;
!     }
  }
  
  DEFBINOP_FN (lt, sparse_matrix, complex_matrix, mx_el_lt)
*** ./src/OPERATORS/op-sm-m.cc.orig17	2007-01-02 18:15:06.171820744 +0100
--- ./src/OPERATORS/op-sm-m.cc	2007-01-02 18:14:55.049396863 +0100
***************
*** 65,77 ****
  DEFBINOP (ldiv, sparse_matrix, matrix)
  {
    CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_matrix&);
-   MatrixType typ = v1.matrix_type ();
  
!   Matrix ret = xleftdiv (v1.sparse_matrix_value (), 
! 			       v2.matrix_value (), typ);
! 
!   v1.matrix_type (typ);
!   return ret;
  }
  
  DEFBINOP_FN (lt, sparse_matrix, matrix, mx_el_lt)
--- 65,90 ----
  DEFBINOP (ldiv, sparse_matrix, matrix)
  {
    CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_matrix&);
  
!   if (v1.rows() == 1 && v1.columns() == 1)
!     {
!       double d = v1.scalar_value ();
! 
!       if (d == 0.0)
! 	gripe_divide_by_zero ();
! 
!       return octave_value (v2.array_value () / d);
!     }
!   else
!     {
!       MatrixType typ = v1.matrix_type ();
! 
!       Matrix ret = xleftdiv (v1.sparse_matrix_value (), 
! 			     v2.matrix_value (), typ);
! 
!       v1.matrix_type (typ);
!       return ret;
!     }
  }
  
  DEFBINOP_FN (lt, sparse_matrix, matrix, mx_el_lt)
*** ./src/OPERATORS/op-sm-sm.cc.orig17	2007-01-02 18:39:04.367168034 +0100
--- ./src/OPERATORS/op-sm-sm.cc	2007-01-02 18:38:52.219775823 +0100
***************
*** 57,68 ****
  DEFBINOP (div, sparse_matrix, sparse_matrix)
  {
    CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_sparse_matrix&);
!   MatrixType typ = v2.matrix_type ();
!   SparseMatrix ret = xdiv (v1.sparse_matrix_value (), 
! 			   v2.sparse_matrix_value (), typ);
    
!   v2.matrix_type (typ);
!   return ret;
  }
  
  DEFBINOPX (pow, sparse_matrix, sparse_matrix)
--- 57,81 ----
  DEFBINOP (div, sparse_matrix, sparse_matrix)
  {
    CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_sparse_matrix&);
! 
!   if (v2.rows() == 1 && v2.columns() == 1)
!     {
!       double d = v2.scalar_value ();
! 
!       if (d == 0.0)
! 	gripe_divide_by_zero ();
! 
!       return octave_value (v1.sparse_matrix_value () / d);
!     }
!   else
!     {
!       MatrixType typ = v2.matrix_type ();
!       SparseMatrix ret = xdiv (v1.sparse_matrix_value (), 
! 			       v2.sparse_matrix_value (), typ);
    
!       v2.matrix_type (typ);
!       return ret;
!     }
  }
  
  DEFBINOPX (pow, sparse_matrix, sparse_matrix)
***************
*** 74,86 ****
  DEFBINOP (ldiv, sparse_matrix, sparse_matrix)
  {
    CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_sparse_matrix&);
-   MatrixType typ = v1.matrix_type ();
- 
-   SparseMatrix ret = xleftdiv (v1.sparse_matrix_value (), 
- 			       v2.sparse_matrix_value (), typ);
  
!   v1.matrix_type (typ);
!   return ret;
  }
  
  DEFBINOP_FN (lt, sparse_matrix, sparse_matrix, mx_el_lt)
--- 87,112 ----
  DEFBINOP (ldiv, sparse_matrix, sparse_matrix)
  {
    CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_sparse_matrix&);
  
!   if (v1.rows() == 1 && v1.columns() == 1)
!     {
!       double d = v1.double_value ();
! 
!       if (d == 0.0)
! 	gripe_divide_by_zero ();
! 
!       return octave_value (v2.sparse_matrix_value () / d);
!     }
!   else
!     {
!       MatrixType typ = v1.matrix_type ();
! 
!       SparseMatrix ret = xleftdiv (v1.sparse_matrix_value (), 
! 				   v2.sparse_matrix_value (), typ);
! 
!       v1.matrix_type (typ);
!       return ret;
!     }
  }
  
  DEFBINOP_FN (lt, sparse_matrix, sparse_matrix, mx_el_lt)
*** ./src/OPERATORS/op-sm-s.cc.orig17	2007-01-02 18:21:16.783138825 +0100
--- ./src/OPERATORS/op-sm-s.cc	2007-01-02 18:20:55.722204683 +0100
***************
*** 76,88 ****
  {
    CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_scalar&);
  
!   MatrixType typ = v1.matrix_type ();
!   SparseMatrix m1 = v1.sparse_matrix_value ();
!   Matrix m2 = Matrix (1, 1, v2.scalar_value ());
!   Matrix ret = xleftdiv (m1, m2, typ);
!   v1.matrix_type (typ);
  
!   return ret;
  }
  
  DEFBINOP_FN (lt, sparse_matrix, scalar, mx_el_lt)
--- 76,99 ----
  {
    CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_scalar&);
  
!   if (v1.rows() == 1 && v1.columns() == 1)
!     {
!       double d = v1.scalar_value ();
! 
!       if (d == 0.0)
! 	gripe_divide_by_zero ();
  
!       return octave_value (v2.scalar_value () / d);
!     }
!   else
!     {
!       MatrixType typ = v1.matrix_type ();
!       SparseMatrix m1 = v1.sparse_matrix_value ();
!       Matrix m2 = Matrix (1, 1, v2.scalar_value ());
!       Matrix ret = xleftdiv (m1, m2, typ);
!       v1.matrix_type (typ);
!       return ret;
!     }
  }
  
  DEFBINOP_FN (lt, sparse_matrix, scalar, mx_el_lt)
*** ./src/OPERATORS/op-sm-scm.cc.orig17	2007-01-02 18:23:10.734362560 +0100
--- ./src/OPERATORS/op-sm-scm.cc	2007-01-02 18:22:57.177050604 +0100
***************
*** 47,58 ****
  DEFBINOP (div, sparse_matrix, sparse_complex_matrix)
  {
    CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_sparse_complex_matrix&);
!   MatrixType typ = v2.matrix_type ();
!   SparseComplexMatrix ret = xdiv (v1.sparse_matrix_value (), 
  				  v2.sparse_complex_matrix_value (), typ);
    
!   v2.matrix_type (typ);
!   return ret;
  }
  
  DEFBINOPX (pow, sparse_matrix, sparse_complex_matrix)
--- 47,71 ----
  DEFBINOP (div, sparse_matrix, sparse_complex_matrix)
  {
    CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_sparse_complex_matrix&);
! 
!   if (v2.rows() == 1 && v2.columns() == 1)
!     {
!       Complex d = v2.complex_value ();
! 
!       if (d == 0.0)
! 	gripe_divide_by_zero ();
! 
!       return octave_value (v1.sparse_matrix_value () / d);
!     }
!   else
!     {
!       MatrixType typ = v2.matrix_type ();
!       SparseComplexMatrix ret = xdiv (v1.sparse_matrix_value (), 
  				  v2.sparse_complex_matrix_value (), typ);
    
!       v2.matrix_type (typ);
!       return ret;
!     }
  }
  
  DEFBINOPX (pow, sparse_matrix, sparse_complex_matrix)
***************
*** 64,76 ****
  DEFBINOP (ldiv, sparse_matrix, sparse_complex_matrix)
  {
    CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_sparse_complex_matrix&);
-   MatrixType typ = v1.matrix_type ();
- 
-   SparseComplexMatrix ret = xleftdiv (v1.sparse_matrix_value (), 
- 				      v2.sparse_complex_matrix_value (), typ);
  
!   v1.matrix_type (typ);
!   return ret;
  }
  
  DEFBINOP_FN (lt, sparse_matrix, sparse_complex_matrix, mx_el_lt)
--- 77,103 ----
  DEFBINOP (ldiv, sparse_matrix, sparse_complex_matrix)
  {
    CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_sparse_complex_matrix&);
  
!   if (v1.rows() == 1 && v1.columns() == 1)
!     {
!       double d = v1.scalar_value ();
! 
!       if (d == 0.0)
! 	gripe_divide_by_zero ();
! 
!       return octave_value (v2.sparse_complex_matrix_value () / d);
!     }
!   else
!     {
!       MatrixType typ = v1.matrix_type ();
! 
!       SparseComplexMatrix ret = 
! 	xleftdiv (v1.sparse_matrix_value (), 
! 		  v2.sparse_complex_matrix_value (), typ);
! 
!       v1.matrix_type (typ);
!       return ret;
!     }
  }
  
  DEFBINOP_FN (lt, sparse_matrix, sparse_complex_matrix, mx_el_lt)
*** ./src/OPERATORS/op-s-scm.cc.orig17	2007-01-02 18:40:01.142322030 +0100
--- ./src/OPERATORS/op-s-scm.cc	2007-01-02 18:39:49.859888273 +0100
***************
*** 50,62 ****
  {
    CAST_BINOP_ARGS (const octave_scalar&, const octave_sparse_complex_matrix&);
  
!   MatrixType typ = v2.matrix_type ();
!   Matrix m1 = Matrix (1, 1, v1.scalar_value ());
!   SparseComplexMatrix m2 = v2.sparse_complex_matrix_value ();
!   ComplexMatrix ret = xdiv (m1, m2, typ);
!   v2.matrix_type (typ);
  
!   return ret;
  }
  
  DEFBINOP (pow, scalar, sparse_complex_matrix)
--- 50,73 ----
  {
    CAST_BINOP_ARGS (const octave_scalar&, const octave_sparse_complex_matrix&);
  
!   if (v2.rows() == 1 && v2.columns() == 1)
!     {
!       Complex d = v2.complex_value ();
! 
!       if (d == 0.0)
! 	gripe_divide_by_zero ();
  
!       return octave_value (v1.scalar_value () / d);
!     }
!   else
!     {
!       MatrixType typ = v2.matrix_type ();
!       Matrix m1 = Matrix (1, 1, v1.scalar_value ());
!       SparseComplexMatrix m2 = v2.sparse_complex_matrix_value ();
!       ComplexMatrix ret = xdiv (m1, m2, typ);
!       v2.matrix_type (typ);
!       return ret;
!     }
  }
  
  DEFBINOP (pow, scalar, sparse_complex_matrix)
*** ./src/OPERATORS/op-s-sm.cc.orig17	2007-01-02 18:40:45.452095048 +0100
--- ./src/OPERATORS/op-s-sm.cc	2007-01-02 18:40:36.762532172 +0100
***************
*** 46,58 ****
  {
    CAST_BINOP_ARGS (const octave_scalar&, const octave_sparse_matrix&);
  
!   MatrixType typ = v2.matrix_type ();
!   Matrix m1 = Matrix (1, 1, v1.double_value ());
!   SparseMatrix m2 = v2.sparse_matrix_value ();
!   Matrix ret = xdiv (m1, m2, typ);
!   v2.matrix_type (typ);
  
!   return ret;
  }
  
  DEFBINOP (pow, scalar, sparse_matrix)
--- 46,69 ----
  {
    CAST_BINOP_ARGS (const octave_scalar&, const octave_sparse_matrix&);
  
!   if (v2.rows() == 1 && v2.columns() == 1)
!     {
!       double d = v2.scalar_value ();
! 
!       if (d == 0.0)
! 	gripe_divide_by_zero ();
  
!       return octave_value (v1.scalar_value () / d);
!     }
!   else
!     {
!       MatrixType typ = v2.matrix_type ();
!       Matrix m1 = Matrix (1, 1, v1.double_value ());
!       SparseMatrix m2 = v2.sparse_matrix_value ();
!       Matrix ret = xdiv (m1, m2, typ);
!       v2.matrix_type (typ);
!       return ret;
!     }
  }
  
  DEFBINOP (pow, scalar, sparse_matrix)
*** ./src/OPERATORS/op-cs-scm.cc.orig17	2007-01-02 17:57:20.685564503 +0100
--- ./src/OPERATORS/op-cs-scm.cc	2007-01-02 17:57:06.586281715 +0100
***************
*** 47,59 ****
  {
    CAST_BINOP_ARGS (const octave_complex&, const octave_sparse_complex_matrix&);
  
!   MatrixType typ = v2.matrix_type ();
!   ComplexMatrix m1 = ComplexMatrix (1, 1, v1.complex_value ());
!   SparseComplexMatrix m2 = v2.sparse_complex_matrix_value ();
!   ComplexMatrix ret = xdiv (m1, m2, typ);
!   v2.matrix_type (typ);
  
!   return ret;
  }
  
  DEFBINOP (pow, complex, sparse_complex_matrix)
--- 47,70 ----
  {
    CAST_BINOP_ARGS (const octave_complex&, const octave_sparse_complex_matrix&);
  
!   if (v2.rows() == 1 && v2.columns() == 1)
!     {
!       Complex d = v2.complex_value ();
! 
!       if (d == 0.0)
! 	gripe_divide_by_zero ();
  
!       return octave_value (v1.complex_value () / d);
!     }
!   else
!     {
!       MatrixType typ = v2.matrix_type ();
!       ComplexMatrix m1 = ComplexMatrix (1, 1, v1.complex_value ());
!       SparseComplexMatrix m2 = v2.sparse_complex_matrix_value ();
!       ComplexMatrix ret = xdiv (m1, m2, typ);
!       v2.matrix_type (typ);
!       return ret;
!     }
  }
  
  DEFBINOP (pow, complex, sparse_complex_matrix)
*** ./src/OPERATORS/op-cs-sm.cc.orig17	2007-01-02 17:58:05.269295136 +0100
--- ./src/OPERATORS/op-cs-sm.cc	2007-01-02 18:06:39.446977560 +0100
***************
*** 49,61 ****
  {
    CAST_BINOP_ARGS (const octave_complex&, const octave_sparse_matrix&);
  
!   MatrixType typ = v2.matrix_type ();
!   ComplexMatrix m1 = ComplexMatrix (1, 1, v1.complex_value ());
!   SparseMatrix m2 = v2.sparse_matrix_value ();
!   ComplexMatrix ret = xdiv (m1, m2, typ);
!   v2.matrix_type (typ);
  
!   return ret;
  }
  
  DEFBINOP (pow, complex, sparse_matrix)
--- 49,72 ----
  {
    CAST_BINOP_ARGS (const octave_complex&, const octave_sparse_matrix&);
  
!   if (v2.rows() == 1 && v2.columns() == 1)
!     {
!       double d = v2.scalar_value ();
! 
!       if (d == 0.0)
! 	gripe_divide_by_zero ();
  
!       return octave_value (v1.complex_value () / d);
!     }
!   else
!     {
!       MatrixType typ = v2.matrix_type ();
!       ComplexMatrix m1 = ComplexMatrix (1, 1, v1.complex_value ());
!       SparseMatrix m2 = v2.sparse_matrix_value ();
!       ComplexMatrix ret = xdiv (m1, m2, typ);
!       v2.matrix_type (typ);
!       return ret;
!     }
  }
  
  DEFBINOP (pow, complex, sparse_matrix)
*** ./src/OPERATORS/op-cm-scm.cc.orig17	2007-01-02 17:48:56.507045532 +0100
--- ./src/OPERATORS/op-cm-scm.cc	2007-01-02 17:49:02.809731785 +0100
***************
*** 40,47 ****
  
  // complex matrix by sparse complex matrix ops.
  
! DEFBINOP_OP (add, complex_matrix, sparse_complex_matrix,+)
! DEFBINOP_OP (sub, complex_matrix, sparse_complex_matrix,-)
  
  DEFBINOP_OP (mul, complex_matrix, sparse_complex_matrix, *)
  
--- 40,47 ----
  
  // complex matrix by sparse complex matrix ops.
  
! DEFBINOP_OP (add, complex_matrix, sparse_complex_matrix, +)
! DEFBINOP_OP (sub, complex_matrix, sparse_complex_matrix, -)
  
  DEFBINOP_OP (mul, complex_matrix, sparse_complex_matrix, *)
  
***************
*** 49,62 ****
  {
    CAST_BINOP_ARGS (const octave_complex_matrix&,
  		   const octave_sparse_complex_matrix&);
-   
-   MatrixType typ = v2.matrix_type ();
- 
-   ComplexMatrix ret = xdiv (v1.complex_matrix_value (), 
- 			    v2.sparse_complex_matrix_value (), typ);
  
!   v2.matrix_type (typ);
!   return ret;
  }
  
  DEFBINOPX (pow, complex_matrix, sparse_complex_matrix)
--- 49,74 ----
  {
    CAST_BINOP_ARGS (const octave_complex_matrix&,
  		   const octave_sparse_complex_matrix&);
  
!   if (v2.rows() == 1 && v2.columns() == 1)
!     {
!       Complex d = v2.complex_value ();
! 
!       if (d == 0.0)
! 	gripe_divide_by_zero ();
! 
!       return octave_value (v1.complex_array_value () / d);
!     }
!   else
!     {
!       MatrixType typ = v2.matrix_type ();
! 
!       ComplexMatrix ret = xdiv (v1.complex_matrix_value (), 
! 				v2.sparse_complex_matrix_value (), typ);
! 
!       v2.matrix_type (typ);
!       return ret;
!     }
  }
  
  DEFBINOPX (pow, complex_matrix, sparse_complex_matrix)
*** ./src/OPERATORS/op-cm-sm.cc.orig17	2007-01-02 17:50:19.846869580 +0100
--- ./src/OPERATORS/op-cm-sm.cc	2007-01-02 17:52:55.288026042 +0100
***************
*** 49,61 ****
  {
    CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_sparse_matrix&);
    
!   MatrixType typ = v2.matrix_type ();
! 
!   ComplexMatrix ret = xdiv (v1.complex_matrix_value (), 
! 			    v2.sparse_matrix_value (), typ);
! 
!   v2.matrix_type (typ);
!   return ret;
  }
  
  DEFBINOPX (pow, complex_matrix, sparse_matrix)
--- 49,73 ----
  {
    CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_sparse_matrix&);
    
!   if (v2.rows() == 1 && v2.columns() == 1)
!     {
!       double d = v2.scalar_value ();
! 
!       if (d == 0.0)
! 	gripe_divide_by_zero ();
! 
!       return octave_value (v1.complex_array_value () / d);
!     }
!   else
!     {
!       MatrixType typ = v2.matrix_type ();
! 
!       ComplexMatrix ret = xdiv (v1.complex_matrix_value (), 
! 				v2.sparse_matrix_value (), typ);
! 
!       v2.matrix_type (typ);
!       return ret;
!     }
  }
  
  DEFBINOPX (pow, complex_matrix, sparse_matrix)
*** ./src/OPERATORS/op-scm-s.cc.orig17	2007-01-02 18:00:54.794646705 +0100
--- ./src/OPERATORS/op-scm-s.cc	2007-01-02 18:00:19.091470602 +0100
***************
*** 82,94 ****
  {
    CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_scalar&);
  
!   MatrixType typ = v1.matrix_type ();
!   SparseComplexMatrix m1 = v1.sparse_complex_matrix_value ();
!   Matrix m2 = Matrix (1, 1, v2.scalar_value ());
!   ComplexMatrix ret = xleftdiv (m1, m2, typ);
!   v1.matrix_type (typ);
  
!   return ret;
  }
  
  DEFBINOP_FN (lt, sparse_complex_matrix, scalar, mx_el_lt)
--- 82,105 ----
  {
    CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_scalar&);
  
!   if (v1.rows() == 1 && v1.columns() == 1)
!     {
!       Complex d = v1.complex_value ();
! 
!       if (d == 0.0)
! 	gripe_divide_by_zero ();
  
!       return octave_value (v2.scalar_value () / d);
!     }
!   else
!     {
!       MatrixType typ = v1.matrix_type ();
!       SparseComplexMatrix m1 = v1.sparse_complex_matrix_value ();
!       Matrix m2 = Matrix (1, 1, v2.scalar_value ());
!       ComplexMatrix ret = xleftdiv (m1, m2, typ);
!       v1.matrix_type (typ);
!       return ret;
!     }
  }
  
  DEFBINOP_FN (lt, sparse_complex_matrix, scalar, mx_el_lt)
*** ./src/OPERATORS/op-m-scm.cc.orig17	2007-01-02 17:52:09.412344215 +0100
--- ./src/OPERATORS/op-m-scm.cc	2007-01-02 17:53:11.242219222 +0100
***************
*** 50,62 ****
  {
    CAST_BINOP_ARGS (const octave_matrix&, const octave_sparse_complex_matrix&);
  
!   MatrixType typ = v2.matrix_type ();
! 
!   ComplexMatrix ret = xdiv (v1.matrix_value (), 
! 			    v2.sparse_complex_matrix_value (), typ);
! 
!   v2.matrix_type (typ);
!   return ret;
  }
  
  DEFBINOPX (pow, matrix, sparse_complex_matrix)
--- 50,74 ----
  {
    CAST_BINOP_ARGS (const octave_matrix&, const octave_sparse_complex_matrix&);
  
!   if (v2.rows() == 1 && v2.columns() == 1)
!     {
!       Complex d = v2.complex_value ();
! 
!       if (d == 0.0)
! 	gripe_divide_by_zero ();
! 
!       return octave_value (v1.array_value () / d);
!     }
!   else
!     {
!       MatrixType typ = v2.matrix_type ();
! 
!       ComplexMatrix ret = xdiv (v1.matrix_value (), 
! 				v2.sparse_complex_matrix_value (), typ);
! 
!       v2.matrix_type (typ);
!       return ret;
!     }
  }
  
  DEFBINOPX (pow, matrix, sparse_complex_matrix)
*** ./src/OPERATORS/op-scm-sm.cc.orig17	2007-01-02 18:09:43.553496627 +0100
--- ./src/OPERATORS/op-scm-sm.cc	2007-01-02 18:09:24.284490195 +0100
***************
*** 47,58 ****
  DEFBINOP (div, sparse_complex_matrix, sparse_matrix)
  {
    CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_sparse_matrix&);
!   MatrixType typ = v2.matrix_type ();
!   SparseComplexMatrix ret = xdiv (v1.sparse_complex_matrix_value (), 
! 				  v2.sparse_matrix_value (), typ);
    
!   v2.matrix_type (typ);
!   return ret;
  }
  
  DEFBINOPX (pow, sparse_complex_matrix, sparse_matrix)
--- 47,71 ----
  DEFBINOP (div, sparse_complex_matrix, sparse_matrix)
  {
    CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_sparse_matrix&);
! 
!   if (v2.rows() == 1 && v2.columns() == 1)
!     {
!       double d = v2.scalar_value ();
! 
!       if (d == 0.0)
! 	gripe_divide_by_zero ();
! 
!       return octave_value (v1.sparse_complex_matrix_value () / d);
!     }
!   else
!     {
!       MatrixType typ = v2.matrix_type ();
!       SparseComplexMatrix ret = xdiv (v1.sparse_complex_matrix_value (), 
! 				      v2.sparse_matrix_value (), typ);
    
!       v2.matrix_type (typ);
!       return ret;
!     }
  }
  
  DEFBINOPX (pow, sparse_complex_matrix, sparse_matrix)
***************
*** 64,76 ****
  DEFBINOP (ldiv, sparse_complex_matrix, sparse_matrix)
  {
    CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_sparse_matrix&);
-   MatrixType typ = v1.matrix_type ();
- 
-   SparseComplexMatrix ret = xleftdiv (v1.sparse_complex_matrix_value (), 
- 				      v2.sparse_matrix_value (), typ);
  
!   v1.matrix_type (typ);
!   return ret;
  }
  
  DEFBINOP_FN (lt, sparse_complex_matrix, sparse_matrix, mx_el_lt)
--- 77,102 ----
  DEFBINOP (ldiv, sparse_complex_matrix, sparse_matrix)
  {
    CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_sparse_matrix&);
  
!   if (v1.rows() == 1 && v1.columns() == 1)
!     {
!       Complex d = v1.complex_value ();
! 
!       if (d == 0.0)
! 	gripe_divide_by_zero ();
! 
!       return octave_value (v2.sparse_matrix_value () / d);
!     }
!   else
!     {
!       MatrixType typ = v1.matrix_type ();
! 
!       SparseComplexMatrix ret = xleftdiv (v1.sparse_complex_matrix_value (), 
! 					  v2.sparse_matrix_value (), typ);
! 
!       v1.matrix_type (typ);
!       return ret;
!     }
  }
  
  DEFBINOP_FN (lt, sparse_complex_matrix, sparse_matrix, mx_el_lt)
*** ./src/OPERATORS/op-m-sm.cc.orig17	2007-01-02 17:53:52.770117616 +0100
--- ./src/OPERATORS/op-m-sm.cc	2007-01-02 18:07:19.099937893 +0100
***************
*** 48,59 ****
  DEFBINOP (div, matrix, sparse_matrix)
  {
    CAST_BINOP_ARGS (const octave_matrix&, const octave_sparse_matrix&);
-   MatrixType typ = v2.matrix_type ();
  
!   Matrix ret = xdiv (v1.matrix_value (), v2.sparse_matrix_value (), typ);
! 
!   v2.matrix_type (typ);
!   return ret;
  }
  
  DEFBINOPX (pow, matrix, sparse_matrix)
--- 48,72 ----
  DEFBINOP (div, matrix, sparse_matrix)
  {
    CAST_BINOP_ARGS (const octave_matrix&, const octave_sparse_matrix&);
  
!   if (v2.rows() == 1 && v2.columns() == 1)
!     {
!       double d = v2.scalar_value ();
! 
!       if (d == 0.0)
! 	gripe_divide_by_zero ();
! 
!       return octave_value (v1.array_value () / d);
!     }
!   else
!     {
!       MatrixType typ = v2.matrix_type ();
! 
!       Matrix ret = xdiv (v1.matrix_value (), v2.sparse_matrix_value (), typ);
! 
!       v2.matrix_type (typ);
!       return ret;
!     }
  }
  
  DEFBINOPX (pow, matrix, sparse_matrix)
*** ./src/ov-cx-sparse.cc.orig17	2007-01-02 19:09:57.017500717 +0100
--- ./src/ov-cx-sparse.cc	2007-01-02 19:09:11.345791003 +0100
***************
*** 126,133 ****
    // FIXME -- maybe this should be a function, valid_as_scalar()
    if (numel () > 0)
      {
!       gripe_implicit_conversion ("Octave:array-as-scalar",
! 				 "complex sparse matrix", "real scalar");
  
        retval = std::real (matrix (0, 0));
      }
--- 126,134 ----
    // FIXME -- maybe this should be a function, valid_as_scalar()
    if (numel () > 0)
      {
!       if (numel () > 1)
! 	gripe_implicit_conversion ("Octave:array-as-scalar",
! 				   "complex sparse matrix", "real scalar");
  
        retval = std::real (matrix (0, 0));
      }
***************
*** 161,168 ****
    // FIXME -- maybe this should be a function, valid_as_scalar()
    if (numel () > 0)
      {
!       gripe_implicit_conversion ("Octave:array-as-scalar",
! 				 "complex sparse matrix", "real scalar");
  
        retval = matrix (0, 0);
      }
--- 162,170 ----
    // FIXME -- maybe this should be a function, valid_as_scalar()
    if (numel () > 0)
      {
!       if (numel () > 1)
! 	gripe_implicit_conversion ("Octave:array-as-scalar",
! 				   "complex sparse matrix", "real scalar");
  
        retval = matrix (0, 0);
      }
*** ./src/ov-bool-sparse.cc.orig17	2007-01-02 19:09:34.725619219 +0100
--- ./src/ov-bool-sparse.cc	2007-01-02 19:08:39.149402422 +0100
***************
*** 100,107 ****
  
    if (numel () > 0)
      {
!       gripe_implicit_conversion ("Octave:array-as-scalar",
! 				 "bool sparse matrix", "real scalar");
  
        retval = matrix (0, 0);
      }
--- 100,108 ----
  
    if (numel () > 0)
      {
!       if (numel () > 1)
! 	gripe_implicit_conversion ("Octave:array-as-scalar",
! 				   "bool sparse matrix", "real scalar");
  
        retval = matrix (0, 0);
      }
***************
*** 120,127 ****
  
    if (rows () > 0 && columns () > 0)
      {
!       gripe_implicit_conversion ("Octave:array-as-scalar",
! 				 "bool sparse matrix", "complex scalar");
  
        retval = matrix (0, 0);
      }
--- 121,129 ----
  
    if (rows () > 0 && columns () > 0)
      {
!       if (numel () > 1)
! 	gripe_implicit_conversion ("Octave:array-as-scalar",
! 				   "bool sparse matrix", "complex scalar");
  
        retval = matrix (0, 0);
      }
*** ./src/ov-re-sparse.cc.orig17	2007-01-02 19:09:46.839011575 +0100
--- ./src/ov-re-sparse.cc	2007-01-02 19:07:47.444984569 +0100
***************
*** 98,105 ****
  
    if (numel () > 0)
      {
!       gripe_implicit_conversion ("Octave:array-as-scalar",
! 				 "real sparse matrix", "real scalar");
  
        retval = matrix (0, 0);
      }
--- 98,106 ----
  
    if (numel () > 0)
      {
!       if (numel () > 1)
! 	gripe_implicit_conversion ("Octave:array-as-scalar",
! 				   "real sparse matrix", "real scalar");
  
        retval = matrix (0, 0);
      }
***************
*** 119,126 ****
    // FIXME -- maybe this should be a function, valid_as_scalar()
    if (rows () > 0 && columns () > 0)
      {
!       gripe_implicit_conversion ("Octave:array-as-scalar",
! 				 "real sparse matrix", "complex scalar");
  
        retval = matrix (0, 0);
      }
--- 120,128 ----
    // FIXME -- maybe this should be a function, valid_as_scalar()
    if (rows () > 0 && columns () > 0)
      {
!       if (numel () > 1)
! 	gripe_implicit_conversion ("Octave:array-as-scalar",
! 				   "real sparse matrix", "complex scalar");
  
        retval = matrix (0, 0);
      }
2007-01-03  David Bateman  <dbateman <at> free.fr>

	* MSparse.cc (SPARSE_A2A2_OP, SPARSE_A2A2_FCN_1,
	SPARSE_A2A2_FCN_1): Modify macros so that scalars stored as
	sparse matrices are special cased.

	* Sparse-op-defs.h: Include mx-ops.h to have access to mixed
	matrix, sparse matrix operations.
	(SPARSE_SMSM_BIN_OP_1, SPARSE_SMSM_BIN_OP_2, SPARSE_SMSM_BIN_OP_3,
	SPARSE_SMSM_CMP_OP, SPARSE_SMSM_BOOL_OP, SPARSE_MSM_BIN_OP_1,
	SPARSE_MSM_BIN_OP_2, SPARSE_MSM_CMP_OP, SPARSE_MSM_BOOL_OP,
	SPARSE_SMM_BIN_OP_1, SPARSE_SMM_BIN_OP_2, SPARSE_SMM_CMP_OP, 
	SPARSE_SMM_BOOL_OP, SPARSE_SPARSE_MUL, SPARSE_FULL_MUL, 
	FULL_SPARSE_MUL): Modify macros so that scalars stored as
	sparse matrices are special cased.

2007-01-03  David Bateman  <dbateman <at> free.fr>

	* (OPERATORS/op-cm-scm.cc, OPERATORS/op-cm-sm.cc, 
	OPERATORS/op-cs-scm.cc, OPERATORS/op-cs-sm.cc, 
	OPERATORS/op-m-scm.cc, OPERATORS/op-m-sm.cc, 
	OPERATORS/op-scm-cm.cc, OPERATORS/op-scm-cs.cc, 
	OPERATORS/op-scm-m.cc, OPERATORS/op-scm-s.cc, 
	OPERATORS/op-scm-scm.cc, OPERATORS/op-scm-sm.cc, 
	OPERATORS/op-sm-cm.cc, OPERATORS/op-sm-cs.cc, 
	OPERATORS/op-sm-m.cc, OPERATORS/op-sm-s.cc, 
	OPERATORS/op-sm-scm.cc, OPERATORS/op-sm-sm.cc, 
	OPERATORS/op-s-scm.cc, OPERATORS/op-s-sm.cc):
	Modify div and ldiv functions so that scalars stored as sparse 
	matrices are special cased.

	* ov-re-sparse.cc (double_value, complex_value): Scalar can be
	stored as a sparse matrix and so don't warn on implicit conversion
	to a scalar.
	* ov-cx-sparse.cc (double_value, complex_value): ditto.
	* ov-bool-sparse.cc (double_value, complex_value): ditto.

Gmane