Sub Ex_Zhpgvd()
Const N = 3
Dim Ap(N * (N + 1) / 2) As Complex, Bp(N * (N + 1) / 2) As Complex
Dim W(N - 1) As Double, Z(N - 1, N - 1) As Complex, Info As Long
Ap(0) = Cmplx(0.2, 0)
Ap(1) = Cmplx(-0.11, -0.93): Ap(3) = Cmplx(-0.32, 0)
Ap(2) = Cmplx(0.81, 0.37): Ap(4) = Cmplx(-0.8, -0.92): Ap(5) = Cmplx(-0.29, 0)
Bp(0) = Cmplx(2.2, 0)
Bp(1) = Cmplx(-0.11, -0.93): Bp(3) = Cmplx(2.32, 0)
Bp(2) = Cmplx(0.81, 0.37): Bp(4) = Cmplx(-0.8, -0.92): Bp(5) = Cmplx(2.29, 0)
Call Zhpgvd(1, "V", "L", N, Ap(), Bp(), W(), Z(), Info)
Debug.Print "Eigenvalues =", W(0), W(1), W(2)
Debug.Print "Eigenvectors ="
Debug.Print Creal(Z(0, 0)), Cimag(Z(0, 0)), Creal(Z(0, 1)), Cimag(Z(0, 1))
Debug.Print Creal(Z(1, 0)), Cimag(Z(1, 0)), Creal(Z(1, 1)), Cimag(Z(1, 1))
Debug.Print Creal(Z(2, 0)), Cimag(Z(2, 0)), Creal(Z(2, 1)), Cimag(Z(2, 1))
Debug.Print Creal(Z(0, 2)), Cimag(Z(0, 2))
Debug.Print Creal(Z(1, 2)), Cimag(Z(1, 2))
Debug.Print Creal(Z(2, 2)), Cimag(Z(2, 2))
Debug.Print "Info =", Info
End Sub