Linked Questions

63
votes
8answers
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 ...
43
votes
5answers
1k views

Why is there no PositionFunction in Mathematica?

Too often I have seen the programs of inexperienced users greatly slowed by using Position in an iterative fashion, when far faster would have been to compute a ...
22
votes
4answers
3k views

Can Mathematica's random number generation be improved?

Performance on Random Number generation is intolerable. Whenever you need many deviates from the same distribution but with different parameters it takes forever. Here is a thread on Poisson deviates ...
14
votes
5answers
2k views

GroupBy several keys while keeping the Dataset as a Table (List of Associations)

Assume you import data from a Table source of the following format. ...
16
votes
4answers
793 views

Reproducing a ranking function that behaves like Excel's RANK

I tried to find a function or expression in Mathematica that produces the same output as the RANK function in Excel (see its description here), but unfortunately I ...
31
votes
2answers
773 views

Why is Query so much slower than Part?

Time for another of these(1),(2) as yet another new-in-10 function appears to have poor performance compared to older alternatives. This time: Query appears to be ...
29
votes
1answer
931 views

Why some built-in functions are slow

I just wonder why some built-in functions are slower compared to some other ways using more than one built-in functions for doing same job. consider this example: ...
27
votes
1answer
650 views

In 10.1.0 BenchmarkPlot doesn't work?

Bug introduced in 10.1 This bug was resolved in 10.2.0, but another bug was introduced in 10.3.0 persisting through 10.3.1 and finally resolved in 10.4 In Mathematica 10.1.0 and 10.3.0 ...
9
votes
6answers
331 views

Truncating a list once all members of a set have appeared?

Consider if you would the case where we have some list of elements: list0 = {54, 4, 7, 9, 3, 54, 4, 20, 2, 456, 2, 3}; And we have some target list: ...
6
votes
3answers
288 views

Speed of ConvexHullMesh

Pick $N$ random points on the surface of the sphere, then use ConvexHullMesh[] to compute their convex hull. Empirically, this takes time quadratic time in $N,$ ...
9
votes
2answers
208 views

Slicing an Association with named key span without normalizing?

Is there way to slice an Association with named key span? Span currently doesn't accept named keys: ...
11
votes
2answers
407 views

Held keys in associations

Bug introduced in 10.0 and persisting through 11.0.1 or later Bug introduced in 10.0 and fixed in 10.4 Association is new in 10.0. Bug still present: ...
9
votes
2answers
660 views

Extracting values with multiple keys

I want to extract sorted data from a huge database based upon two (or more) keys in a very timely manner. Here is a reproducible toy example for two keys only: ...
6
votes
1answer
264 views

Why is AllTrue much slower than VectorQ?

This seems to be a theme with V10, a new function dedicated to a specific task doesn't live up to expectation performance-wise. Mr. Wizard has already uncovered 2 such functions here and here. So how ...
7
votes
2answers
134 views

Multi-dimensional PositionIndex

I've noticed that PositionIndex does not take a level spec like most related functions. So while it's very useful on 1D lists, I can't really use it to get a index ...

15 30 50 per page