1. sum(dot(A,B,1)) 一般比 trace(A'*B) 效果更好
2. A * diag(w) <=> bsxfun(@times, A,w'), diag(w)*A <=> bsxfun(@times, w,A)
3. 判断变量x是否存在:if(exist('x'))