資源簡介
通過構造因子圖(Factor Graph)關于和積算法(Sum-Product Algorithm)的matlab源碼,借此可實現消息傳遞算法(Message Propagation Algorithm,MPA)、LDPC編解碼、卡爾曼濾波、隱性馬爾可夫鏈(HMC)等應用

代碼片段和文件信息
classdef?and_node?%AND_NODE?a?bivalue?node?&?subclass?of?factor_node?constraints?the?child
%and?parent?connections?to?behave?as?a?and?gate?such?that?the?child?message
%become?false?when?any?of?the?parent?message?is?false.?
%
%?Description?of?factor_fun
%???input:?in_msg?from_id?to_id
%?if?message?is?directed?to?child
%???msg(2)?=?product?of?all?in_msg{i}(2)
%???msg(1)?=?1?-?msg(2)
%?if?message?is?directed?to?parent
%??msg(2)?=?product?of?all?in_msg{i}(2)?except?the?message?from?child
%??msg(2)?=?child_msg(1)?+?msg(1)*(child_msg(2)?-?child_msg(1))
%??msg(1)?=?child_msg(1)
???properties
???end
???methods
???????function?s?=?and_node(id)
???????????s?=?s@factor_node(id);
???????end
???????
???????function?msg?=?factor_fun(s?in_msg?from_id?to_id)
???????????msg?=?[0?0];
???????????child_id?=?s.link_id(size(s.link_id2));
???????????if?to_id?==?child_id
???????????????%?construct?message?to?child
???????????????msg(2)?=?1;
???????????????for?i?=?1:size(s.link_id2)-1
???????????????????msg(2)?=?msg(2)*in_msg{i}(2);
???????????????end
???????????????msg(1)?=?1?-?msg(2);
???????????else
???????????????%?construct?message?to?one?of?the?parents
???????????????%?identify?message?from?child
???????????????child_idx?=?find(from_id==child_id);
???????????????child_msg?=?in_msg{child_idx};
???????????????msg(2)?=?1;
???????????????for?i?=?1:size(s.link_id2)-1
???????????????????if?from_id(i)?==?child_id
???????????????????????continue;
???????????????????end
???????????????????msg(2)?=?msg(2)*in_msg{i}(2);
???????????????end
???????????????msg(2)?=?child_msg(1)?+?msg(2)*(child_msg(2)?-?child_msg(1));
???????????????msg(1)?=?child_msg(1);
???????????end
???????????sum_msg?=?sum(msg);
???????????if?sum_msg?==?0
???????????????msg?=?ones(size(msg));
???????????end
???????????msg?=?msg/sum(msg);
???????end
???end
end?
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????1915??2010-03-20?00:49??SumProductLab_R3.00\and_node.m
?????文件?????????211??2010-03-20?00:49??SumProductLab_R3.00\connect.m
?????文件????????1783??2010-03-20?00:49??SumProductLab_R3.00\cp_node.m
?????文件????????2356??2010-03-20?00:49??SumProductLab_R3.00\cp2_node.m
?????文件????????2778??2010-03-20?00:49??SumProductLab_R3.00\cp3_node.m
?????文件?????????756??2010-03-20?00:49??SumProductLab_R3.00\equ_node.m
?????文件????????1306??2010-03-20?00:49??SumProductLab_R3.00\even_parity_node.m
?????文件????????2462??2010-03-20?00:49??SumProductLab_R3.00\evident_node.m
?????文件????????1974??2010-03-20?00:49??SumProductLab_R3.00\Examples\and_example.m
?????文件????????1611??2010-03-20?00:49??SumProductLab_R3.00\Examples\explained_away.m
?????文件????????1700??2010-03-20?00:49??SumProductLab_R3.00\Examples\factor_graph_test.m
?????文件????????3354??2010-03-20?00:49??SumProductLab_R3.00\Examples\Hidden_Markov_Chain.m
?????文件????????2601??2010-03-20?00:49??SumProductLab_R3.00\Examples\hypothesis.m
?????文件????????2087??2010-03-20?00:49??SumProductLab_R3.00\Examples\Kalman_Filter_Example.m
?????文件????????2424??2010-03-20?00:49??SumProductLab_R3.00\Examples\LDPC.m
?????文件????????2932??2010-03-20?00:49??SumProductLab_R3.00\Examples\Linear_Backward_Example.m
?????文件????????1804??2010-03-20?00:49??SumProductLab_R3.00\Examples\noisy_or_example.m
?????文件????????2108??2010-03-20?00:49??SumProductLab_R3.00\Examples\or_example.m
?????文件?????????324??2010-03-20?00:49??SumProductLab_R3.00\Examples\sim_hmm.m
?????文件????????5287??2010-03-20?00:49??SumProductLab_R3.00\Examples\sudoku.m
?????文件?????????212??2010-03-20?00:49??SumProductLab_R3.00\Examples\sudoku_4x4_01.mat
?????文件?????????212??2010-03-20?00:49??SumProductLab_R3.00\Examples\sudoku_4x4_02.mat
?????文件?????????218??2010-03-20?00:49??SumProductLab_R3.00\Examples\sudoku_9x9_01.mat
?????文件?????????218??2010-03-20?00:49??SumProductLab_R3.00\Examples\sudoku_9x9_02.mat
?????文件???????13266??2010-03-20?00:49??SumProductLab_R3.00\factor_node.m
?????文件????????1785??2010-03-20?00:49??SumProductLab_R3.00\ls_add_node.m
?????文件?????????926??2010-03-20?00:49??SumProductLab_R3.00\ls_equ_node.m
?????文件????????1364??2010-03-20?00:49??SumProductLab_R3.00\ls_gain2_node.m
?????文件?????????670??2010-03-20?00:49??SumProductLab_R3.00\ls_marginal.m
?????文件?????????191??2010-03-20?00:49??SumProductLab_R3.00\marginal.m
?????文件????????3184??2010-03-20?00:49??SumProductLab_R3.00\noisy_or_node.m
............此處省略7個文件信息
- 上一篇:MATLAB SPIN路由算法
- 下一篇:ARIMA預測MATLAB程序
評論
共有 條評論