I do not know a way to make Experimental`NumericalFunction
listable itself, but depending of your goals you can achieve the same behavior in several ways.
The simplest way is to create a proxy Symbol
with Listable
attribute:
ClearAll[f, fL]
SetAttributes[fL, Listable]
fL[x_] := f[x]
f = Experimental`CreateNumericalFunction[{x}, x^2, {}, {_}, WorkingPrecision -> 30];
fL@Table[i, {i, 1, 10}]
{1.`30., 4.`30., 9.`30., 16.`30., 25.`30., 36.`30., 49.`30., 64.`30., 81.`30., 100.`30.}
It is also possible to assign the Listable
attribute directly to f
:
ClearAll[f]
SetAttributes[f, Listable]
f[x_] = Block[{x},
Experimental`CreateNumericalFunction[{x}, x^2, {}, {_Real}, WorkingPrecision -> 30][x]]
f@Table[i, {i, 1, 10}]
{1.`30., 4.`30., 9.`30., 16.`30., 25.`30., 36.`30., 49.`30., 64.`30., 81.`30., 100.`30.}
Instead of the attribute one can program listability via Map
what can be even faster:
ClearAll[f]
f[l_List] := f /@ l;
f[x_] = Block[{x},
Experimental`CreateNumericalFunction[{x}, x^2, {}, {_Real}, WorkingPrecision -> 30][x]];
f@Table[i, {i, 1, 10}]
{1.`30., 4.`30., 9.`30., 16.`30., 25.`30., 36.`30., 49.`30., 64.`30., 81.`30., 100.`30.}
Another way is to create a listable pure function:
ClearAll[f]
f = With[{f = Experimental`CreateNumericalFunction[{x}, x^2, {}, {_Real}, WorkingPrecision -> 30]},
Function[x, f[x], Listable]];
f@Table[i, {i, 1, 10}]
{1.`30., 4.`30., 9.`30., 16.`30., 25.`30., 36.`30., 49.`30., 64.`30., 81.`30., 100.`30.}
Or you can Map
f
at level -1
(assuming that your input matrix contains only numbers and not expressions):
ClearAll[f]
f = Experimental`CreateNumericalFunction[{x}, x^2, {}, {_Real}, WorkingPrecision -> 30];
table = Table[i, {i, 1, 10}];
Map[f, table, {-1}]
{1.`30., 4.`30., 9.`30., 16.`30., 25.`30., 36.`30., 49.`30., 64.`30., 81.`30., 100.`30.}
Also it is possible to create a numerical function accepting a list of fixed length (but probably it isn't sufficient for you):
ClearAll[f]
f = Experimental`CreateNumericalFunction[{{x, {10}}}, x^2, {10}, WorkingPrecision -> 30];
f@Table[i, {i, 1, 10}]
{1.`30., 4.`30., 9.`30., 16.`30., 25.`30., 36.`30., 49.`30., 64.`30., 81.`30., 100.`30.}
Experimental`CreateNumericalFunction
? $\endgroup$Listable
function:fL = Function[x, f[x], Listable]
$\endgroup$