MATLAB: Do I receive a segmentation violation when I perform calculations using sparse matrices in MATLAB 6.5.1 (R13SP1)

_spmultopMATLABnumericsnumerics.dllspmultop

I use the following code to define a sparse matrix and then multiply with a scalar:
B(1) = sparse(1,1);
B*0
I receive the following segmentation violation:
------------------------------------------------------------------------
Segmentation violation detected at Mon Apr 25 11:00:29 2005
------------------------------------------------------------------------
Configuration:
MATLAB Version: 6.5.1.199709 (R13) Service Pack 1
Operating System: Microsoft Windows XP
Window System: Version 5.1 (Build 2600: Service Pack 2)
Processor ID: x86 Family 15 Model 2 Stepping 9, GenuineIntel
Virtual Machine: Java 1.3.1_01 with Sun Microsystems Inc. Java HotSpot(TM) Client VM
(mixed mode)
Register State:
EAX = 00000000 EBX = 24f81da0
ECX = 00000000 EDX = 00000001
ESI = 24f82100 EDI = 00000000
EBP = 00dfd304 ESP = 00dfd270
EIP = 7a624d8a FLG = 00010246
Stack Trace:
[0] numerics.dll:_spmultop(0x24f81da0, 0x24f82100, 2, 1) + 410 bytes
[1] numerics.dll:_spBinaryArrayOps(0x24f81d10, 0x24f81650, 2, 1) + 231 bytes
[2] numerics.dll:_spBinaryMatrixOps(0x24f81d10, 0x24f81650, 0, 1) + 169 bytes
[3] numerics.dll:_spFullBinMatrixTimesFcn(1, 0x00dfd414, 2, 0x00dfd4dc) + 39 bytes
[4] m_interpreter.dll:_inExecuteInternalFcn(206, 2, 1, 0) + 1183 bytes
[5] m_interpreter.dll:enum opcodes __cdecl inIntFcn(enum opcodes,int,int,int)(77, 0x010000ce, 1, 2) + 90 bytes
[6] m_interpreter.dll:int __cdecl inInterp(enum inDebugCheck,int,int,struct inPcodeNest_tag volatile *)(2, 0, 0, 0x012de5e8) + 2554 bytes
[7] m_interpreter.dll:_inInterPcode(2, 0x00dfdc54, 0, 0) + 193 bytes
<snip>

Best Answer

This bug has been fixed in Release 14 Service Pack 3 (R14SP3). For previous product releases, read below for any possible workarounds:
There is a bug in MATLAB 6.5.1 (R13SP1) that affects the way MATLAB handles sparse matrix initialization.
When a sparse matrix is created using this syntax, the amount of storage allocated for nonzero matrix elements is initialized to zero. This can be verified using the following command:
nzmax(B)
This causes an error when performing calculations using sparse matrices with zero storage allocation.
To work around this issue, use the following alternative syntax to define a sparse matrix:
B = sparse(1,1);