function F_hat = maxminTM(F) % PURPOSE: Compute max-min transition matrix of (asymmetric) fuzzy graph F. %------------------------------------------------------------------------------- % USAGE: F_hat = maxminTM(F) % where: F = (asymmetric) fuzzy graph (n x n) % F(i,j) is the dependence of variable i on variable j % all diagonal elements should be equal to 1. % [Example] F = [1.0, 0.8, 0.9; % 0.2, 1.0, 0.0; % 0.0, 0.5, 1.0]; % n = # of variables %------------------------------------------------------------------------------- % RETURNS: F_hat = max-min transition matrix (n x n) % F(i,j) is the dependence of variable i on variable j, % taking all chains into account. % [Example] F_hat = [1.0, 0.8, 0.9; % 0.2, 1.0, 0.2; % 0.2, 0.5, 1.0]; % ------------------------------------------------------------------------------- % REFERENCE: % H. Yamashita and T. Takizawa (2010). Fuzzy Theory. Tokyo: Kyoritsu % Shuppan Co., Ltd. (in Japanese). % ------------------------------------------------------------------------------ % Written by Kaiji Motegi, Faculty of Political Science and Economics, % Waseda University. % June 23, 2014. % ------------------------------------------------------------------------------ n = size(F,1); % # of variables pn = n^(n-1); % useful quantity en = (1:n)'; % useful vector % construct F_hat F_hat = zeros(n, n); if n == 1 % trivial case F_hat = 1; else % non-trivial case % core part of index matrix J_middle = zeros(pn, n-1); for l = 1:(n-1) J_middle(:,l) = kron(ones(n^(l-1), 1), kron(en, ones(n^(n-l-1), 1))); end; % work element-by-element for i = 1:n for j = 1:n % index matrix I: all chains from variables i to variable j J = [i * ones(pn, 1), J_middle, j * ones(pn, 1)]; % index matrix II: location of each pair H = zeros(pn, n); for k = 1:n H(:,k) = (J(:, k+1) - 1) * n + J(:, k); end; % take maximum of minimum of chains F_hat(i,j) = max(min(F(H), [], 2)); end; end; end;