-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRankSwap.h
57 lines (51 loc) · 2.4 KB
/
RankSwap.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
* Argus Open Source
* Software to apply Statistical Disclosure Control techniques
*
* Copyright 2014 Statistics Netherlands
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the European Union Public Licence
* (EUPL) version 1.1, as published by the European Commission.
*
* You can find the text of the EUPL v1.1 on
* https://joinup.ec.europa.eu/software/page/eupl/licence-eupl
*
* This software is distributed on an "AS IS" basis without
* warranties or conditions of any kind, either express or implied.
*/
#if !defined RankSwap_h
#define RankSwap_h
// =========================================================================
// -------------------------------------------------------------------------
// RANK SWAPPING HEADER FILE
// Author: Josep Domingo-Ferrer
// Francesc Sebe
// Josep M. Mateo
// Antoni Martinez-Balleste
// Angel Torres
// Narcis Macia
// Universitat Rovira i Virgili
// July 2001
// -------------------------------------------------------------------------
// =========================================================================
#define RNK_OK 1 // Rankswap ended OK
#define RNK_ERR_PER 0 // Percent value must be in [0, 100]
#define RNK_ERR_RGS -1 // Number of registers wrongly defined
#define RNK_ERR_COL -2 // Number of columns wrongly defined
class CRankSwap
{
public:
long rankswap(double **data,long n_regs,long n_columns,long percent, long *prog);
private:
void quicksort_with_info(double *vector,long inf,long sup,long *sort_info);
void swap_f(double *a, double *b);
void swap_i(long *a, long *b);
void partition_with_info(double *vector,long inf,long sup, double x, long *k, long *sort_info);
void rankswap_vector(double vector[],long n_columns, long n_regs,long percent, long *prog);
void generate_swap(long swap[],long n_columns, long n_regs,long percent, long *prog );
void unsort_with_info(double vector[],long n_regs,long sort_info[]);
long long_min(long a,long b);
long long_max(long a,long b);
};
#endif