Using this function avoids to call Matlab SORT(), which does unnecessary work since the two inputs is already sorted.
Mex implementation for speed.
'rows' option supported
Hi Paul, you are right this is a BUG. Submission including correction is pending.
Hi Bruno, thanks for a useful tool. It comes in handy for efficiently summing sparse tensors together. On my system there appears to be a bug when one of the two arrays is empty (see example case below). Is this a compilation problem on my system or a bug in the algorithm? Thanks!
>> [C idx]=mergesa(,[1 1 1; 3 1 1],'rows')
1 1 1
3 1 1
@Tal: C++ comments are accepted in the C99 style. Only C89 does not consider them, but this standard is 23 years old now.
note that the .c files have c++ comments, resulting in errors when compiled with gcc.
file names should be changed to .cpp or use a c style comments.
Fix bug of merge rows with empty array
Minor speed improvement
Optionally return the splitting locations of the inputs