As explained in Chapter 1, the following
steps will perform the rank-1 update
:
We will now show how to translate these operations into PLAPACK code.
- spread (collect) the entries of x within columns of nodes,
- spread (collect) the entries of y within rows of nodes, and
- perform the local rank-1 updates.
Consider again the driver code for matrix-vector multiply given in Example 2.3, yielding objects a, x, and y. The following statements will perform the spread of x within columns of nodes, and the spread of y within rows of nodes:
PLA_Obj_datatype( a, &datatype );
PLA_Pvector_create( datatype, PLA_PROJ_ONTO_ROW, PLA_ALL_ROWS,
n, template, PLA_ALIGN_FIRST, &xdup );
PLA_Copy( x, xdup );
PLA_Pvector_create( datatype, PLA_PROJ_ONTO_COL, PLA_ALL_COLS,
m, template, PLA_ALIGN_FIRST, &ydup );
PLA_Copy( y, ydup );
After this, all information is available locally to perform
the local rank-one update. Before doing so, we need to create
duplicated multiscalar to hold the constant ``1''.
PLA_Mscalar_create( datatype, PLA_ALL_ROWS, PLA_ALL_COLS, 1, 1, template, &one ); PLA_Obj_set_to_one( one ); PLA_Local_ger( one, y, x, a );