Symmetric matrix is not symmetric
问题 I have recently written code for finite element method. Since my algorithm is generating a symmetric matrix, after gathering data for each element the resulting matrix should be symmetric. However, after I run loop over element, the resulting global matrix is not symmetric. The basic code structure is like this: A=zeros(dof,dof) for (each element) loc_A = v'*(diagonal matrix)*v % (v is 1xN row vector) % loc_A is symmetric matrix A(K,K) = A(K,K)+loc_A % (K is Nx1 column vector) end Since I add