Dear Statlisters
Is there a Mata equivalent to Stata's cross function, SQL's cross join or R's expand.grid(), such that if X = [1 \ 2] and Y = [3 \ 4] then Z(X,Y) = [1, 3 \ 1, 4 \ 2, 3 \ 2, 4]? Sorting of rows is not important. (Note: the Mata cross() function does something different.)
I can imagine a solution that adds rows to a new matrix at each step of a nested loop but is there anything faster or more elegant? The application is that I wish to implement a multiple pass (parallel) blocking strategy in probabilistic record linkage. I wish to first create a key of comparisons to be made which can then be deduplicated before deriving the match weights. I'm aiming to avoid the redundant calculations that are created by multiple pass blocking strategies.
Is there a Mata equivalent to Stata's cross function, SQL's cross join or R's expand.grid(), such that if X = [1 \ 2] and Y = [3 \ 4] then Z(X,Y) = [1, 3 \ 1, 4 \ 2, 3 \ 2, 4]? Sorting of rows is not important. (Note: the Mata cross() function does something different.)
I can imagine a solution that adds rows to a new matrix at each step of a nested loop but is there anything faster or more elegant? The application is that I wish to implement a multiple pass (parallel) blocking strategy in probabilistic record linkage. I wish to first create a key of comparisons to be made which can then be deduplicated before deriving the match weights. I'm aiming to avoid the redundant calculations that are created by multiple pass blocking strategies.
Comment