8k views

### How to efficiently find positions of duplicates?

Is there an efficient way to find the positions of the duplicates in a list? I would like the positions grouped according to duplicated elements. For instance, given ...
785 views

### Partitioning a list when the cumulative sum exceeds 1

I have a long list of say 1 million Uniform(0,1) random numbers, such as: dat = {0.71, 0.685, 0.16, 0.82, 0.73, 0.44, 0.89, 0.02, 0.47, 0.65} I want to ...
1k views

### Index-based Array splitting

I have an array of arbitrary elements, say strings: testArray = {"String A", "String B", "String C", "String D", "String E"}; How can I split this into two ...
290 views

### 3D Thinning algorithm in Mathematica

as far as I understood Thinning[] only works on 2D images thus far. Is there a library/piece of code that performs 3D Thinning in Mathematica? Max edit: I want ...
360 views

### Ordering function with recognition of duplicates

Fairly often I have a need to get the Ordering of an expression but with recognition of duplicates. For example: ...
468 views

### How to increase the speed of DeleteDuplicates on some selected columns?

I have a data1 with 4 columns and would like to remove the duplications by looking at the first 3 columns. Thus I used below code:- ...
943 views

### How to Gather a list with some elements considered unique

I have a list of the form: list={{0,...},{1,...},{1,...},{0,...},{3,...},{3,...},{0,...},{0,...},{5,...},{5,...},{5,...},{0,...},{5,...},{0,...},...} So when we ...
180 views

### How to calculating groupwise mean

I have a huge panel data with more than 2.5 million observations and more than 15000 groups. I want to calculate group-wise mean and I also need Id variable in my result. This is what I have done. <...
146 views

### Obtain all the (multinomial) subsets

I have a set, lets say: set = {1, 2, 3, 4, 5} I want to get all the possible subsets with 1, 2, and 2 elements. What I did was to generate all possible ...