clear rows = 100; for i = 1:rows, for j = 1:rows, amat(i,j) = (i*j-1)/rows; end xvec(i) = i/rows; end xvec = xvec'; yin = zeros(rows,1); yvec = dgemv('N',rows,rows,1.0,amat,rows,xvec,1,0.0,yin,1);