28
$\begingroup$

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 BenchmarkPlot from the GeneralUtilities package doesn't work and we shall focus on the situation of 10.1.0 here. Copying Taliesin Beynon's initial use of the function on this site:

Needs["GeneralUtilities`"]

myPosIdx[x_] := <|Thread[x[[#[[All, 1]]]] -> #]|> &@GatherBy[Range@Length@x, x[[#]] &];

This evaluates as follows in 10.1.0

BenchmarkPlot[{PositionIndex, myPosIdx}, RandomInteger[100, #] &, 16, 
 "IncludeFits" -> True]

SymbolName::sym: Argument {37,31,57,40,5,78,99,97,78,49,82,60,98,80,68,62} at position 1 is expected to be a symbol. >>

SymbolName::sym: Argument {37,31,57,40,5,78,99,97,78,49,82,60,98,80,68,62} at position 1 is expected to be a symbol. >>

SymbolName::sym: Argument {37,31,57,40,5,78,99,97,78,49,82,60,98,80,68,62} at position 1 is expected to be a symbol. >>

General::stop: Further output of SymbolName::sym will be suppressed during this calculation. >>

What went wrong and how do I fix it?

$\endgroup$
6
  • $\begingroup$ See the same in Ubuntu (consider this a confirmation!) $\endgroup$ Commented May 12, 2015 at 8:15
  • $\begingroup$ This also no longer works on 10.1.0 for OSX. $\endgroup$ Commented May 12, 2015 at 9:36
  • $\begingroup$ I have reported this as "[CASE:3460529] PrintDefinitions from package GeneralUtilities` bug" $\endgroup$ Commented Nov 4, 2015 at 19:42
  • $\begingroup$ @Sjoerd Has a solution for the new bug been identified? $\endgroup$
    – Mr.Wizard
    Commented Jan 10, 2016 at 22:33
  • $\begingroup$ @Mr.Wizard Not that I know of. I just tested it on 10.3.1 and it still gave these error messages. $\endgroup$ Commented Jan 10, 2016 at 22:49

1 Answer 1

22
$\begingroup$

In addition to the error messages quoted in the question the line returns:

GeneralUtilities`Benchmarking`PackagePrivate`plot[
 IndexBy[{{{16, 9.37132*10^-6}, . . .

IndexBy was removed from 10.1.0:

Note that IndexBy will be removed in a future version of Mathematica. It was something that was considered for 10.0.0 but didn't make the cut. – Stefan R Feb 26 at 17:37

We can therefore fix the problem by restoring the function IndexBy. I provided an improved definition for this function here:

We can either:

  • Load this definition into the System context, e.g. System`IndexBy = indexBy, or

  • Redefine the BenchmarkPlot subfuction that uses IndexBy:

    Get["GeneralUtilities`"];
    
    With[
      {dv := DownValues[GeneralUtilities`Benchmarking`PackagePrivate`addlabels]},
      dv = dv /. System`IndexBy -> indexBy;
    ]
    
$\endgroup$
7
  • $\begingroup$ Hmm, so they removed IndexBy, but forgot to update BenchmarkPlot? And actually it looks very strange to remove a function in a minor update... $\endgroup$
    – Ruslan
    Commented May 12, 2015 at 11:45
  • $\begingroup$ @Ruslan IndexBy was an undocumented internal function so there was no obligation to keep it but it seems that there was a lack of communication or at least coordination within WRI regarding its existence. $\endgroup$
    – Mr.Wizard
    Commented May 12, 2015 at 11:47
  • 3
    $\begingroup$ Looks like BenchmarkPlot has already been fixed in our latest development builds, but this is a great workaround until the next release! $\endgroup$
    – Stefan R
    Commented May 12, 2015 at 17:43
  • 4
    $\begingroup$ It now fails in 10.3 with a different error: First argument {{16.,{0.124288,<|9->{10000.},11->{20000.},6->{30000.},99->{40000.},57->{50000.},35->{60000.},88->{70000.},78->{80000.},61->{90000.},93->{100000.},76->{110000.,120000.},51->{130000.},23->{140000.},44->{150000.},74->{160000.}|>}},{24.,{<<1>>}},{36.,{0.241031,<|81->{10000.},19->{20000.},<<28>>,25->{360000.}|>}}} in NonlinearModelFit is not a list or a rectangular array. >> $\endgroup$
    – Verbeia
    Commented Oct 19, 2015 at 3:24
  • 1
    $\begingroup$ 10.4.1 contains a definition of IndexBy in GeneralUtilities. $\endgroup$ Commented May 4, 2016 at 20:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.