Next: 3.2 Splitting of Linear Up: 3 Advanced Linear Algebra Previous: 3 Advanced Linear Algebra

# 3.1 Creating Views into Objects

A view of a linear algebra object is created by a call to the following routine

Valid values for new_obj are NULL, in which case space is created for the data structure in which the descriptor of the object is stored, or a pointer to a previously created object or view. In the latter case the existing object is either freed and new space created, or the existing object is reused (e.g., for performance reasons). Notice that the alignment is with respect to the parent object (obj_old), not with respect to the template. Whether indexing starts at zero or one is still determined by the value of zero_or_one used when the template was created. There are a number of special constants defined to aid in the creation of a view: if global_length and/or global_width equal

PLA_DIM_ALL, the global length and/or width of the view equals that of the original object. Also, by setting align_row or align_col equal to

PLA_ALIGN_FIRST, one indicates alignment with the first row or column index of the original object, avoiding having to check if zero_or_one in the template is zero or one. The input object type is inherited by the output object.

PLACE BEGIN HR HERE

PLACE END HR HERE

A frequent use of views is to create a new reference into the entire original object, much like creating a second pointer into a buffer, so that this new pointer can be used to step through the buffer without loosing the reference to the beginning of the buffer. For this we have a special routine

Swapping two views can be accomplished by calling

This call is equivalent to the following sequence of calls:
```PLA_Obj_view_all( obj2, &temp );
PLA_Obj_view_all( obj1, &obj2 );
PLA_Obj_view_all( temp, &obj1 );
PLA_Obj_free( &temp );```
However, since in our implementation views are just pointers to data structures, a swap can also be accomplished by the sequence of statements
```temp = obj2;
obj2 = obj1;
obj1 = temp;```
By calling the swap routine, a user can be guaranteed to be independent of the underlying implementation of PLAPACK.

Next: 3.2 Splitting of Linear Up: 3 Advanced Linear Algebra Previous: 3 Advanced Linear Algebra

rvdg@cs.utexas.edu