f1 = {Max[4 # - 1.5, -4 # + 4.5], Min[4 # - 0.5, -4 # + 3.5],
Min[4 # + 0.5, -4 # + 2.5]} &;
cf1 = Compile[{{z, _Real}}, {Max[4 z - 1.5, -4 z + 4.5],
Min[4 z - 0.5, -4 z + 3.5], Min[4 z + 0.5, -4 z + 2.5]}];
ArrayPlot[Table[x y, {x, -200, 200}, {y, -200, 200}],
ColorFunction -> (RGBColor@f1@# &)] // Timing
I know how to compile the ColorFunction f1, but I dont't know whether f2 can be compiled.
f2 = Blend[{{0, RGBColor[0, 0, 9/16]}, {1/9, Blue}, {23/63, Cyan},{13/21,Yellow},
{47/63, Orange}, {55/63, Red}, {1, RGBColor[1/2, 0, 0]}}, #] &;
Blendis not on that list, which means you can't compile it unless you re-implementBlendusing functions on that list (which shouldn't be hard, since it's just linear interpolation). – rm -rf Mar 12 '13 at 13:32ColorFunctionit shouldn't be too slow... – s0rce Mar 12 '13 at 18:20Blend[]internally performs linear interpolation over the RGB color space. See the linked question for compiled functions for linear interpolation. – J. M.'s missing motivation Apr 27 '13 at 04:45