To perform a single-instance operation, specify each vector argument as a 1D parallel array and each matrix argument as a 2D parallel array. (Alternatively, you can declare these arguments to have more dimensions, but all instance axes must have length 1.)
For example, a single-instance operation in F77 can be performed by first defining the block-distributed arrays:
integer*8 a, x, y integer*4 ext(2), axis_is_local(2) integer*4 ier axis_is_local(1) = 0 axis_is_local(2) = 0 ext(1) = p ext(2) = q call s3l_declare(a, 2, ext, S3L_float, axis_is_local, $ S3L_USE_MALLOC, ier) call s3l_declare(x, 2, ext, S3L_float, axis_is_local, $ S3L_USE_MALLOC, ier) call s3l_declare(y, 2, ext, S3L_float, axis_is_local, $ S3L_USE_MALLOC, ier) |
and then using
call S3L_mat_vec_mult(y, a, x, 1, 1, 2, 1, ier) |
Arrays x and y are 1D; the definitions of x_vector_axis = 1 and col_axis = 2 indicate that the product a(i, j) * x(j) will be evaluated for all values of j. These products will be summed over the first index of a (row_axis = 1), and the result added to the corresponding element in y. The equivalent code is
do i = 1, p sum = 0.0 do j = i, q sum = sum + a(i, j) * x(j) enddo enddo |