SecreC 2 language  2.8.0 (2023.09)
Language and standard library reference
Functions

Functions

template<domain D :shared3p >
D bool sort (D bool[[2]] matrix, uint column)
 
template<domain D :shared3p , type T>
D T sort (D T[[2]] matrix, uint column)
 

Detailed Description

Function for sorting rows of a matrix based on values of a column.

Note
D - shared3p protection domain
Returns
returns a matrix where the input matrix rows are sorted based on values of the specified column
Leakage
Shuffled reordering decisions are declassified
Leaks the number of equal elements

Function Documentation

◆ sort() [1/2]

D bool sort ( D bool[[2]]  matrix,
uint  column 
)
Note
Supported types - bool
boolean values are sorted after their numerical value. false first then true
Parameters
column- index of the column used for ordering
matrix- a matrix of supported type

◆ sort() [2/2]

D T sort ( D T[[2]]  matrix,
uint  column 
)
Note
T - any data type
Parameters
column- index of the column used for ordering
matrix- a matrix of supported type