The following program fits the model of Example 8. It then displays two matrices: 1) the matrix of approximate second derivatives, and 2) two times the inverse of the matrix of approximate second derivatives.
Module MainModule
' Evaluate2a and EvaluateEx2a 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.Evaluate2a(Ind, F, G, H)
If Ind = 0 Then
ad.PrintTriangle(H, "Approximate 2nd derivatives")
Else
ad.PrintX("Approximate 2nd derivatives could not be calculated.")
End If
Sem.EvaluateEx2a(Ind, F, G, HI)
If Ind = 0 Then
If Sem.WasInverted Then
ad.PrintTriangle(HI, "Approximate 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