[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Dynamic types question
From: |
adler |
Subject: |
Re: Dynamic types question |
Date: |
Fri, 30 Mar 2001 21:32:31 -0500 (EST) |
You are right, my mistake.
I was getting the nonconformant ops error when octave
was converting to matrices and doing the ops on those.
By grepping for gripe_nonconformant in liboctave, I was
able to find examples of what needs to be done.
Thanks
I wonder, however, if there are definitions of matrix
operations which return different sizes than the
tradition matrix arithmetic ones?
_______________________________________
Andy Adler, address@hidden
On Fri, 30 Mar 2001, Paul Kienzle wrote:
> Where do you expect it to be caught? Before the operator is called? Can't
> do that since you may be defining some weird sort of operator for your new
> type which does not require conformant ops. The error message you are
> seeing for + seems to be coming from liboctave. Are you automatically
> promoting sparse to full for + but not for .*? Obviously yes otherwise
> your sparse_ops code would never be called and you would not see the
> assert. As indeed should be the case, since .* with a sparse is
> guaranteed to produce a sparse of at least the same shape as your sparse,
> and possibly sparser.
>
> - Paul
>
> On Thu, Mar 29, 2001 at 11:43:01PM -0500, address@hidden wrote:
> > 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
> >
-------------------------------------------------------------
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
-------------------------------------------------------------