27
$\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$
  • $\begingroup$ See the same in Ubuntu (consider this a confirmation!) $\endgroup$ – dr.blochwave May 12 '15 at 8:15
  • $\begingroup$ This also no longer works on 10.1.0 for OSX. $\endgroup$ – Jacob Akkerboom May 12 '15 at 9:36
  • $\begingroup$ I have reported this as "[CASE:3460529] PrintDefinitions from package GeneralUtilities` bug" $\endgroup$ – Jacob Akkerboom Nov 4 '15 at 19:42
  • $\begingroup$ @Sjoerd Has a solution for the new bug been identified? $\endgroup$ – Mr.Wizard Jan 10 '16 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$ – Sjoerd C. de Vries Jan 10 '16 at 22:49
21
$\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$
  • $\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 May 12 '15 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 May 12 '15 at 11:47
  • $\begingroup$ Thanks for tracking this down. It was on my to-do list, as I ran into this a couple of days ago. (+1 on both Q&A) $\endgroup$ – Michael E2 May 12 '15 at 13:15
  • 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 May 12 '15 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 Oct 19 '15 at 3:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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