Open tqyunwuxin opened 6 years ago
"Y_hat(:,blk_arr(:,idx)) = Y_hat(:,blk_arr(:,idx)) + bsxfun(@plus, Dnew*alphanew, DC(:,idx));" 这个语句,当blk_arr(:,idx)的值相同时,Y_hat 会取出同一列,但是求和操作只起一次作用。
举例:a=zeros(3,3);b=ones(3,2);index=[1,1]; a(:,index)=a(:,index)+b; a = 1 0 0 1 0 0 1 0 0
应该是 "Y_hat(:,blk_arr(:,idx)) = Y_hat(:,blk_arr(:,idx)) + bsxfun(@plus, Dnew*alphanew, DC(:,blk_arr(:,idx)));"
谢谢指出我的遗漏,原因是我后来跑别的实验,代码没有改好。
"Y_hat(:,blk_arr(:,idx)) = Y_hat(:,blk_arr(:,idx)) + bsxfun(@plus, Dnew*alphanew, DC(:,idx));" 这个语句,当blk_arr(:,idx)的值相同时,Y_hat 会取出同一列,但是求和操作只起一次作用。
举例:a=zeros(3,3);b=ones(3,2);index=[1,1]; a(:,index)=a(:,index)+b; a = 1 0 0 1 0 0 1 0 0