4 #include <itpp/itbase.h>
17 cout<<
"copy the text in a file to the end of another file"<<endl;
18 ifstream infile(
"tmp/a.txt");
19 ofstream outfile(
"tmp/b.txt");
20 outfile << infile.rdbuf();
30 cout<<
"k = "<<k<<endl;
32 for (
int i=0;i<k;i++){
33 for (
int j=0;j<k;j++){
47 cout<<
"k = "<<k<<endl;
49 for (
int i=0;i<k;i++){
50 for (
int j=0;j<k;j++){
64 cout<<
"got matrix G("<<G.rows()<<
", "<<G.cols()<<
")"<<endl;
71 char *filename_G_sx=
"data/repetition/cubic_size_5_G_sx.mm";
72 char *filename_G_sz=
"data/repetition/cubic_size_5_G_sz.mm";
73 cout<<filename_G_sx<<endl;
76 cout<<G_sx.rows()<<
" + "<<G_sx.cols()<<endl;
77 cout<<G_sz.rows()<<
" + "<<G_sz.cols()<<endl;
83 GF2mat A=gf2dense_eye(2),B(3,3);
84 static GF2mat p[]={A,B};
85 cout<<
"A = "<<A<<endl;
113 vector<vector<int> > vec(10);
117 for (
int i=0;i<10;i++){
118 cout<<vec[i][i]<<endl;
124 vector<vector<int> > vec;
128 for (
int i=0;i<10;i++){
129 cout<<vec[i][i]<<endl;
147 cout<<
sizeof(H)/
sizeof(H[0])<<endl;
150 cout<<
sizeof(F)/
sizeof(F[0])<<endl;
186 int **board =
new int*[4];
187 for (
int i = 0; i < 4; i++) {
188 board[i] =
new int[10];
194 G.set(1,1,G(1,1)+G(1,2));
201 GF2mat G(2,2),H(2,2);
215 itpp::RNG_reset(seed);
216 int a = randi(1,100000000);
218 std::cout<<std::time(
nullptr)<<
"\t";
219 itpp::RNG_reset(std::time(
nullptr));
220 int b = randi(1,std::time(
nullptr));
222 itpp::RNG_reset(b+seed);
223 std::cout<<randi(1,100000000)<<
"\t";
224 std::cout<<std::endl;
230 std::srand(std::time(
nullptr));
231 int random_variable = std::rand();
232 std::cout <<
"Random value on [0 " << RAND_MAX <<
"]: "
233 << random_variable <<
"\t";
236 for (
int n=0; n != 20; ++n) {
239 x = 1 + std::rand()/((RAND_MAX + 1u)/6);
240 std::cout << x <<
' ';
252 auto now = std::chrono::system_clock::now();
253 auto now_ms = std::chrono::time_point_cast<std::chrono::milliseconds>(now);
255 auto value = now.time_since_epoch();
256 long duration = value.count();
258 int remain = duration % 1000000000;
261 std::chrono::milliseconds dur(duration);
263 std::chrono::time_point<std::chrono::system_clock> dt(dur);
282 itpp::RNG_reset(seed);
286 for (
int i = 0; i < 7; i++){
287 cout<<randi(0,10000)<<
"\t";
309 cout<<
"case otherwise\t";
318 GF2mat G = gf2dense_eye(5);
331 if (
generate_code(Gax, Gaz, na, Gax_row, id_Gax, Gaz_row, id_Gaz,debug)==2){
332 cout<<
"get return code 2"<<endl;
336 cout<<
"dax="<<dax<<endl;
338 cout<<
"daz="<<daz<<endl;
344 GF2mat A(2,2), B(2,2);
349 GF2mat C =
kron(A,B);
356 int main(
int args,
char ** argvs){
359 parser.init(args, argvs);
360 parser.set_silentmode(
true);
361 int na = 7; parser.get(na,
"na");
362 int Gax_row = 3; parser.get(Gax_row,
"Gax_row");
364 int id_Gax = 1; parser.get(id_Gax,
"id_Gax");
368 int Gaz_row = 1; parser.get(Gaz_row,
"Gaz_row");
369 int id_Gaz = 1; parser.get(id_Gaz,
"id_Gaz");
373 int debug=0;parser.get(debug,
"debug");