next_case.m.svn-base

来自「bayesian network structrue learning mat」· SVN-BASE 代码 · 共 47 行

SVN-BASE
47
字号
function [cas, continu] = next_case(cas, node_sizes, rev)% [cas, continu] = next_case(cas, node_sizes, rev)%% rev is optionnal :% if ns == [2 2 2] then%  if rev = 0 or is not present%   [1 1 1] --> [2 1 1] --> [1 2 1] --> ...%%  if rev ~= 0%   [1 1 1] --> [1 1 2] --> [1 2 1] --> ...%if nargin<3, rev=0; endN=length(node_sizes);if length(cas)~=N, error('sizes must be the same'); endif     N==0, continu = 0;elseif N==1, if cas >= node_sizes, continu = 0; else cas = cas+1; continu =1; endelseif N>=2 if all(cas>=node_sizes)~=0, continu=0;  else  continu=1; goon=1;  if ~rev    n=1; cas(n)=cas(n)+1;    while goon	if cas(n)>node_sizes(n) & n<N	  cas(n)=1;	  cas(n+1)=cas(n+1)+1;	else	  goon=0;	end	n=n+1;     end  else    n=N; cas(n)=cas(n)+1;    while goon	if cas(n)>node_sizes(n) & n>1	  cas(n)=1;	  cas(n-1)=cas(n-1)+1;	else	  goon=0;	end	n=n-1;    end   end  endend

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?