octave-maintainers
[Top][All Lists]
Advanced

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

Re: fix null assignment


From: Jaroslav Hajek
Subject: Re: fix null assignment
Date: Fri, 19 Sep 2008 09:07:53 +0200

On Fri, Sep 19, 2008 at 12:12 AM, John W. Eaton <address@hidden> wrote:
> On 18-Sep-2008, Jaroslav Hajek wrote:
>
> | Apparently, Matlab never changes lhs if the index set is empty, i.e.
> | it does not even reshape the matrix to row vector when you do A([]) =
> | [] for a matrix A. An updated changeset is attached. With this, only 2
> | tests are failing. These are caused by blkdiag relying on
> | Matlab-incompatible behaviour. The second changeset addresses this.
>
> Thanks, I applied both patches.
>
> Maybe the second change would not be needed if we only performed the
> empty-assignment-is-deletion operation for the specific literal "= []"
> syntax, and not for any 0x0 array assignment.

I see. So it was not a Matlab-incompatible behaviour after all. Maybe
we should revert the second patch once this works.

> As I recall, that's
> what Matlab does, but it might require some work to implement
> correctly in Octave.  For example, should the special syntax be
> recognized directly in the parser, or should there be a special
> representation for [] so that it can be recognized in the interpreter?
>

It seems that there is a need to propagate the information (whether
this is a deletion statement) fairly deeply - thinking of things like
a(3).x.y(1:2,:) = []
that should work... this stuff is resolved by subsasgn, and creating
methods like subsnulasgn would probably mean a lot of duplication. It
seems better to make a special kind of object for the "genuine" empty
matrix that was not touched by expressions. I'm just not sure where to
put it.

> jwe
>



-- 
RNDr. Jaroslav Hajek
computing expert
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz


reply via email to

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