Closed lopeztarifa closed 4 years ago
The calculation of the residues in the free version: https://github.com/NLESC-JCER/Fortran_Davidson/blob/1ad27484ab09d8ff9dc69f16be62abed27a218d7/src/davidson.f90#L388-L392
can be vectorised to avoid the callings to fun_mtx_gemv and fun_stx_gemv. The trick was inspired by Votca lines:
https://github.com/votca/xtp/blob/0b1252f2f0e18d22b2eeba8428afd59c87490425/include/votca/xtp/davidsonsolver.h#L118-L122
And consists in constructing a squere matrix with the eingevalues in the diagonal first, e.g.:
! 6. Construction of lambda matrix lambda= eye( size( V, 2), size( V, 2)) do j= 1, size(V,2) lambda( j, j)= eigenvalues_sub( j) enddo
then followed by the residue calculation:
! 7. Residue calculation rs = lapack_matmul('N', 'N', stxV, eigenvectors_sub) guess = lapack_matmul('N', 'N', rs, lambda) deallocate(rs) rs = lapack_matmul('N', 'N', mtxV, eigenvectors_sub) - guess do j=1,lowest errors(j) = norm(reshape(rs,(/parameters%nparm/))) end do
The calculation of the residues in the free version: https://github.com/NLESC-JCER/Fortran_Davidson/blob/1ad27484ab09d8ff9dc69f16be62abed27a218d7/src/davidson.f90#L388-L392
can be vectorised to avoid the callings to fun_mtx_gemv and fun_stx_gemv. The trick was inspired by Votca lines:
https://github.com/votca/xtp/blob/0b1252f2f0e18d22b2eeba8428afd59c87490425/include/votca/xtp/davidsonsolver.h#L118-L122
And consists in constructing a squere matrix with the eingevalues in the diagonal first, e.g.:
then followed by the residue calculation: