nuget server logo nuget api documents
↑

API Docs / Microsoft.VisualBasic.DataMining.DynamicProgramming / SimpleChaining

SimpleChaining

Full name Microsoft.VisualBasic.DataMining.DynamicProgramming.SmithWaterman.SimpleChaining Assembly Microsoft.VisualBasic.DataMining.DynamicProgramming Members 6

01 Syntax

Microsoft.VisualBasic.DataMining.DynamicProgramming.SmithWaterman.SimpleChaining

02 Methods

NameOverloadsSummary
Chaining 1 Identify the best chain from given list of match
topScoreMatch 1 在候选 match 中直接线性挑选得分最高的一条,作为退化的“最佳链”。
ChainingImpl 1 Identify the best chain from given list of match
printLowerMatrix 1 System out the input array as an strict lower diagonal matrix

03 Properties

NameOverloadsSummary
FromAComparator 1

04 Fields

NameOverloadsSummary
maxChainingSize 1 链化算法所允许的最大 match 数量。

05 Members

method Chaining #
Chaining(Match(), Boolean)

Identify the best chain from given list of match

Parameters
NameTypeDescription
matchesMatch()

a list of match

debugBoolean

if true, print list of input match, adjacency, score matrix, best chain found.

Returns

the optimal chain as a list of match

method topScoreMatch #
topScoreMatch(Match())

在候选 match 中直接线性挑选得分最高的一条,作为退化的“最佳链”。

method ChainingImpl #
ChainingImpl(Match(), Boolean)

Identify the best chain from given list of match

Parameters
NameTypeDescription
matchesMatch()

a list of match

debugBoolean

if true, print list of input match, adjacency, score matrix, best chain found.

Returns

the optimal chain as a list of match

method printLowerMatrix #
printLowerMatrix(Double(), Int32)

System out the input array as an strict lower diagonal matrix

field maxChainingSize #
maxChainingSize

链化算法所允许的最大 match 数量。

Remarks

SimpleChaining.ChainingImpl() 需要分配 adjMatrix 与 sMatrix 两个长度约为 size*(size-1)/2 的 Double 数组,内存开销是 O(n^2):

  • size = 4096 -> 2 * 64MB = 128 MB
  • size = 8192 -> 2 * 256MB = 512 MB
  • size = 46340 -> 2 * 8.2GB = 16 GB(此前仅在此处才会触发溢出保护)

这两个数组远大于 85KB,会直接进入大对象堆(LOH)。LOH 默认不做压缩, 因此在两两比对的 O(n^2) 外层循环中反复分配/丢弃会造成进程常驻内存 持续攀升且不归还,外部观察即为“内存泄漏”。

取 4096 作为上限:低于该规模时单次链化的临时内存不超过约 128MB; 超过该规模时链化对最终“最佳比对”的贡献极小(候选片段已高度碎片化), 直接返回得分最高的单条 match 即可,收益/开销比更合理。

property FromAComparator #
FromAComparator