next up previous contents index
Next: 4. The DSP Functions Up: 3. Unix Command-line Interface Previous: 3.1 Description

Subsections

3.2 Examples

Since there are several ways in which arguments are passed to the UDI DSP functions, some examples might be helpful. These examples don't cover every possible combination of input/output vectors, input/output scalars, and flags, but they should be sufficient to give the SPMquotcall_udi" user a good idea of how to call any of the functions. Please see the chapter describing the DSP functions in order to see how arguments are passed to each specific function. Since some of these command lines are a bit complicated with several options, it may be worthwhile for the user to create aliases or shell scripts to reduce the amount of typing for commonly used calls.

3.2.1 Output Vector

To call a function such as SPMquothamm" with no input, but one vector output:
call_udi hamm -d16 -O
Note that the SPMquot-d" option is required to specify the length of the desired output vector. The SPMquot-O" option causes the output to be in ASCII form instead of binary.

3.2.2 Input Vector and Output Vector

To call a function such as SPMquotvsin" with one input and one output vector:
call_udi vsin -I -O < vector.in
This assumes that there is an ASCII file called SPMquotvector.in", with one floating-point number per line. Note that it isn't necessary to specify the length of the input vector with the SPMquot-d" option, since SPMquotcall_udi" counts the number of lines in the input file. Be careful though! If instead of redirecting input from a file, you use the console to directly type the input, or if you use a pipe, it would then be necessary to specify the length explicitly. The output will be sent to the standard output also in ASCII format.

3.2.3 Two Input Vectors and Output Vector

To call a function such as SPMquotvdiv" with two input and one output vector:
call_udi vdiv -I -O -fvector2.in < vector1.in
The first vector argument to SPMquotvdiv" will be read in ASCII format from SPMquotvector1.in", while the second vector argument will be read from SPMquotvector2.in" (also in ASCII format). The output will be sent to the standard output in ASCII format.

3.2.4 Input Vector, Input Scalar, Output Vector

To call a function such as SPMquotvsadd" which has an input scalar, one input vector and an output vector:
call_udi vsadd -I -O -s5.0 < vector.in

3.2.5 Input Flag, Output Vector

To call a function such as SPMquotbkman" which has a flag input, and an output vector:
call_udi bkman -d16 -O -y2
Here, the SPMquot-y2" flag specifies the coefficients to use in computing the Blackman window. Again it's necessary to use the SPMquot-d" option to specify the length of the output vector, since there's no input vector.

3.2.6 Input Vector with Increment, Output Vector

To call a function such as SPMquotpolar" which uses an increment, and has an input and output vector:
call_udi polar -I -O -c2 < vector.in > vector.out
Notice that it's necessary to use a multiple of two for the input increment with functions such as SPMquotpolar" and SPMquotrect", since the vectors represent ordered pairs of data (magnitude, phase) or (x, y).

3.2.7 Square Input Matrix, Input Scalar and Output Matrix

To call a function such as SPMquotmatinv" assuming that the input and output matrices are square (number of elements in the file is a power of two):
call_udi matinv -I -O -s0.0 < matrix.in
Notice that it isn't necessary to use the \verb"-r" option since the number
of rows, by default, is the square root of the number of elements in the
file.

3.2.8 Input Matrix and Output Matrix

To call a function such as SPMquotmtrans" with an input matrix which is not necessarily square:
call_udi mtrans -I -O -r4 < matrix.in
Let's consider that the file SPMquotmatrix.in" has sixty-four elements. Thus the flag SPMquot-r4" option tells SPMquotcall_udi" that the matrix has four rows and sixteen (64/4) columns.

3.2.9 Two Input Matrices and Output Matrix

To call a function such as SPMquotmmul" or SPMquotvmmul":
call_udi mmul -I -O -r4 -fmatrix2.in < matrix1.in
Here the dimensions of both input matrices may be arbitrary, except the number of rows of the second matrix must equal the number of columns in the first matrix. The SPMquot-r4" option specifies the number of rows for the first matrix. The other dimensions are calculated by considering the number of elements in both files.


next up previous contents index
Next: 4. The DSP Functions Up: 3. Unix Command-line Interface Previous: 3.1 Description
Diemo Schwarz
1999-03-04