nuget server logo nuget api documents
↑

API Docs / Microsoft.VisualBasic.DataMining.UMAP / Utils

Utils

Full name Microsoft.VisualBasic.DataMining.UMAP.Utils Assembly Microsoft.VisualBasic.DataMining.UMAP Members 6

01 Syntax

Microsoft.VisualBasic.DataMining.UMAP.Utils

02 Methods

NameOverloadsSummary
Empty 1 Creates an empty array
Range 1 Creates an array filled with index values
Filled 1 Creates an array filled with a specific value
RejectionSample 1 Generate nSamples many integers from 0 to poolSize such that no integer is selected twice.The duplication constraint is achieved via rejection sampling.
ShuffleSample 1 partial Fisher-Yates shuffle of the index pool 0, poolSize) for the degenerate case of [Utils.RejectionSample())
NewStripedLocks 1 Create a striped lock object array.

03 Members

method Empty #
Empty(Int32)

Creates an empty array

method Range #
Range(Int32)

Creates an array filled with index values

method Filled #
Filled(Int32, Double)

Creates an array filled with a specific value

method RejectionSample #
RejectionSample(Int32, Int32, IProvideRandomValues)

Generate nSamples many integers from 0 to poolSize such that no integer is selected twice.The duplication constraint is achieved via rejection sampling.

Remarks

the deduplication check of this function is implemented based on a HashSet object instead of the original O(n^2) linear scan, so that the sampling procedure is O(n) now.

note about that the number of the random numbers that have been consumed by this function is not changed, so the generated result is still the same as the original implementation for a given random source.

method ShuffleSample #
ShuffleSample(Int32(), Int32, IProvideRandomValues)

partial Fisher-Yates shuffle of the index pool 0, poolSize) for the degenerate case of [Utils.RejectionSample()

method NewStripedLocks #
NewStripedLocks(Int32)

Create a striped lock object array.

Remarks

the striped lock is used for protect the heap row while running the heap push operation in parallel. the lock objects are always acquired in the ascending order of the stripe index, so that the dead lock is impossible.

Parameters
NameTypeDescription
stripesInt32

the number of the lock objects, a larger value means a lower lock contention but a higher memory footprint.

Returns

a lock array that is indexed via row Mod length.