octave-maintainers
[Top][All Lists]
Advanced

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

Re: Matlab check for negation of empty matrix


From: Olaf Till
Subject: Re: Matlab check for negation of empty matrix
Date: Fri, 28 Mar 2014 14:15:51 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Thu, Mar 27, 2014 at 04:18:07PM -0400, John W. Eaton wrote:
> <snip>
>   all ([])  =>  1
>   any ([])  =>  0

If [] is interpreted as in the special case of a vector argument (no
column-wise operation) it makes sense to me: any statement regarding
the particular elements of [] is true (since there are no elements) so
it is also true that "all" elements are true; but "any" seems to imply
that elements exist, so it is false.

> <snip>
>  Shouldn't these results just be [](1x0)
> since there are no columns and these functions operate over the
> columns of their arguments?

If [] is interpreted as a matrix argument, yes. I agree that treating
a vector argument as a special case is a source of inconsistency.

> <snip>
> But in any case, we don't get to choose this behavior if we want to
> remain compatible with Matlab.

Sadly true.

Olaf

-- 
public key id EAFE0591, e.g. on x-hkp://pool.sks-keyservers.net

Attachment: signature.asc
Description: Digital signature


reply via email to

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