evalboolff.m

来自「this is for demo in matlab」· M 代码 · 共 43 行

M
43
字号
function costFun = evalBoolFF( B, varargin )% evalBoolFF - evaluation of different combinations for activation%              functions for J-K or R-S flip-flops%% Use: evalBoolFF (file_name, cost3)  to initialize the function, where% file_name is a name of a function, that sets the corresponging bits of% the activation functions (see examples) and cost3 is 1 or -1, depending% whether the non-inverted or the inverted bits are to be penalized%% Use: cost = evalBoolFF ( B )  to evaluate particular bit combination% % evalBoolFF ver.1                                  Last update 24 Feb 2007% Copyright 2002-2007       Andrey Popov          andrey.popov@gmx.netpersistent fill_name cost3if nargin == 2    fill_name = B;    cost3 = varargin{1};    returnend% call the neccessary function to fill the J, K, R or S vectorFF = feval(fill_name, B);G = find(FF) - 1;% Perform boolean minimizationR = minBool(G, 2);R = R(2:end,:);     % remove the heading rown = size(R,1);costFun(1) = n;                 % number of desjunctionscostFun(2) = sum(sum(R~=0));    % number of involved signalsif cost3 == 1    costFun(3) = sum(sum(R==1));    % number of non-inverted signalselse    costFun(3) = sum(sum(R==-1));   % number of inverted signalsend

⌨️ 快捷键说明

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