The code in module 2 of attached sheet contains a function PORT_FACTOR_EIGEN_VALUES_V
ECTORS_JACOBI_FUNC, which essentially is supposed to return the eigenvectors and eigenvalues of a matrix (based on the so-called Jacobi method, for what its worth).
However, it seems that the code gets stuck & throws up an error message...
The issue seems to be in the following code segment: ROTATION_ARR(3), which gives a ‘type mismatch’ error
(NB: By default (variable ‘output’ = 0), the code jumps straight to the 2nd pass (1983)).
Understand that its not necessarily an easy one, but any help would be greatly appreciated
Cheers
A_ROTATION_LINE: 'Returns vector containing the row and column vectors and
'the angle of rotation for the P matrix
'------------------------------------------------------------------------------------------------
ReDim TEMP_MATRIX(1 To NSIZE, 1 To NSIZE)
MAX_VAL = -1
ii = -1
jj = -1
For i = 1 To NSIZE
For j = i + 1 To NSIZE
TEMP_MATRIX(i, j) = Abs(DATA_MATRIX(i, j))
If TEMP_MATRIX(i, j) > MAX_VAL Then
MAX_VAL = TEMP_MATRIX(i, j)
ii = i
jj = j
End If
Next j
Next i
If DATA_MATRIX(ii, ii) = DATA_MATRIX(jj, jj) Then
RAD_VAL = 0.25 * PI_VAL * Sgn(DATA_MATRIX(ii, jj))
Else
RAD_VAL = 0.5 * Atn(2 * DATA_MATRIX(ii, jj) / (DATA_MATRIX(ii, ii) - DATA_MATRIX(jj, jj)))
End If
ROTATION_ARR = Array(ii, jj, RAD_VAL)
'------------------------------------------------------------------------------------------------
Return
'------------------------------------------------------------------------------------------------
'------------------------------------------------------------------------------------------------
R_ROTATION_LINE:
'Returns the rotation PTHIS_MATRIX matrix
'------------------------------------------------------------------------------------------------
ReDim PTHIS_MATRIX(1 To NSIZE, 1 To NSIZE)
For i = 1 To NSIZE: PTHIS_MATRIX(i, i) = 1: Next i 'Identity Matrix
PTHIS_MATRIX(ROTATION_ARR(1), ROTATION_ARR(1)) = Cos(ROTATION_ARR(3))
PTHIS_MATRIX(ROTATION_ARR(2), ROTATION_ARR(1)) = Sin(ROTATION_ARR(3))
PTHIS_MATRIX(ROTATION_ARR(1), ROTATION_ARR(2)) = -Sin(ROTATION_ARR(3))
PTHIS_MATRIX(ROTATION_ARR(2), ROTATION_ARR(2)) = Cos(ROTATION_ARR(3))
'------------------------------------------------------------------------------------------------
Return
'-----------------------------------------
EigenVektorValues.xlsm