constrainsigmas.m
来自「Continuous Profile Models (CPM) Matlab T」· M 代码 · 共 50 行
M
50 行
function sigmas = constrainSigmas(G,oldSigmas,proposedSig);%% make sure that each sigma for a sample of the same class%% is within a factor sigFac of each other%% update the smallest sigma firstsigmas=oldSigmas; %% this is from before any updatesfac=G.sigmaFac;%display('jenn');%fac=realmax %Jenn%violations=zeros(size(sigmas));%% SAME FOR ALL SIGMAS! (no, but pulled it oustide)for cc=1:G.numClass thisClass = G.class{cc}; for bb=1%:G.numBins %for bb=1:G.numBins updateOrder = thisClass; %1:length(thisClass); for jj=1:length(updateOrder) ss=updateOrder(jj); %% make one update sigmas(bb,ss)=proposedSig(bb,ss); %% now check it theseSig = sigmas(bb,ss); %% setdiff is really slow, so use: %otherSig = sigmas(bb,setdiff(updateOrder,ss)); otherSig = sigmas(bb,[updateOrder(1:(jj-1)) ... updateOrder((jj+1):end)]); maxOther = max(otherSig); minOther = min(otherSig); if theseSig>fac*minOther sigmas(bb,ss)=fac*minOther elseif theseSig*fac<maxOther sigmas(bb,ss)=maxOther/fac; end %replicate to other bins sigmas(:,ss) = sigmas(bb,ss); end end end%sigmas'%keyboard;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?