Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: sparse matrix question
Replies: 1   Last Post: Jul 16, 1996 7:08 PM

 Messages: [ Previous | Next ]
 Tzu-Yi Chen Posts: 1 Registered: 12/7/04
sparse matrix question
Posted: Jul 10, 1996 8:54 PM

I'm running across a problem in which Matlab seems to have
two ways of reading its sparse matrix format. There's a
short example at the end. If anyone else has seen anything
like it and/or knows what might be causing it, I'd like to
know. B is a sparse matrix returned by a mex file. If I
convert B into a full matrix and then back to a sparse
matrix, the problem disappears. I only see this problem
with certain matrices (e.g. upper triangular).

Many thanks!

-Yi Chen
tzuyi@cs.berkeley.edu

>> R
R =
-2.2361 0.0440 1.5095 -1.0373 -0.7109
0 -2.6664 -0.8325 0.4838 -0.1787
0 0 -0.8025 -1.4912 -0.1387
0 0 0 -0.5565 -0.4982
0 0 0 0 -0.1676

>> full(B)
ans =
-2.2361 0.0440 1.5095 -1.0373 -0.7109
0 -2.6664 -0.8325 0.4838 -0.1787
0 0 -0.8025 -1.4912 -0.1387
0 0 0 -0.5565 -0.4982
0 0 0 0 -0.1676

>> R(1,4)
ans =
-1.0373

>> B(1,4)
ans =
0

>> R(1,4)-B(1,4)
ans =
-1.0373

>> all(all(~(R-B)))
ans =
1

Date Subject Author
7/10/96 Tzu-Yi Chen
7/16/96 John R. Gilbert