{S,D}ROTI ( nz, x, indx, y, c, s )
nz integer*4 On entry, the number of elements in the vector in the compressed form. On exit, nz is unchanged. x real*4 | real*8 On entry, an array of the elements of vector x in compressed form. On exit, if nz <= 0, x is unchanged. If nz > 0, the array X is updated. indx integer*4 On entry, an array containing the indices of the compressed form. The values in INDX must be distinct for consistent vector or parallel execution. On exit, indx is unchanged. y real*4 | real*8 On entry, an array of the elements of vector y stored in full form. On exit, if nz <= 0, y is unchanged. If nz > 0, the elements in the vector y corresponding to the indices in the INDX array are overwritten. c real*4 | real*8 On entry, c is the first rotation element, which can be interpreted as the cosine of the angle of rotation. On exit, c is unchanged. s real*4 | real*8 On entry, s is the second rotation element, which can be interpreted as the sine of the angle of rotation. On exit, s is unchanged.
The _ROTI routines apply a real Givens rotation to a sparse vector x stored in compressed form and another vector y stored in full form. For i = 1, ..., nz: temp = -s * x(i) + c * y(indx(i)) x(i) = c * x(i) + s * y(indx(i)) y(indx(i)) = temp If nz <= 0, x and y are unchanged. Only the elements of y whose indices are listed in INDX are referenced or modified. The output vectors x and y have nonzero elements in the locations where either input vector x or y had nonzero elements. Because the _ROTI subprograms do not handle this fill-in, the arrays X and INDX must take this into account on input. This means that all nonzero elements of y must be listed in the array INDX, resulting in an INDX array containing the indices of all nonzero elements of both vectors x and y.
INTEGER NZ, INDX(10) REAL*8 Y(40), X(10), C, S NZ = 10 CALL DROTI(NZ, X, INDX, Y, C, S) This FORTRAN code shows how to apply a Givens rotation to a sparse vector x, stored in compressed form, and another vector y, stored in full form.