Path: news.mathworks.com!not-for-mail
From: "Bruno Luong" <b.luong@fogale.findmycountry>
Newsgroups: comp.soft-sys.matlab
Subject: Re: LARGE roundoff error in matrix-vector multiplication?
Date: Fri, 5 Nov 2010 22:16:03 +0000 (UTC)
Organization: FOGALE nanotech
Lines: 19
Message-ID: <ib1vn3$bge$1@fred.mathworks.com>
References: <ib1q18$51r$1@fred.mathworks.com>
Reply-To: "Bruno Luong" <b.luong@fogale.findmycountry>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1288995363 11790 172.30.248.35 (5 Nov 2010 22:16:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 5 Nov 2010 22:16:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 390839
Xref: news.mathworks.com comp.soft-sys.matlab:684283

"Henry Wolkowicz" <hwolkowicz@uwaterloo.ca> wrote in message <ib1q18$51r$1@fred.mathworks.com>...
> I get the following relatively large roundoff error on matrix-vector multiplication
> 
> >> [size(A) nnz(A) nnz(x)  normest(round(A*1e3)/1e3-A)]
> ans =
>    129   185   465   185     0
> >> norm(A(:,colPerm)*x(colPerm) - A*x)
> ans =
>   1.3523e-012
> 
> i.e. a   A is sparse  129by185  and I am finding    A*x
> A has numbers with 2 decimal accuracy. The vector colPerm is a permutation of the integers  1:185.  By permuting the columns of A and components of x and redoing the multiplication I get an error in the 12th place. This seems like an enormous error for this type of multiplication. This does not happen with random matrices A. So perhaps there is some catastrophic 'subtraction' roundoff that happens? But getting an error in the 12th place seems enormous to me. I am trying to obtain a high accuracy algorithm and this is just checking the error at the end. So the error check has an error in it?
> Am I doing something wrong here?

http://en.wikipedia.org/wiki/Condition_number

Your matrix is badly scaled.

Bruno