Created
June 15, 2013 12:34
-
-
Save karlnapf/5787975 to your computer and use it in GitHub Desktop.
probe a graph colouring
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function [V,colours] = probe( colours) | |
%% function [V] = probe(A,p) | |
% Creates a probing matrix based on a graph colouring of A using the | |
% algorithm in "J. Tang and Y. Saad, A probing method for computing the diagonal of the matrix | |
% inverse" (2010). | |
% | |
% REQUIRES: Matgraph toolbox http://www.ams.jhu.edu/~ers/matgraph/ | |
% | |
% Input: colours - A graph colouring (of A^p probably) | |
% | |
% Output: V - Probing matrix V | |
% | |
% Author: Daniel Simpson | |
% Date: 26/08/2010 | |
% | |
% There is no waranty or guarentee of any kind associated with this code. | |
%% | |
%Calculate adjacency graph of the pth nearest neighbour graph. | |
n = length(colours); | |
ncolours = max(colours); | |
V = zeros(n,ncolours); | |
for i = 1:ncolours | |
V(colours==i,i)=sign(randn(sum(colours==i),1)); | |
end | |
% keyboard; | |
% free(g); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment