i want to find the eigenvectors and eigenvalues for a matrix... can someone help me use this module from

VB Code:
  1. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  2. 'This code is generated by the AlgoPascal translator
  3. '
  4. 'This code is distributed under the ALGLIB license
  5. '    (see [url]http://www.alglib.net/copyrules.php[/url] for details)
  6. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  7. 'This routines must be defined by the programmer
  8. ' Function TridiagonalEVD(ByRef D() As Double, _
  9. '         ByRef E_() As Double, _
  10. '         ByVal N As Long, _
  11. '         ByVal ZNeeded As Long, _
  12. '         ByRef Z() As Double) As Boolean
  13. ' Sub ToTridiagonal(ByRef A() As Double, _
  14. '         ByVal N As Long, _
  15. '         ByVal IsUpper As Boolean, _
  16. '         ByRef Tau() As Double, _
  17. '         ByRef D() As Double, _
  18. '         ByRef E() As Double)
  19. ' Sub UnpackQFromTridiagonal(ByRef A() As Double, _
  20. '         ByRef N As Long, _
  21. '         ByRef IsUpper As Boolean, _
  22. '         ByRef Tau() As Double, _
  23. '         ByRef Q() As Double)
  24.  
  25.  
  26. 'Routines
  27. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  28. 'Finding the eigenvalues and eigenvectors of a symmetric matrix
  29. '
  30. 'The algorithm finds eigen pairs of a symmetric matrix by reducing it to
  31. 'tridiagonal form and using the QL/QR algorithm.
  32. '
  33. 'Input parameters:
  34. '    A       -   symmetric matrix which is given by its upper or lower
  35. '                triangular part.
  36. '                Array whose indexes range within [1..N, 1..N].
  37. '    N       -   size of matrix A.
  38. '    IsUpper -   storage format.
  39. '    ZNeeded -   flag controlling whether the eigenvectors are needed or not.
  40. '                If ZNeeded is equal to:
  41. '                 * 0, the eigenvectors are not returned;
  42. '                 * 1, the eigenvectors are returned.
  43. '
  44. 'Output parameters:
  45. '    D       -   eigenvalues in ascending order.
  46. '                Array whose index ranges within [1..N].
  47. '    Z       -   if ZNeeded is equal to:
  48. '                 * 0, Z hasn’t changed;
  49. '                 * 1, Z contains the eigenvectors.
  50. '                Array whose indexes range within [1..N, 1..N].
  51. '                The eigenvectors are stored in the matrix columns.
  52. '
  53. 'Result:
  54. '    True, if the algorithm has converged.
  55. '    False, if the algorithm hasn't converged (uncommon case).
  56. '
  57. '  -- ALGLIB --
  58. '     Copyright 2005 by Bochkanov Sergey
  59. '
  60. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  61. Public Function SymmetricEVD(ByRef A_() As Double, _
  62.          ByVal N As Long, _
  63.          ByVal ZNeeded As Long, _
  64.          ByVal IsUpper As Boolean, _
  65.          ByRef D() As Double, _
  66.          ByRef Z() As Double) As Boolean
  67.     Dim Result As Boolean
  68.     Dim A() As Double
  69.     Dim Tau() As Double
  70.     Dim E() As Double
  71.     A = A_
  72.  
  73.     Call ToTridiagonal(A, N, IsUpper, Tau, D, E)
  74.     If ZNeeded = 1# Then
  75.         Call UnpackQFromTridiagonal(A, N, IsUpper, Tau, Z)
  76.     End If
  77.     Result = TridiagonalEVD(D, E, N, ZNeeded, Z)
  78.  
  79.     SymmetricEVD = Result
  80. End Function

i got this module from http://www.alglib.net/eigen/symmetric/symmevd.php .. i have add the ap lib module and this module...

i used that code to test the function SymmetricEVD

VB Code:
  1. Private Sub Command1_Click()
  2. Dim mat(0 To 1, 0 To 1), Result(0 To 1, 0 To 1), eigenvect(0 To 1, 0 To 1) As Double
  3.  
  4. mat(0, 0) = 1
  5. mat(0, 1) = 2
  6. mat(1, 0) = 3
  7. mat(1, 1) = 4
  8.  
  9. Call SymmetricEVD(mat, 2, 1, True, Result, eigenvect)
  10. End Sub

but i get "type mismatch"