- Contents in this wiki are for entertainment purposes only
QAT Code: The Pairs Expansion Method
Jump to navigation
Jump to search
About ∞ White paper ∞ QuasiMatrix Code ∞ QAT Code ∞ Data Examples ∞ Scatter-Gather Explained ∞ The Plow Share ∞
The QAT Code —Pair Expansion
The Warehouse if Pairs Expansion then Visual Scatter else Visual Cluster redim Bracketing Clusters while Event Chemistry wend SLIP class redim
Public Function ExpandPairs() As Boolean
' Create the pair-combinations of all the Atoms that DO HAVE shared conjectural-regularity.
Dim ndx As Long
Dim strField() As String 'array
Dim strPairs As String
Dim strJoin As String
Dim varX As Variant
' Pairs format (Sorted):
' Atom1 ** Atom2 CR Atom3 ** Atom 4 CR, ...
On Error GoTo trap
If mtWh.State >= enumWhStates.ExtractedKeychains Then
Set mtWh.colPairs = New Collection
With New clsStopWatch
If mtWh.State >= Loaded Then
' Create the paired-combinations of Atoms sharing Links.
' Enumerate atoms, creating a tabulation by string-concatenation
' of any new combinatrics joined from the array returned by the
' transform method producing combinatorics.
RaiseEvent Progress("Pairs combination-expansion beginning...")
ndx = 0
For Each varX In mtWh.colAtomsKeychain
strJoin = Join(Combinatorics(varX), "**")
If Len(strJoin) Then
strPairs = Join(Array(strPairs, strJoin), Me.DataDelimRow) ' future: this needs checked for delay
End If
If ndx Mod 2 = 0 Then
RaiseEvent Progress("Expanding - (" & CStr(ndx) & ")...")
DoEvents
End If
ndx = ndx + 1
Next
RaiseEvent Console("Pairs expanded. [" & CStr(.Elapsed) & " msec]")
.Reset ' timer
' Store the Pairs tabular string data as a string array.
mtWh.Pairs = Split(strPairs, Me.DataDelimRow)
mtWh.PairsCount = UBound(mtWh.Pairs) + 1
' Sort the new Pairs array.
QuickSortVariants mtWh.Pairs, 1, UBound(mtWh.Pairs), 1, UBound(mtWh.Pairs)
RaiseEvent Console(CStr(mtWh.PairsCount) & " Pairs sorted. [" & CStr(.Elapsed) & " msec]")
RaiseEvent Progress("")
mtWh.State = enumWhStates.ExpandedPairs
ExpandPairs = True
RaiseEvent Console(CStr(mtWh.PairsCount) & " Pairs expanded. [" & CStr(.Elapsed) & " msec]")
End If
End With
Else
RaiseEvent Console("clsWhse.ExpandPairs: Failure: The Atoms Keychain has not been extracted.")
End If ' mtWh.State >= enumWhStates.ExtractedKeychains
Exit Function
ExitPoint:
RaiseEvent Progress("")
Exit Function
trap:
RaiseEvent Console("clsWhse.ExpandPairs: " & Err.Source & " Error(" & CStr(Err.Number) & "): '" & CStr(Err.Description) & "'")
Resume ExitPoint
Resume
End Function