4k views

How to get list of duplicates when using DeleteDuplicates?

This might be easy, but can't find a way to use DeleteDuplicates to get also list of the actual duplicates. Example: ...
1k views

Why is the new PositionIndex horribly slow?

This issue has largely been mitigated in 10.0.1. New timings for the final test below are: ...
6k views

Partitioning with varying partition size

How can I partition a list into partitions whose sizes vary? The length of the $k$'th partition is a function $f(k)$. For example: if $l = \{1, 2, 3, 4, 5, 6\}$ and $f(k) = k$. Then the partitioning ...
378 views

Find the identical rows in a matrix [duplicate]

Suppose I have the following matrix: ...
417 views

Randomly distribute numbers to lists

I have 4 empty lists. I would like to randomly distribute numbers from 1 to 10 to these 4 empty lists. How can I add integers to lists randomly? For example: ...
263 views

While partitioning the elements in a list using GatherBy, can I correspondingly partition the elements of an unrelated list?

If we have a list like the following: list1 = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; And we use GatherBy to subpartition is ...
820 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 ...
363 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: ...
489 views

Retaining and reusing a one-to-one mapping from a sort

Imagine I sort the elements of an array $Q$ by some means. Perhaps I sort strictly by the elements in the first column, perhaps I use SortBy[...] to sequentially sort by the elements in successive ...
764 views

intersection between two 2D arrays with labeled data is slow

Here is how to Generate data the function is below with two images to generate data img1 img2 ...
209 views

position of intersection of two lists

I have the two lists: ...
338 views

Modify BinLists to give elements indices in list instead of giving the list elements belonging to each bin

How could I use BinLists to give elements indices in list instead of giving the list elements belonging to each bin ? Thanks.
2k views

Match opening and closing parentheses?

Suppose I have a List of the form: lst={"(", "(", "(", ")", "(", ")", ")", ")"} By running ...