help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Dynamic types question


From: adler
Subject: Dynamic types question
Date: Thu, 29 Mar 2001 23:43:01 -0500 (EST)

While I've been writing my sparse functions,
I've noticed that octave does not prevent
you from nonconformant args for multiplication
like it does for addition.

   octave-2.1.32:1> a=eye(3);
   octave-2.1.32:2> b=sparse(eye(4));
   octave-2.1.32:3> a+b
   error: operator +: nonconformant arguments (op1 is 3x3, op2 is 4x4)
   error: evaluating binary operator `+' near line 3, column 2

Good - octave protects us here

   octave-2.1.32:3> a.*b
   octave-2.1.32: sparse_ops.cc:635: class octave_value
   oct_binop_f_s_el_mul(const class octave_value &,
      const class octave_value &): Assertion `Anr == Bnr' failed.
   panic: Aborted -- stopping myself...

Problem - no protection here - my assert is catching the error   

QUESTIONS:

1.  I recall some previous version of octave doing this correctly.
    However, I tried 2.1.30 and it gives the same error.

2.  Is this a bug?

3.  If not, how should I handle it gracefully in my code?


In order to try this one probably needs a 
copy of my sparse functions. The make_int.cc
example does not have sized matrices
 - one could use
http://www.octave.org/mailing-lists/octave-sources/2000/166
which only has real matrix support.

Or, get it from
http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/octave/dld/sparse/?cvsroot=octave
for complex sparse support. (not fully tested)

_______________________________________
Andy Adler,                address@hidden



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]