```Date: Oct 20, 2011 11:28 PM
Author: mailcwc@gmail.com
Subject: Precision question

I have three algorithms  to calculate the inner product of vectorA(i,j) and vector V for M x N times.With the line       A = round(A),       B1 = B2 = B3.Without the line  A = round(A);,      B1 != B2, B2 = B3.Is this a precision error?Which one is correct?clc;100clear all;M = 1000;N = 1000;P = 10;A = 10*rand(M,N,P);A = round(A);% A = zeros(M,N,P);% for i = 1:P%     A(:,:,i) = i;% endV = 1:P;% Algorithm 1A = shiftdim(A,2);tic;B1 = zeros(M,N);for i = 1:M    for j = 1:N        B1(i,j) = V*A(:,i,j);    endendt1 = toc;A = shiftdim(A,1);%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Algorithm 2tic;temp = zeros(M,N,P);for i = 1:P    temp(:,:,i) = A(:,:,i)*V(i);endB2 = sum(temp,3);clear temp;t2 = toc;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Algorithm 3ticv = repmat(reshape(V, [1 1 P]), [M N]);temp = bsxfun(@times, A, v);B3 = sum(temp,3);clear temp;t3 = toc;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%isequal(B1,B2,B3)isequal(B1,B2)isequal(B2,B3)isequal(B1,B3)t1t2t3
```