⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 set_potential.m.svn-base

📁 Probabilistic graphical models in matlab.
💻 SVN-BASE
字号:
function [model] = set_potential(model, a, b, pot_mat)if (strcmp (model.type, 'pairwise-discrete' ) )    if (model.link_matrix(a,b) == 0 && model.link_matrix(b,a) == 0 )        error('You specified an edge that did not exist.');    else        c = model.link_matrix_table(a,b);        d = model.link_matrix_table(b,a);    end    if (d > 0)        c = d;    end    if (c == 0)        model.number_potential_tables = model.number_potential_tables +1;        model.link_matrix_table(a,b) = model.number_potential_tables;        c = model.number_potential_tables;    end    [u,v] = size (pot_mat);    if (model.all_variables)            m = model.all_variables_size;        n = model.all_variables_size;            else            m = model.variables_sizes(a);    n = model.variables_sizes(b);    end        if ( u ~= m || v ~= n)        error('Dimensions of the potential table do not match the variables sizes');    end    model.potential_tables(c) = { pot_mat };    model.edges(c, :) = [a b];else    % FACTOR GRAPH CASE    % a is the link vector, b the potential table    c = 0;    for i=1:model.number_potential_tables        if isequal(model.link_tables{i}, a)            c = i;        end    end    if (model.all_variables)        if isequal (size(b), ones(1,size(a,2)) * model.all_variables_size )        else            error ('Dimensions of the potential table do not match the variable size.');        end    else    % Variables have different size                if isequal (size(b), model.variables_sizes (a) )        else            error ('Dimensions of the potential table do not match the variables sizes.');        end    end    if (c == 0)        model.number_potential_tables = model.number_potential_tables +1;        c = model.number_potential_tables;    end    model.link_tables(c) = { a };    model.potential_tables(c) = { b };end

⌨️ 快捷键说明

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