-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathNumerical.h
86 lines (75 loc) · 3.24 KB
/
Numerical.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*
* 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.
*/
// CatalaanCtrl.h : Declaration of the CCatalaanCtrl
#ifndef __CATALAANCTRL_H_
#define __CATALAANCTRL_H_
#include <string>
#include "RankSwap.h"
#include "IProgressListener2.h"
#define MAXRECORDLENGTH 10000 // main symbols
// errors
#define MIC_OK 1 // Everything is OK
#define MIC_OUT_MEM 0 // The routine has run out of memory
#define MIC_ERR_NEL -1 // Number of records wrongly defined
#define MIC_ERR_NVAR -2 // Number of variables wrongly defined
#define MIC_ERR_MEG -3 // Minimum number of records in a group wrongly defined
#define MIC_ERR_GOV -4 // Number of groups of variables wrongly defined
#define MIC_ERR_VPG -5 // Grouping of variables is wrongly defined
#define MIC_ERR_COL -6 // Bad definition of column sorting
#define MIC_ERR_STD -7 // There was an error while calculating STDEV
/////////////////////////////////////////////////////////////////////////////
// CCatalaanCtrl
class Numerical
{
public:
Numerical()
{
}
// ICatalaanCtrl
public:
void DoRankSwap(/*[in]*/ std::string inFileName, /*[in]*/ std::string outFileName, /*[in]*/ std::string separator, /*[in]*/ long numVar, /*[in]*/ long perc, /*[in,out]*/ long *errorCode);
void DoMicroAggregation(/*[in]*/ std::string inFileName, /*[in]*/ std::string outFileName, /*[in]*/ std::string separator, /*[in]*/ long nVar, /*[in]*/ long nMinRecPerGr, /*[in]*/ long nGroupsPerVar, /*[in]*/ long typeSolution, /*[in,out]*/ long *nColumnsPerGr, /*[in,out]*/ long *errorCode);
void SetProgressListener(IProgressListener2* progressListener);
private:
typedef struct
{
double *costs;
double cost;
long link;
} t_node;
typedef struct
{
long n_nodes;
t_node *nodes;
} t_graph;
bool ConvertNumeric(const char* code, double &d);
double** ReadFromFile(std::string inFileName,std::string separator,long nVar, long* numberOfLines, long* errorCode);
void WriteOutput(std::string outFileName, std::string separator, long nVar, long nRec, double **out_Data);
/*
long Microaggregation(long n_var, long n_elements,
long elms_p_group, long group_var,
long *how_many,long *var,
double **out_data, int optim);
long Do_Opt_Mic ( long n_el, long n_var, long k, double **out_data, long * prog);
void Quick_Sort(double *vector, long *bo, long inf, long sup);
long Opt_Mic ( t_graph g, long k, long *bo, double *v, double **out_data, long var, long vars, long *prog);
long Graph ( long k, long n, double *v, long *bo, t_graph *g);
double Sum_Quad_Err ( double *fp, long y, long n);
double Mean ( double *fp, long y, long n);
*/
};
#endif //__CATALAANCTRL_H_