Nonblocking Call to NetSolve

As in the Matlab interface (see Chapter 6), the Mathematica interface can be called in an asynchronous fashion. Nonblocking calls are performed by the function NetSolveNB[], and its calling sequence is the same as the blocking call NetSolve[]. The difference is in the result returned. NetSolveNB[] always returns a request handler.

NetSolveProbe[] returns an integer value to indicate if the problem has been completed. A value of 0 indicates that the result is available and a value of 1 indicates that the computation is still in progress. Other values are error codes (see the section called Catching Errors).

Let us multiply two complex matrices using NetSolveNB[]. We generate the matrices ac and bc using already generated matrices a, b and c.
In[17]:= ac = a - 2 a I

Out[17]= {{9 - 18 I, 2 - 4 I, 3 - 6 I}, {6 - 12 I, 3 - 6 I, 9 - 18 I}}

In[18]:= bc = b - 3 b I

Out[18]= {{6 - 18 I, 4 - 12 I}, {4 - 12 I, 10 - 30 I}, {2 - 6 I, 9 - 27 I}}  

In[19]:= request = NetSolve[zmatmul[ac, bc]]
contacting server cetus2a.cs.utk.edu ...

Out[19]= 0

In[20]:= NetSolveProbe[request]

Out[20]= 0

As the computation is still in progress, the user can choose to perform other work, or wait for the request to complete:
In[21]:= NetSolveWait[request]

Out[21]= {{-340. - 340. I, -415. - 415. I}, {-330. - 330. I, -675. - 675. I}}