next up previous contents index
Next: 2.4 Accessing UDI_object data Up: 2. The C Interface Previous: 2.2 UDI Data Structure

  
2.3 Windows

One of the more powerful features of UDI is the ability to create an object which holds no data itself, but rather ``looks" onto a section of another object. This is extremely useful in signal processing, as one often analyzes a sampled time signal in small slices. Windows are also useful for picking out a single row or column of a matrix, or looking at the real or imaginary part of a complex datum. In the future, UDI may also support looking at a single datum inside a multiple-data element.

Windows are created by:  

void create_window(w, parent, num_elem, offset, incr, type, data_num)
   UDI_object w;      /* the window being created */
   UDI_object parent; /* the object onto which the window looks   */
   int num_elem;      /* the number of elements in the window     */
   int offset;        /* the offset into the parent of the window */

   int incr;          /* increment between elements of parent for each */
                      /* successive element of w */

   int type;          /* window type: WIN_NORMAL, WIN_SUBELEM,  */
                      /*        WIN_REAL_PART, or WIN_IMAG_PART */

   int data_num;   /* only used with WIN_SUBELEM windows, in which case */
                   /* it specifies which datum in the parent's elements */

We call the object onto which the window looks the ``parent'' to stress the window's dependence on it. If, for example, the parent is killed, the window must die as well. You may also have a window on another window, and if the parent window moves, the child window moves along with it.

By ``oring" the window types together, you can get a window on, for example, the imaginary part of a subelement of the parent. Let's say the parent's elements have five data and the second data is complex. To create a window looking onto the imaginary part of the second data of the parent's elements we set type equal to (WIN_SUBELEM | WIN_IMAG_PART)" and data_num equal to 2". Currently, though, there exist no multi-data element types.

There are some specialized routines for creating vector windows  from rows, columns, or diagonals of matrices.

 

void create_matrix_row_vector(vector, matrix, row_number)
   UDI_object vector, matrix;
   int row_number;

   

void create_matrix_column_vector(vector, matrix, column_number)
   UDI_object vector, matrix;
   int column_number;

void create_matrix_diagonal_vector(vector, matrix)
   UDI_object vector, matrix;
There are also routines for changing the ``shape" of the window:      
void set_window_length(window, num_elem)
   UDI_object window;
   int num_elem;

void set_window_offset(window, offset)
   UDI_object window;
   int offset;

void set_window_incr(window, increment)
   UDI_object window;
   int increment;
In signal processing, one often treats a signal in small chunks, so it is useful to be able to slide a window around in its parent.  
void slide_window(window, num_elem)
   UDI_object window;
   long num_elem;
A second function exists which does the same thing, except that if the window slides outside of its parent, the length of the window is shortened so that it fits.  
void slide_window_clip(window, num_elem)
   UDI_object window;
   long num_elem;


next up previous contents index
Next: 2.4 Accessing UDI_object data Up: 2. The C Interface Previous: 2.2 UDI Data Structure
Diemo Schwarz
1999-03-04