Calling netsolve() to perform computation

The easiest way to perform a numerical computation in NetSolve is to call the function netsolve(). With this function, the user sends a blocking request to NetSolve. By blocking we mean that after typing the command in the Matlab session, the user resumes control only when the computation has been successfully completed on a server. The other way to perform computation is to send a nonblocking request as described in the section called Calling netsolve_nb().

Let us continue with the eig example we started to develop in the preceding section. The user now knows that he has to provide a double-precision square matrix to NetSolve, and he knows that he is going to get two real vectors back (or one single complex vector). He first creates a 300 × 300 matrix, for instance,
>> a = rand(300);
The call to NetSolve is now
>> [x y] = netsolve('eig',a)
All the calls to netsolve() will look the same. The left-hand side must contain the output arguments, in the same order as listed in the output description (see the section called What to Do First). The first argument to netsolve() is always the name of the problem. After this first argument the input arguments are listed, in the same order as they are listed in the input description (see the section called What to Do First). This function does not have a fixed calling sequence, since the number of inputs and outputs depends on the problem the user wishes to solve.

Let us see what happens when we type:
>> [x y] = netsolve('eig',a)
Sending Input to Server zoot.cs.utk.edu
Downloading Output from Server zoot.cs.utk.edu

x =          y =
    10.1204             0
    -0.9801        0.8991
    -0.9801       -0.8991
    -1.0195             0
    -0.6416        0.6511
      ...           ...
      ...           ...

As mentioned earlier, the user can decide to regroup x and y into one single complex vector. Let us make it clear again that this possibility is a specificity of eig and is not available in general for all problems. To merge x and y, the user has to type:
>> [x] = netsolve('eig',a)
Sending Input to Server zoot.cs.utk.edu
Downloading Output from Server zoot.cs.utk.edu

x =  
    10.1204 
    -0.9801 + 0.8991i
    -0.9801 - 0.8991i
    -1.0195    
    -0.6416 + 0.6511i
        .........       
        .........