Skip to content

Commit

Permalink
merged with head
Browse files Browse the repository at this point in the history
  • Loading branch information
jegonzal committed Mar 5, 2011
2 parents 381e58b + 8812a2f commit 3c4bb32
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
22 changes: 22 additions & 0 deletions matlab/util/group.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
function [chunks, groupname, cuts] = group(M, group_on, aggregate)
% Example Usage:
% grps = group(raw.data, [1,2], [1,2,4]);
% groups together (puts in the same cell) the rows of raw.data that have
% the same values for columns [1,2]. And the data that is put in the cell
% is the values in cols [1,2,4].


%% This is a very powerful function to group large tables
% Let M be a large table with each row being a record
% then group on are the columns on which to group the records
% and aggregate are the columns to retain in the final grouping
% chunks will be a cell array where each cell contains all the
% records with groupname and cuts is the count of the items in that
% group.
[groupname, junk, ind] = unique(M(:,group_on), 'rows');
clear('junk');
[junk, oind] = sort(ind);
clear('junk');
cuts = hist(ind, min(ind):max(ind))';
chunks = mat2cell(M(oind,aggregate), cuts, length(aggregate));
end
2 changes: 1 addition & 1 deletion src/graphlab/core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ namespace graphlab {
gl::core glcore;
\endcode
The core contains the
cd The core contains the
\li Data Graph: which represents the structured data dependencies.
\li Engine: The computational structure which contains the
Expand Down

0 comments on commit 3c4bb32

Please sign in to comment.