Help with isequal

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Help with isequal

Rik-4
Could someone with access to Matlab test the following?  The question at
hand is whether isequal always returns a "full" value, or can occasionally
return a sparse, logical value.

t = isequal (sparse(1), sparse(1))
issparse (t)
t = isequal (sparse(1), 1)
issparse (t)
t = isequal (1, sparse(1))
issparse (t)
t = all (sparse([1 1 1]))
issparse (t)

Thanks,
Rik


Reply | Threaded
Open this post in threaded view
|

Re: Help with isequal

Michele Ginesi
On 11/26/2017 07:33 PM, Rik wrote:

> Could someone with access to Matlab test the following?  The question at
> hand is whether isequal always returns a "full" value, or can occasionally
> return a sparse, logical value.
>
> t = isequal (sparse(1), sparse(1))
> issparse (t)
> t = isequal (sparse(1), 1)
> issparse (t)
> t = isequal (1, sparse(1))
> issparse (t)
> t = all (sparse([1 1 1]))
> issparse (t)
>
> Thanks,
> Rik
>
>
Matlab R2017b here. They are all full logical values, except for the
last one which is a sparse logical. I attach the diary for completeness.

--
Michele Ginesi

Reply | Threaded
Open this post in threaded view
|

Re: Help with isequal

bredsj
In reply to this post by Rik-4

Result on Ubuntu 16.04 LTS and Matlab 2017b

>> test

t =

  logical

   1


ans =

  logical

   0


t =

  logical

   1


ans =

  logical

   0


t =

  logical

   1


ans =

  logical

   0


t =

  sparse logical

   (1,1)      1


ans =

  logical

   1

>>


On 26/11/2017 20:33, Rik wrote:
t = isequal (sparse(1), sparse(1))
issparse (t)
t = isequal (sparse(1), 1)
issparse (t)
t = isequal (1, sparse(1))
issparse (t)
t = all (sparse([1 1 1]))
issparse (t)

--
Steph Bredenhann Pr.Eng, Pr.CPM

Tel: 021 854 6927
Fax: 086 66 95 380
Mobile: 082 55 00 207

(sent from PC)
Steph Bredenhann