Home » Source Code » Hash algorithms » lshcode/lshfunc.m

lshcode/lshfunc.m ( File view )

  • By 毛宁 2014-10-28
  • View(s):33
  • Download(s):0
  • Point(s): 1
			function I = lshfunc(type,l,k,d,varargin)
% I = lshfunc(TYPE,L,K,D)
% Creates a random set of locality-sensitive hash functions. 
% Input:
%    TYPE : type of hashing, can be 'lsh'/'e2lsh'
%           (see README and lsh.m for explanation)
%    L : number of functions (i.e., of hash tables)
%    K : number of bits in a function (i.e., length of a key)
%    D : is the dimension of the data.
% Output:
%  I(j) is the function for the j-th table. It's a struct with the
%  following fields, that depend on the choice of hashing scheme:
%    'lsh':  d - the vector of k dimensions
%            t - the vector of k thredholds
%    'e2lsh' : W - the width of intervals on random projection line
%              A - projection matrix (D x k)
%              b - random shifts (1 x k)
%  I = lshfunc(...,'exclude',EXCL)
%    will exclude the dimensions listed in vector EXCL (i.e., those
%    dimensions will not be used at all in calculating the hash). 
%    Default is to include all dimensions.
%  I = lshfunc(...,'range',RNG)
%    will assume that the range of the data is given by RNG. which can be:
%      a scalar, meaning each dimension range is [0,RNG]
%      a 1 x D vector, meaning dimension i has range [0,RNG(i)]
%      a 2 x D matrix, with the range for i-th dimension given by RNG(:,i)
%    Default for RNG is 1.
%  I = lshfunc(...,'W',W)
%    provides a value for parameter W in e2lsh scheme. W is a scalar
%    specifying the width of an interval on the projection line
%    corresp. to a single hash value. 
%    If W is negative, its abs. value is interpreted as the number of intervals.
%    Default for W is to partition the range into 16 intervals.
% (C) Greg Shakhnarovich, TTI-Chicago (2008)


% parse the optional arguments
for a=1:2:length(varargin)

% convert the range to 
range = processRange(d,range);

switch type, % different algorithms

  case 'lsh',  % optim
(Please download the complete source code to view)
Expand> <Close

Want complete source code? Download it here

Point(s): 1

0 lines left, continue to read
Sponsored links

File list

Tips: You can preview the content of files by clicking file names^_^
Name Size Date
0.00 B2009-06-26|22:00
findbucket.m653.00 B2008-11-10|12:45
lpnorm.m3.79 kB2008-11-10|12:45
lsh.m3.18 kB2008-11-10|12:45
lshfunc.m2.94 kB2008-11-10|12:45
lshhash.m957.00 B2008-11-10|12:45
lshins.m3.21 kB2008-11-10|12:45
lshlookup.m3.07 kB2009-06-26|21:35
lshprep.m1.56 kB2008-11-10|12:45
lshstats.m2.36 kB2009-06-26|21:36
processRange.m1.01 kB2008-11-10|12:45
README10.58 kB2009-06-26|22:00
Sponsored links

lshcode/lshfunc.m (12.66 kB)

Need 1 point
Your Point(s)

Your Point isn't enough.

Get point immediately by PayPal

More(Debit card / Credit card / PayPal Credit / Online Banking)

Submit your source codes. Get more point


Don't have an account? Register now
Need any help?
Mail to: support@codeforge.com


CodeForge Chinese Version
CodeForge English Version

Where are you going?

^_^"Oops ...

Sorry!This guy is mysterious, its blog hasn't been opened, try another, please!

Warm tip!

CodeForge to FavoriteFavorite by Ctrl+D