Here is a follow up:
If I just use one row of the matrix (which only has 6 nonzero elements), then
I still get an error in the 13th place by changing the order of the arithmetic.
It seems that 'catastrophic subtraction error' is what is going on?
here is the input
format long
full([tempA tempx tempAperm tempxperm])
valrow3=tempA'*tempx
valrow3perm=tempAperm'*tempxperm
valrow3perm valrow3
and here is the output
1.0e+003 *
0.001000000000000 0.000000000000000 0.001000000000000 0.000000000000000
0.000400000000000 0.158000000000000 0.001700000000000 0.158000000000000
0.000400000000000 0.158000000000000 0.001500000000000 2.504373333333334
0.001500000000000 2.504373333333334 0.000400000000000 0.158000000000000
0.001700000000000 0.158000000000000 0.000400000000000 0.158000000000000
0.001700000000000 0.158000000000000 0.001700000000000 0.158000000000000
valrow3 =
3.092960000000001e+003
valrow3perm =
3.092960000000001e+003
ans =
4.547473508864641e013

"Henry Wolkowicz" <hwolkowicz@uwaterloo.ca> wrote in message <ib1q35$8rp$1@fred.mathworks.com>...
> I get the following relatively large roundoff error on matrixvector multiplication
>
> >> [size(A) nnz(A) nnz(x) normest(round(A*1e3)/1e3A)]
> ans =
> 129 185 465 185 0
> >> norm(A(:,colPerm)*x(colPerm)  A*x)
> ans =
> 1.3523e012
>
> 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?
