compute_ritz_vectors Subroutine

public subroutine compute_ritz_vectors(this, k)

Arguments

Type IntentOptional Attributes Name
type(LanczosCalcType), intent(inout) :: this
integer, intent(in) :: k

Contents

Source Code


Source Code

    subroutine compute_ritz_vectors(this, k)
        ! now we project the eigenvalues of T into the full space to obtain
        ! estimates for the state vectors
        !   rows, columns:                                       M                                N
        ! ritz_vectors(n_states, space_size) = T_eigenvectors(n_states, k) x basis_vectors(k, space_size)
        !   we want to do (column-major):
        ! ritz_vectors(space_size, n_states) = T_eigenvectors(k, n_states) x basis_vectors(space_size, k)

        type(LanczosCalcType), intent(inout) :: this
        integer, intent(in) :: k
        integer :: i, j

        associate(space_size => this%super%space_size)

            if (this%super%t_store_subspace_basis) then
                ! for each state, find the ritz vector
                ! TODO: do this with BLAS
                do i = 1, this%n_states
                    do j = 1, space_size
                        this%ritz_vectors(j, i) = inner_product(this%super%basis_vectors(j, 1:k), this%T_eigenvectors(1:k, i))
                    end do
                end do
            else
                ! TODO: must reconstitute the basis vectors one at a time
            end if
        end associate
    end subroutine compute_ritz_vectors