The following program fits the model of Example 8. It then displays two matrices: 1) the matrix of second derivatives, and 2) two times the inverse of the matrix of second derivatives.
Module MainModule
' Evaluate2e and EvaluateEx2e methods example
Sub Main()
Dim Sem As New AmosEngineLib.AmosEngine
Dim ad As New AmosDebug.AmosDebug
Dim Originalparameters() As Double
Sem.Covest()
Sem.BeginGroup(AmosEngine.AmosDir & "Examples\English\userguide.xls", "grnt_fem")
Sem.AStructure("visperc = (1) spatial + (1) err_v")
Sem.AStructure("cubes = (a) spatial + (1) err_c")
Sem.AStructure("lozenges = (b) spatial + (1) err_l")
Sem.AStructure("paragraph = (1) verbal + (1) err_p")
Sem.AStructure("sentence = (c) verbal + (1) err_s")
Sem.AStructure("wordmean = (d) verbal + (1) err_w")
If (Sem.FitModel() = 0) Then
Dim Ind As Integer
Dim F As Double
Dim G() As Double
Dim H() As Double
Dim HI() As Double
Sem.Evaluate2e(Ind, F, G, H)
If Ind = 0 Then
ad.PrintTriangle(H, "2nd derivatives")
Else
ad.PrintX("2nd derivatives could not be calculated.")
End If
Sem.EvaluateEx2e(Ind, F, G, HI)
If Ind = 0 Then
If Sem.WasInverted Then
ad.PrintTriangle(HI, "2nd derivatives inverted (times 2)")
Else
ad.PrintX("Matrix of 2nd derivatives could not be inverted.")
End If
End If
End If
Sem.Dispose()
End Sub
End Module