rhomat.m
来自「The package includes 3 Matlab-interfaces」· M 代码 · 共 28 行
M
28 行
function rho = rhoMat(rhoVal,adj)rhoSize = size(rhoVal);N = size(adj,1);neighbNum = sum(adj);if (iscell(rhoVal)) error('argument given for trw (in loopy) must either be a scalar or a matrix in size <num_nodes> x <num_nodes>');endif prod(rhoSize)==1 rho = cell(1,N); for i=1:N rho{i} = rhoVal*ones(1,neighbNum(i)); endelse if (length(rhoSize)~=2 || rhoSize(1)~=N || rhoSize(2)~=N) error('argument given for trw (in loopy) must either be a scalar or a matrix in size <num_nodes> x <num_nodes>'); else rho = cell(1,N); for i=1:N if neighbNum(i)>0 rho{i} = rhoVal(i,find(adj(i,:))); end end endend
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?