1 subroutine ga_orthog_vec(n, nvec, g_m, g_x, j) 2C$Id$ 3 implicit none 4#include "global.fh" 5 integer n ! vector length 6 integer nvec ! no. of vectors 7 integer g_m ! GA handle for matrix 8 integer g_x ! GA handle for vector 9 integer j ! Column for vector 10c 11c orthogonalize the vector x(1:n,j) to the vectors g(1:n, 1:nvec) 12c 13c Note that x is NOT normalized. 14c 15 integer i, iter 16 double precision xm, mm 17c 18 do iter = 1, 2 19 do i = 1, nvec 20 xm = ga_ddot_patch( 21 $ g_x, 'n', 1, n, j, j, 22 $ g_m, 'n', 1, n, i, i) 23 mm = ga_ddot_patch( 24 $ g_m, 'n', 1, n, i, i, 25 $ g_m, 'n', 1, n, i, i) 26 call ga_dadd_patch( 27 $ 1.0d0, g_x, 1, n, j, j, 28 $ -xm/mm, g_m, 1, n, i, i, 29 $ g_x, 1, n, 1, 1) 30 enddo 31 enddo 32c 33 end 34 35