Thread Subject: max of logical sparse

Subject: max of logical sparse

From: Bruno Luong

Date: 14 Mar, 2009 14:32:01

Message: 1 of 11

I have a violent crash when I do this:

B=sparse(1,1,true,10,10)
max(B,[],1)

If B is convert to double, or full matrix, then everything works fine.

Matlab 2009A, 32 bits Vista.

Do you have the same?

Bruno

Subject: max of logical sparse

From: Matt Fig

Date: 14 Mar, 2009 15:15:03

Message: 2 of 11

Nope. All is well.

Win Vista 32 r2007a


Can you elaborate on 'violent,' does the pc jump off the table?

Subject: max of logical sparse

From: Bruno Luong

Date: 14 Mar, 2009 15:38:01

Message: 3 of 11

> Can you elaborate on 'violent,' does the pc jump off the table?

Hi Matt,

PC is fine. This below message is displayed on the screen, and I can do all but close Matlab. I jumped off my chair, and restart Matlab after climbing up.

It seems working fine on 2006B too.

Bruno

------------------------------------------------------------------------
       Segmentation violation detected at Sat Mar 14 16:33:06 2009
------------------------------------------------------------------------

Configuration:
  MATLAB Version: 7.8.0.347 (R2009a)
  MATLAB License: Prerelease
  Operating System: Microsoft Windows Vista
  Window System: Version 6.0 (Build 6001: Service Pack 1)
  Processor ID: x86 Family 6 Model 15 Stepping 13, GenuineIntel
  Virtual Machine: Java 1.6.0_04-b12 with Sun Microsystems Inc. Java HotSpot(TM) Client VM mixed mode
  Default Encoding: windows-1252

Subject: max of logical sparse

From: Matt

Date: 14 Mar, 2009 15:55:03

Message: 4 of 11

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <gpgj0p$ht5$1@fred.mathworks.com>...
> > Can you elaborate on 'violent,' does the pc jump off the table?
>
> Hi Matt,
>
> PC is fine. This below message is displayed on the screen, and I can do all but close Matlab. I jumped off my chair, and restart Matlab after climbing up.
>
> It seems working fine on 2006B too.
>
> Bruno
>
> ------------------------------------------------------------------------
> Segmentation violation detected at Sat Mar 14 16:33:06 2009
> ------------------------------------------------------------------------
>
> Configuration:
> MATLAB Version: 7.8.0.347 (R2009a)
> MATLAB License: Prerelease
> Operating System: Microsoft Windows Vista
> Window System: Version 6.0 (Build 6001: Service Pack 1)
> Processor ID: x86 Family 6 Model 15 Stepping 13, GenuineIntel
> Virtual Machine: Java 1.6.0_04-b12 with Sun Microsystems Inc. Java HotSpot(TM) Client VM mixed mode
> Default Encoding: windows-1252


And the crash persists after rebooting?

Guess I'm not upgrading to 2009a

Subject: max of logical sparse

From: Bruno Luong

Date: 14 Mar, 2009 16:13:01

Message: 5 of 11

>
>
> And the crash persists after rebooting?
>

Yup.

Bruno

Subject: max of logical sparse

From: Steven Lord

Date: 15 Mar, 2009 14:48:48

Message: 6 of 11


"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message
news:gpgj0p$ht5$1@fred.mathworks.com...
>> Can you elaborate on 'violent,' does the pc jump off the table?
>
> Hi Matt,
>
> PC is fine. This below message is displayed on the screen, and I can do
> all but close Matlab. I jumped off my chair, and restart Matlab after
> climbing up.
>
> It seems working fine on 2006B too.

Yes, this is a bug. I've reported it to the development staff. As a
workaround, convert the logical array to a double array before calling MAX.

--
Steve Lord
slord@mathworks.com

Subject: max of logical sparse

From: Bruno Luong

Date: 15 Mar, 2009 15:34:01

Message: 7 of 11

Thank you Steve.

Bruno

Subject: max of logical sparse

From: Matt

Date: 15 Mar, 2009 16:14:02

Message: 8 of 11

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <gpgf51$t0d$1@fred.mathworks.com>...
> I have a violent crash when I do this:
>
> B=sparse(1,1,true,10,10)
> max(B,[],1)
>
> If B is convert to double, or full matrix, then everything works fine.
>
> Matlab 2009A, 32 bits Vista.

Since B is a logical array, wouldn't it be better anyway to call any(B,1) instead of max(A,[],1). The results are equivalent.

Does any() result in a crash?

Subject: max of logical sparse

From: Bruno Luong

Date: 15 Mar, 2009 16:46:01

Message: 9 of 11

>
> Does any() result in a crash?

Hi Matt,

No, ANY works fine. But I don't use it at all like this. The instructions showed above are boiled down from something else to show a bug.

Bruno

Subject: max of logical sparse

From: Matt

Date: 15 Mar, 2009 17:05:05

Message: 10 of 11

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <gpjbc9$bge$1@fred.mathworks.com>...
> >
> > Does any() result in a crash?
>
> Hi Matt,
>
> No, ANY works fine. But I don't use it at all like this. The instructions showed above are boiled down from something else to show a bug.
>
> Bruno


Confused. As far as you've told us, the bug only shows up when you try to take the max() of a logical array. There's never any reason to do so, since any() will do the same thing better.

Subject: max of logical sparse

From: Bruno Luong

Date: 15 Mar, 2009 21:04:01

Message: 11 of 11

>
> Confused. As far as you've told us, the bug only shows up when you try to take the max() of a logical array. There's never any reason to do so, since any() will do the same thing better.

If you want to know Matt. We have a software that takes an data image measured from one of our optical instrument. The images can be very general: it can be RGB, a 3D topo, a boolean mask, etc... They can be full or sparse (mask), then there is a GUI thats allow user to manipulate those images, such as algebra operations, Sobel filtering, Median filter, Max filter, etc... The Max filter applies on the boolean mask calls for a piece of code that looks like the one I posted above. This piece of code depends on user inputs. The software is not designed to be intelligent to replace MAX with ANY for the moment.

Bruno

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com