Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: curious problem with sparse matrices that have explicit "0" entries.....
Date: Sat, 3 Jan 2009 16:28:02 +0000 (UTC)
Organization: Xoran Technologies
Lines: 21
Message-ID: <gjo3mi$3pr$1@fred.mathworks.com>
References: <Xns9B885ED987C87ejhericholtmamcom@216.168.3.30>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1231000082 3899 172.30.248.35 (3 Jan 2009 16:28:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 3 Jan 2009 16:28:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1440443
Xref: news.mathworks.com comp.soft-sys.matlab:509656



> As an artifact of construction, some of the entries in the
> A and Aeq matrices are explicitly 0.
> 
> I don't understand why this causes a problem......  why
> should there be any difference between a sparse matrix
> with say, 17 non-zero entries, and one with the same 17
> non-zero entries, and an 18th with an explicit zero?

I'm probably not the best one to answer that, but it is pretty clear that the designers of the sparse matrix data type have worked very hard to make it impossible to do what you have done. I have found no way to create a sparse matrix with explicit zeros from within MATLAB alone. So you could easily be violating an important assumption of the sparse data toolbox.

Just out of curiosity, what happens if you do the following?

>>find(Aeq), find(A)

Does it return the indices of the explicit zeros? If so, the find() function has failed. It is only supposed to return explicit non-zeros.

My speculation is that somewhere internally linprog() is using something like find() to analyze the sparsity pattern of A and Aeq. Your handcrafted sparse matrix might cause it to fail.

On the other hand, if you discover that find() works as expected, that's also very surprising. You wouldn't expect the version of find() implemented in the sparse matrix toolbox to double check that the explicit values of the sparse matrix are actually non-zero. That would mean additional overhead which ought not to be necessary, and the code designers would want to exploit that.