SecreC 2 language  2.8.0 (2023.09)
Language and standard library reference
Functions
selectK[[1]]

Functions

template<domain D, type T>
D T selectK (D T[[1]] vector, uint k)
 

Detailed Description

Function for selecting the k smallest elements of a vector.

Note
D - all protection domains
Supported types - uint8 / uint16 / uint32 / uint / int8 / int16 / int32 / int / xor_uint8 / xor_uint16 / xor_uint32 / xor_uint64
Requires that the input array's length is a power of two.
The algorithm behind this function is optimized for speed, accuracy is not guaranteed.
Parameters
vector- a vector of supported type
k- the number of elements to be selected
Returns
returns a vector of k elements selected from the input vector

Function Documentation

◆ selectK()

D T selectK ( D T[[1]]  vector,
uint  k 
)