Code covered by the BSD License  

Highlights from
Submodular Function Optimization

image thumbnail

Submodular Function Optimization


Andreas Krause


28 Jun 2008 (Updated )

This toolbox provides functions for maximizing and minimizing submodular set functions.

% Andreas Krause (
% Compute Euclidean distances between a set of vectors
% function D = sfo_dist(coords)
% coords: N x D matrix of points (each of the N rows is a vector)
% returns an N x N matrix of Euclidean distances
% Example: coords = rand(10,2); D = sfo_dist(coords)

function D = sfo_dist(coords)
n = size(coords,1);
D = zeros(n);

for i = 1:n
    x = coords(i,:);
    D(i,:) = sqrt(sum((ones(n,1)*x-coords).^2,2));

Contact us