# How to access the components of a vector-valued interpolating function?

I have a problem in accessing the components of a vector-valued interpolating function. I have the following data:

data = {{0, {1, 0}}, {1, {0, 1}}};


with a interpolating function

ip = Interpolation[data, InterpolationOrder -> 1];


I can now get the value of ip at a given argument, say 0.5 and get:

ip[0.5]

{0.5, 0.5}


However, if I use a symbol instead of a number as argument, I get

{a, b} - ip[c]

{a - InterpolatingFunction[{{0, 1}}, <>][c],
b - InterpolatingFunction[{{0, 1}}, <>][c]}


Now, I can use Indexed

MapIndexed[#1 - Indexed[ip[c], #2] &, {a, b}]


But this seems to be rather complex for such a seemingly simple task.

So I guess what I'm looking for is a way to convert an InterpolatingFunction with 'Output dimensions' n into an n-Vector of InterpolatingFunction with 'OutputDimensions' 1.

PS:

MapIndexed[Indexed[ip[c], #2] &, Range[2]]


seems to work. So I just leave this question hoping for a more 'idiomatic' solution.

The main advantage over Indexed is that the interpolating function is evaluated only once. Having to introduce a dummy variable seems a drawback.

vectorEvaluate // ClearAll;
vectorEvaluate // Attributes = {HoldRest};
vectorEvaluate[v_?VectorQ, x_, code_] := Block[{x = v}, code];

data = {{0, {1, 0}}, {1, {0, 1}}};
ip = Interpolation[data, InterpolationOrder -> 1];
vectorEvaluate[ip[c], v, {a, b} - v]
(*
vectorEvaluate[
InterpolatingFunction[{{0, 1}},...][c],
v, {a, b} - v]
*)

Block[{c = 0.2}, %]
(*  {-0.8 + a, -0.2 + b}  *)


Alternatively:

vectorEvaluate // ClearAll;
vectorEvaluate // Attributes = {HoldRest};
vectorEvaluate[v_?VectorQ, code_] := Block[{x = v}, code];

vectorEvaluate[ip[c], {a, b} - ip[c]]


Here ip[c] is evaluated twice, only twice even if ip[c] has more than two components. With Indexed as in the OP, ip[c] would have to be evaluated as many times as components.